Typed it into the chat log.
Typed it into the chat log.
Er, no, I've always and only used 'gain'. gain_or_loss is a remnant of how Byrth wrote it, when the value was originally a string. Kensagaku managed to mix both of them together, which meant that neither was being used properly.
As for 'how it works' -- it's a function parameter. If you use a function parameter, you have to use the name it's been given. If you use something else, then clearly you're not referring to the function parameter. If whatever you're using has never been defined at all (as in the case of your code), then clearly you're not going to get any sensible value.
It typically only happened with ranged, because ranged users are most likely to not be engaged to something they decide to shoot at/weaponskill. Plus a melee has to be standing right next to the mob. It's always been an issue with both types, just more likely to happen (and thus be noticed) with one rather than the other.
Yeah, I decided that one was a feature a while ago. Updated the documentation and fixed a bug with monster-pet WSs.
Okay. I have read through a lot of Gearswap help stuff and gone through a lot of Gearswap files, and I haven't found a solution for specifically what I want to do, so I'll just ask.
My Spellcast file for PUP was set up so that, if I was on PUP/THF, it would automatically equip my Treasure Hunter belt when engaged. Then, after any action, it would switch to my standard TP belt. This worked well for me in Dynamis/Salvage and I want to be able to continue doing this without having to hit a macro every single fight.
Is it possible to do this in Gearswap, and if so, how? I have my PUP gearswap file up and running in every other way I needed it to run, just missing this TH piece.
Thanks in advance!
No prob, it was actually ridiculously simple in SC, but I'm really just beginning in GS and have no idea if it's even possible. It didn't swap back to TH with autotarget then either, and for that I resigned myself to using a macro. Not a problem if I have to do that, just want it to equip the TH belt for the initial target.Anyways, this is how I did it in Spellcast:
<if job="PUP/THF">
<if status="engaged">
<equip when="engaged" set="TP">
<waist>Tarutaru sash</waist>
</equip>
<equip when="aftercast">
<waist>Windbuffet Belt</waist>
</equip>
</if>
</if>
Since it's PUP, I'm pretty much always using maneuvers and ending up in aftercast, so it worked out really well.
I havent been actually doin much stuff in game since i started making gearswap work for my whm mule. But two days ago i was doin dynamis with me and my mule, and while i was fighting with my thf i spotted a nm pop and ran over to claim with my whm mule with flash or stun. I did this several times that night and each time my subtarget was blue color but i would be out of range. Is that gearswap makin the sub target not change colors if out of range? if it is, is there a way to fix that?
No, gearswap doesn't interfere with the targeting colors.
Or shortcuts i guess could be a culprit too. my macro was just /ma "stun" <stnpc> and im pretty sure always had different colors based on range before. Alright Byrthnoth, was just checking cause I knew there was a pretarget function and i really have no clue what that is for and what the difference betwixt that and precast was, and since it was called pretarget i wasnt sure if it interfered with sub targetting.
Nothing Shortcuts or GearSwap does could potentially interfere with targeting colors.
Trivial code to do what you're asking:
Code:function status_change(new_status, old_status) if new_status == 'Engaged' then equip(sets.engaged, {waist="Tarutaru Sash"}) else equip(sets.idle) end end function aftercast(spell) if player.status == 'Engaged' then equip(sets.engaged) else equip(sets.idle) end end
Awesome, I'll try it, thanks! Yes, I'm sure it was really easy, but I've never used lua before and don't fully understand what I'm doing. I just have to keep plugging at it til I understand it. To be honest, sir, your files confused me so much I had to find some more basic ones to start off with.
One other issue I'm having that I just noticed today. My gear is switching to my pet healer set when my puppet casts ANYTHING (Bio, Protect, Haste, Dia, etc, etc). I only WANT it to switch for cures. Can you tell me what I did wrong below? Thanks again!
function pet_midcast(spell,action)
if petWS:contains(spell.english) then
equip(sets.Midcast.Pet.WS)
elseif {'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'} then
equip(sets.TP.Pet.Cure)
else
equip(sets.TP)
end
end
That line doesn't do what you think it does. In Lua, anything that isn't nil or false has the boolean value true. To gearswap, that line reads "elseif true then," which is to say that it will always equip(sets.TP.Pet.Cure) unless the spell meets the earlier condition. You can fix your problem by moving that table out of the pet_midcast function and defining it in the get_sets function. Cast it as a T-table, then check to see if the table contains spell.english in the pet_midcast function.
Also, how did you write your sets tables?Code:function get_sets() automaton_cures=T{'Cure','Cure II','Cure III','Cure IV','Cure V','Cure VI'} end function pet_midcast(spell,action) if petWS:contains(spell.english) then equip(sets.Midcast.Pet.WS) elseif automaton_cures:contains(spell.english) then equip(sets.TP.Pet.Cure) else equip(sets.TP) end end
Thank you, I will try that out! And thank you for explaining as well, only way I'll learn.
To be honest, I copied the majority of my PUP gearswap from Bokura's PUP gearswap (can't post url, too few posts, too much suckage, but shouldn't be too hard to locate). What about the naming convention is odd to you? Asking so I'll better understand as I tweak it and work on other files.
This means sets.TP is a table with gear in it, i.e.equip(sets.TP)
Code:sets.TP={head="",body="",etc...}This means something else: sets.TP contains a key named Pet. Unless I'm mistaken, the table looks something like this:equip(sets.TP.Pet.Cure)
That's kind of strange. It would be better to separate the pet table from the TP table.Code:sets.TP={head="",body="",etc...,Pet={Cure={head="",body="",etc...}}}
So i was kinda curious about this:
function status_change(new_status, old_status)
I wasnt sure what new and old meant. So does New mean you went from idle to engaged, and is old you were engaged did a spell and after spell were still engaged? Cause that seems to me like it would mean old is the same as aftercast. Is there a difference between using old status change and aftercast?
I'm not sure I follow. New and old are parameters passed by gearswap to the status_change function. Here are all of the statuses:If you were to go from /healing to standing (idling), gearswap would call the status_change function and pass it "Resting" for Old, and "Idle" for new. There are no statuses for casting or aftercast.[0] = {id=0,en="Idle"},
[1] = {id=1,en="Engaged"},
[2] = {id=2,en="Dead"},
[3] = {id=3,en="Engaged dead"},
[4] = {id=4,en="Event"},
[5] = {id=5,en="Chocobo"},
[33] = {id=33,en="Resting"},
[34] = {id=34,en="Locked"},
[38] = {id=38,en="Fishing fighting"},
[39] = {id=39,en="Fishing caught"},
[40] = {id=40,en="Fishing broken rod"},
[41] = {id=41,en="Fishing broken line"},
[42] = {id=42,en="Fishing caught monster"},
[43] = {id=43,en="Fishing lost catch"},
[44] = {id=44,en="Crafting"},
[47] = {id=47,en="Sitting"},
[48] = {id=48,en="Kneeling"},
[50] = {id=50,en="Fishing"},
[51] = {id=51,en="Fishing fighting center"},
[52] = {id=52,en="Fishing fighting right"},
[53] = {id=53,en="Fishing fighting left"},
[56] = {id=56,en="Fishing rod in water"},
[57] = {id=57,en="Fishing fish on hook"},
[58] = {id=58,en="Fishing caught fish"},
[59] = {id=59,en="Fishing rod break"},
[60] = {id=60,en="Fishing line break"},
[61] = {id=61,en="Fishing monster catch"},
[62] = {id=62,en="Fishing no catch or lost"}
In your example, you go from idle to engaged, cast a spell, then continue fighting. From gearswap's perspective, it sees you go from idle to engaged and calls the status_change function, passing new=engaged, old=idle. Gearswap sees you cast the spell, but your status is still engaged, so it does not call the status_change function.
Because i always see stuff like this in luas
Both seem to do the same thing to me, in spellcast you only needed one thing to put tp equip ment on when you engaged and after casting a spell/using a JA,WS And i would see new and old on status change with out any explanation so i wasnt sure exaclty what it does. jsut like i dont exactly understand the purpose of pretarget coding cause it sounds like the same as precast to me. I am sure there is a reason for 2 different things, but until i know what it is, it just wont make sense to me.Code:function aftercast(spell) if player.status=='Engaged' then equip(sets.TP[TP_Set_Names[TP_Index]]) else equip(sets.Idle[Idle_Set_Names[Idle_Index]]) end end function status_change(new,old) if T{'Idle','Resting'}:contains(new) then equip(sets.Idle[Idle_Set_Names[Idle_Index]]) elseif new == 'Engaged' then equip(sets.TP[TP_Set_Names[TP_Index]]) end end