.CEL Scripting parameter value validation
Posted: 18.07.2003, 22:18
Version: 1.3.1 pre-6
Subject: .CEL Scripting parameter value validation
Parameter Name: time
I just discovered that all script commands that accept the parameter named "time", allow the value to be negative. When it's set to a negative number, nothing happens (no change in the display) except to freeze the display (scene can't be moved via keyboard or mouse), and the only way to reset it is to press ESC.
The commands I found that use "time" are:
* center
* goto
* gotoloc
* gotolonglat
* others?
Parameter name: duration
In addition, script commands that accept the parameter named "duration" also accept negative values. In this case, the command is seemingly ignored, as in:
... nothing happens (no select, no center, no wait), the display is not frozen, and the next valid command will be executed.
The commands I found that use "duration" are:
* wait
* changedistance
* print
* orbit
* rotate
* move
* others?
My suggestion
Add some min-max value validation to numeric input parameters coming from a script and let the user know when a parameter is in error (command name or script line number, parameter name, and parameter value). Maybe even tell them what the valid min-max range is?
Subject: .CEL Scripting parameter value validation
Parameter Name: time
I just discovered that all script commands that accept the parameter named "time", allow the value to be negative. When it's set to a negative number, nothing happens (no change in the display) except to freeze the display (scene can't be moved via keyboard or mouse), and the only way to reset it is to press ESC.
The commands I found that use "time" are:
* center
* goto
* gotoloc
* gotolonglat
* others?
Parameter name: duration
In addition, script commands that accept the parameter named "duration" also accept negative values. In this case, the command is seemingly ignored, as in:
Code: Select all
select {object "Sol/Earth"}
center {time 3}
wait {duration -3}
... nothing happens (no select, no center, no wait), the display is not frozen, and the next valid command will be executed.
The commands I found that use "duration" are:
* wait
* changedistance
* orbit
* rotate
* move
* others?
My suggestion
Add some min-max value validation to numeric input parameters coming from a script and let the user know when a parameter is in error (command name or script line number, parameter name, and parameter value). Maybe even tell them what the valid min-max range is?