Alexcennah Default replied

550 weeks ago

The status_change events happens when our characters change to/from Engaged, Idle, Dead etc. Easy. From my example:

function status_change(new,old)
	if new == 'Engaged' then
		equip_TP_set()
	else
		equip_Idle_set()
	end
end

"New" means new status. "Old" means status. So in the code above, if we engage a monster, GS will equip our TP set. If not, it'll equip our Idle set. Simple and clean.


last edited 550 weeks ago by Alexcennah

Alexcennah Default replied

550 weeks ago

Filtered_action is a different event, since it only happens when we try some action that we can't do (e.g. a WHM trying to use Resolution or a SMN/BRD trying to cast a Blue Magic). On that script I did nothing, but I could place a cancel_spell() function call to ignore every irregular command. By "irregular command" I mean commands we really can't do. Filtered_action WON'T work if we COULD cast the spell/JA/WS but for some reason we can't AT THAT MOMENT (e.g. the recast timer is down or we haven't enough MP or TP).

So what's the big deal with filtered_action? Well, look at a tidbit of code from my RUN.lua:

function filtered_action(spell)

	if player.sub_job == "BLU" then
		send_command('@input /ma Cocoon <me>')
		cancel_spell()
		return
	elseif player.sub_job == "SAM" then
		send_command('@input /ja Hasso <me>')
		cancel_spell()
		return
	elseif player.sub_job == "WHM" then
		send_command('@input /ma Haste <me>')
		cancel_spell()
		return
	else
		cancel_spell()
	end

end

My main RUN macroset has a macro for Utsusemi, since my main sub is /NIN. I'm a lazy bastard, so instead of writing new macrosets when I'm using different subjobs, I decided to make my Utsusemi macro cast different stuff! So, if I try to use my Utsusemi macro (or everything I can't cast at that moment whatsoever), it'll change to a Cocoon macro when I'm /BLU, a Hasso macro whem I'm /SAM and a Haste macro when I'm /WHM! Neat, huh?

Alexcennah Default replied

550 weeks ago

And here we came to the self_command, one of the nicest stuff GearSwap can give us.

Self_command is a command we create ourselves, using gs c <command>. In our example:

	if command == 'idle' then
			equip_Idle_set()
	end

Typing gs c idle on windower console makes our character equip his/her Idle set directly. And better, we can make a macro for that using the default windower command /console (in this case, /console gs c idle).

Now the time to explain what I did in that TP sets has come. Let's look at TP sets declaration in get_sets:

	--TP Sets
 
sets.TP = {}
sets.TP.index = {'Standard','TH','Evasion'}
---- 1=Standard, 2=TH, 3=Evasion ----
TP_ind = 1
 
 
sets.TP.Standard = {ammo="Raider's Bmrng.",
	head="Iuitl Headgear +1",neck="Asperity necklace",lear="Dudgeon earring",rear="Heartseeker earring",
	body="Thaumas coat",hands="Plun. Armlets +1",lring="Epona's ring",rring="Rajas Ring",
	back="Atheling Mantle",waist="Windbuffet Belt",legs="Iuitl Tights +1",feet="Manibozho boots"}
 
sets.TP.TH = set_combine(sets.TP.Standard,{feet="Raid. Poulaines +2"})
sets.TP.Evasion = set_combine(sets.TP.Standard,{body = 'Espial gambison',legs = 'Kaabnax Trousers',feet = 'Espial Socks'})

I created a table sets.TP.index to help me control the use of my TP sets in battle. The first element (sets.TP.index[1]) is "Standard", the second one (sets.TP.index[2]) is "TH" and the third one (sets.TP.index[3]) is "Evasion". Please note my 3 TP sets uses the same names as these index. Let's look now on my self_command event:

	if command == 'tp' then
		TP_ind = 1
		send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
		equip_TP_set()
	end
	if command == 'th' then
		TP_ind = 2
		send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
		equip_TP_set()
	end
	if command == 'eva' then
		TP_ind = 3
		send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
		equip_TP_set()
	end

If I type (or macro) the command gs c tp, it'll change the variable TP_ind to 1, so everytime the GearSwap call my TP set, it'll equip my base TP set. With the command gs c th, the index will change to 2, then it'll use my TH set instead. And the command gs c eva will change the index to 3 and use The Evasion set.

BTW, the gs c mode command will rotate between those 3 modes, if you want to use just one macro for that.

if command == 'mode' then
	TP_ind = TP_ind +1
	if TP_ind > #sets.TP.index then
		TP_ind = 1
	end
	send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
	equip_TP_set()
end

SeekerStar Admin replied

550 weeks ago

Did you write that particular bit yourself? o.O

The index thing, I mean.

Also, that macro swap thing for RUN looks incredibly useful; I tend to swap from /whm to /war to /nin to /dnc, and with that, I could have it do all sorts of different things.

I have to study this for a bit before I try to write one of my own :D
"Here's a random tip for you. Criticizing the whm is stupid and suicidal. Side effect may include lack of heals in your direction, dancing on your corpse, stubborn refusal to give you raises, laughing and pointing, sudden dirt nap taking due to lack of buffs… "

Alexcennah Default replied

550 weeks ago

No, I picked it from the first .lua I had my hands on to study. But since every script I see (including the ones included with the addon) uses it, I bet it's been used since the beginning. BTW, most SpellCast .xml did something similar, it's just a common method to control several TP sets.

Don't be so worried about writing your own scripts. My purpose here is just making you guys understand the basic principles behind GearSwap, so you can pick codes to use here and there and understand how they work. I just can't let you guys use stuff like those monstrous Motenten's luas without at least know what you are doing.

SeekerStar Admin replied

550 weeks ago

All this info is amazing.

Thank you so so so much. :D
"Here's a random tip for you. Criticizing the whm is stupid and suicidal. Side effect may include lack of heals in your direction, dancing on your corpse, stubborn refusal to give you raises, laughing and pointing, sudden dirt nap taking due to lack of buffs… "

Alexcennah Default replied

550 weeks ago

You're welcome, if you have any questions, feel free to ask me.

SeekerStar Admin replied

550 weeks ago

Don't worry, I probably will…


x.x
"Here's a random tip for you. Criticizing the whm is stupid and suicidal. Side effect may include lack of heals in your direction, dancing on your corpse, stubborn refusal to give you raises, laughing and pointing, sudden dirt nap taking due to lack of buffs… "

Alexcennah Default replied

549 weeks ago

A new Voldemort has arrived! Download the Unlimited plugin now, it removes the game 30 FPS cap.

SeekerStar Admin replied

549 weeks ago

does it help with framerate lag?

Because seriously, ew.

Also my RollTracker is not functioning :(
"Here's a random tip for you. Criticizing the whm is stupid and suicidal. Side effect may include lack of heals in your direction, dancing on your corpse, stubborn refusal to give you raises, laughing and pointing, sudden dirt nap taking due to lack of buffs… "
Please log in to post a reply.