MudMagic BASIC scripting follows the normal BASIC style, that is:
IF ... THEN ELSE .... END |
For Example:
IF $1 = "Somevalue" THEN print "say You said $1" ELSE print "say You said something else" END |
For numerical operands: + - / * = < > <= => <> For string operands: + = <> |
REM commentary, this is ignored - so you can put notes to yourself here PRINT strings, expression SEND strings, expression (print and send are identical) if two tokens separated by ',' - space will be insert if two tokens separated by ';' - tab will be insert if two tokens seperated by '.' - no spacing occurs if PRINT ended by ',' or ';', "new line symbol" will not be inserted after last token into strings in PRINT command external variables may be appears examples: print "this","is","a","test"; outputs: This is a test print "this";"is";"a";"test"; outputs: This is a test print "This"."is"."a"."test"; outputs: Thisisatest IF condition THEN ... ELSE ... END |
Name starts by '$'.
For example. To capture 2 variables in the statement: test one two. You could write a regular expression such as:
^test (.*) (.*)
This will match any sentence you input in the command line that starts with the word test, and catches the first two words after test. You can then use:
FIRST_WORD = $1
SECOND_WORD = $2
in your script.
Name starts by '$'. $MESSAGEBOX "Message to output" |
NUMBER_ONE = 10 NUMBER_TWO = 20 IF NUMBER_ONE > 5 THEN PRINT "Number one " NUMBER_ONE; ELSE IF NUMBER_TWO < 100 print "Number two is less than 100" ELSE print "Number two is " NUMBER_TWO END END |
1.
N1 = 25 N2 = 35 NUMB = ((N1 + N2) * 5) / 25 PRINT NUMB; PRINT "Hello"; ","; "World"; PRINT "The number is -"; NUMB; PRINT NUMB; "- is the number"; 700; |
2.
N1 = 45 N2 = 35 IF N1 < N2 THEN PRINT "THEN 1 PART" PRINT "N1 ="; N1 ELSE PRINT "ELSE 1 PART" PRINT "N2 ="; N2 END PRINT "AFTER IF" PRINT "N1 ="; N1 PRINT "N2 ="; N2 |
3. This takes an external pcre caught command. Example:
Alias: ^test (.*)
PRINT ": EXT $1" rem $MESSAGEBOX0 rem $MESSAGEBOX1 "Test" rem $MESSAGEBOX2 "First arg","Second arg" |
4.
IF $1 = "Kyndig" THEN print "yup, was kyndig" ELSE print "nope, wasn't kyndig" END |