Git Product home page Git Product logo

lua's People

Contributors

alphaone2 avatar aureus1 avatar banggugyangu avatar byrth avatar cairthenn avatar chiaia avatar from20020516 avatar giulianoriccio avatar ivaar avatar jayjs20 avatar jerryhebert avatar joshk6656 avatar kelhor avatar kenshidrk avatar kinematics avatar lili-ffxi avatar milkmanskid avatar morath86 avatar mujihina avatar nifim avatar nitrous24 avatar podginator avatar posimagi avatar rubenatorx avatar sechs avatar sigilbaram avatar snickysnacks avatar tehkrizz avatar xurion avatar z16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua's Issues

Feature Request: Reive tracking

I would like to see the following things tracked in reives:
a. Reive momentum scores
b. Reive bonuses
c. Bayld awarded

Here are some regex examples, although I'm not 100% certain they'll work outright:

a. Reive momentum score: ([%w%s])%p
b. Momentum bonus: ([%w%s])%p
c. (%w+) obtained (%d+) bayld%p

Region codes for event_party_invite wrong

The region ID provided is definitely not the region. It varied from person to person standing right next to each other, and some zones shared it, but others within the same region did not. No idea what it is at this point.

Cast Timers

Checking cast countdowns for spells would be handy

IsTargetLocked

Can we get an IsTargetLocked flag added to player table or whichever makes the most sense on your end?

Autojoin colors.lua error message

Whenever I attempt to load autojoin I receive the following error:

Load error: Program files (x86)\Windower4\addons\autojoin\colors.lua:13: attempt to index a nil value

get_items()['equipment']['ammo']

What does the return value from get_items()['equipment']['ammo'] and get_items()['equipment']['ammo_slot_id'] represent?
If you check the code from BuffDurantion.lua it seems to represent the index where the gear is in the inventory table:

Line 207 tonumber(items.inventory[equip[''..slot..'']].id) == tonumber(gearid) then

The thing is if it represents the index shouldn't it return the gear id when you run the above code through eval? Because i tried it and i never got the gear id using that method.
i always got the id of another item in my inventory.

So does it not return that or does luacore have a bug?

Thanks and sorry if my explanation is confusing.

Edited to reflect the new buffduration code.

Libs folder check.

Need to have windower check on startup if libs folder is in the addons folder. Talked to Iryoku about it. Had me post it as a issue for it.

feature request: event_pet_summoned, event_pet_dismissed

event_pet_summoned and event_pet_dismissed would be triggered when a pet job calls and dismisses pets. This would be very useful for example for SMN, where key mappings could be redefined depending on which avatar is out.

targets_target_ID in mob array/table

If it's possible (and feasible), I'd like to request exposure of the targets_target_ID in the get_mob_by_id() table, similar to how it exists in the get_player() table.

I have a feeling that this data is available in the client for it to allow /assist commands to work, and to also turn other players' heads to focus on their current target.

Thanks!

[Edit: accidentally clicked a random button. Ignore my closing and opening >_>]

File/directory interface functions

To make up for Lua's poor support for either. Checking if a file exists only works by trying to open it and catching failures, checking for directories is impossible without external libraries or invoking cd, which opens a cmd prompt. Some interface functions to handle that would be nice.

Command to change mob name by ID

This would be helpful as it would allow you to differentiate between mobs of same time and allow you to do stuff like:

[Goblin Butcher (S)] = sleeping? or something similar

It would show you which debuffs mob has and whatnot!

Overall I think it would be a very unique feature to have if possible.

Add chat log event.

Copied from Windower/Issues#13

@Byrth:

I thought it would be a good idea to give LUA access to the text buffer (triggering on it as an event), so that it can operate on messages like "uses Tachi: Gekko." It might also be useful to make some kind of Interface function that gives plugins access to the text buffer for the sake of, for instance, checking for resists and automatically adjusting spellcast variables as appropriate.

BuffDuration: not running on Japanese client.

Thank you for great capability. I tried this on Japanese client. However it does not work propery. (Does not appeared timers by any enhancing magic.)

In the code, bad point in following function:

  • event_gain_status

At line 128, creating the timer by name. I think 'name' is various name (i.e. English, Japanese, French and Germany) by client. On the English client, probably it can create a timer propery because name is written in English. (e.g. "Shell") On Japanese client, strings of the name is "シェル". Thus it cannot create a timer propery.

Current: createTimer(tostring(name))
Correct: createTimer(tostring(buffname))

  • event_lose_status

There is a wrong point like previous one. Following is an example of amendment.

