|
Gearswap Scripting Tips and Tricks
Server: Odin
Game: FFXI
Posts: 170
By Odin.Quixacotl 2014-08-08 18:50:03
More people than ever are converting to Gearswap as evidenced by the Help treads and from in-game banter.
I thought I would share a few of my own Gearswap scripting 'Easter Egg' codelets which might be useful to both novice and seasoned scriptwriters alike. These codes can also be used as educational ideas to inspire others to write their own scripts. Anyone can copy a script but you still have to edit it. Customization takes GS to a whole new level.
Notes: These codes are -not- stand alone. In order to utilize these codes you must have a basic concept of GS scripting.
I invite others' to share their own ideas.
Lock certain slotsCode
function check_range_lock()
if player.equipment.range ~= 'empty' then
disable('range', 'ammo')
else
enable('range', 'ammo')
end
end
Lock Mecistopins Mantle for ALL your jobs with one file. - Only works if you're using Mote's library luas.
Open Notepad and name it (Yourcharactername)-Globals.lua. Copy/Paste the code below and place it with the rest of your (You)_JOB.lua files.
Code
------------------------------------------------------------------------------
-- An example of setting up user-specific global handling of certain events.
-- This is for personal globals, as opposed to library globals.
------------------------------------------------------------------------------
sets.reive = {neck="Adoulin's Refuge +1"}
-- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
function job_handle_equipping_gear(playerStatus, eventArgs)
if buffactive['Reive Mark'] and player.inventory["Adoulin's Refuge +1"] or player.wardrobe["Adoulin's Refuge +1"] then
equip(sets.reive)
end
if player.equipment.back == 'Mecisto. Mantle' then
disable('back')
else
enable('back')
end
end
-----------------------------------------------------------
-- Test function to use to avoid modifying library files.
-----------------------------------------------------------
function user_test(params)
end
Auto Lockstyle
-- Simple Code
function status_change(new,action)
send_command('input /lockstyle on')
end
-- Better defined Code
function get_sets()
---
-- Custom Variables --
names = {}
names.Cities = T{
"Eastern Adoulin", "Western Adoulin",
"Ru'Lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jeuno",
"Port Windurst", "Windurst Waters", "Windurst Woods",
"Windurst Walls", "Heavens Tower",
"Port San d'Oria", "Northern San d'Oria", "Southern San d'Oria",
"Port Bastok", "Bastok Markets",
"Bastok Mines", "Metalworks",
"Aht Urhgan Whitegate",
"Tavanazian Safehold",
"Nashmau", "Selbina",
"Mhaura", "Norg", "Kazham"}
Mode_Index = 1
sets.idle = {}
sets.idle.Town = {legs="Crimson Cuisses"}
end
function aftercast(spell,action)
update_gear()
end
function status_change(new,action)
update_gear()
end
function update_gear()
if player.status == 'idle' then
if names.Cities:contains(world.area) then
equip(sets.idle.Town)
else
send_command('input /lockstyle on')
equip(sets.idle[idle_custom_layers[Mode_Index]])
end
elseif player.status == 'engaged' then
equip(sets.engaged[engaged_custom_layers[Mode_Index]])
elseif player.status == 'resting' then
equip(sets.Resting)
end
end
Universal Cancel spell - You need the plugin, "Cancel" for this to work. Code
function midcast(spell,action)
if spell.english == 'Sneak' or spell.english == 'Spectral Jig' or spell.english:startswith('Monomi') and spell.target.type == 'SELF' then
send_command('cancel 71')
end
end
For the Beastmasters - You can use variations of this code to cycle misc. ammo for other jobs.
-- Cycle Broths (jugs) and Pet food Code
function get_sets()
Item={}
Item.Broth={name="Trans. Broth"}
Item.PetFood={name="Pet Food Theta"}
--
--
sets.JA['Call Beast'] = {
main="Izizoeksi", ammo=Item.Broth,
hands="Ankusa Gloves"}
sets.JA.Reward = {ammo=Item.PetFood}
BrothIndex = 1
BrothArray = {"Lucky Broth","Wispy Broth","Fizzy Broth","Trans. Broth","Cl. Wheat Broth","Salubrious Broth"}
PetFoodIndex = 1
PetFoodArray = {"Pet Food Theta","Pet Food Eta","Pet Food Zeta"}
end
function precast(spell,action)
if sets.JA[spell.english] then
equip(sets.JA[spell.english])
end
end
function self_command(command)
if command:lower() == 'broth' then
BrothIndex = (BrothIndex % #BrothArray) + 1
add_to_chat(8,'----- Use Broth: '..BrothArray[BrothIndex]..' -----')
Item.Broth.name = BrothArray[BrothIndex]
elseif command:lower() == 'petfood' then
PetFoodIndex = (PetFoodIndex % #PetFoodArray) + 1
add_to_chat(8,'----- Use PetFood: '..PetFoodArray[PetFoodIndex]..' -----')
Item.PetFood.name = PetFoodArray[PetFoodIndex]
end
end
Equip Twilight Cape and Obis on Day or Weather - Works for Scholar Storms. Code
function get_sets()
sets.midcast = {}
sets.midcast['Healing Magic'] = {main="Arka IV",back="Pahtli Cape",waist="Goading Belt"}
sets.midcast['Elemental Magic'] = {main="Atinian Staff",back="Toro Cape",waist="Oneiros Sash"}
sets.midcast.day_weather = {}
sets.midcast.day_weather['Fire'] = {back="Twilight Cape",waist="Karin Obi"}
sets.midcast.day_weather['Ice'] = {back="Twilight Cape",waist="Hyorin Obi"}
sets.midcast.day_weather['Wind'] = {back="Twilight Cape",waist="Furin Obi"}
sets.midcast.day_weather['Earth'] = {back="Twilight Cape",waist="Dorin Obi"}
sets.midcast.day_weather['Lightning'] = {back="Twilight Cape",waist="Rairin Obi"}
sets.midcast.day_weather['Water'] = {back="Twilight Cape",waist="Suirin Obi"}
sets.midcast.day_weather['Light'] = {back="Twilight Cape",waist="Korin Obi"}
sets.midcast.day_weather['Dark'] = {back="Twilight Cape",waist="Anrin Obi"}
end
function midcast(spell)
if spell.action_type == 'Magic' then
if spell.skill == 'Elemental Magic' or spell.name:startswith('Cure') then
equip(sets.midcast[spell.skill])
end
if spell.element == world.weather_element or spell.element == world.day_element then
equip(sets.midcast.day_weather[spell.element])
end
end
end
Don't Blink when Tele-WarpingCode
NoBlink = S{"Escape", "Retrace", "Warp", "Warp II", "Teleport-Altep", "Teleport-Dem",
"Teleport-Mea", "Teleport-Holla", "Teleport-Vahzl", "Teleport-Yhoat",
"Recall-Jugner", "Recall-Meriph", "Recall-Pashh"}
function midcast(spell)
if spell.action_type == 'Magic' then
if NoBlink:contains(spell.name) then
return
end
end
end
Don't Blink when DeadCode
function precast(spell,action)
if player.status == 'Dead' then cancel_spell() end
end
Lock Gear for the duration of a buff - Buffactive Gear Code
function get_sets()
sets.buff = {}
sets.buff['Cover'] = {head="Rev. Coronet +1", body="Cab. Surcoat +1"}
sets.buff['Sentinel'] = {feet="Cab. Leggings +1"}
end
function buff_change(buff,gain)
if buff == "Cover" then update_gear() end
if buff == "Sentinel" then update_gear() end
end
function aftercast(spell,action)
update_gear()
end
function status_change(new,action)
update_gear()
end
function update_gear()
if player.status == 'Engaged' then
equip(sets.Engaged)
elseif player.status == 'Idle' then
equip(sets.Idle)
else
equip(sets.Resting)
end
if buffactive['Cover'] then equip(sets.buff['Cover']) end
if buffactive['Sentinel'] then equip(sets.buff['Sentinel']) end
end
More to come soon...
[+]
VIP
Server: Fenrir
Game: FFXI
Posts: 764
By Fenrir.Motenten 2014-08-08 18:59:20
If you use the cancel addon instead of the cancel plugin, you can use send_command('cancel sneak') for better readability.
Also, because I was reminded yet again of those horrific indexing patterns, like equip(sets.MeleeTP[sets.MeleeTP.index[MeleeTP_ind]]), I'm going to try to put together a more reasonable bit of code to handle that that can be used by everyone.
Server: Odin
Game: FFXI
Posts: 170
By Odin.Quixacotl 2014-08-08 19:07:54
Thanks Motenten. The community can certainly use any easier and streamlined way of doing things, including me. :)
Server: Sylph
Game: FFXI
Posts: 2623
By Sylph.Jeanpaul 2014-08-09 01:23:54
For lockstyle, I use (within the self_command section):
Code if command == 'LOCKSTYLEGO' then
equip(sets.Lockstyle)
send_command('wait 1.5;input /lockstyle on;gs c equip Idle set')
end while binding alt+Z to "gs c LOCKSTYLEGO" in the init.txt file. That way, I can equip a specific set look, though it requires that I press alt+Z every new zone I enter, and of course making a set in each lua file
Simple example: Code sets.Lockstyle = {head="Usukane Somen",
body="Usukane Haramaki",hands="Usukane Gote",
legs="Usukane Hizayoroi",feet="Usukane Sune-Ate"}
I also use a section in precast/buff_change to equip (and keep equipped without locking, just in case) my PDT set if I'm stunned, terror'd, or petrified: in precast: Code if buffactive.terror or buffactive.petrification or buffactive.stun then
equip(sets.TP.DT)
end
and also in buff change: Code if buff == "terror" and gain then
equip(sets.TP.DT)
end
if buff == "stun" and gain then
equip(sets.TP.DT)
end
if buff == "petrification" and gain then
equip(sets.TP.DT)
end
VIP
Server: Fenrir
Game: FFXI
Posts: 764
By Fenrir.Motenten 2014-08-09 02:36:05
OK, created a utility class for 'mode' variables. It's available in the Mote-Libs repository (not pushed to Windower yet), and does -not- require using Mote-Include. It's completely independent of that.
Get the file Modes.lua from https://github.com/Kinematics/Mote-libs if you want to try it out.
The below is the comments from the file itself, but should help explain its usage so you can decide whether it's of interest to you.
Code
-------------------------------------------------------------------------------------------------------------------
-- This include library allows use of specially-designed tables for tracking
-- certain types of modes and state.
--
-- Usage: include('Modes.lua')
--
-- Construction syntax:
--
-- 1) Create a new list of mode values. The first value will always be the default.
-- MeleeMode = M{'Normal', 'Acc', 'Att'} -- Pass in a basic table, using braces.
-- MeleeMode = M('Normal', 'Acc', 'Att') -- Pass in a list of strings, using parentheses.
-- MeleeMode = M(anotherTable) -- Pass in a reference to another table, using parentheses.
-- Note: The table must have standard numeric indexing. It cannot use string indexing.
--
-- 2) Create a boolean mode with a default value of false (note parentheses).
-- UseLuzafRing = M()
-- UseLuzafRing = M(false)
-- Create a boolean mode with a default value of true:
-- UseLuzafRing = M(true)
--
--
-- Public functions:
--
-- Assuming a Mode variable 'm':
--
-- 1) m:cycle() -- Cycles through the list going forwards. Acts as a toggle on boolean mode vars.
-- 2) m:cycleback() -- Cycles through the list going backwards. Acts as a toggle on boolean mode vars.
-- 3) m:toggle() -- Toggles a boolean Mode between true and false.
-- 4) m:set(n) -- Sets the current mode value to n.
-- Note: If m is boolean, n can be boolean true/false, or strings of on/off/true/false.
-- 5) m:reset() -- Returns the mode var to its default state.
-- 6) m.current -- Gets the current mode value. Booleans will return the boolean values of true or false.
-- 7) m.value -- Gets the current mode value. Booleans will return the strings "on" or "off".
--
-- All public functions return the current value after completion.
--
--
-- Example usage:
--
-- sets.MeleeMode.Normal = {}
-- sets.MeleeMode.Acc = {}
-- sets.MeleeMode.Att = {}
--
-- MeleeMode = M{'Normal', 'Acc', 'Att'}
-- MeleeMode:cycle()
-- equip(sets.engaged[MeleeMode.current])
--
--
-- sets.LuzafRing.on = {ring2="Luzaf's Ring"}
-- sets.LuzafRing.off = {}
--
-- UseLuzafRing = M(false)
-- UseLuzafRing:toggle()
-- equip(sets.precast['Phantom Roll'], sets.LuzafRing[UseLuzafRing.value])
-------------------------------------------------------------------------------------------------------------------
So instead of
Code
sets.RangedTP = {}
sets.RangedTP.index = {'Standard', 'Accuracy'}
--1=Standard, 2=Accuracy--
RangedTP_ind = 1
sets.RangedTP.Standard = {<stuff>}
sets.RangedTP.Accuracy = {<stuff>}
elseif command == 'toggle RTP set' then
RangedTP_ind = RangedTP_ind +1
if RangedTP_ind > #sets.RangedTP.index then RangedTP_ind = 1 end
send_command('@input /echo <----- Ranged TP Set changed to '..sets.RangedTP.index[RangedTP_ind]..' ----->')
equip(sets.RangedTP[sets.RangedTP.index[RangedTP_ind]])
You could have:
Code
RangedTPModes = M{'Standard', 'Accuracy'}
sets.RangedTP.Standard = {<stuff>}
sets.RangedTP.Accuracy = {<stuff>}
elseif command == 'toggle RTP set' then
RangedTPModes:cycle()
send_command('@input /echo <----- Ranged TP Set changed to '.. RangedTPModes.value ..' ----->')
equip(sets.RangedTP[RangedTPModes.value])
And, because cycle() returns the current value when done, you could even trim down the code where you cycle things to:
Code
elseif command == 'toggle RTP set' then
equip(sets.RangedTP[RangedTPModes:cycle()])
send_command('@input /echo <----- Ranged TP Set changed to '.. RangedTPModes.value ..' ----->')
(Of course I'd personally use add_to_chat instead of send_command to send an echo, but I just copied this from another lua file.)
Necro Bump Detected!
[40 days between previous and next post]
By bubba37343 2014-09-17 18:17:24
I was just getting used to spellcast when it was no longer supported for some reason. I don't understand any coding, so, is there a place I can get a WHM Gearswap file that I can just plug my gear into? I have been searching for weeks, and haven't found anything.
Also, how do I get Gearswap to start up other than the "//lua l gearswap" command? And how do I make it go to the certain job's file when I job change?
Any help would be appreciated. Thank you.
Bismarck.Inference
Server: Bismarck
Game: FFXI
Posts: 417
By Bismarck.Inference 2014-09-17 18:22:31
List of premades, Motenten(Kinematics) is generally regarded as the most popular for people who just want to plug in their gear and go:
http://www.bluegartr.com/threads/119444-Gearswap-Shop-Thread
If you have GearSwap toggled under your launcher, it should load the addon automatically when you start up FFXI.
Your .LUA files should go under : Windower/Addons/GearSwap/Data
If you name it as : charactername_JOB it will autoload anytime that character switches to that job(use 3 letter abbreviation for job, so Inference_WHM for example)
By bubba37343 2014-09-19 14:21:47
Thank you very much. I will learn the ways of the "Swap".
Necro Bump Detected!
[57 days between previous and next post]
By Kooljack 2014-11-15 14:18:08
ok, I've been using spellcast & gearswap so long that I don't even know how to manually equip a single piece of gear through the chatlog/macro. I keep getting command error whatever i do.
Necro Bump Detected!
[319 days between previous and next post]
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-09-30 06:04:40
Since many people use toggles to manage various accuracy states, runes, nukes etc. . .
How would one create an onscreen display that has the indexes from the arrays passed to it and then displayed on the UI? I was thinking that the text plugin could be used to do this but no luck so far.
It would be nice to see the current indexes of my accuracy, magical accuracy, drainPotency<=>DrainAcc, and Nuke arrays at a glance rather than having to remember or cycle though them to see.
More people than ever are converting to Gearswap as evidenced by the Help treads and from in-game banter.
I thought I would share a few of my own Gearswap scripting 'Easter Egg' codelets which might be useful to both novice and seasoned scriptwriters alike. These codes can also be used as educational ideas to inspire others to write their own scripts. Anyone can copy a script but you still have to edit it. Customization takes GS to a whole new level.
Notes: These codes are -not- stand alone. In order to utilize these codes you must have a basic concept of GS scripting.
I invite others' to share their own ideas.
Lock certain slotsCode
function check_range_lock()
if player.equipment.range ~= 'empty' then
disable('range', 'ammo')
else
enable('range', 'ammo')
end
end
Lock Mecistopins Mantle for ALL your jobs with one file. - Only works if you're using Mote's library luas.
Open Notepad and name it (Yourcharactername)-Globals.lua. Copy/Paste the code below and place it with the rest of your (You)_JOB.lua files.
Code
------------------------------------------------------------------------------
-- An example of setting up user-specific global handling of certain events.
-- This is for personal globals, as opposed to library globals.
------------------------------------------------------------------------------
sets.reive = {neck="Adoulin's Refuge +1"}
-- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
function job_handle_equipping_gear(playerStatus, eventArgs)
if buffactive['Reive Mark'] and player.inventory["Adoulin's Refuge +1"] or player.wardrobe["Adoulin's Refuge +1"] then
equip(sets.reive)
end
if player.equipment.back == 'Mecisto. Mantle' then
disable('back')
else
enable('back')
end
end
-----------------------------------------------------------
-- Test function to use to avoid modifying library files.
-----------------------------------------------------------
function user_test(params)
end
Auto Lockstyle
-- Simple Code
function status_change(new,action)
send_command('input /lockstyle on')
end
-- Better defined Code
function get_sets()
---
-- Custom Variables --
names = {}
names.Cities = T{
"Eastern Adoulin", "Western Adoulin",
"Ru'Lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jeuno",
"Port Windurst", "Windurst Waters", "Windurst Woods",
"Windurst Walls", "Heavens Tower",
"Port San d'Oria", "Northern San d'Oria", "Southern San d'Oria",
"Port Bastok", "Bastok Markets",
"Bastok Mines", "Metalworks",
"Aht Urhgan Whitegate",
"Tavanazian Safehold",
"Nashmau", "Selbina",
"Mhaura", "Norg", "Kazham"}
Mode_Index = 1
sets.idle = {}
sets.idle.Town = {legs="Crimson Cuisses"}
end
function aftercast(spell,action)
update_gear()
end
function status_change(new,action)
update_gear()
end
function update_gear()
if player.status == 'idle' then
if names.Cities:contains(world.area) then
equip(sets.idle.Town)
else
send_command('input /lockstyle on')
equip(sets.idle[idle_custom_layers[Mode_Index]])
end
elseif player.status == 'engaged' then
equip(sets.engaged[engaged_custom_layers[Mode_Index]])
elseif player.status == 'resting' then
equip(sets.Resting)
end
end
Universal Cancel spell - You need the plugin, "Cancel" for this to work. Code
function midcast(spell,action)
if spell.english == 'Sneak' or spell.english == 'Spectral Jig' or spell.english:startswith('Monomi') and spell.target.type == 'SELF' then
send_command('cancel 71')
end
end
For the Beastmasters - You can use variations of this code to cycle misc. ammo for other jobs.
-- Cycle Broths (jugs) and Pet food Code
function get_sets()
Item={}
Item.Broth={name="Trans. Broth"}
Item.PetFood={name="Pet Food Theta"}
--
--
sets.JA['Call Beast'] = {
main="Izizoeksi", ammo=Item.Broth,
hands="Ankusa Gloves"}
sets.JA.Reward = {ammo=Item.PetFood}
BrothIndex = 1
BrothArray = {"Lucky Broth","Wispy Broth","Fizzy Broth","Trans. Broth","Cl. Wheat Broth","Salubrious Broth"}
PetFoodIndex = 1
PetFoodArray = {"Pet Food Theta","Pet Food Eta","Pet Food Zeta"}
end
function precast(spell,action)
if sets.JA[spell.english] then
equip(sets.JA[spell.english])
end
end
function self_command(command)
if command:lower() == 'broth' then
BrothIndex = (BrothIndex % #BrothArray) + 1
add_to_chat(8,'----- Use Broth: '..BrothArray[BrothIndex]..' -----')
Item.Broth.name = BrothArray[BrothIndex]
elseif command:lower() == 'petfood' then
PetFoodIndex = (PetFoodIndex % #PetFoodArray) + 1
add_to_chat(8,'----- Use PetFood: '..PetFoodArray[PetFoodIndex]..' -----')
Item.PetFood.name = PetFoodArray[PetFoodIndex]
end
end
Equip Twilight Cape and Obis on Day or Weather - Works for Scholar Storms. Code
function get_sets()
sets.midcast = {}
sets.midcast['Healing Magic'] = {main="Arka IV",back="Pahtli Cape",waist="Goading Belt"}
sets.midcast['Elemental Magic'] = {main="Atinian Staff",back="Toro Cape",waist="Oneiros Sash"}
sets.midcast.day_weather = {}
sets.midcast.day_weather['Fire'] = {back="Twilight Cape",waist="Karin Obi"}
sets.midcast.day_weather['Ice'] = {back="Twilight Cape",waist="Hyorin Obi"}
sets.midcast.day_weather['Wind'] = {back="Twilight Cape",waist="Furin Obi"}
sets.midcast.day_weather['Earth'] = {back="Twilight Cape",waist="Dorin Obi"}
sets.midcast.day_weather['Lightning'] = {back="Twilight Cape",waist="Rairin Obi"}
sets.midcast.day_weather['Water'] = {back="Twilight Cape",waist="Suirin Obi"}
sets.midcast.day_weather['Light'] = {back="Twilight Cape",waist="Korin Obi"}
sets.midcast.day_weather['Dark'] = {back="Twilight Cape",waist="Anrin Obi"}
end
function midcast(spell)
if spell.action_type == 'Magic' then
if spell.skill == 'Elemental Magic' or spell.name:startswith('Cure') then
equip(sets.midcast[spell.skill])
end
if spell.element == world.weather_element or spell.element == world.day_element then
equip(sets.midcast.day_weather[spell.element])
end
end
end
Don't Blink when Tele-WarpingCode
NoBlink = S{"Escape", "Retrace", "Warp", "Warp II", "Teleport-Altep", "Teleport-Dem",
"Teleport-Mea", "Teleport-Holla", "Teleport-Vahzl", "Teleport-Yhoat",
"Recall-Jugner", "Recall-Meriph", "Recall-Pashh"}
function midcast(spell)
if spell.action_type == 'Magic' then
if NoBlink:contains(spell.name) then
return
end
end
end
Don't Blink when DeadCode
function precast(spell,action)
if player.status == 'Dead' then cancel_spell() end
end
Lock Gear for the duration of a buff - Buffactive Gear Code
function get_sets()
sets.buff = {}
sets.buff['Cover'] = {head="Rev. Coronet +1", body="Cab. Surcoat +1"}
sets.buff['Sentinel'] = {feet="Cab. Leggings +1"}
end
function buff_change(buff,gain)
if buff == "Cover" then update_gear() end
if buff == "Sentinel" then update_gear() end
end
function aftercast(spell,action)
update_gear()
end
function status_change(new,action)
update_gear()
end
function update_gear()
if player.status == 'Engaged' then
equip(sets.Engaged)
elseif player.status == 'Idle' then
equip(sets.Idle)
else
equip(sets.Resting)
end
if buffactive['Cover'] then equip(sets.buff['Cover']) end
if buffactive['Sentinel'] then equip(sets.buff['Sentinel']) end
end
More to come soon...
|
|