Handling Buffs And Debuffs

Language: JP EN DE FR
New Items
2023-11-19
users online
Forum » Windower » Support » Handling Buffs and Debuffs
Handling Buffs and Debuffs
Offline
Posts: 5
By Sarteck 2021-12-06 17:15:36
Link | Quote | Reply
 
My LUA experience is very limited, but I am familiar with scripting languages in general. I've toyed around with GearSwap and understand the general gist. I would like to create a script to handle buff changes.

Specifically (right now) I would like to create a script that will detect if I have the "doom" status, and if so, to use a Holy Water in an attempt to dispel it. If the attempt fails, I would like it to repeat.

I understand that the actual command is simple enough to employ:
Code
function undoom()
    local player = windower.ffxi.get_player()
    if S(player.buffs):contains(15) then
        send_command('@input /item "Holy Water" <me>')
    end
end

I am unsure of when exactly I should be calling it, though. (Note that "15" is "Doom" in \Windower\res\buffs.lua .)

I have been looking at the Events page for an answer, so that I could call it like so:
Code
windower.register_event('EVENT', undoom)


1) Am I going about this the right way?
2) What EVENT should I be using if I want it to be continously checking? I can't just do it on the status change, since Holy Water doesn't have a 100% chance of working, and if it doesn't work the first time, then it won't check again, right?

Sorry for the newb question. I've been searching and can't quite find what I'm looking for.

P.S., if anyone has links to resources and tutorials that I might find useful, I'd highly appreciate it.
 Lakshmi.Elidyr
Offline
Server: Lakshmi
Game: FFXI
user: elii
Posts: 911
By Lakshmi.Elidyr 2021-12-06 17:44:25
Link | Quote | Reply
 
Kind of where you want to look.
Code
windower.register_event('gain buff', function(id)
end)

windower.register_event('lose buff', function(id)
end)

Per the Events page: Events
Inside of gearswap you may have to handle differently? I think like `raw_register` or something.

In my honest opinion though I would say probably write it as it's own addon though. There are numerous ways to handle, and a lot of things that would need to be accounted for; muddle, stoned, paralyze, petra, etc. There is really going to be a bit more to it when you get in to it. Looping to verify if it removed, preventing spamming, etc.

Other than that if you just want a quick and dirty way then yeah, those will be for checking gaining/losing buffs. You could use time change to check for buff active. Honestly to many ways to list how to do this.

*Extra note, this falls under botting category imo.*
[+]
 Asura.Zigzagzig
Offline
Server: Asura
Game: FFXI
user: zigzagzig
Posts: 37
By Asura.Zigzagzig 2021-12-06 17:44:41
Link | Quote | Reply
 
This is what i am using :

you can probably workout, adapt and change to your liking !

windower.register_event('gain buff', function(buff_id)
local buff_name = res.buffs[buff_id].name
if buff_name == 'stun' then equip(sets.defense.DT)
windower.add_to_chat(50,'DT [ SET EQUIPED ]')
elseif buff_name == 'terror' then equip(sets.defense.DT)
windower.add_to_chat(50,'DT [ SET EQUIPED ]')
elseif buff_name == 'paralysis' then
send_command('input /p <=== Paralyzed please Para !')
elseif buff_name == 'petrification' then equip(sets.defense.DT)
windower.add_to_chat(50,'DT [ SET EQUIPED ]')
send_command('input /p <=== Petrification, please Stona !')
elseif buff_name == 'sleep' then
send_command('input /p <=== zzZzz Asleep zzZzz , please Cure me !')
elseif buff_name == 'doom' then equip(sets.defense.DT)
send_command('input /p <=== DOOMED , please Cursna !')
elseif buff_name == 'charm' then
send_command('input /p <=== Charmed Sleep me !')
return
end
end)



windower.register_event('lose buff', function(buff_id)
local buff_name = res.buffs[buff_id].name
if buff_name == 'doom' then
send_command('input /p <=== Doom removed, Thank you !;@wait 1')
elseif buff_name == 'petrification' then
send_command('input /p <=== is no longer Petrify Thank you !;@wait 1')
elseif buff_name == 'sleep' then
send_command('input /p <=== is no longer Asleep !;@wait 1')
elseif buff_name == 'paralysis' then
send_command('input /p <=== is no longer Paralyzed !;@wait 1')
return
end
end)
[+]
Offline
Posts: 5
By Sarteck 2021-12-06 17:57:42
Link | Quote | Reply
 
Lakshmi.Elidyr said: »
You could use time change to check for buff active.
This is more or less what I think I would have to do, since attempted removal upon the buff gain. In other words, "gain buff" and "lose buff" really wouldn't be as effective.

I'll fool around with "time change" and see if it's what I'm looking for, but I wonder if I should be using it or one of the Events associated with ticks ("prerender" and "postrender")? Or if I should be including a timer of my own?

[Thanks to both of you for the replies and examples.]
Offline
By abdhaljs 2021-12-06 18:14:42
Link | Quote | Reply
 
