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 or AS string is text, read with PropString(); a # name or AS float is a decimal number, read with Prop(); TRUE or FALSE is on/off; anything else is a whole number, read with PropInteger().
  • A decimal setting needs # or AS float. zoom AS double = 1.5 and ratio = 0.75 become 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, or speed 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 0
In the manual : Variables and types