I decided to not use Lua support because it will cause the script to lock and not be able to terminate externally. Instead, I decided to add variable support and string support.
So the major changes are as follows:
- VAR Varname InitVarValue //Declares a variable with a base value
- SET Varname Varvalue //Sets a declared variable with a value
- RANDOM Varname Low High //Random a number in range and stores in variable
- Combine Varname StringToAdd //Combines strings together
- ADD Varname Number //Adds a number to a variable
- SUB Varname Number //Subtracts a number from a variable
- MUL Varname Number //Multiplies a number to the variable
- DIV Varname Number //Divides a number to the variable (Integer Division)
- COMPARE Var1 Var2 //Inits a compare between two variables then can use the GOTOX functions
- GOTOEQUAL Label //Go to a label if the compare resulted in equal
- GOTONOTEQUAL Label //Go to a label if the compare resulted in not equal
- GOTOABOVE Label //Go to a label if Var1 is bigger than Var2
- GOTOBELOW Label //Go to a label if Var1 is smaller than Var2
- SENDPACKET StringPacket //Send a packet
- PRINT Text //Outputs text to dbgview.exe
- MID Varname StringIn Pos Length //Gets characters in the middle of a string
The style of which the code is used is assembler style which means that only one instruction can be executed at a time and that you cannot combine multiple instructions together. Compare is used as a command that sets the context for using other GOTO commands.
Using Variables
Example script using variables:
VAR randommove 0
:1
RANDOM randommove 100 200
MOVE randommove
GOTO 1
This script will cause your character to constantly move between the coordinates of 100 and 200 for ever.
Example script using compares:
VAR imove 0
:1
MOVE imove
ADD imove 20
COMPARE imove 100
GOTOABOVE ijump
GOTOEQUAL ijump
GOTO 1
:ijump
RANDOM imove 0 2
JUMP imove
This script will cause your character to move to 0 then move in 20 pixel incriments until it is above or equal 100. Then it will randomly jump left, up or right.
Using Strings
Strings can be declared in variables similarly to numbers except they must be enclosed by double quotes.
Example: VAR strvar “This Is A String”
Only certain functions can accept strings or else an error will occur. If the error is variable not recognized, it usually means that the variable was not a number or that the variable does not exist.
Example script with strings:
VAR Packet “0A 00”
VAR move 0
:1
MOVE move
ADD move 50
COMPARE move 500
GOTOABOVE crashme
GOTO 1
:crashme
SENDPACKET Packet
This script will cause you to move in 50 pixel increments until 500 then the player crashes (if I had the crash packet right).
You can use the mid command to get parts of a string or use the combine command to combine strings. You can use the print function to see the effects of each function in action.
PRINT “Output this to dbgview.exe”
If there’s any errors, since I did not test some of the other string functions, please report them and I will try to fix them