function event_lose_status(id,name)
for i in ipairs(lines) do
x = i
str = lines[x]
if str ~= nil then
str=tostring(str)
a,b,c,d = string.find(str,'<b id="(%w+)" duration="(%w+)"')
if c ~= nil then
buffid = c
duration = d
buffn = tostring(str:split('>',2)[2]:split('<',2)[1])
if tonumber(buffid) == tonumber(id) then
deleteTimer(1,buffn)
send_ipc_message(buffn..' '..player['name']..' delete')
break
end
end
end
end
end

Could you consider to correct this localization issue?

At the end, this amendment was proposed by a user who loves Windower in Japan. I posted this on behalf of him. ">>36さん ありがとう"

Primitive Textures not appearing

Here's the code where i use it (don't really wanna commit it till i can get it working properly. tablehelper is the one here in the libs folder
aecho.lua

require 'imgHelper'
function event_load()
    player = get_player()
    watchbuffs = {  "Light Arts",
                    "Addendum: White",
                    "Penury",
                    "Celerity",
                    "Accession",
                    "Perpetuance",
                    "Rapture",
                    "Dark Arts",
                    "Addendum: Black",
                    "Parsimony",
                    "Alacrity",
                    "Manifestation",
                    "Ebullience",
                    "Immanence",
                    "Stun",
                    "Petrified",
                    "Silence",
                    "Stun",
                    "Sleep",
                    "Slow",
                    "Paralyze",
                    "Protect",
                    "Shell",
                    "Haste"
                }
end

function event_gain_status(id,name)
    for u = 1, #watchbuffs do
        if watchbuffs[u]:lower() == name:lower() then
            if name:upper() == 'SILENCE' then
                send_command('input /item "Echo Drops" '..player["name"])
                send_command('send @others atc '..player["name"]..' - '..name)
            else
                send_command('send @others atc '..player["name"]..' - '..name)
                createImage(name)
            end
        end
    end
end

function event_lose_status(id,name)
    for u = 1, #watchbuffs do
        if watchbuffs[u]:lower() == name:lower() then
            deleteImage(name)
        end
    end
end

imgHelper.lua

require 'tablehelper'
imgTable = T{}
function createImage(name,posx,posy,dimx,dimy)
    posX = #imgTable * 24
    prim_delete(name)
    if checkExists(name) then
        return
    else
        if #imgTable == 0 then
            tCell = T{name,posX,0} --name,xpos,ypos
            imgTable[1] = tCell
        else
            tCell = T{name,posX,0}  --name,xpos,ypos
            imgTable[#imgTable+1] = tCell --add cell to table
        end
                prim_create(name)
        prim_set_color(name,187,0,255,0)
        add_to_chat(55,'Color: Green Alpha:187')
        prim_set_fit_to_texture(name,false)
        prim_set_size(name,24,24)
        prim_set_texture(name,lua_base_path..'icons\\'..name:lower()..'.png')
        add_to_chat(55,lua_base_path..'icons\\'..name:lower()..'.png')
        --assumes your icons are stored with the name you pass in windower/addons/<youraddon>/icons
        prim_set_repeat(name,1,1)
        prim_set_visibility(name,true)
        if posx == nil then
            prim_set_position(name,posX,0)
        else
            prim_set_position(name,posx,posy)
        end 
    end

end

function deleteImage(name)
    for u = 1, #imgTable do
        if imgTable[u][1] ~= nil then
            if imgTable[u][1] == name then
                table.remove(imgTable,u)
                prim_delete(name)
                return
            end
        end
    end
end

function moveImage(name,oldx,oldy,newx,newy)
    if oldx == nil then
        if newx ~= nil then
            prim_set_position(name,newx,newy)
        end
    elseif newx == nil then
        prim_set_position(name,oldx-24,oldy)
    end

end

function checkExists(name)
    if #imgTable == 0 then
        return false
    else
        for u = 1, #imgTable do
            if imgTable[u][1] == name then
                return true
            else
                return false
            end
        end
    end
end

Add treasure pool information

A function to get the current treasure pool as a table would be practical for LL-y features, among other things. It could get added separately, or by amending the get_items() struct.

Timers idea for custom timers

The idea is if you send timers "timers c <up/down> name" to convert this final name to a spell id and show that icon if it exists, if not just ignore it and show ? icon like normal

Global Lua function: round(number, precision)

Lua doesn't provide a method to round numbers, which could be desirable for chat output. Sample implementation:

function round(num, prec)
    local mult = 10^(prec or 0)
    return math.floor(num * mult + 0.5) / mult
end

Game Crashing on character login. Windower 4.0 w/ no plugins installed.

Friend can use the game fine using normal pol. When he tries to use windower 4.0 from a fresh install and no plugins installed, he will crash once he logs his character in.

Can delete this issue, He just installed the update files from bg and didn't run the seekers install. After he ran the seekers install and did a small update through pol it worked fine.

Events firing twice

Certain events fire twice (especially noticeable for chat events), assuming from duplicate packets.

event_zone_change broken

Triggering the event crashes POL, regardless of the code inside the function. I got the same crash when I tried calling a function with the wrong number of arguments, so I guess not all arguments match.

Calling a function with more or less arguments than are specified should normally be possible in Lua (omitted arguments default to nil, superfluous arguments are ignored), but it may be a transition error between Lua and C++.

Probable memory corruption within Lua interpreter

I discovered a bug that isn't possible in bare Lua while calling Lua code within the event model. Rather than trying to describe it in English, I'll show examples of code that works and code that doesn't.

In all cases below, when I say "breaks" or "doesn't work" below, I mean I get this error:
...\tablebug.lua:28: bad argument #1 to 'write' (string expected, got nil)

This breaks. It just writes out t[6] whenever we get an action. This will still break if the write() is called from event_status_change(), event_incoming_text(), event_target_change() and presumably most others.

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd',
    [5] = 'e',
    [6] = 'f'
}

