The scripting language that Shakti and I devised is completely message-based. Variables are handled through specific functions which operate on variables or variable slot's - AKA elements in an array.
Messages are then sent to the target object ID's ScriptProc function. The message is then handled (or not handled) by the object. The engine also has a ScriptProc function where it can respond to specific messages as well.
The goal was to make the game completely controllable and modifiable from the script. It also supports user commands through set macros we've come up with. Overall it's very powerful but definitely not up to par with a major scripting language.
There are a few more details involved in order to get everyone working on the same page but overall it's quite simple.
Everyone one of our script commands utilizes this structure:
- dwMessage is the message ID
- dwParam1 is the first param, usually the object being acted on
- dwParam2 is the second param, usually the target object of the command (IE: aIDAttack (1,2) - object 1 attacks object 2
- dwParam3 is the third param and it is rarely, if ever, used in our system. When used it usually acts as a modifier for the messageID. Say you wanted object 1 to move to object 2 at a speed of 4: aIDMoveToAtSpd(1,2,4)
A simple script to make object 1 attack object 2 until it is dead.
There several ways to accomplish this in our script but I showed what I think is the easiest.
//Check if object 2 is dead, if true, set variable 1 to 1
//If variable 1 is 0, we know object 2 is still alive so attack it
//1 out of 100 times we will attack with special move 5
User commands are added like this:
Params are determined by how the user passes them to the function. We cannot test to see whether the user is using their command correctly, but we can provide a mechanism so they can build up complicated commands and then execute them with one line of script. The number following the macros is an indicator the script how many params it requires. All standard script commands start with "a" and all user commands start with "u"
//Param1 - object
//Param2 - target
//Param3 - weapon
//Check if object doing action is alive, if target is alive, and
//if action object even has the weapon
if (aIDIsAlive(PARAM1) AND aIDIsAlive(PARAM2) AND
//Object 1 attack object 2 with weapon 20
Interesting to see how you approached your script. I'd like to see some samples of it.