Lua Commands Based On Time Of Day?

Language: JP EN DE FR
2010-09-08
New Items
users online
Forum » Windower » Support » Lua commands based on time of day?
Lua commands based on time of day?
 Asura.Bloodlusty
Offline
Server: Asura
Game: FFXI
Posts: 84
By Asura.Bloodlusty 2024-12-23 09:09:48
Link | Quote | Reply
 
Sorry if this has been asked or covered before

Can you add a command to change equipment based on time of day. I.e only use Lugra earring if between dusk to dawn

Can you add a command to equip moonshade earring if TP is below 2750tp

Are these possible / already done?
VIP
Offline
Posts: 788
By Lili 2024-12-23 10:06:59
Link | Quote | Reply
 
This has nothing to do with windower in general, it's a gearswap specific question, correct? In that case you should put it in the gearswap section.

And yes, this has been done before and is not difficult.
 Asura.Bloodlusty
Offline
Server: Asura
Game: FFXI
Posts: 84
By Asura.Bloodlusty 2024-12-23 12:55:23
Link | Quote | Reply
 
Thanks
 Carbuncle.Nynja
Offline
Server: Carbuncle
Game: FFXI
user: NynJa
Posts: 4092
By Carbuncle.Nynja 2024-12-23 14:01:38
Link | Quote | Reply
 
Lili said: »
is not difficult.

This is very subjective based on your coding skillset.

Can i rig up the code from scratch? No
Can i rip similar code from other gearswaps, edit it and make use of it to suit my needs? Yes

But someone who doesnt even know what a function is, they wouldnt even be able to steal the code and add it to their own lua.
Offline
Posts: 190
By LightningHelix 2024-12-23 15:37:33
Link | Quote | Reply
 
time of day is
Code
windower.ffxi.get_info().time
which returns "number of minutes past 00:00 in the current vana'diel day" because uh, of course it does. thankfully you can just hardcode comparing it to the dusk/dawn times and never have to sweat any fancy conversion (fwiw, I always just floor it/60 to get hours and modulo 60 it to get minutes, hell if I know if there's some fancy lua time function built in)

player tp is
Code
windower.ffxi.get_player().vitals.tp
which returns your tp obviously

these go in whatever functions you're using to modify your equipsets, but since I don't know what you're doing, you'll have to do that part yourself

edit: for these and more fun functions, don't hesitate to use the windower wiki page which I have bookmarked at this point
 Asura.Bloodlusty
Offline
Server: Asura
Game: FFXI
Posts: 84
By Asura.Bloodlusty 2024-12-23 17:30:34
Link | Quote | Reply
 
Thanks all, appreciate the feedback. I’ll look into the web link, interesting that it can be done
 Bahamut.Academic
Offline
Server: Bahamut
Game: FFXI
user: Sevu
Posts: 44
By Bahamut.Academic 2024-12-23 17:41:04
Link | Quote | Reply
 
Carbuncle.Nynja said: »
Lili said: »
is not difficult.

This is very subjective based on your coding skillset.

Can i rig up the code from scratch? No
Can i rip similar code from other gearswaps, edit it and make use of it to suit my needs? Yes

But someone who doesnt even know what a function is, they wouldnt even be able to steal the code and add it to their own lua.

I understand where you coming from but if you want to customize your gearswap lua, you'd do yourself a service to learn some basic lua, and RTDM :D

the Windower function is already mentioned, if you wish to do it directly in GS, you can use `world.time`

Example:
Code
if world.time >= 17*60 or world.time <= 7*60 then
	if world.time >= (18*60) or world.time <= (6*60) then
		sets.Movement = set_combine(sets.Movement, sets.Movement.Night)
	else
		sets.Movement = set_combine(sets.Movement, sets.Movement.Dusk)
	end
else
	sets.Movement = set_combine(sets.Movement, sets.Movement.Day)
end


https://docs.windower.net/addons/gearswap/reference/
[+]
Log in to post.