windower / lua Goto Github PK
View Code? Open in Web Editor NEWLua Addons and Scripts
Lua Addons and Scripts
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
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.
This would let me more accurately automatically enable/disable DPS processing in the Scoreboard addon. An engaged check isn't enough since mages don't engage.
Thanks!
Checking cast countdowns for spells would be handy
Can we get an IsTargetLocked flag added to player table or whichever makes the most sense on your end?
It would be great to have this list since it would enable the creation of KI tracking add-ons!
thanks
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
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.
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.
get_weather_id()
returns the current weather ID,
get_storm_id()
returns the current (SCH) storm effect ID,
get_day_id()
returns the current day's ID.
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.
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 >_>]
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.
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.
Copied from Windower/Issues#13
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.
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:
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))
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さん ありがとう"
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 syntax to call any function name from within the game:
//lua invoke <addonname> <functionname> [args]
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.
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
The following events do not trigger at all:
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
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.
Certain events fire twice (especially noticeable for chat events), assuming from duplicate packets.
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++.
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?
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!
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.
Needs udated for Ionis. Currently shows IOErr underneath
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.
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)
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 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!
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.
Says "File does not exist." when attempting to load add-ons loacted in the windower 4 > Addons folder.
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.
essentially, being able to filter out others (and your own) melee damage, but not WS damage.
For when you give zero fucks about your party's melee, but want to know the WS damage for SC potential, etc
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 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.
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!
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?
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!
The color argument should either be an 8 bit or 16 bit value. I'm not sure which at the moment. It's currently 32-bits and is picking up garbage in at least the upper 8 bits.
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.
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.
Guess it's safe to assume that there is a patch in progress for this one?
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.
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.