that seems promising. i'm learning lua on the fly as i go, so i feel like there's a lot of basic syntax stuff that i haven't picked up on but isn't explicitly covered in the resources i'm finding. or if it is, it's not clicking for me. There's not much documentation on self_command that I can find; how does the syntax work? I tried:
Code:function self_command(command) if command == 'macro_reset' then -- Default macro set/book if player.sub_job == 'WAR' then set_macro_page(2, 1) elseif player.sub_job == 'DNC' then set_macro_page(5, 1) elseif player.sub_job == 'THF' then set_macro_page(7, 1) elseif player.sub_job == 'NIN' then set_macro_page(4, 1) elseif player.sub_job == 'RNG' then set_macro_page(6, 1) elseif player.sub_job == 'MNK' then set_macro_page(8, 1) else set_macro_page(2, 1) end end end
with an in-game macro for "/console gs c macro_reset" but that didn't work.
are you using motes include??
if so you should use this not self_command
select_default_macro_book function in motes include was built for the purpose of changing your macro books
Code:function select_default_macro_book() -- Default macro set/book if player.sub_job == 'WAR' then set_macro_page(2, 1) elseif player.sub_job == 'DNC' then set_macro_page(5, 1) elseif player.sub_job == 'THF' then set_macro_page(7, 1) elseif player.sub_job == 'NIN' then set_macro_page(4, 1) elseif player.sub_job == 'RNG' then set_macro_page(6, 1) elseif player.sub_job == 'MNK' then set_macro_page(8, 1) else set_macro_page(2, 1) end end
i am, but i want this function to fire on a keypress. select_default_macro_book only fires when you change jobs using the includes and the job files from motenten.
so i need a way to fire select_default_macro_book on keypress/console command, or a function that can be made to fire on keypress/console command, or a console command that fires select_default_macro_book.
then use the best of both worlds
the reason for cmdParams[1] is because motes include breaks the sent command in to separate strings and creates a tableCode:function select_default_macro_book() -- Default macro set/book if player.sub_job == 'WAR' then set_macro_page(2, 1) elseif player.sub_job == 'DNC' then set_macro_page(5, 1) elseif player.sub_job == 'THF' then set_macro_page(7, 1) elseif player.sub_job == 'NIN' then set_macro_page(4, 1) elseif player.sub_job == 'RNG' then set_macro_page(6, 1) elseif player.sub_job == 'MNK' then set_macro_page(8, 1) else set_macro_page(2, 1) end end function job_self_command(cmdParams, eventArgs) if cmdParams[1] == 'macro_reset' then select_default_macro_book() end end
ah, i remember reading that, but i don't know enough about lua yet to really follow the consequences. that did the trick, thank you! And that taught me a bit more about how functions can be used; should save me some effort later on. very interesting.
that leads me to my next questions: what's the string to check for a gear type? like player.equipment.???? = ('Club') or something. basically, i want to be able to have the script check the true/falseness of a particular weapon type. i know how to have it check for a particular named weapon, like, say, Kraken Club, but I'd like it to identify "yep, that's a club." or "nope that's not a club." without needing to get more specific than that.
and: how would i set up a second select_default_macro_book function? i want it to be different books than the actual default, so i can't just call select_default_macro_book(), right?
Does anyone else macro disappear? I think I've linked it back to Motenn's auto swap. Its always page 1 that does missing. I am going to change all mine to
if player.sub_job == 'WAR' then
set_macro_page(6, 1)
Right now they are all and its page one that goes blank which is incredibly frustrating.
if player.sub_job == 'WAR' then
set_macro_page(1, 1)
I'll see if page 6 starts disappearing.
Anyone else have this issue? Is my assumption wrong?
1.
check it in your code withCode:function get_weapon_type(slot) local item_data = gearswap.res.items:with('name', player.equipment[slot]) if item_data.category ~= "Weapon" then return nil end return gearswap.res.skills:with('name', item_data.skill).en end
get_weapon_type(slotname) == "Weapontype"
2. if you want 2 different setups i would do something like this
-i only used the same as you for both macro setsCode:function select_default_macro_book() -- Default macro set/book if player.sub_job == 'WAR' then set_macro_page(2, 1) elseif player.sub_job == 'DNC' then set_macro_page(5, 1) elseif player.sub_job == 'THF' then set_macro_page(7, 1) elseif player.sub_job == 'NIN' then set_macro_page(4, 1) elseif player.sub_job == 'RNG' then set_macro_page(6, 1) elseif player.sub_job == 'MNK' then set_macro_page(8, 1) else set_macro_page(2, 1) end end function job_self_command(cmdParams, eventArgs) if cmdParams[1] == 'macro_set_1' then select_default_macro_book()\ elseif cmdParams[1] == 'macro_set_2' then if player.sub_job == 'WAR' then set_macro_page(2, 1) elseif player.sub_job == 'DNC' then set_macro_page(5, 1) elseif player.sub_job == 'THF' then set_macro_page(7, 1) elseif player.sub_job == 'NIN' then set_macro_page(4, 1) elseif player.sub_job == 'RNG' then set_macro_page(6, 1) elseif player.sub_job == 'MNK' then set_macro_page(8, 1) else set_macro_page(2, 1) end end end
okay, so combining those, i have
did i combine it wrong? I also tried replacing 'name' with 'Great Katana' and 'slot' with 'main' but it's not working. Sorry, I know it's probably something basic I'm just not putting together properly.Code:function get_weapon_type(slot) local item_data = gearswap.res.items:with('name', player.equipment[slot]) if item_data.category ~= "Weapon" then return nil end return gearswap.res.skills:with('name', item_data.skill).en end function job_self_command(cmdParams, eventArgs) if cmdParams[1] == 'macro_set_1' then select_default_macro_book() elseif cmdParams[1] == 'macro_set_2' then if get_weapon_type(main) == 'Great Katana' then set_macro_page(2, 20) elseif get_weapon_type(main) == 'Polearm' then set_macro_page(3, 20) elseif get_weapon_type(main) == 'Sword' then set_macro_page(4, 20) elseif get_weapon_type(main) == 'Dagger' then set_macro_page(5, 20) elseif get_weapon_type(main) == 'Club' then set_macro_page(6, 20) elseif get_weapon_type(main) == 'Staff' then set_macro_page(7, 20) elseif get_weapon_type(main) == 'Hand-to-Hand' then set_macro_page(8, 20) elseif get_weapon_type(main) == 'Great Sword' then set_macro_page(9, 20) elseif get_weapon_type(main) == 'Axe' then set_macro_page(0, 20) elseif get_weapon_type(main) == 'Great Axe' then set_macro_page(1, 20) elseif get_weapon_type(main) == 'Scythe' then set_macro_page(1, 19) elseif get_weapon_type(main) == 'Katana' then set_macro_page(2, 19) else select_default_macro_book() end end
for get_weapon_type(slotname) == "Weapontype"
slotname use one of these
"main"
"sub"
"range"
"ammo"
for "Weapontype" use one of these
"Hand-to-Hand"
"Dagger"
"Sword"
"Great Sword"
"Axe"
"Great Axe"
"Scythe"
"Polearm"
"Katana"
"Great Katana"
"Club"
"Staff"
"Archery"
"Marksmanship"
"Throwing"
make sure to include the ""
example:
get_weapon_type("main") == "Great Katana"
also change
return gearswap.res.skills:with('name', item_data.skill).en
to
return gearswap.res.skills:with('id', item_data.skill).en
-i messed up sorry
okay, so we have two parts:
andCode:function get_weapon_type(slot) local item_data = gearswap.res.items:with('name', player.equipment[slot]) if item_data.category ~= "Weapon" then return nil end return gearswap.res.skills:with('id', item_data.skill).en end
i THINK i have part 2 ready, but i'm not sure if i did part 1 correctly, and i know that's the part that lets the second part fireCode:function job_self_command(cmdParams, eventArgs) if cmdParams[1] == 'default_macro_set' then select_default_macro_book() elseif cmdParams[1] == 'WS_macro_set' then if get_weapon_type("main") == "Great Katana" then set_macro_page(2, 20) elseif get_weapon_type("main") == "Polearm" then set_macro_page(3, 20) elseif get_weapon_type("main") == "Sword" then set_macro_page(4, 20) elseif get_weapon_type("main") == "Dagger" then set_macro_page(5, 20) elseif get_weapon_type("main") == "Club" then set_macro_page(6, 20) elseif get_weapon_type("main") == "Staff" then set_macro_page(7, 20) elseif get_weapon_type("main") == "Hand-to-Hand" then set_macro_page(8, 20) elseif get_weapon_type("main") == "Great Sword" then set_macro_page(9, 20) elseif get_weapon_type("main") == "Axe" then set_macro_page(0, 20) elseif get_weapon_type("main") == "Great Axe" then set_macro_page(1, 20) elseif get_weapon_type("main") == "Scythe" then set_macro_page(1, 19) elseif get_weapon_type("main") == "Katana" then set_macro_page(2, 19) else select_default_macro_book() end end end
ermergerd! That's because it is; it was a typo in my in-game macro. case matters! it's working now. fantastic! one button gets me all my weaponskills on my macro bar... muahahaha! thanks dude, this is fantastic. DO ALL THE SKILLCHAINS
So I'm having a couple of issues and I'm hoping I can find help here.
1). When I change jobs, my COR lua loses the ability to toggle gearsets (F9) unless I restart windower.
2). Line 280 in rolltracker keeps bringing up errors when I use Tacticians or Allies' rolls.
If you can help, lemme know what I need to post. >_>;;
Related to my post in Windower thread, how do I bind Gearswap to f13-24?
Also, trying to get modes up and running. I'm using the previous script to scan what type of weapon i'm using, but i'm running into a problem: if my range slot is empty, the scan returns nil and the script fails to proceed. how do i make it so that the script continues?
According to the console, the nil value is being returned from this partCode:function get_weapon_type(slot) local item_data = gearswap.res.items:with('name', player.equipment[slot]) if item_data.category ~= "Weapon" then return nil end return gearswap.res.skills:with('id', item_data.skill).en end
Code:if item_data.category ~= "Weapon" then return nil end
but when i tried replacing "return nil" with "return other stuff" it just kept doing the same thing, so i dont think i was approaching that correctly.