Animus (Functions)

Prefix

prefix(msg)
Insert 'msg' into the beginning of the line that is currently being processed.

prefix(#, msg)
Insert 'msg' into the beginning of line '#'.
Replace

replace(msg)
Replace the current line with 'msg'.

replace(#, msg)
Replace line '#' with 'msg'.
Info

info(title, msg)
Show a tooltip displaying the info icon next to the 'title' and the 'msg' below.
SetReset

setReset(name, value)
After 'value' seconds the 'name' reset will trigger the reset hook for yourself.

setReset(player, name, value)
After 'value' seconds the 'name' reset will trigger the reset hook for 'player'. This is used mostly to track statuses belonging to other players (like how long before the enemy can use a certain skill again)
SetBal

setBal(name, value)
Set the balance 'name' to 'value'. Balances are "Ready" which means it's capable of being used right now, "Request" which means the system should request to use that balance as soon as possible, "Requested" which means it already requested it but hasn't heard back from the game server yet, "Confirmed" which means it used it and got a successfull response from the game server, and "Waiting" which means it's waiting on balance to come back.
DelBlocker

delBlocker(balance, blocker)
Delete the blocker 'blocker' from the balance 'balance'.
SetVar

setVar(name)
Set the variable 'name' to a default value of "true". This function will trigger the setVar hook.

setVar(name, value)
Set the variable 'name' to 'value'. These variables are accessible by all the other modules, which facilites communication between them. This function will trigger the setVar hook.
GetAttr

GetAttr(type, name, key)
Get the 'type' called 'name' and return the value of its associated key 'key'.

Note: Right now it only works if 'type' is set to "var"
Send

send(command)
Send 'command' to the game Animus is currently connected to. This function will send the command directly to the game and won't go through the Animus aliases for processing.
GetMatch

getMatch(num)
When you match a pattern as part of an alias or trigger, you use this function to get that value out of the pattern. If your pattern is "^(\w+) slashes you with a sword.$" and you want to know who actually attacked you (the first pattern match) then you would call getMatch(1).
Register

register(type, name)
Register the 'name' of type 'type' to the calling module. This allows you to filter out the "noise" for the hooks (like setVar and setBal). Lets say you build a module and you only care about the "herb" balance, you would register("balance","herb") so that way the hook setBal will ONLY fire for the "herb" balance.

Note: You can currently filter by the following types: var, balance, reset, and thread
Suffix

suffix(msg)
Insert 'msg' into the end of the line that is currently being processed.

suffix(#, msg)
Insert 'msg' into the end of line '#'.
Tip

tip(msg)
Show a tooltip displaying the 'msg' you specified.

tip(title, msg)
Show a tooltip displaying the 'msg' you specified with the given 'title'.
Warn

warn(title, msg)
Show a tooltip displaying the warning icon next to the 'title' and the 'msg' below.
DelReset

delReset(name)
Delete the 'name' reset early so it doesn't trigger the reset hook.

setReset(player, name)
Delete the 'name' reset early so it doesn't trigger the reset hook for 'player'.
GetBal

getBal(name)
Get the value of the balance 'name'. Typical values are "Ready","Request","Requested","Confirmed", and "Waiting". The meaning of these is explained in the SetBal help section.
IsBlocked

isBlocked(balance)
Returns true or false, based on if the balance 'balance' currently has one or more blockers assigned to it.
GetBlocker

getBlocker(balance, blocker)
Returns true or false, based on if the balance 'balance' has the blocker 'blocker' assigned to it.
DelVar

delVar(name)
Delete the variable 'name'. This function will trigger the delVar hook.
DelAttr

DelAttr(type, name, key)
Take the 'type' called 'name' and delete its associated 'key'.

Note: Right now it only works if 'type' is set to "var"
Alias

alias(command)
Send 'command' to the game Animus is currently connected to. This function will send the command through the Animus aliases for processing before actually sending them to the game. If you want to send the command without processing it, use the send command instead.
Hook

hook(name, ...)
Hooks provide a way for modules to communicate to each other. Using this function you can create your own custom hooks. The elipsis (...) means "any number of arguments", and is used to pass an unlimited number of arguments into the hooks you are making. As an example, lets say you want to create a new hook called "afflicted" that gets called anytime you get an affliction put on you, and the hook will pass in the affliction name. You would call hook("affliction","paralysis") for example, and all modules listening for the "affliction" hook will then get called and be able to act if they are coded to do so.
GetHtml

getHtml(url)
Make a get request for 'url' and return the HTML data that comes back.

getHtml(url, post)
Make a post request for 'url' and pass the parameters specified in the 'post' argument.

For example: getHtml("www.google.com", "name=Bob&guest=2")
RFile

rFile(name)
Read the file 'name' and return the contents (line seperated) as a Lua table.
Show

show(msg)
Insert 'msg' immediately into the paragraph currently being processed.
Hide

hide( )
Hide the line currently being processed.

hide(#)
Hide line '#'.
Error

error(title, msg)
Show a tooltip displaying the error icon next to the 'title' and the 'msg' below.
GetReset

getReset(name)
Get the time left (in seconds) for the 'name' reset

setReset(player, name)
Get the time left (in seconds) for the 'name' reset for 'player'.
IsBal

isBal(name)
Returns true or false, based on if the balance 'name' exists.
CheckBal

checkBal(name)
Returns true or false, based on if the balance 'name' has a value of "Ready" and nothing blocking it.
SetBlocker

setBlocker(balance, blocker)
Assign the blocker 'blocker' to the balance 'balance'. Blockers are used as a way to block balances from being used, even if they are marked as "Ready". A good example of this is when you don't know if a player has a certain skill or not, you can assign a blocker to that given balance, and when you determine that the player has the proper skill, you can simply remove the blocker to enable it's usage.
GetVar

getVar(name)
Return the value of the variable 'name'.
SetAttr

setAttr(type, name, key)
Take the 'type' called 'name' and set 'key' to "true". Kinda confusing, and rarely used, but an example is if you want a variable to become permanent you would say setAttr("var","myVar","permanent") and it would stick around even after Animus is closed (and come back when Animus starts up). Permanent variables are useful for when you want Animus to know something that happened in a previous gaming session.

setAttr(type, name, key, value)
Same as above but instead of "true" being the default you get to set 'key' to 'value'. This is useful for remembering details, like when you want to know who killed you last, you could say setAttr("var", "kills", "revenge", "Goliathon") to store in the variable "kills" that you need to take revenge on the player "Goliathon". While it is usually easier to simply store everything as variables using setVar("revenge", "Goliathon") for example, sometimes its cleaner to have attributes on those variables.

Note: Right now it only works if 'type' is set to "var"
AddThread

addThread(name, func)
This is a great feature for running functions "behind the scenes". Web requests are a great example of doing things in seperate threads. This function allows you to create a new thread, called 'name', and have that new thread execute the function you specify...in this case 'func'. So if you want something to run as a background process...create a function to do what you want, then use this function to execute it.
GetTime

getTime( )
Get the current timestamp from Animus. Time is represented by the number of seconds since epoch, with accuracy down to six decimal places.