Syntax
Turns the top-level assignment on the next line into a setting shown in the Inspector. The value set there replaces the value written in the code when the program starts.
' @expose
' @expose range(<min>, <max>)
' @expose (<min>, <max>)
[GLOBAL] <name> [AS <type>] = <value>Parts
| <min> | The lowest value offered in the Inspector. A plain number literal. |
|---|---|
| <max> | The highest value offered in the Inspector. A plain number literal. |
| <name> | The variable. The setting is named after it without its sigil: speed# gives speed. |
| <type> | The declared type. string makes a text setting and float a decimal one; any other type makes a whole-number setting. |
| <value> | The value used when the Inspector has not set one. TRUE or FALSE makes an on/off setting, stored as 1 or 0. |
Good to know
- The kind of setting: a
$name orAS stringis text, read with PropString(); a#name orAS floatis a decimal number, read with Prop();TRUEorFALSEis on/off; anything else is a whole number, read with PropInteger(). - A decimal setting needs
#orAS float.zoom AS double = 1.5andratio = 0.75become whole-number settings that start at 1 and 0. - The marker may be written with
',REM,//or a backtick, alone on its line. The assignment must be on the very next line, at the top level. Otherwise: "@expose must be followed by a top-level assignment (name = value)". - Text after the marker, such as a second comment, makes it an ordinary comment: the variable is not exposed, and nothing tells you.
- Under
OPTION EXPLICIT, expose a declaration:GLOBAL lives = 3, orspeed AS float = 2.5.
Example
' @expose range(0, 20)speed# = 5.5' @exposetitle$ = "Hero"' @exposeGLOBAL lives = 3' @exposegodMode = FALSEConsole(title$ + " " + Str(speed#) + " " + Str(lives) + " " + Str(godMode)) ' Hero 5.5 3 0In the manual : Variables and types