OMRON
CHAPTER 7 – Script Example
Revision 2.0
Page 135
If the fuel burner is on, based on Boolean point ‘burner’ set to ‘TRUE’, and the altitude of the
balloon, based on point ‘alt’, exceeds 400, then the fuel burner is turned off. Point ‘alt’ is measured
in pixels between 140 and 1000, so the value of 400 is the height in pixels.
IF burner THEN
fuel = fuel – rate
IF fuel < 0.0 THEN
fuel = 0.0
burner = FALSE
ENDIF
ENDIF
If the fuel burner is on, the amount of fuel remaining decreases by the rate of ascent. The rate of
ascent, point ‘rate’ can be modified by moving the slider. If point ‘fuel’ currently has a value of less
than 0, then there is no fuel left and the fuel burner is turned off.
IF burner AND fuel > 0.0 AND rate > 0.0 THEN
lift = lift + rate/5.0
ELSE
IF alt > 140.0 THEN
lift = lift - 0.2
ENDIF
ENDIF
If the fuel burner is on, and there is still fuel left, and the rate of ascent exceeds 0 (the balloon has
taken off) then point ‘lift’ is incremented by the rate of ascent divided by 5 to allow the balloon to
climb. Otherwise the balloon must be descending and point ‘lift’ is decremented by 0.2.
IF lift < -10.0 THEN
lift = -10.0
ENDIF
Once point ‘lift’ reaches -10, it is not allowed to go lower.
alt = alt + lift
The altitude of the balloon is incremented by point ‘lift’.
IF alt <= 140.0 THEN
IF distance>630.0 AND distance<660.0 AND lift>=-3.0 THEN
winner = TRUE
burner = FALSE
ENDIF
If the balloon has hit the ground (point ‘alt’ equals 140), then provided it is on the plateaux (the
position of the balloon in pixels defined by point ‘distance’ is between 630 and 660) and the rate of
descent is not too fast (defined by point ‘lift’), then the game is won.
IF lift < -3.0 then
crash = TRUE
burner = FALSE
ENDIF
Содержание CX-SUPERVISOR - SCRIPT REFERENCE REV2.0
Страница 2: ...CX Supervisor Script Language Software Revision 2 0...
Страница 3: ......
Страница 5: ...CX Supervisor Script Language OMRON Page ii Revision 2 0...
Страница 7: ...CX Supervisor Script Language OMRON Page iv Revision 2 0...
Страница 9: ...CX Supervisor Script Language OMRON Page vi Revision 2 0...
Страница 13: ......
Страница 15: ...CHAPTER 1 Introduction OMRON Page 2 Revision 2 0...
Страница 19: ...CHAPTER 2 Expressions OMRON Page 6 Revision 2 0...
Страница 21: ...CHAPTER 3 Scripts OMRON Page 8 Revision 2 0...
Страница 151: ...CHAPTER 8 Colour Palette OMRON Page 138 Revision 2 0...