Useful Functions - shastaxc/silver-libs GitHub Wiki
SilverLibs functions can all be called directly. For the most part, they are used internally by SilverLibs features, but there are some that can be useful for other purposes. Most of these functions can be used without enabling any specific features of SilverLibs.
All functions must be called with silibs. prepended, like silibs.function_name().
Using these functions is only recommended for people with some programming experience. If you misuse these functions you may break something or cause performance to take a big hit.
| Function name | Description |
|---|---|
| find_ability(ability_name) | Gives detailed information about a JA, from the GearSwap resources. Use: local index, ja = silibs.find_ability('Provoke') |
| get_ability_table_by_name(ability_name) | Calls find_ability and returns only the JA table. |
| find_spell(spell_name) | Gives detailed information about a spell, from the GearSwap resources. Use: local index, spell = silibs.find_spell('Blind') |
| get_spell_table_by_name(spell_name) | Calls find_spell and returns only the spell table. |
| can_access_ability(ability_name) | Checks if you can currently use a specified JA. |
| can_access_spell(spell_name, spell) | Checks if you can currently use a specified spell. Param2 (spell) is optional, but if provided can skip lookup. |
| can_recast_ability(ability_name, time) | Checks recast time for a specified JA within a certain time (defaults to 1 second). |
| can_recast_spell(spell_name, time) | Checks recast time for a specified spell within a certain time (defaults to 1 second). |
| is_target_enemy(mob_table) | Takes in a mob table or spawn_type and determines if target is enemy. |
| get_enemies_in_range(range, aoe_center_target) | Returns table of monsters within given distance, accounting for model sizes. Given range must be in yalms. |
| get_weather_intensity() | Get current weather intensity. Returns 0 for none, 1 for single weather, 2 for double weather. |
| is_weapon(item) | Determines whether an item is a weapon. Input must be an item name or a table with a name property. |
| get_dual_wield_needed() | Tells you the amount of DW you need to cap attack speed. Must have the HasteInfo integration enabled. |
| is_dual_wielding() | Determines if you are currently dual wielding weapons. |
| can_dual_wield() | Determines if you are currently capable of dual wielding by checking your traits. |
| actual_cost(spell) | Determines MP cost of a spell accounting for buffs. Input format must be a table from Windower's resources spells.lua. |
| get_equipped_item_data(slot) | Get details of an item in an equipped slot. Result comes from Windower's resources items.lua. |
| midaction() | Checks if you are in the middle of performing an action. This is like GearSwap's midaction() but more accurate. |
| has_item(item_name, bags_to_search, is_temp_item) | Checks if you own an item. |
| get_item(item_name, get_count) | Returns details of an item if you have it. If get_count is true then it will also tell you how many you have. |
| use_sneak() | Smart selection of several forms of Sneak. Available in Premade Self Commands. |
| use_invisible() | Smart selection of several forms of Invisible. Available in Premade Self Commands. |
| lock(lock_name, ...) | Add a lock to slots to prevent the gear from changing. Manual locks can be added with Premade Self Commands. See Gear Locks for more info. |
| unlock(lock_name, ...) | Remove a lock from slots. Manual locks can be removed with Premade Self Commands. See Gear Locks for more info. |
| clearlocks(...) | Remove all locks from slots. Also available with Premade Self Commands. See Gear Locks for more info. |
| get_last_midcast_set() | Provides the midcast set you used in your most recent action. |