Control Statements SECTION 4 CX-Supervisor Script Language
28
SELECT CASE TRUE
CASE temperature > 0 AND temperature <= 10
colour (blue)
CASE temperature > 10 AND temperature <= 20
colour (green)
CASE temperature > 20 AND temperature <= 30
colour (red)
CASE ELSE
colour (white)
ENDSELECT
In this example, instead of using a point as the condition as with the previous
example, the value is the condition - in this case Boolean state ''TRUE'' - with
the integer point 'temperature' being tested at each case. If it is ''TRUE'' that
'temperature' is between 0 and 10, then the current object is set to blue, or if it
is ''TRUE'' that 'temperature' is between 11 and 20, then the current object is
set to green, or if it is ''TRUE'' that 'temperature' is between 21 and 30, then
the current object is set to red. If none of these CASE statements are met,
then the current object is set to white. Like ELSE and ELSEIF, the CASE
ELSE statement is optional.
References
Refer to chapter 6, Object Commands for details of applying attributes to an
object and for the use of the Colour object command. Refer to chapter 8,
Colour Palette for details of the Colour Palette colour designation.
4-3-4 FOR... NEXT Loop
Syntax
FOR pointname = startpt TO endpt STEP steppt
statementblock1
NEXT
Remarks
Typical Examples
FOR loopcount = 0 TO 100
Ellipse_1.vertical%fill = loopcount
NEXT
In this example, 'Ellipse_1' is gradually filled 100 times.
FOR loopcount = 100 TO 0 STEP -5
Ellipse_1.vertical%fill = loopcount
NEXT
Argument Description
pointname The pointname to be used as the loop counter.
startpt The initial setting of pointname, and the first value to be
used through the loop.
endpt The last value to be used. The loop ends when
pointname exceeds this value.
steppt Amount to increase pointname by every pass of the loop.
Steppt can be negative to count backwards providing
startpt is larger than endpt. The STEP keyword and
variable may be omitted in which case pointname is
incremented at each pass of the loop (identical to adding
STEP 1).