ModBot allows customizable scripts to such an extent you can actually program your own sub-procedures within your INI file. You can harness any global variable within ModBot to use with the scripts.
Scripts match MQ2 code to every extent, below are several examples of scripts and common variables one would use to create complex scripts.
Scripts General Info
Scripts can be difficult and there are some MQ2 commands that give scripts trouble. Keep this in mind and prepare to post your script code should you have problems.
No script can take more then 15 seconds to complete. However, this can be modified in the code directly in the Sub MBScript or even changed in the script you create ({Timer} is the variable).
Scripts are executed from top to bottom and you are allowed to use a label :Top (e.g. /goto :Top), in your script. The /goto :Top option allows for complex loops to take place directly from code in the INI file.
If you use any INI generated ModBot global string variables that have spaces in your custom scripts they must be encapsulated by 2 apostrophes when used in the script, see PetCast example below.
Reserved Characters
These characters can not be used in scripts
$ "
'' (Two apostrophes) are for passing variables with spaces in script code. Use them to replace quotes.
Syntax
[Script-<name of script>]
Commands=<number of statements>
C1=<Commands>
.
Cn=<Commands>
What does a script look like in your INI file:
[Script-HelloWorld]
Commands=2
C1=/echo Hello World
C2=/if ({Timer}>50) /varset Timer 5s
C3=/goto :Top
In the example above it will echo to the MQ2ChatWindow "Hello World" for 5s. Notice how we do NOT use a $ to reference the "Timer" variable.
How To use or launch a script
/bc bob script HelloWorld
You can set Gem=script and Spell=HelloWorld as a spell name for any of the spells you've configured in ModBot, and it will be triggered when that event, heal, etc would take place.
Common Variables (You can use any variable without the $, you can even create new global vars and use them, all from the INI file via Scripts)
{ACState} = If greater than 0, ModBot thinks you are in combat
{ACMATarget} = The target of the main assist
{CampStatus} = If greater than 0, means I've been given a /bc makecamp command
{FollowFlag} = If greater than 0, means I should be following something
{TankName} = The acting main assist
{PSTargetID} = This variable will have the ID of the mob that is currently being acted upon in standard Modbot Scripts and PreConditions. For instance, if you have an AD entry and you want to check things about the target of the entry, you can use {Spawn[{PSTargetID}].xxx}, etc.
{Me}, {Spawn}, etc = See MQ2 Manual