function event_action ()
    write(t[6])
end

It still breaks if I remove one element:

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd',
    [5] = 'e'
}

function event_action ()
    write(t[5])
end

If I remove one more element, it's fine. o.o

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd'
}

function event_action ()
    write(t[4])
end

Removing 'local' on the declaration doesn't fix it, but moving it into the event handler does. This works, regardless of 'local' or not on the internal and external declarations. o.o

function event_target_change ()
    local t = {
        [1] = 'a',
        [2] = 'b',
        [3] = 'c',
        [4] = 'd',
        [5] = 'e'
    }
    write(t[5])
end

This works. It's fine if called from event_load()

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd',
    [5] = 'e',
    [6] = 'f'
}

function event_load ()
    write(t[6])
end

It's also fine if event_load() calls another function:

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd',
    [5] = 'e',
    [6] = 'f'
}

function foo()
    write(t[6])
end

function event_load ()
    foo()
end

This version works. So some time after event_load() it's still okay.

local t = {
    [1] = 'a',
    [2] = 'b',
    [3] = 'c',
    [4] = 'd',
    [5] = 'e',
    [6] = 'f'
}

function foo()
    write(t[6])
end

function event_load ()
    send_command('wait 3; lua i tablebug foo')
end

Anyway, hopefully that spells it out. Something is amiss. I wonder if it's possible to just try a different Lua interpreter as a quick smoke screen to see if it's related to the particular one that we're using?

Feature Request: X Y Z and Angles of the camera

I do not know if it is possible or not, but having access to these would allow interactive overlays with objects in game somewhat! Simple but idea would be "Area Tagging" or something like that... Say you go to area in FFXI, if you incorporate the C++ to Lua timers you could go to like.. area in Abyssea or New areas for example and see on the ground or the air W/E a text overlay that can get smallers or bigger depending on how close you are to it. With the X Y Z and angles of the camera this could make it so overlay goes and comes as u target the tagged area with you're point of view!

This kinda idea would add a awesome aspect to FFXI!, could maybe do /tag or something like that and maybe have it upload those coordinates and you're message to server. I do not know how realistic this could be cause Lua can be decoded on the spot and people could probably mess with it. I am not a Lua expert but I am good with 3D coordinates and working with vectors! Please let me know you're input on this and if you think it could be abuse proof.

Only other option for something like this would be adding it into C++ and directly loading with windower and/or FFace to avoid abuse. Looking forward to you're feedback!

Interface function: open URLs.

This is currently possible with os.execute('start '), but this opens a temporary command prompt, which is annoying. There doesn't appear to be a Lua alternative that bypasses that.

Statustimer

Needs udated for Ionis. Currently shows IOErr underneath

event_outgoing_text(original, modified)

function event_outgoing_text(original, modified)
write(a)
modified = '/p hi'
return modified
end

This only works 6 times, before seemingly stopping the lua script. The only way to get anything to work again is to reload the addon.

I may be doing something stupid, but I've tried it with only that function, and it works 6 times before stopping. If I do not return anything it will work indefinitely, but returning absolutely anything (Original, modified, or anything else) will break it after 6 times.

Scoreboard - BST pet error

Last night, the console showed the below message every time Falcor hit a mob.

addons\scoreboard\scoreboard.lua:227: attempt to call global 'get_mob_by_target_id' (a table value)

Send Addon not parsing items correctly

The Send addon does not seem to handle /item commands being sent to it. I type //send @ALL /item "item" < me>. This has worked recently, but now on the characters it is sent to it is received as /item item < me>. It appears the quotes are being stripped out.

Windows 7x64
Windower 4 current version
Most current version of Send.

event_outgoing_text

