|
Gearswap Skillchain gear help
By Zarianna 2021-10-31 19:09:24
I have some code that functions in my Dragoon .lua that will throw on skillchain gear after I weaponskill a second time within a skillchain window. Code SkillchainPending = false
AllowSkillchainGear = false
SkillchainTimer = 0
send_command('bind !s gs c AllowSkillchainGear')
function get_sets()
sets.SCDmg = {
}
end
function self_command(command)
if command == 'AllowSkillchainGear' then
AllowSkillchainGear = not AllowSkillchainGear
add_to_chat (56, 'Allow use of skillchain damage gear: ' ..tostring(AllowSkillchainGear))
elseif string.sub(command, 0, 4) == '-cd ' then --If the first 4 characters of the command are '-cd '
add_to_chat (30, string.sub(command, 5, string.len(command))) --add everything after '-cd ' to a message in the chat
end
end
function precast(spell, act, spellMap, eventArgs)
if spell.type:lower() == "weaponskill" and SkillchainPending == true then
if (os.time() - SkillchainTimer) <= 9 and AllowSkillchainGear == true then
equip(sets.SCDmg)
end
else
SkillchainPending = false
end
end
function aftercast(spell, act, spellMap, eventArgs)
if not spell.interrupted then
if spell.type == "WeaponSkill" then
SkillchainPending = true
SkillchainTimer = os.time()
end
end
end
When I try to move this over to my RDM.lua it ceases to function. I can jam the code in elsewhere in my RDM.lua but that breaks the functionality of anything related to Mote-Include.lua
Needless to say, I am lost as to how to get it over without completely rewriting my RDM.lua to not use any mote includes. Code function self_command(command) seems to be what's breaking things, but I am not a decent coder at all so I may be wrong there.
Quetzalcoatl.Orestes
Server: Quetzalcoatl
Game: FFXI
Posts: 430
By Quetzalcoatl.Orestes 2021-10-31 20:39:21
Mote's luas typically use job_self_command() instead of self_command(), job_precast() instead of precast() and job_aftercast() instead of aftercast().
You don't want two of the same function, so these will need to be integrated instead of copy + pasted as a whole.
In your RDM.lua, find the get_sets function and copy your sets.SCDmg into it. (do not copy the function get_sets part, just the contents of the function, which is typically the indented portion)
Locate the job_self_command function and copy the contents of your self_command funciton into it. If job_self_command doesn't exist, then create it. If these functions have code already, then append yours below it.
Do the same for job_precast and job_aftercast.
SkillchainPending, and SkillchainTimer can be placed in user_setup.
HTH
By Zarianna 2021-10-31 21:43:15
Code elseif string.sub(command, 0, 4) == '-cd ' then
add_to_chat (30, string.sub(command, 5, string.len(command)))
Gives me an error in the job_self_command function commenting it out/removing it seems to break the what I'm trying to achieve with the command as well and I don't understand what this string of code is actually trying to accomplish other than posting to my chat log.
"bad argument #1 to 'sub' (string expected, got nil)
Quetzalcoatl.Orestes
Server: Quetzalcoatl
Game: FFXI
Posts: 430
By Quetzalcoatl.Orestes 2021-10-31 21:50:46
Code elseif string.sub(command, 0, 4) == '-cd ' then
add_to_chat (30, string.sub(command, 5, string.len(command)))
gives me an error in the job_self_command function commenting it out/removing it seems to break the what I'm trying to achieve with the command as well.
"bad argument #1 to 'sub' (string expected, got nil)
job_self_command takes slightly different arguments. Try substituting anywhere you have 'command' with cmdParams[1] like below.
NOTE: this is assuming your job_self_command function takes "cmdParams" as it's first argument. Code
function job_self_command(cmdParams, eventArgs)
if cmdParams[1] == 'AllowSkillchainGear' then
-- etc.
By Zarianna 2021-10-31 21:59:37
I think I fixed it by removing Code elseif string.sub(command, 0, 4) == '-cd ' then
--add_to_chat (30, string.sub(command, 5, string.len(command)))
time to test!
By Zarianna 2021-10-31 22:04:11
No, it is however displaying to chat the Allow use of skillchain damage gear: True/false but not swapping into it
Quetzalcoatl.Orestes
Server: Quetzalcoatl
Game: FFXI
Posts: 430
By Quetzalcoatl.Orestes 2021-10-31 22:51:46
probably best to use pastebin or similar to link us to your file at this point.
By Zarianna 2021-10-31 22:56:59
https://pastebin.com/PVQri1bL
would be how the lua currently is. That is with the problematic code commented out at the moment. Posting message, but not switching gear for skillchains; everything else functioning as intended.
Code elseif string.sub(command, 0, 4) == '-cd ' then --If the first 4 characters of the command are '-cd '
add_to_chat (30, string.sub(command, 5, string.len(command))) --add everything after '-cd ' to a message in the chat was for a different thing, removed.
My best guess is: AllowSkillchainGear = not AllowSkillchainGear
needs to be something else? It's like it's not setting AllowSkillchainGear to true and I don't know how to go about doing that, or it is being set as true but not triggering on weaponskill during window
By Zarianna 2021-10-31 23:37:02
I think I know what it is... I got it, or maybe a hack-around?
Code if spell.type:lower() == "weaponskill" and SkillchainPending == true then
if (os.time() - SkillchainTimer) <= 9 and AllowSkillchainGear == true then --adjusted timer
--equip(sets.SCDmg)
send_command('gs equip sets.SCDmg')
end
Quetzalcoatl.Orestes
Server: Quetzalcoatl
Game: FFXI
Posts: 430
By Quetzalcoatl.Orestes 2021-10-31 23:43:33
Try this. https://pastebin.com/V6LScbPy
You had some incorrect syntax in job_precast. The following here Code
if (os.time() - SkillchainTimer) <= 20 and AllowSkillchainGear == true then
equip(sets.SCDmg)
end
else
SkillchainPending = false
should look like this. Code
if (os.time() - SkillchainTimer) <= 20 and AllowSkillchainGear == true then
equip(sets.SCDmg)
else
SkillchainPending = false
end
Also, the commented out section of code you mentioned that was still causing problems was still referring to 'command' which isn't defined here. For example, this is what you had. Code
if cmdParams[1] == 'AllowSkillchainGear' then
AllowSkillchainGear = not AllowSkillchainGear
add_to_chat (56, 'Allow use of skillchain damage gear: ' ..tostring(AllowSkillchainGear))
--Problematic code
--elseif string.sub(command, 0, 4) == '-cd ' then
--add_to_chat (30, string.sub(command, 5, string.len(command)))
-----------------
end
This is how it should look. Code
if cmdParams[1] == 'AllowSkillchainGear' then
AllowSkillchainGear = not AllowSkillchainGear
add_to_chat(56, 'Allow use of skillchain damage gear: ' ..tostring(AllowSkillchainGear))
--Problematic code
elseif string.sub(cmdParams[1], 0, 4) == '-cd ' then
add_to_chat(30, string.sub(cmdParams[1], 5, string.len(cmdParams[1])))
-----------------
end
You also had 3 sets with either ear2 twice, or ring2 twice, which is likely just going to silently not equip what you expect. (fixed in my paste)
[+]
By Zarianna 2021-11-01 00:04:28
Code elseif string.sub(command, 0, 4) == '-cd ' then
add_to_chat (30, string.sub(command, 5, string.len(command)))
appears to be from another function in the drg.lua, I adjusted my test lua to not use that line and the test lua works without it. The changes made didn't resolve the issue; but I did find a work-around(?), as posted above changing Code if spell.type:lower() == "weaponskill" and SkillchainPending == true then
if (os.time() - SkillchainTimer) <= 9 and AllowSkillchainGear == true then --adjusted timer
equip(sets.SCDmg)
end
to
Code if spell.type:lower() == "weaponskill" and SkillchainPending == true then
if (os.time() - SkillchainTimer) <= 9 and AllowSkillchainGear == true then --adjusted timer
send_command('gs equip sets.SCDmg')
end
made it work.
Thanks for the callout on double ear2's I should probably double check all my lua's for silly errors like that. Also helping me get it over to mote compatible was huge!
[+]
I have some code that functions in my Dragoon .lua that will throw on skillchain gear after I weaponskill a second time within a skillchain window. Code SkillchainPending = false
AllowSkillchainGear = false
SkillchainTimer = 0
send_command('bind !s gs c AllowSkillchainGear')
function get_sets()
sets.SCDmg = {
}
end
function self_command(command)
if command == 'AllowSkillchainGear' then
AllowSkillchainGear = not AllowSkillchainGear
add_to_chat (56, 'Allow use of skillchain damage gear: ' ..tostring(AllowSkillchainGear))
elseif string.sub(command, 0, 4) == '-cd ' then --If the first 4 characters of the command are '-cd '
add_to_chat (30, string.sub(command, 5, string.len(command))) --add everything after '-cd ' to a message in the chat
end
end
function precast(spell, act, spellMap, eventArgs)
if spell.type:lower() == "weaponskill" and SkillchainPending == true then
if (os.time() - SkillchainTimer) <= 9 and AllowSkillchainGear == true then
equip(sets.SCDmg)
end
else
SkillchainPending = false
end
end
function aftercast(spell, act, spellMap, eventArgs)
if not spell.interrupted then
if spell.type == "WeaponSkill" then
SkillchainPending = true
SkillchainTimer = os.time()
end
end
end
When I try to move this over to my RDM.lua it ceases to function. I can jam the code in elsewhere in my RDM.lua but that breaks the functionality of anything related to Mote-Include.lua
Needless to say, I am lost as to how to get it over without completely rewriting my RDM.lua to not use any mote includes. Code function self_command(command) seems to be what's breaking things, but I am not a decent coder at all so I may be wrong there.
|
|