Hello im looking for help with COR lua.
I want to add the roll value to my add_to_chat and send_command
in add_to_chat for main chat log that isnt spammed
in send_command send for doing rolls from main character
thanks in advance
these are the sections in my lua from lua made by other people:
Code
function job_setup()
-- Whether to use Luzaf's Ring
state.LuzafRing = M(true, "Luzaf's Ring")
-- Whether a warning has been given for low ammo
state.warned = M(false)
define_roll_values()
end
function job_aftercast(spell, action, spellMap, eventArgs)
if spell.type == 'CorsairRoll' and not spell.interrupted then
display_roll_info(spell)
end
end
function define_roll_values()
rolls = {
["Corsair's Roll"] = {lucky=5, unlucky=9, bonus="Experience Points"}
end
function display_roll_info(spell)
rollinfo = rolls[spell.english]
local rollsize = (state.LuzafRing.value and 'L') or 'S'
if rollinfo then
add_to_chat(158, spell.english..' **'..rollinfo.bonus..'** Lucky, '..tostring(rollinfo.lucky)..' Unlucky, '..tostring(rollinfo.unlucky)..'.')
send_command('send middleeast input /echo _____________Lucky, '..tostring(rollinfo.lucky)..',____________Unlucky, '..tostring(rollinfo.unlucky)..'.')
end
Could anyone help me figure out why this rule doesn't seem to work in my PLD lua?
Code
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
handle_equipping_gear(player.status)
end
if buff == "Doom" then
if gain then
equip(sets.Doom)
send_command('@input /p Cursna - Doomed')
send_command('@input /item "Holy Water" <me>')
disable('ring1', 'ring2', 'legs')
elseif not gain and not player.status == "Dead" and not player.status == "Engaged Dead" then
enable('ring1', 'ring2', 'legs')
send_command('input /p Doom removed, Thank you.')
handle_equipping_gear(player.status)
else
enable('ring1', 'ring2', 'legs')
send_command('input /p '..player.name..' is no longer Doomed Thank you !')
end
end
end
Is there a reason you decided to change the original doom function in my lua? The way you're trying to do it seems over-complicated.
Try one of these, maybe it'll help:
Code
1
state.Buff.Doom = buffactive['doom'] or false
Code
1
state.Buff.Doom = buffactive['doomed'] or false
it wasn't working that why i try to change it :( i guess that something else somehwere in code. when i tested it with protect it needed to go 2 time up to get it to work.
Code
state.Buff.Doom = buffactive['doom'] or false
the fonction job_setup() is only call once when you change job right ? was wondering how state.buff.doom is modified is so. that in mote include ?
There is a comment in the PLD lua on Mote's github that says that states will be tracked if defined in job_setup(). I never tested Doom myself, so maybe there is a bug or something. Maybe I'll go die to the tree a few times and see if I can't figure it out, if I get some time.
I was testing with the tree last night and couldn't get it to work; I tried changing the buff from Doom to Berserk, Warcy, etc. and couldn't get anything to trigger with the rule written as is.
So I was just digging through the mote includes and saw an example for the weakness timer creation and this rule seems to work (at least for other buffs, haven't tested it on doom yet):
Code
function job_buff_change(buff, gain)
if state.Buff[buff] ~= nil then
handle_equipping_gear(player.status)
end
if buff:lower() == 'doom' then
if gain then
equip(sets.Doom)
send_command('@input /p Cursna - Doomed')
send_command('@input /item "Holy Water" <me>')
disable('ring1', 'ring2', 'legs')
elseif not gain and not player.status == "Dead" and not player.status == "Engaged Dead" then
enable('ring1', 'ring2', 'legs')
send_command('input /p Doom removed, Thank you.')
handle_equipping_gear(player.status)
else
enable('ring1', 'ring2', 'legs')
send_command('input /p '..player.name..' is no longer Doomed Thank you !')
end
end
end
How would I modify the following to check for Klimaform and equip Arbatel Loafers +1 when Klimform is active, else use whatever is defined in the nuke index? Right now I simply have Loafers written in, but this sometimes results in a loss of damage if Klimaform wears off mid cast. Every time I try to alter it I break something, any help would be greatly appreciated.
Code
if Nuke:contains(spell.name) then
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
if (spell.element == world.day_element or spell.element == world.weather_element) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
else
equip({waist="Refoccilation Stone"})
end
end
How would I modify the following to check for Klimaform and equip Arbatel Loafers +1 when Klimform is active, else use whatever is defined in the nuke index? Right now I simply have Loafers written in, but this sometimes results in a loss of damage if Klimaform wears off mid cast. Every time I try to alter it I break something, any help would be greatly appreciated.
Code
if Nuke:contains(spell.name) then
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
if (spell.element == world.day_element or spell.element == world.weather_element) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
else
equip({waist="Refoccilation Stone"})
end
end
I didn't make this, pretty sure it's a Kinematic's GS, but it has this rule for Klimaform equip and it seems to work for me:
Code
-- Equip sets appropriate to the active buffs, relative to the spell being cast.
function apply_grimoire_bonuses(spell, action, spellMap)
if state.Buff.Perpetuance and spell.type =='WhiteMagic' and spell.skill == 'Enhancing Magic' then
equip(sets.buff['Perpetuance'])
end
if state.Buff.Rapture and (spellMap == 'Cure' or spellMap == 'Curaga') then
equip(sets.buff['Rapture'])
end
if spell.skill == 'Elemental Magic' then --or spellMap ~= 'ElementalEnfeeble'
if state.Buff.Ebullience and spell.english ~= 'Impact' then
equip(sets.buff['Ebullience'])
end
if state.Buff.Immanence then
equip(sets.buff['Immanence'])
end
if state.Buff.Klimaform and spell.skill == "Elemental Magic" and spell.element == world.weather_element then
equip(sets.buff['Klimaform'])
end
end
if state.Buff.Penury then equip(sets.buff['Penury']) end
if state.Buff.Parsimony then equip(sets.buff['Parsimony']) end
if state.Buff.Celerity then equip(sets.buff['Celerity']) end
if state.Buff.Alacrity then equip(sets.buff['Alacrity']) end
end
if Nuke:contains(spell.name) then
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
if (spell.element == world.day_element or spell.element == world.weather_element) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
else
equip({waist="Refoccilation Stone"})
end
end
to something like
Code
if Nuke:contains(spell.name) then
if (buffactive.Klimaform) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), {feet="Arbatel loafers +1"})
else
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
end
if (spell.element == world.day_element or spell.element == world.weather_element) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
else
equip({waist="Refoccilation Stone"})
end
end
Writing it this way, I can load it without errors but the feet don't swap, and I'm not sure that I'm writing it in such a way that it doesn't mess up the Obi check.
EDIT: I think its working properly now, I was missing a { in one of the lines but it seems to be functioning properly now. Thank you for your suggestion, Berzerk.
Awesome! Did you have to modify what I posted? Just curious because I'm trying to learn gearswap but haven't tried messing with a rule like this before.
Awesome! Did you have to modify what I posted? Just curious because I'm trying to learn gearswap but haven't tried messing with a rule like this before.
I just fixed what I wrote out myself, and it appeared to be working but now it isn't... ; ;
I'm new to it myself, I use standalone LUAs because I just glaze over trying to interpret the ones that use the mote/include files. Though, the ones I've been using seem to work out well enough, I'm not sure what the other versions offer that I'm not utilizing that I would need. I only really use them for glorified gearswapping, I've seen some LUAs that automatically use JAs and whatnot in response to actions/conditions and none of that really interests me, so for now what I have is enough.
I'm still trying to figure out how to make my midcast function swap feet properly, here's what I currently have written:
Code
if Nuke:contains(spell.name) then
if (buffactive.Klimaform) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), {feet="Arbatel loafers +1"})
else
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
end
if (spell.element == world.day_element or spell.element == world.weather_element) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
else
equip({waist="Refoccilation Stone"})
end
end
It loads fine, and everything works except Arbatel Loafers +1 swapping in when Klimaform is active. Any suggestions would be greatly appreciated.
It is really hard to help you debug without being able to see the entire lua. I may be able to dig further in to see if there's any other errors if you post it in its entirety.
Also, a potential issue you are having is in the flow of that code block. In plain English it is doing this:
Check if the list 'Nuke' contains an element that matches the spell.
If so, check if Klimaform is active
If so, equip your nuking set that matches the spell, then equip your boots. If not, just equip your nuking set.
Check if the spell element matches the day/weather element.
If so, equip your nuking set, then equip your obi. If not, just equip your Refoccilation Stone.
End of function.
So, what it is doing is likely equipping your boots (if the function is working properly at all) and then equipping OVER that set with your nuking/obi set because you will almost necessarily be using the spell with the appropriate -storm spell. A fix you could implement would be to put your Klimaform check after the line:
A very rough draft of how that entire function would look is something like this:
Code
if (spell.element == world.day_element or spell.element == world.weather_element) and Nuke:contains(spell.name) then
equip(equip(sets.Nuke[sets.Nuke.index[Nuke_ind]]), sets.Obi)
if buffactive['Klimaform'] then
equip({feet="Arbatel loafers +1"})
end
elseif Nuke:contains(spell.name) and not (spell.element == world.day_element or spell.element == world.weather_element) then
equip(sets.Nuke[sets.Nuke.index[Nuke_ind]])
else
equip({waist="Refoccilation Stone"})
end
I hope this helps. But, again, it would be helpful if you posted the document in its entirety.
I'm having an issue with my SCH GS in the section where it's supposed to lock Back if CP mantle, or Rings if Warp/CP ring but it isn't doing it. Admittely my GS are usually a mix of other GS (this part from Bokura's GS)so I am having trouble seeing what the issue is myself though T_T...
Mantle/Ring lock section:
Code
function check_equip_lock()
if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
disable('ring1','ring2')
elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
disable('back')
elseif Lock_Main == 'ON' then
disable('main','sub')
else
enable('main','sub','ring1','ring2','back')
end
end
Forgive me for making assumptions on this, but I believe the reason it isn't locking your sets is because you never actually incur a status change. I'm assuming you do your stuff in a disengaged status. You can add a call to check_equip_lock() as the first line in your precast function and in your buff_change function to circumvent that.
Also, the way you have the check_equip_lock function set up is that it will only unlock your gear if NONE of the prerequisites are met, which can end up causing a lot of headaches. You should set it up so that it has a unique if/else block for each slot(s) you wish to have lock or unlock automatically.
Here's an example using your function:
Code
function check_equip_lock()
if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
disable('ring1','ring2')
else
enable('ring1','ring2')
end
if player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
disable('back')
else
enable('back')
end
if Lock_Main == 'ON' then
disable('main','sub')
else
enable('main','sub')
end
end
I haven't tested this, but hopefully will give you an idea of how to fix it. Best of luck!
I may have eventually figured something like this out, but yes that did the trick. TYVM. The GS referenced wasn't like that, but is much more in depth so there's probably a lot more going on in that I really catch.
Is there any way to get that code ^ to be split up?
Code
function check_equip_lock()
if player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
disable('ring2')
else
enable('ring2')
end
if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" then
disable('ring1')
else
enable('ring1')
end
if player.equipment.back == "Mecisto. Mantle" then
disable('back')
else
enable('back')
end
end
This ends up locking both left and right ring. When I take the right ring off, the left stays locked even though the right ring swaps. I have to play with it a little more, but from my observation it seems that they swap correctly until I put a warp ring on, then the left ring will not swap after that.
edit:
Fresh reloading yielded left ring still being locked from the start.
edit #2:
I'm just an idiot and mispelled my left ring lol.
if buffactive['Flurry'] then
equip(sets.precast.RA)
add_to_chat(122,"Flurry found")
else
equip(sets.precast.RA.noFlurry)
add_to_chat(122,"No flurry")
end
Can I do the same with buffactive['Flurry II'] to differienciate them? If not, what would be another way?
if buffactive['Flurry'] then
equip(sets.precast.RA)
add_to_chat(122,"Flurry found")
else
equip(sets.precast.RA.noFlurry)
add_to_chat(122,"No flurry")
end
Can I do the same with buffactive['Flurry II'] to differienciate them? If not, what would be another way?
Thanks in advance!
Some one can correct me if I am wrong, but I believe it is pulled from res.buffs which there for would not have two different versions. Flurry is flurry, similar to enlight, or haste.
If I had multiple pieces of Herculean gear of the same piece with different augments. How would I go about separating them in my gearswap?
If you like your lua to be nice and clean then you'll want to put the gear into your globals.
Method 1:
1) In game do //gs export for each piece of gear that you want, then find your export folder (should be located with your job luas)
2) Copy the line with the piece you want
Should look something like this: legs={ name="Herculean Trousers", augments={'Accuracy+10','Weapon skill damage +4%','STR+10',}}
3) Then go into your Globals and look for "Default items for utility gear values" and create a line in "Default items for utility gear values" labeling that piece of gear. For example, if the piece you've chosen is a WS piece then label it as:
gear.herc_legs_WS = legs={ name="Herculean Trousers", augments={'Accuracy+10','Weapon skill damage +4%','STR+10',}},
4) Go into your actual job lua and insert your piece as you labeled it in your globals in the gear slot, in this case it would be under legs. Example of this would be:
legs=herc_legs_WS,
This is one way of doing it. There is another way, but it tends to get messy. I personally don't really care about neatness as long is it gets the job done.
Method 2:
1) Same as Method 1
2) Same as Method 1
3) Go into your job lua and insert it into the piece, this example would be legs:
legs={ name="Herculean Trousers", augments={'Accuracy+10','Weapon skill damage +4%','STR+10',}},
if buffactive['Flurry'] then
equip(sets.precast.RA)
add_to_chat(122,"Flurry found")
else
equip(sets.precast.RA.noFlurry)
add_to_chat(122,"No flurry")
end
Can I do the same with buffactive['Flurry II'] to differienciate them? If not, what would be another way?
Thanks in advance!
You can do this, but you'll have to set a toggle.
state.FlurryMode = M{['description']='Flurry Mode', 'Flurry II', 'Flurry I'}
Then set your toggle button, In my case I have it set to this:
send_command('bind @delete gs c cycle FlurryMode')
which is windows button and delete.
Code
function job_post_precast(spell, action, spellMap, eventArgs)
if spell.action_type == 'Ranged Attack' then
if state.FlurryMode.value == 'Flurry II' and (buffactive[265] or buffactive[581]) then
equip(sets.precast.RA.Flurry2)
elseif state.FlurryMode.value == 'Flurry I' and (buffactive[265] or buffactive[581]) then
equip(sets.precast.RA.Flurry1)
end
If I had multiple pieces of Herculean gear of the same piece with different augments. How would I go about separating them in my gearswap?
First, equip each of them and type this:
Code
//gs export
You should get a message saying that Gearswap is exporting your current gear.
Now, you can go into where you have Windower installed, and look in addons\Gearswap\data for the export folder. In there will be .lua(s) named by character and export date. You can always sort by date modified to make it easier.
Anyway, open one up, and the augmented gear will have the full augment list there.
Copy everything between the outer brackets and open your job's .lua file if it's not already.
Technically, you can use that in place of the equipment name, but that'll get messy, if not annoying to update.
Instead, what we can now is define variables for augmented items to use instead. I like to put them right before defining sets, though I'm not sure it matters.
So, continuing the example, that cape and other augmented stuff from my RUN LUA:
Note that you don't need quotes around the variable names.
Also, notice that augments that may show up as a single stat may technically be combining two augments, which is why it's much better to use the //gs export command to ensure accuracy.
Is there any way to get something like this working?
Code
if main == 'Ukonvasara' then
send_command('input //exec war_gaxe.txt')
elseif main == 'Ragnarok' then
send_command('input //exec war_gsword.txt')
elseif main == 'Loxotic Mace +1' then
send_command('input //exec war_club.txt')
elseif main == 'Reikiko' then
send_command('input //exec war_sword.txt')
elseif main == 'Barbarity' then
send_command('input //exec war_axe.txt')
end
I have something similar that works for sub jobs but would like something based on weapon
Code
if player.sub_job == 'BLU' then
send_command('input //exec run_blu.txt')
elseif player.sub_job == 'WAR' then
send_command('input //exec run_war.txt')
elseif player.sub_job == 'DRK' then
send_command('input //exec run_drk.txt')
elseif player.sub_job == 'SAM' then
send_command('input //exec run_sam.txt')
elseif player.sub_job == 'NIN' then
send_command('input //exec run_nin.txt')
end
I'm running into this problem where when casting elemental magic gearswap won't revert back to idle.
short spells have almost no issue.
Stone seems to trigger it sometimes and equip remains in midcast
Stone 2 has more chance of it being stuck in midcast and so on...
seems to have something to do with casting time?
Tried several lua files all seem to run into the same issue.
Getting lua runtime error: gearswap/equip_processing.lua:246: attempt to index field '?' (a nil value) when equipping the new Hepatizon Sapara +1 since the new update.
Seen someone mention having this issue with moonbow whistle when that updated but didn't see how it was resolved.
I imagine its an equipment list somewhere that needs updating but I have no clue how to do it so gearswap doesn't swap gear if i put this sword on at the moment. Anyone else experiencing this? or know a fix?
Just looking for someone to explain this addon a bit for me. It looks like it is an alternative to Spellcast.
Is it going to be replacing Spellcast? In which ways is it better or worse. I don't know any programming but I've slowly learned more and more about spellcast and the 'language' used in gearswap is confusing to me.
It says it uses packets so it potentially could be more detectable? but does that also eliminate any lag that spellcast may encounter?
I plan on redoing my PUP xml to include pet casting sets thanks to the new addon petschool. I'm just not sure if it's worth it to just wait until gearswap gets more popular or to go ahead and do it in spellcast.
If anyone could give me more info I'd greatly appreciate it.