<< Click to Display Table of Contents >> Navigation: 3. Script Language > SCS. - Select from Mutiple Cases > Multiple Choice Commands |
MiniRobotLanguage (MRL)
CAS. Command
Case String
Intention
This command can be used to script multiple-choice decisions.
It has to be used together with:
SCS., CAN., CAE., and ESC..
See example below.
: §§TXT=Karl Kovse
SCS.§§TXT
CAS.Karl
PRT.This will come
CAS.Peter
PRT.This will not come
CAE.
PRT. This will not come
ESC.
MBX.Ready
ENR.
Syntax
CAS.[P1]
Parameter Explanation
P1 - String which shall be compared to the SCS.-String. Can use Standard-Search Patterns like:
{Yes&OR:Qui} see chapter with explanation of standard search patterns.
If P1 is omitted, only an empty string will meet the condition.
Example
'********************************************
' Demo for SCS., CAS., CAE., ESC. and CAN.
'********************************************
' SCS.-Test
'DBM.2
'-------------------------
FOR.$$LOP|1|20
VAR.$$TXT=Peter$$LOP
VAR.$$NUM=500
PRT.TXT=$$TXT
SCS.$$TXT
CAS.Was first case.
PRT.First Case
' This one will come in the twentieth
CAS.{Rufus&OR:Peter2}
PRT.Was "Peter2..."
' You can jump out of the structure directly with GOTO.
' And you can nest unlimited many SCS.
SCS.$$NUM
CAN.(100*5)
PRT.You can nest it unlimited.
CAN. 499
' You can even intermix CAS. / CAN.
CAS. Intermixed
CAE.
PRT.THis will not come
ESC.
JMP. otu
CAS.Third
PRT.Was Third
CAS.{Peter&AND:3}
PRT.Was "Peter" and "3"
' If you need a perfect match ...
CAS.{&EXACT:Theo}
PRT.This one is Theo.
CAS.Fourth.
PRT.Was this one.
' CASE ELSE
CAE.
PRT.Was nothing of all.
' END SELECT
ESC.
:otu
NEX.
MBX.Ending
:enz
END.
Remarks
Please do not write code between the SCS. and the first following CAS./CAN.
While this code will actually be executed, you could get memory-leaks if you jump out of the construct from that place.
Limitations:
There are no relevant nesting limitations. if you do not understand some behavior of the CAS., then please take a look on the "Standard Search Patterns". These are used inside the CAS.
See also: