Gearswap Support Thread |
||
Gearswap Support Thread
For the same issues I explained above, no. Additionally, you would need to check for the "more specific" requirements first, i.e. you have to check if Curaga V is appropriate first, otherwise it'll just use Curaga III, because if the player's HP is less than 46%, then it will also be less than 81%.
Code function pretarget(spell) if T{"Cure","Cure II","Cure III","Cure IV"}:contains(spell.name) and spell.target.type == 'PLAYER' and not spell.target.charmed and AutoAga == 1 then target_count = 0 for i=1,party.count if party[i].hpp<80 then target_count = target_count + 1 end end if target_count > 1 then cancel_spell() send_command(';input /ma "Curaga III" '..spell.target.name..';') end end end Target_count +1, could this be changed to +2 to make it only use it if 3 players in your party have low hp? EDIT:: It appears Player Positions (x and y map co-ordinates) are also recordable, is it possible to map players who's hp is within these catagories AND are within say ~ 7 distance for curaga to hit them all? If you want to change the condition, you would change it the 'if target_count > 1 then' to 'if target_count > 2 then', or even something like 'if target_count > party.count/2 then' if you wanted it to scale to your party in some way.
The target_count = target_count + 1 is a counter for the number of players whose HPP is less than 80. Edit: I haven't played with x,y,z since they were fixed, so I'm not sure what it would look like, but yes, theoretically, you should be able to. Ragnarok.Flippant said: » If you want to change the condition, you would change it the 'if target_count > 1 then' to 'if target_count > 2 then', or even something like 'if target_count > party.count/2 then' if you wanted it to scale to your party in some way. The target_count = target_count + 1 is a counter for the number of players whose HPP is less than 80. Edit: I haven't played with x,y,z since they were fixed, so I'm not sure what it would look like, but yes, theoretically, you should be able to. Interesting I will certainly be trying to implement this then. I just copied and pasted your Cure rule in and it says that Line 5~ do expected near if. there is an extra END in it also Code function pretarget(spell) if T{"Cure","Cure II","Cure III","Cure IV"}:contains(spell.name) and spell.target.type == 'PLAYER' and not spell.target.charmed and AutoAga == 1 then target_count = 0 for i=1,party.count do if party[i].hpp<80 then target_count = target_count + 1 end end if target_count > 1 then cancel_spell() send_command(';input /ma "Curaga III" '..spell.target.name..';') end end end I assume the do was there? Yup yup, I always forget the 'do' e_e
Don't see the extra end though (one is for the for statement). Ragnarok.Flippant said: » Yup yup, I always forget the 'do' e_e Don't see the extra end though (one is for the for statement). Code function pretarget(spell) if T{"Cure","Cure II","Cure III","Cure IV"}:contains(spell.name) and spell.target.type == 'PLAYER' and not spell.target.charmed and AutoAga == 1 then target_count = 0 for i=1,party.count do if party[i].hpp<80 then target_count = target_count + 1 end end if target_count > 1 then cancel_spell() send_command(';input /ma "Curaga III" '..spell.target.name..';') end end end it was due to the missing do! lol. So looking at it, the if HP rule is being checked only for the count, what if I wanted it to Differentiate between curaga 4 and 3 using HP again? Your rule obviously works very well for just Curaga 3, but I don't see a direct way to backwards compose this to work for both, unless I used a different variable to Target_countCuraga3 or something? Code function pretarget(spell) if T{"Cure","Cure II","Cure III","Cure IV"}:contains(spell.name) and spell.target.type == 'PLAYER' and not spell.target.charmed and AutoAga == 1 then target3_count = 0 target4_count = 0 for i=1,party.count do if party[i].hpp<50 then target4_count = target4_count + 1 elseif party[i].hpp<80 then target3_count = target3_count + 1 end end if target3_count > 1 then cancel_spell() send_command(';input /ma "Curaga III" '..spell.target.name..';') elseif target4_count > 1 then cancel_spell() send_command(';input /ma "Curaga IV" '..spell.target.name..';') end end end Would this work? Technically, but it probably won't give you what you want to happen in certain scenarios.
First, Curaga V should take precedence whenever possible. As it stands now, if you have two people with 40% HP and two people with 70% HP, Curaga III will go off instead. Second potential issue, if you have one person with 40% HP and one person with 70% HP, what do you want to happen? As it stands, it won't use any curaga, because both counters are only at 1. If you want it to use Curaga III, then you may want to check if target3_count+target4_count > 1. Or, you may want to change how your counters work so that a target with less than 50% HP would count towards both. But maybe you want it so that if even one person benefits from the higher tier, you want to use that one? Maybe even based on how much MP you have left, and how much you estimate your return will be (well, the latter is highly dependent on player position, so that might not be something you want to consider until later). Whatever you want should be technically possible, it's just a matter of being able to explain what you want enough to make sure you cover any situation. If you can think of as many possible scenarios and what action you want to take based on those conditions, it's easier to map the control flow. Ragnarok.Flippant said: » Technically, but it probably won't give you what you want to happen in certain scenarios. First, Curaga V should take precedence whenever possible. As it stands now, if you have two people with 40% HP and two people with 70% HP, Curaga III will go off instead. Second potential issue, if you have one person with 40% HP and one person with 70% HP, what do you want to happen? As it stands, it won't use any curaga, because both counters are only at 1. If you want it to use Curaga III, then you may want to check if target3_count+target4_count > 1. Or, you may want to change how your counters work so that a target with less than 50% HP would count towards both. But maybe you want it so that if even one person benefits from the higher tier, you want to use that one? Maybe even based on how much MP you have left, and how much you estimate your return will be (well, the latter is highly dependent on player position, so that might not be something you want to consider until later). Whatever you want should be technically possible, it's just a matter of being able to explain what you want enough to make sure you cover any situation. If you can think of as many possible scenarios and what action you want to take based on those conditions, it's easier to map the control flow. Hmm I see you're point. I would want it to use the lower Curaga and the allow a Top off cure after wards etc (that can be done manually obviously). At this stage MP return is not a concern, it's mainly for when Dual Boxing etc and I don't want to have to be hitting 8 different macros for for cures. Personally I favor overcure, but if say ~ I had 2+ players at 80% and one above say 60, I'd want Curaga 3. If I had 1 player at 75% and 2 at 60, I'd want curaga 3. If I had 1 at 75 and 2 at 50, I'd want curaga 4 to full hp. if it was 4+ player's I would say ~ Curaga 3 if all are above 60% but curaga 4 if one isn't. Anything else can be ignored ~ It's getting complicated but I do see what you meant (btw I looked into POS checks and it does seem to work, however it's nailing the math for distance atm so I'll put that to one side.) I don't want it for curaga 5 as I never use it and Curaga 4 is a potent spell already. I appreciate this probably aint the easiet thing to work out so thanks for the assist! Ok, I um, sorta got it to work...
It does the idle, the tag, the tp, the ws, all nicely. but I don't know what this means, or what it is. "Mote-Libs: Cycle: Unknown field [targetmode]" It should be the ACC/Mod/PDT thing right? This ***really makes my head hurt. So as of 3 weeks, I have on the odd occasion experienced my character locking up and refusing to cast any spells until I UNLOAD GEARSWAP and reload it.
here is the WHM File (The curaga stuff is new so this is not the area causing the issue) I've added a if midaction part to the sublimation thinking it might be due to this. however I don't see any error's that should cause it to lock. Any assistance would be appreciated. EDIT:: Nevermind spotted it.... Is there a code that will auto lockstyle into a predefined set when you zone into a new area? Without having to press any buttons.
Been practicing learning to write GS lingo since the combo of Mote and Conagh are the perfect WHM G.S. That being said I'm working on gaining some clarity I've been trying to understand how I would get a precast > Midcast function to work in sync:
>>sets.precast.FC.Curaga =<< Does this require a "Function command" to get it to work or No? A visual template would be appreciated if it's not to much to ask. At least i can have a visual to see rinse and repeat. Phoenix.Skyfire said: » Is there a code that will auto lockstyle into a predefined set when you zone into a new area? Without having to press any buttons. As far as I know, GS doesn't handle the zone event, but you can register the event yourself Code windower.register_event('Zone change', function(new,old) send_command('wait 2; gs equip lockstyle_set; input /lockstyle on') end) Didn't test this. It might be 'zone change'; the Windower documentation has it capitalized, but it's the only one that's capitalized, and I am too lazy to log in to test. I also am not sure if it fires immediately when zoning (black screen, can't do anything), or after the screen already loads. Guessing the latter, but if it's the former, might need to pump up the wait time. Leviathan.Syagin said: » Been practicing learning to write GS lingo since the combo of Mote and Conagh are the perfect WHM G.S. That being said I'm working on gaining some clarity I've been trying to understand how I would get a precast > Midcast function to work in sync: >>sets.precast.FC.Curaga =<< Does this require a "Function command" to get it to work or No? A visual template would be appreciated if it's not to much to ask. At least i can have a visual to see rinse and repeat. I am not quite sure what you mean, because you seem to imply that you are attempting to avoid functions, which isn't possible. Your whole GS file should be a list of functions. Functions are basically a series of instructions that are executed each time they are called, and in GS, they are typically called by certain events. GS maps out most of these events automatically, so you just need to write the functions that go with these events; but you can, additionally, register your own events and make your own functions as you please. Now, I don't know if you're looking to use Mote's templates or not. If you are, then you will have to read his wiki (https://github.com/Kinematics/GearSwap-Jobs/wiki) for instructions, because he is using GS's reserved functions in his structure already and you will be required to use functions that he's assigned for user use instead. If you are not: The most basic functions that you will want to cover is: get_sets(): This is called only once: when your GS file is loaded. This is where you list your gear sets, and where most people also list global variables. precast([ table] spell): This is called immediately after a spell is triggered but before it is started. Spells can also be canceled at this level. midcast([ table] spell): This is called immediately after a spell is started. aftercast([ table] spell): This is called immediately after a spell is completed. status_change([string] new,[string]old): This is called whenever your status changes (engaged,idle,resting,dead). buff_change([string]buff,[boolean]gain): This is called whenever you gain or lose a buff. self_command([string]command): This is called whenever you issue a command through gs using //gs c [command]. Inside the beta_examples_and_information folder (in the GS addon folder) is an excel with a full list of event-prompted functions (for you to make), built-in functions (for you to use), and both local (spell tables--only available within spell-related functions) and global (everything else--available at any time) variables that you have access to. There are also many rudimentary examples of GS files for you to take a look at, although they probably have not been updated in a while and may use deprecated code. I believe Mote also wrote a basic guide somewhere here, but I don't have a link. Maybe someone who knows could provide that. I cant seem to get cancel conflicting buffs to work, any suggestions or did I get the incorrect code.
Code -- Buff utility functions. ------------------------------------------------------------------------------------------------------------------- local cancel_spells_to_check = S{'Sneak', 'Stoneskin', 'Spectral Jig', 'Trance', 'Monomi: Ichi', 'Utsusemi: Ichi'} local cancel_types_to_check = S{'Waltz', 'Samba'} -- Function to cancel buffs if they'd conflict with using the spell you're attempting. -- Requirement: Must have Cancel addon installed and loaded for this to work. function cancel_conflicting_buffs(spell, action, spellMap, eventArgs) if cancel_spells_to_check:contains(spell.english) or cancel_types_to_check:contains(spell.type) then if spell.action_type == 'Ability' then local abil_recasts = windower.ffxi.get_ability_recasts() if abil_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') eventArgs.cancel = true return end elseif spell.action_type == 'Magic' then local spell_recasts = windower.ffxi.get_spell_recasts() if spell_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Spell waiting on recast.') eventArgs.cancel = true return end end if spell.english == 'Spectral Jig' and buffactive.sneak then cast_delay(0.2) send_command('cancel sneak') elseif spell.english == 'Sneak' and spell.target.type == 'SELF' and buffactive.sneak then send_command('cancel sneak') elseif spell.english == ('Stoneskin') then send_command('@wait 1.0;cancel stoneskin') elseif spell.english:startswith('Monomi') then send_command('@wait 1.7;cancel sneak') elseif spell.english == 'Utsusemi: Ichi' then send_command('@wait 1.7;cancel copy image,copy image (2)') elseif (spell.english == 'Trance' or spell.type=='Waltz') and buffactive['saber dance'] then cast_delay(0.2) send_command('cancel saber dance') elseif spell.type=='Samba' and buffactive['fan dance'] then cast_delay(0.2) send_command('cancel fan dance') end end end Code if abil_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') eventArgs.cancel = true return Should probably do ~ Code if spell.type == 'JobAbility' and windower.ffxi.get_ability_recasts()[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') Referring it to check something then check something within a rule but then nbit adding () for the function contains etc is whats causing the issue. I use this on WHM and it works 100% Cerberus.Conagh said: » if spell.type == 'JobAbility' and windower.ffxi.get_ability_recasts()[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') Its not saying the lua is broken and on debugmode I dont even see a reference to this, all other events seems to be taking place. This is the code with your addendum. Code function cancel_conflicting_buffs(spell, action, spellMap, eventArgs) if cancel_spells_to_check:contains(spell.english) or cancel_types_to_check:contains(spell.type) then if spell.action_type == 'Ability' then local abil_recasts = windower.ffxi.get_ability_recasts() if spell.type == 'JobAbility' and windower.ffxi.get_ability_recasts()[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') eventArgs.cancel = true return end elseif spell.action_type == 'Magic' then local spell_recasts = windower.ffxi.get_spell_recasts() if spell_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Spell waiting on recast.') eventArgs.cancel = true return end end This may have been answered before and I missed it, however...
Awhile back, I had been trying to re-work the downgrade function of Curing Waltz included in Mote's libs into a downgrading Cure function. I came up with the following, but it doesn't change anything about any cures. It doesn't throw any errors, but it won't put any messages in the chat log, won't downgrade based on HP and won't downgrade based on MP. Effectively, it does nothing and seems like it isn't being triggered to begin with. I've probably taken something out of the Waltz function that is just breaking the entire thing, but I'm not sure what it's missing. Any help would be appreciated! Here's the paste: http://pastebin.com/MErxfsQJ Thank you all. Asura.Vafruvant said: » This may have been answered before and I missed it, however... Awhile back, I had been trying to re-work the downgrade function of Curing Waltz included in Mote's libs into a downgrading Cure function. I came up with the following, but it doesn't change anything about any cures. It doesn't throw any errors, but it won't put any messages in the chat log, won't downgrade based on HP and won't downgrade based on MP. Effectively, it does nothing and seems like it isn't being triggered to begin with. I've probably taken something out of the Waltz function that is just breaking the entire thing, but I'm not sure what it's missing. Any help would be appreciated! Here's the paste: http://pastebin.com/MErxfsQJ Thank you all. Well, without much information, and after a brief look, Code local cureMPCost = {['Cure'] = 8, ['Cure II'] = 24, ['Cure III'] = 46, ['Cure IV'] = 88, ['Cure V'] = 135, ['Cure VI'] = 230} local mpCost = cureMPcost This makes no sense, because mpCost is now pointing to a table, then you try to do math with it. You want mpCost = cureMPcost[preferredCure]. As to whether that's your only issue or not, I don't know and that's a lot of code to look through without any hints as to what may be wrong. I recommend placing print('blah') in places to make sure it's hitting certain conditions. That way, you can narrow it down to the point that it's failing. Ragnarok.Worldslost said: » I cant seem to get cancel conflicting buffs to work, any suggestions or did I get the incorrect code. Code -- Buff utility functions. ------------------------------------------------------------------------------------------------------------------- local cancel_spells_to_check = S{'Sneak', 'Stoneskin', 'Spectral Jig', 'Trance', 'Monomi: Ichi', 'Utsusemi: Ichi'} local cancel_types_to_check = S{'Waltz', 'Samba'} -- Function to cancel buffs if they'd conflict with using the spell you're attempting. -- Requirement: Must have Cancel addon installed and loaded for this to work. function cancel_conflicting_buffs(spell, action, spellMap, eventArgs) if cancel_spells_to_check:contains(spell.english) or cancel_types_to_check:contains(spell.type) then if spell.action_type == 'Ability' then local abil_recasts = windower.ffxi.get_ability_recasts() if abil_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Ability waiting on recast.') eventArgs.cancel = true return end elseif spell.action_type == 'Magic' then local spell_recasts = windower.ffxi.get_spell_recasts() if spell_recasts[spell.recast_id] > 0 then add_to_chat(123,'Abort: Spell waiting on recast.') eventArgs.cancel = true return end end if spell.english == 'Spectral Jig' and buffactive.sneak then cast_delay(0.2) send_command('cancel sneak') elseif spell.english == 'Sneak' and spell.target.type == 'SELF' and buffactive.sneak then send_command('cancel sneak') elseif spell.english == ('Stoneskin') then send_command('@wait 1.0;cancel stoneskin') elseif spell.english:startswith('Monomi') then send_command('@wait 1.7;cancel sneak') elseif spell.english == 'Utsusemi: Ichi' then send_command('@wait 1.7;cancel copy image,copy image (2)') elseif (spell.english == 'Trance' or spell.type=='Waltz') and buffactive['saber dance'] then cast_delay(0.2) send_command('cancel saber dance') elseif spell.type=='Samba' and buffactive['fan dance'] then cast_delay(0.2) send_command('cancel fan dance') end end end The obvious questions: 1. Are you calling this function (or is it called in Mote's includes)? 2. Do you have the Cancel addon loaded (not the plugin)? Flippant, I have something that's been bugging me..........
My gearswap file seems to lock up for no reason (happens when I spam spells) shortcuts still work, however normal manual selection etc doesn't Code: At first I thought it might be the sublimation rule, so I -- it out, but it still occurred so I -- out the curaga rule but it's still occurring. I'm stumped as it's not just me it's happening too.... any ideas? I feel like I've missed something. eslim said: » line 294-297 is your problem conagh, i've tried to figure out a way to use it but gearswap keeps locking up and there's no way to force no-action status or something back to a player. basically the problem (i think) is this: instant spell goes off and is canceled bcuz you are in midcast or something else and it'll lock up in midcast with nothing being casted so nothing can be casted bcuz it'll keep saying in midcast so the loop happens etc equip(sets.precast.enhancing) else equip(sets.precast.fastcast) end But I think I see, maybe I should add it to function mp change... Code windower.register_event('mp change', function(mp) To create a action status... Code windower.register_event('mp change', function(mp) local total_mpp_deficit = 0 if player.mpp<75 then total_mpp_deficit = (100 - player.mpp) end if buffactive['Sublimation: Complete'] and not midcast() then if total_mpp_deficit > sublimation_benchmark then if Sublimation == 1 then windower.send_command('@wait 2;input /ja "Sublimation" <me>') add_to_chat(039,'Sublimation Completed: MP Danger Zone') end elseif player.mpp < 75 then if Sublimation == 1 then windower.send_command('@wait 2;input /ja "Sublimation" <me>') add_to_chat(159,'Sublimation Completed: MP Mid Range') end end elseif not buffactive['Sublimation: Complete'] and not buffactive['Sublimation: Activated']and not midcast() then if Sublimation == 1 then windower.send_command('@wait 2;input /ja "Sublimation" <me>') end end end) Tried this instead? I assume you were referring to Sublimation trying to check Mpp when nothing changed... This now checks if you mp changes and confirms you are not midaction without trying to cancel anything.. Oh wait...
Code if midaction() then cancel_spell() return end this seems to be what stops it............. it's checking if you are midaction and then cancels spells... but considers doing nothing as an action... as it's checking your MP changes and creates a fake action? Deleting this seems to have fixed it. midaction() should only ever return true if in the middle of a "spell" (or rather, the tables maintained by GS never get updated when the spell is completed, for whatever reason). Other events shouldn't be in the command_registry, so those are not what is causing the issue. And this table isn't reset when you reload your GS file, so if an entry is stuck on "midaction," you have to reload the GS addon itself to unblock it.
midaction() actually returns two values, boolean (true or false) and a spell table. By using Code if midaction() then b,s = midaction() cancel_spell() print('canceled by '..s.english) return end and casting Protect immediately followed by spamming Cure (starting while Protect is still casting), I think I realize the issue (at least narrowed it down, anyway). Even after the 3-second cooldown and I should be able to cast Cure, what prints is 'canceled by Cure,' meaning that the new spell is added into the command_registry even though it doesn't actually get through to the game, and since it never completes (since it technically never started), midaction never gets set to false. I'll post a bug report to Windower x: Ragnarok.Flippant said: » midaction() should only ever return true if in the middle of a "spell" (or rather, the tables maintained by GS never get updated when the spell is completed, for whatever reason). Other events shouldn't be in the command_registry, so those are not what is causing the issue. And this table isn't reset when you reload your GS file, so if an entry is stuck on "midaction," you have to reload the GS addon itself to unblock it. midaction() actually returns two values, boolean (true or false) and a spell table. By using Code if midaction() then b,s = midaction() cancel_spell() print('canceled by '..s.english) return end and casting Protect immediately followed by spamming Cure (starting while Protect is still casting), I think I realize the issue (at least narrowed it down, anyway). Even after the 3-second cooldown and I should be able to cast Cure, what prints is 'canceled by Cure,' meaning that the new spell is added into the command_registry even though it doesn't actually get through to the game, and since it never completes (since it technically never started), midaction never gets set to false. I'll post a bug report to Windower x: AHA KNEW IT WASN'T ME GOING MAD !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! At least it will get fixed |
||
All FFXI content and images © 2002-2024 SQUARE ENIX CO., LTD. FINAL
FANTASY is a registered trademark of Square Enix Co., Ltd.
|