Summary
gFunc is a global table containing functions used to interface with LuAshitacast from within your profile. The following functions are designed for use by end users and documented. You should not modify the gFunc table in any way, nor should you try to call any functions not documented here.
Declaration: gFunc.AddSet(setName)
Arguments:
setName (string): the name of the set you want to add or replace
Return Type: nil
Effects: Backs up your profile, replaces the set with your current equipment, then writes your profile back to disc.
Will no longer modify anything besides the set in question. If the set doesn't already exist, it will be added to the end of your sets.
This can be blocked with the gSettings.AllowAddSet setting. The gSettings.AddSetBackup setting can be set to false to prevent backups.
For this to function, your main sets table must be initialized local sets = {, local Sets = {, or profile.Sets = {.
Declaration: gFunc.ApplyBaseSets(baseTable)
Arguments:
sets (table): your profile's base sets table
Return Type: nil
Effects: Recursively searches all sets for 'BaseSet' attributes, and references those sets to incorporate their items. Subtables should be notated with '.'
Declaration: gFunc.CancelAction()
Return Type: nil
Effects: Cancels the pending action and any accompanying swaps when called from Precast, Preshot, Ability, Item, or Weaponskill.
Declaration: gFunc.ChangeActionId(id)
Arguments:
id (number): the ID of the action you'd like to change to
Effects: Changes a pending action to a different action of the same type when called from Precast, Ability, or Weaponskill.
Declaration: gFunc.ChangeActionTarget(target)
Arguments:
target (number): the index of an entity within zone to change target to
Return Type: nil
Effects: Changes a pending action to act on a different target.
Declaration: gFunc.ClearEquipBuffer()
Return Type: nil
Effects: Clears all pending swaps.
Declaration: gFunc.Combine(base, override)
Arguments:
base (table): A set to start with.
override (table): A set to override the initial set's slots with.
Return Type: table
Effects: Returns a new table containing the slots from override, and the slots from base where a slot in override was not present.
Declaration: gFunc.CompareItem(item, itemEntry, container)
Arguments:
item (userdata): An Ashita::FFXI::item_t userdata representing an item in container.
itemEntry (string): the name of a piece of equipment you want to check.
itemEntry (table): a single item table representing the piece of equipment you want to check. Valid members are Name, Augment, AugRank, AugTrial, AugPath, Bag
container (number): the container the userdata item is located in, for checking Bag attributes. If nil, bag will not be checked.
Return Type: boolean
Effects: Returns true if the provided userdata item matches the provided itemEntry using LAC's internal checks.
Declaration: gFunc.Disable(slot)
Arguments:
slot (number): the 1-based index of the slot(1-16)
slot (string): the name of the slot, or 'all' for all slots
Return Type: nil
Effects: Disables the specified slot, preventing swaps from altering the currently equipped piece.
Declaration: gFunc.Echo(color, text)
Arguments:
color (number): a value from 0 to 255 to represent the color
text (number): the text you would like to print
Return Type: nil
Effects: Prints text of a specified color to chat log using the LuAshitacast header.
Declaration: gFunc.Enable(slot)
Arguments:
slot (number): the 1-based index of the slot(1-16)
slot (string): the name of the slot, or 'all' for all slots
Return Type: nil
Effects: Enables the specified slot, allowing it to be changed again.
Declaration: gFunc.Equip(slot, item)
Arguments:
slot (number): the 1-based index of the slot you want to equip to(1-16)
slot (string): the name of the slot you want to equip to
item (string): the name of a piece of equipment you want to put on
item (table): a single item table representing the piece of equipment you want to put on. Valid members are Name, Augment, AugRank, AugTrial, AugPath, Bag
Return Type: nil
Effects: Equips an item to the internal buffer. This does not send a packet and can be safely called multiple times on the same slot. When your current stage finishes, the equipment will all be put on.
Declaration: gFunc.EquipSet(set)
Arguments:
set (string): the name of a set table, which must be located directly inside the profile.Sets table
set (table): a set table
Return Type: nil
Effects: Equips an item set to the internal buffer. This does not send a packet and can be safely called multiple times. When your current stage finishes, the equipment will all be put on.
Declaration: gFunc.Error(text)
Arguments:
text (number): the text you would like to print
Return Type: nil
Effects: Prints text of the default error color to chat log using the LuAshitacast header.
Declaration: gFunc.EvaluateLevels(sets, level)
Arguments:
sets (table): your profile's base sets table
level (number): the level to match against
Return Type: nil
Effects: Looks for any set ending in _Priority, then treats each slot entry containing a table as a priority list.
Creates a new set without the _Priority suffix using the first item in each priority list to be below or at your level as the active slot.
See example usage in tutorial.
Declaration: gFunc.ForceEquip(slot, item)
Arguments:
slot (number): the 1-based index of the slot you want to equip to(1-16)
slot (string): the name of the slot you want to equip to
item (string): the name of a piece of equipment you want to put on
item (table): a single item table representing the piece of equipment you want to put on. Valid members are Name, Augment, AugRank, AugTrial, AugPath, Bag
Return Type: nil
Effects: Sends an equip packet directly to equip an item. This should not be used unless you specifically understand why you're using it.
Declaration: gFunc.ForceEquipSet(set)
Arguments:
set (string): the name of a set table, which must be located directly inside the profile.Sets table
set (table): a set table
Return Type: nil
Effects: Sends equip packets to directly to equip a set. This should not be used unless you specifically understand why you're using it.
Declaration: gFunc.InterimEquip(slot, item)
Arguments:
slot (number): the 1-based index of the slot you want to equip to(1-16)
slot (string): the name of the slot you want to equip to
item (string): the name of a piece of equipment you want to put on
item (table): a single item table representing the piece of equipment you want to put on. Valid members are Name, Augment, AugRank, AugTrial, AugPath, Bag
Return Type: nil
Effects: Equips an item to a secondary internal buffer. If used in midcast or midranged in combination with gFunc.SetMidDelay, this equipment will be worn after precast/preranged until the final equipment is put on. This will not do anything elsewhere.
Declaration: gFunc.InterimEquipSet(set)
Arguments:
set (string): the name of a set table, which must be located directly inside the profile.Sets table
set (table): a set table
Return Type: nil
Effects: Equips an item set to a secondary internal buffer. If used in midcast or midranged in combination with gFunc.SetMidDelay, this equipment will be worn after precast/preranged until the final equipment is put on. This will not do anything elsewhere.
Declaration: gFunc.Message(text)
Arguments:
text (number): the text you would like to print
Return Type: nil
Effects: Prints text of the default message color to chat log using the LuAshitacast header.
Declaration: gFunc.LoadFile(path)
Arguments:
path (string): filename or filepath to load
Return Type: nil
Effects: Loads a lua file, searching first for a full path match, then for a match inside ashita/config/addons/luashitacast/playername_playerid, then ashita/config/addons/luashitacast/, and finally in each package path(same as require).
Should be used in place of require for any dependencies, to allow easy per-character overrides and default fallback, as well as prevent issues with multiple require from different profiles.
Declaration: gFunc.LockSet(set, seconds)
Arguments:
seconds (number): the length of seconds(decimals allowed) to lock a set on for
set (string): the name of a set table, which must be located directly inside the profile.Sets table
set (table): a set table
Return Type: nil
Effects: Overrides all state processing and equips a set for the specified period of time. This does not bypass disable/enable.
Declaration: gFunc.LockStyle(set)
Arguments:
set (table): a set table
Return Type: nil
Effects: Uses the main, sub, range, ammo, head, body, hands, legs, and feet components of the input set to send a lockstyle packet to server. This happens immediately, unlike the equip functions. Fields besides name are not considered.
Declaration: gFunc.SetMidDelay(delaye)
Arguments:
delay (number): how long, in seconds, to delay midcast/midshot
Return Type: nil
Effects: When used in precast, midcast, preshot, or midshot callbacks, delays the midcast/midshot gear from going on for this period of time. If action completes before delay finishes, equipment won't go on at all. This can be called in the pre-events to allow easier synergy with fast cast and snapshot calculations.