Scholar Gearswap .lua |
||
Scholar Gearswap .lua
Cerberus.Shadowmeld
Offline
You do have all your if Statements closed looking more in depth, but your rules for Enfeebling and Dark Magic are nested inside the check for Elemental Magic and will never equip.
Cerberus.Shadowmeld said: » You've got a lot of issues, but here are a few Code function midcast(spell, action, spellMap, eventArgs) if string.find(spell.english,'Cur') then equip(sets.midcast_Cure) if spell.element == world.weather_element or spell_element == world.day_element then equip({main="Chatoyant Staff"},sets.Obi[spell.element]) end if buffactive.rapture then equip({head="Savant's Bonnet +2"}) end elseif spell.english == 'Impact' then local tempset = sets['midcast_Impact'] tempset['body'] = 'Twilight Cloak' tempset['head'] = empty equip(tempset) if spell.element == world.weather_element or spell_element == world.day_element then equip(sets.Obi[spell.element]) end if sets.staves.damage[spell.element] then equip(sets.staves.damage[spell.element]) end elseif spell.skill == "ElementalMagic" then if string.find(spell.english,'helix') then equip(sets['midcast_Helix']) end if spell.skill == "ElementalMagic" then equip(sets.midcast_ElementalMagic) if spell.skill == 'EnfeeblingMagic' then equip(sets.midcast_EnfeeblingMagic) if spell.skill == 'DarkMagic' then equip(sets.midcast_DarkMagic) end else equip(sets.midcast_ElementalMagic) if spell.element=='Earth' then equip({neck="Quanpur Necklace"}) end if spell.element == world.weather_element or spell_element == world.day_element then equip(sets.Obi[spell.element]) end end end if buffactive.ebullience then equip({head="Savant's Bonnet +2"}) end if buffactive.klimform then equip ({feet="Savant's Loafers +2"}) end elseif spell.english == 'Phalanx' then equip(sets['midcast_Phalanx']) elseif spell.english == 'Stoneskin' then equip(sets['midcast_Stoneskin']) elseif spell.skill == 'EnhancingMagic' then if spell.english == 'Embrava' then equip(sets['midcast_Embrava']) if not buffactive.perpetuance then add_to_chat(8,'--------- Perpetuance is down ---------') end if not buffactive.accession then add_to_chat(8,'--------- Accession is down ---------') end if not buffactive.penury then add_to_chat(8,'--------- Penury is down ---------') end end if buffactive.perpetuance then equip(sets['midcast_EnhancingMagic'],{hands="Savant's Bracers +2"}) else equip(sets['midcast_EnhancingMagic']) end else weathercheck(spell.element,sets['midcast_'..spell.skill]) end if spell.english == 'Sneak' then send_command('@wait 1.8;cancel 71;') end end You've got a bunch of un-ended if statements. I'm surprised it actually loads properly honestly. Key info. Magic skills are not one word. ElementalMagic should be Elemental Magic. You have errors of this nature on lines 132, 136, 138, 140, and 163 On line 135 you inexplicably end your if-else checks and then do 3 consecutive if statements, only 1 of which is ended properly, then you have a rogue else statement that isn't tied to any specific if statement. I think those two would fix most of your issues, but I would also like to point out that you have some really inefficient steps in your code. If I might suggest, I would structure it closer to this: Code function midcast(spell) if spell.skill == 'Healing Magic' then if spell.name:startswith("Cure") or spell.name:startswith("Curaga") then -- I changed this because the way you had it before it would catch Cursna as well. This way you can make rules for cursna later equip(sets.midcast_Cure) -- Chatoyant staff and obi rules here end elseif spell.skill == 'Elemental Magic' then if spell.name == 'Impact' then -- Impact rule elseif spell.name:find("helix") then -- Helix Rule else equip(sets.midcast_ElementalMagic) -- obi rule here end elseif spell.skill == 'Enhancing Magic' then elseif spell.skill == 'Enfeebling Magic' then elseif spell.skill == 'Dark Magic' then end end This way your if statements flow properly and your code would be more efficient. Does that make sense? Thank you for your advice, i'll make the change. I'm having 2 more issues if you have a clue about these When I cast Impact it properly change to my fast cast set + twilight cloak but it never change to my Impact set. When I use any JA, it changes to my fast cast set Oo Here is the link of the new script: https://pastebin.com/KrBzAAA2 Cerberus.Shadowmeld said: » You do have all your if Statements closed looking more in depth, but your rules for Enfeebling and Dark Magic are nested inside the check for Elemental Magic and will never equip. As a total noob in progamming, can you explain to me what's the difference between elseif and if and when they need to be ended ? (English isn't my birth language so it's not obvious to me ^^) Offline
Posts: 346
Cerberus.Lauranna said: » As a total noob in progamming, can you explain to me what's the difference between elseif and if and when they need to be ended ? (English isn't my birth language so it's not obvious to me ^^) https://www.lua.org/pil/4.3.1.html Sidiov said: » Cerberus.Lauranna said: » As a total noob in progamming, can you explain to me what's the difference between elseif and if and when they need to be ended ? (English isn't my birth language so it's not obvious to me ^^) https://www.lua.org/pil/4.3.1.html Oh thanks a lot ! Cerberus.Shadowmeld
Offline
Line 116, you say if spell.english == 'Elemental Magic', it should be spell.skill. Also line 138 with Enhancing magicThat might fix your issue.
Specific to lua, if you write an if statement. It thinks everything following the if statement is inside of it until it comes to an else, elseif, or end. end is like closing the brackets in other programming languages. So when you have something like this if spell.skill == 'Elemental Magic' then equip(someset) if spell.skill == 'Enhancing Magic' then equip(someset) end that end is ending the Enhancing Magic rule, but.... it can never actually get to the Enhancing Magic equip because before it can do that it has to pass an if check of whether it is Elemental Magic. You're also not going to want to do multiple checks for the same skill the way you are doing it. Specifically Elemental and Enhancing Magic. Change: Code elseif spell.english == 'Elemental Magic' then if spell.name == 'Impact' then equip(sets['midcast_Impact']) elseif spell.name:find("helix") then equip(sets['midcast_Helix']) end elseif spell.skill == 'Elemental Magic' then equip(sets.midcast_ElementalMagic) To: Code elseif spell.english == 'Elemental Magic' then if spell.name == 'Impact' then equip(sets['midcast_Impact']) elseif spell.name:find("helix") then equip(sets['midcast_Helix']) else equip(sets.midcast_ElementalMagic) end if buffactive.Ebullience then equip({head = "Svnt. Bonnet +2"}) end if buffactive.Klimaform then equip({feet = "Svnt. Loafers +2"}) end and Change: Code elseif spell.skill == "Enhancing Magic" then if string.find(spell.english,'storm') then equip(sets['midcast_EnhancingMagic']) end --[[ These are in the wrong place. Should be in your elemental magic rules. if buffactive.ebullience then equip({head="Savant's Bonnet +2"}) end if buffactive.klimform then equip ({feet="Savant's Loafers +2"}) end]] elseif spell.english == 'Enhancing Magic' then if spell.name == 'Phalanx' then equip(sets['midcast_Phalanx']) if spell.name == 'Stoneskin' then equip(sets['midcast_Stoneskin']) if spell.name == 'Embrava' then equip(sets['midcast_Embrava']) end if not buffactive.perpetuance then add_to_chat(8,'--------- Perpetuance is down ---------') end if not buffactive.accession then add_to_chat(8,'--------- Accession is down ---------') end if not buffactive.penury then add_to_chat(8,'--------- Penury is down ---------') end end if buffactive.perpetuance then equip(sets['midcast_EnhancingMagic'],{hands="Savant's Bracers +2"}) else equip(sets['midcast_EnhancingMagic']) end else weathercheck(spell.element,sets['midcast_'..spell.skill]) To: Code elseif spell.skill == 'Enhancing Magic' then if spell.name == 'Phalanx' then equip(sets.midcast_Phalanx) elseif spell.name == 'Stoneskin' then equip(sets.midcast_Stoneskin) elseif spell.name == 'Embrava' then equip(sets.midcast_Embrava) if not buffactive.Perpetuance then add_to_chat(8,'--------- Perpetuance is down ---------') end if not buffactive.Accession then add_to_chat(8,'--------- Accession is down ---------') end if not buffactive.Penury then add_to_chat(8,'--------- Penury is down ---------') end else equip(sets.midcast_EnhancingMagic) end if buffactive.Perpetuance then equip({hands = "Svnt. Bracers +2"}) end end One last note. Capitalization matters. if buffactive.perpetuance will always return false. This is because the name is capitalized. if buffactive.Perpetuance is correct. Cerberus.Shadowmeld said: » Line 116, you say if spell.english == 'Elemental Magic', it should be spell.skill. Also line 138 with Enhancing magicThat might fix your issue. Specific to lua, if you write an if statement. It thinks everything following the if statement is inside of it until it comes to an else, elseif, or end. end is like closing the brackets in other programming languages. So when you have something like this if spell.skill == 'Elemental Magic' then equip(someset) if spell.skill == 'Enhancing Magic' then equip(someset) end Thank you for all your advices, it's more clear now. I'll make the change :) that end is ending the Enhancing Magic rule, but.... it can never actually get to the Enhancing Magic equip because before it can do that it has to pass an if check of whether it is Elemental Magic. You're also not going to want to do multiple checks for the same skill the way you are doing it. Specifically Elemental and Enhancing Magic. Change: Code elseif spell.english == 'Elemental Magic' then if spell.name == 'Impact' then equip(sets['midcast_Impact']) elseif spell.name:find("helix") then equip(sets['midcast_Helix']) end elseif spell.skill == 'Elemental Magic' then equip(sets.midcast_ElementalMagic) To: Code elseif spell.english == 'Elemental Magic' then if spell.name == 'Impact' then equip(sets['midcast_Impact']) elseif spell.name:find("helix") then equip(sets['midcast_Helix']) else equip(sets.midcast_ElementalMagic) end if buffactive.Ebullience then equip({head = "Svnt. Bonnet +2"}) end if buffactive.Klimaform then equip({feet = "Svnt. Loafers +2"}) end and Change: Code elseif spell.skill == "Enhancing Magic" then if string.find(spell.english,'storm') then equip(sets['midcast_EnhancingMagic']) end --[[ These are in the wrong place. Should be in your elemental magic rules. if buffactive.ebullience then equip({head="Savant's Bonnet +2"}) end if buffactive.klimform then equip ({feet="Savant's Loafers +2"}) end]] elseif spell.english == 'Enhancing Magic' then if spell.name == 'Phalanx' then equip(sets['midcast_Phalanx']) if spell.name == 'Stoneskin' then equip(sets['midcast_Stoneskin']) if spell.name == 'Embrava' then equip(sets['midcast_Embrava']) end if not buffactive.perpetuance then add_to_chat(8,'--------- Perpetuance is down ---------') end if not buffactive.accession then add_to_chat(8,'--------- Accession is down ---------') end if not buffactive.penury then add_to_chat(8,'--------- Penury is down ---------') end end if buffactive.perpetuance then equip(sets['midcast_EnhancingMagic'],{hands="Savant's Bracers +2"}) else equip(sets['midcast_EnhancingMagic']) end else weathercheck(spell.element,sets['midcast_'..spell.skill]) To: Code elseif spell.skill == 'Enhancing Magic' then if spell.name == 'Phalanx' then equip(sets.midcast_Phalanx) elseif spell.name == 'Stoneskin' then equip(sets.midcast_Stoneskin) elseif spell.name == 'Embrava' then equip(sets.midcast_Embrava) if not buffactive.Perpetuance then add_to_chat(8,'--------- Perpetuance is down ---------') end if not buffactive.Accession then add_to_chat(8,'--------- Accession is down ---------') end if not buffactive.Penury then add_to_chat(8,'--------- Penury is down ---------') end else equip(sets.midcast_EnhancingMagic) end if buffactive.Perpetuance then equip({hands = "Svnt. Bracers +2"}) end end One last note. Capitalization matters. if buffactive.perpetuance will always return false. This is because the name is capitalized. if buffactive.Perpetuance is correct. Thanks for your advices, i'm gonna make the change Offline
I haven't had issues with capitalization of abilities. I have used Byrth's sample lua scripts as examples and they do not have ability names capitalized for the buffactive state
Cerberus.Shadowmeld
Offline
Interesting. I didn't know that. I guess I just assumed that it was case sensitive like other tables.
Can anyone post a up-to-date SCH lua that they're currently using that they dont mind sharing xD. THX!
If you check your inbox, I sent you a link to the one I use. Here it is again, though.
Thanks! A lot, also finding out a few here and there gear that i need lol. Reading it now trying to understand this thing while i camp nms.
Hmmmm... How is this going to work, i currently main Ames (club) ammurapi shield on light arts and akademos on dark arts.
Does this mean i cannot lockstyle with Lua till i get a healer staff or a nuking wand/shield? Can lua automatically apply lockstyle sets on conditions? There are LUAs that lock/unlock gear (Mote's THF one with TH sets for instance). You can likely have it push the command in when you use arts.
An alternative, if you simply have times you want to ensure you don't blink or lose TP or whatnot is to disable the slot(s) and just manually equip the weapon you want. That way you can still set up optimal sets for times when swapping is okay. For instance, if I want to keep TP for Myrkr, I just open the console and type: gs disable main gs disable sub Then equip Akademos and grip. To get it all swapping again: gs enable all You can also do that for things like CP capes. Trying to understand the lua pasted above before i start using it.
Can someone explain what the lines below mean? function job_state_change(stateField, newValue, oldValue) if stateField == 'Offense Mode' then if newValue == 'Normal' then disable('main','sub','range') else enable('main','sub','range') end end end I also have a question about this line on Precast:
feet="Peda. Loafers +1" Question 1: Can I just type in the entire name of the item? I.E. Pedagogy Loafers +1 Question 2: Wouldn't it be better to use Academic Loafers +2 since it reduces spellcasting time by 10%? Thx! Regarding the first question:
Code function job_state_change(stateField, newValue, oldValue) if stateField == 'Offense Mode' then if newValue == 'Normal' then disable('main','sub','range') else enable('main','sub','range') end end end job_state_change triggers when you use one of the F# shortcuts (by default, then you can define your own) on your keyboard, in this particular case it is F9 that changes your "Offense mode" between the options defined in user_setup. Quote: state.OffenseMode:options('None', 'Normal')
Moving to the second set of questions:
Thx!
Another question, on my Lugh's Cape the 3rd Augment says "Mag.Acc+20/Mag.Dmg.+20" How do I write that down in code? 'Mag.Acc.+20 Mag.Dmg.+20' or 'Mag.Acc.+20/Mag.Dmg.+20' Trying to make this code right or else it would take hours debugging xD. For augmented gear, use the gearswap export functionality that will export all the augments in the right format. Just equip the item and run
Code //gs export Or if you want to run it on your whole inventory Code //gs export inv This will create a file in your Windower4\addons\GearSwap\data\export folder with a list of all the gear(including augs!) that you can just copy over to your GS file. Anyways, the syntax for your Lugh cape would be: Code { name="Lugh's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}} Remove the INT+10 part if you didn't use dye Code { name="Lugh's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','"Mag.Atk.Bns."+10',}} Also this line.
sets.precast.FC.Stoneskin = set_combine(sets.precast.FC, {head="Umuthi hat", hands="Carapacho cuffs", legs="Doyen pants", waist="Siegel sash"}) I only have the Doyen Pants, can I just leave the code as it is and the code will just ignore the other 3 missing equipment gearswaps or should I change/remove it? O wow Thanks That helped a lot!!
Something you can also do for augmented items is define them so that you can just use a short, convenient name instead (and only have to worry about changing one line if you upgrade further or get better augments later).
In the Gearswap support thread, back a few pages ( http://www.ffxiah.com/forum/topic/41580/gearswap-support-thread/123/ ) you can use the same information about how to use multiples of the same augmentable item. You can leave items you don't have in gear sets. It's no different than if you left them in your mog safe or something. Thx, quick question, does anyone know how to unload those spell timers on the left? cant see my gear's stats...
Cerberus.Shadowmeld
Offline
In console:
unload timers In chat: //unload timers thx!
Another question: Is spell interruption rate down gear supposed to be on pre-cast or midcast? Midcast but it's one of those thing where either you cap it (need 102% between gear/merits) or you will still be interrupted pretty often if you have several mobs on you
Necro Bump Detected!
[271 days between previous and next post]
Offline
Posts: 87
Reviving an old thread!
With the new options of Regal earring and bonus accessories from Omen. I was wondering if someone could share a good updated lua with me. Just got back into the game after a 15 months break and really enjoying going back to SCH. I forgot how powerful they are. I'd love for some to share their lua , so I can take a look what gear I need to update and also upgrade my current simple lua that is from 2015. You can take a look at my SCH lua in the below Google Drive. I just recently leveled the job so I'm not the best to refer to for top gear but the lua itself is quite functional.
https://drive.google.com/open?id=1cG5jhLZg4BXUmGN3oXRAA-gqpktfV1Ie Offline
Posts: 87
Valefor.Madranta said: » You can take a look at my SCH lua in the below Google Drive. I just recently leveled the job so I'm not the best to refer to for top gear but the lua itself is quite functional. https://drive.google.com/open?id=1cG5jhLZg4BXUmGN3oXRAA-gqpktfV1Ie hey. It is really neat. many thanks. I am looking for a more update lua in terms of gear. I'd like to look into helix sets, mb sets . See what AF pieces i need to focus on. |
||
All FFXI content and images © 2002-2024 SQUARE ENIX CO., LTD. FINAL
FANTASY is a registered trademark of Square Enix Co., Ltd.
|