event_outgoing_text stops working each time you rest. It will work fine until then but the second you rest the hook is undone and it no longer triggers. If you hook it and output result to chat, when you get up it spams /heal off and then after that it no longer works.

Also thanks for the set_mob_name function!

Macro lag

Friend is having Macro lag in 4.0, He presses the macro and it takes 2-3sec for the commands to go through. Not sure if this is a windower problem or ffxi but i figured id post it here.

"Addon does not exist"

Says "File does not exist." when attempting to load add-ons loacted in the windower 4 > Addons folder.

Auto-translate formatting

Stripping auto-translate formatting from chatline input when it gets passed as command arguments to Lua functions, so that typing

//command {Item}

actually passes the string "Item" to the Lua function.

Interface function: play_sound(filepath)

ChatMon can play sounds, so I figured there must be a library for that in use already. It would be nice if we could define our own sounds, and even better if filepath could be relative to the addon directory, so we can just put sounds in there and play them with no additional path considerations.

bTimer time difference

bTimer and StatusTimer are showing a difference in time of 4-5 seconds for warcry, berserk, and aggressor which are the only ones I tried. The time in the bTimer file is correct so maybe there is a delay with get_player() function.

Timers from C++ to Lua

I am not so good with Lua but I am familiar with C++ and Python and what I had in the past for timers with Python was something like, OnTick() -> call to Python, this ran like every .01 seconds which allow me to make timers in Python without the use of addition threads cause you dont need to use a Sleep() function. I tried to look for something like this via google... but I could not locate any thread safe timers. This would be most useful for rerunning things outside of events on a timing basis. I think this would definetly help for running addons that dont solely rely on events to do things, AKA Tparty in Lua, for every tick or however often you want, check each players TP and then update.

Thankyou for taking the time to read this and all the effort you are putting into it!

Crashing in certain areas

When I enter Metalworks and Davoi in Windower 4, I crash and have to run the area in regular POL as it crashes upon trying to log back in these areas. Any ideas?

Need access to Pet information

Unless I'm missing something, we currently have no way to access Pet information, but windower obviously knows how to access it because we have the PetTP plugin. Having a get_pet() function would be very useful.

Thanks!

Global Lua function: log(message)

add_to_chat(color, message) fails on certain input, because it only accepts a string as the message argument, and some things can't be coerced into strings (anything except numbers). For development, a function to simply dump debug-like messages to the chatlog would be helpful. Suggestion:

function log(...)
    local args = {...}
    local strtable = {}
    for i = 1, #args, 1 do
        strtable[i] = tostring(args[i])
    end
    add_to_chat(160, table.concat(strtable, ' '))
end

Takes arbitrary number of arguments, converts them all to strings and outputs them with spaces in between. 160 is the dark color used for Kupower messages, but could be anything, could also be configurable, but personally I'd prefer if it wasn't part of the argument list, as it's just one more thing to explicitly type out, and it's supposed to be used for quick debug messages. For regular chat output, add_to_chat() would do the trick anyway.

add event event_storm_change(id, name)

the currently available event event_weather_change(id, name)
does not react to changes in the storm effect (SCH created weather). I'd like a new event function that reacts to that.

Gear Collector - Idea - Export inventories

Similar to how spellcast has an /exportgear command, /gc export inventory would export a xml with all of your current inventory, including non-gear items such as nin tools, meds and food. This would provide an easy and exceptionally fast way to make a gear collector profile for those who don't use spellcast or simply have too much gear in their spellcast to get all of it out at once.

It could group items by type or by how it's sorted. Perhaps it could even include a export sack or export satchel so you can customize what gear you have in all of your inventories.

Global Lua function: split(string, seperator)

Function to split strings by a separator. Sample implementation:

function split(str, sep)
    local res = {}
    local i = 0
    while i <= #str do
        local startpos, endpos = str:find(sep, i)
        if startpos ~= 1 then
            if startpos ~= nil then
                res[#res+1] = str:sub(i, startpos-1)
                i = endpos + 1
            else
                res[#res+1] = str:sub(i, #str)
                break
            end
        else
            i = i + 1
        end
    end
    return res
end

Add function to add items to a trade/craft window.

I'd like to see a function that inputs items into a trade or craft window. [The 8-box interface you get after trading an NPC/player, or using a crystal.]

Personally, was wanting to make a script or addon that would help with storing things with the Porter Moogle. [Trading the slip along with pieces of gear.]

I know that some FFACE programs [craft bots/etc] are capable of this, so I'm assuming it could be reproduced in Lua.

I do see the abuse cases here, but I recall aurues mentioning that he was fine with people doing "bad" things with Lua, but Windower would not redistribute it? Either way, I'd like to see this function, but it won't kill me if you guys are against it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.