Lakshmi.Elidyr said: »
*Extra note, this falls under botting category imo.*

I don't see how it's really different from the "aecho" Addon in Windower that automatically uses Echo Drops when you get Silenced and that's at the top of the list in the Windower Addons tab. They may as well have one for Doom, Curses, and every other status debuff too. It's very automated and automation is just another word for botting.

Personally I think if they are gonna stick an addon in Windower that allows Echo Drops, they should just have one for all.

Not intending to start a debate about grey areas, by the way.
Offline
By Draylo 2021-12-06 18:17:05
Link | Quote | Reply
 
Most of them already say that they don't really approve of aECHO. There has been numerous threads and questions asking for changes to aecho to use remedies since those are more readily available now, and they are always ignored mostly. It pretty much is automation/botting but most people these days don't care and even have auto ws etc in their lua. I think its fine to not support automated actions, that is my opinion though.
[+]
Offline
Posts: 5
By Sarteck 2021-12-06 18:22:24
Link | Quote | Reply
 
I'm honestly not worried about the botting issue. If a GM ever looked at my gameplay, they'd laugh at any suggestion about that, hah hah; I play too awfully. But thanks for the perspective!
 Lakshmi.Elidyr
Offline
Server: Lakshmi
Game: FFXI
user: elii
Posts: 911
By Lakshmi.Elidyr 2021-12-06 18:50:51
Link | Quote | Reply
 
abdhaljs said: »
Lakshmi.Elidyr said: »
*Extra note, this falls under botting category imo.*

I don't see how it's really different from the "aecho" Addon in Windower that automatically uses Echo Drops when you get Silenced and that's at the top of the list in the Windower Addons tab. They may as well have one for Doom, Curses, and every other status debuff too. It's very automated and automation is just another word for botting.

Personally I think if they are gonna stick an addon in Windower that allows Echo Drops, they should just have one for all.

Not intending to start a debate about grey areas, by the way.

Look, I'm not one to judge at all, and I don't have issues with anyone, but let's face the reality. *They* can say it's not, but it is, it's automated.

Would I do it? Absolutely, 100% don't care what someone else thinks I should do with my time.

Sarteck said: »
Lakshmi.Elidyr said: »
You could use time change to check for buff active.
This is more or less what I think I would have to do, since attempted removal upon the buff gain. In other words, "gain buff" and "lose buff" really wouldn't be as effective.

I'll fool around with "time change" and see if it's what I'm looking for, but I wonder if I should be using it or one of the Events associated with ticks ("prerender" and "postrender")? Or if I should be including a timer of my own?

[Thanks to both of you for the replies and examples.]
I mentioned time change instead of pre/post render, because with out proper delay checking and some sort of spam protection you would be sending holy water action like 100's of times a second. Much easier to get acquainted using time change first.
[+]
 Cpu
Offline
Posts: 248
By Cpu 2021-12-07 02:08:11
Link | Quote | Reply
 
You should be able to do this with gearswap as well if you don't want to deal with writing your own addon for it:
Code
function buff_change(name, gain, buff_details)
	if name:lower() == 'doom' then
		if gain then
			enable('neck', 'ring1', 'ring2', 'waist')
			equip(sets.doom)
			disable('neck', 'ring1', 'ring2', 'waist')
			send_command('@input /echo <----- Doomed ----->')
			send_command('@input /item "Holy Water" <me>')
		else
			enable('neck', 'ring1', 'ring2', 'waist')
			send_command('@input /echo <----- Doom Removed ----->')
		end
	end
end

function aftercast(spell)
	if buffactive['Doom'] then
		send_command('@wait 1.25;input /item "Holy Water" <me>')
	end
end
[+]
 Asura.Chiaia
VIP
Offline
Server: Asura
Game: FFXI
user: Demmis
Posts: 1652
By Asura.Chiaia 2021-12-07 03:12:42
Link | Quote | Reply
 
abdhaljs said: »
Lakshmi.Elidyr said: »
*Extra note, this falls under botting category imo.*

I don't see how it's really different from the "aecho" Addon in Windower that automatically uses Echo Drops when you get Silenced and that's at the top of the list in the Windower Addons tab. They may as well have one for Doom, Curses, and every other status debuff too. It's very automated and automation is just another word for botting.

Personally I think if they are gonna stick an addon in Windower that allows Echo Drops, they should just have one for all.

Not intending to start a debate about grey areas, by the way.
It's an addon we wish wasn't in the repo but it is from older Devs that have since left the team. We won't ever take any addon off the list but we also won't let it be updated to allow other removals. Same with the gimp autora addon that is in the list. We won't let people update it to be smarter/better packets etc.

For v5 that won't ever make it into the repo and if they did somehow they get removed as soon as we saw someone stuck it in.

Nothing stopping you from updating aecho though and distributing it among your friends/ls mates though.
[+]
Log in to post.