<< Click to Display Table of Contents >> Navigation: 3. Script Language > SCS. - Select from Mutiple Cases > Multiple Choice Commands |
MiniRobotLanguage (MRL)
CFP. Command
Case Find Pattern
Intention
This command can be used to script multiple-choice decisions using a graphical Pattern.
It has to be used together with:
SCS., CAE., and ESC. and ESL.
It can be nested to any depth.
The Parameter behind SCS. will specify how CFP. will work.
There are 3 choices:
SCS.0
The given Pattern must NOT be found for the condition to be true.
SCS.1 or SCS.(positive number)
The given Pattern must be found at least as often as the number specifies, for the condition to be true.
SCS.-1 or SCS.(negative number)
The given Pattern must be found exactly as often as the number specifies, for the condition to be true.
See example below.
STW.Act|TFrmHelpMan|- Help
$$PA1=?pattern\Tabelle.bmp
$$PA2=?pattern\SCS02.bmp
$$PA3=?pattern\JK_8.bmp
SCS.1
CFP.$$PA1
MBX.Pattern found: $$PA1
CFP.$$PA2
MBX.Pattern found: $$PA2
CFP.$$PA3
MBX.Pattern found: $$PA3
ESL.
MBX.OK
ENR.
Syntax
CFP.P1[|P2][|P3]
Parameter Explanation
P1 - Filename of Pattern-File for details on how to use Pattern-Files see the LFP.-Command.
The Pattern-File does not in any way relate to the Parameter given with SCS.
P2 - opt. Destination Point Shift, will be used to move the target point by a specified amount of Pixels.
For example, if the Target is found at 100,50 and you specify here -10,40 then the final Point will be at 90,90.
P3 - opt. Variable for Result. if omitted the result will be placed on TOS.
Speed in Ticks:
This is a slow command, which is possibly in the range of 0.2 to 1 seconds, depending on the Pattern-Size and complexity.
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.Please always make formulas into () or they may not be calculated.
See also: