Variables

This Settings Editor dialog page allows you to edit the properties of a Variable.

Variable.jpg

The Name field gives the name of the variable, and the Value field gives the current value of the variable. The Default field can be used to assign a startup value to the variable when the character is first loaded or the #RESET command is used. To enable a default value for the variable, enable the Use Default checkbox, otherwise the last value saved for this variable will be restored on startup.

If the Style is set to zMUD Script, the syntax editor will check the syntax and report any errors, which is used for #FUNCTIONs. If the Style is set to Text, you can edit the variable value without performing any syntax checking. If Style is set to VBScript or JScript then the commands will be sent to that script processor. Note: VBScript an JScript use the #SS command internally, if you change to another style you will have to remove that change manually.

You can easily edit string lists by setting the Style to String List. Each item in the list can be edited, and items can be drag/dropped to change their order. You can also right-click on the list and Insert or Delete a row.

You can also edit Record variables by setting the Style to Data Record. Each key and value stored in the record will be shown and can be editted. Fields can be drag/dropped to change their order. You can right-click on the list and Insert or Delete a row.

Variables are used within scripts through the variable special character, which defaults to @. Many of the different data types that can be store in a variable can be referenced using a period notation. Also COM methods and functions can be accessed by this notation. Variables that reference COM objects, arrays, and floating point numbers will have a value like %tmpcom##### and can not be editted directly.

Also braces {} may be used to seperate a variable name from neighboring text or allow functions to expand prior to expanding the variable reference.

Examples:

#VAR example1 %array(0)

#9 {#NOOP %arrset(example1,%i,%i)}

#SHOW @example1.4

     The first 2 lines create an array with the number 0-9 in matching element slots. Then element 4 is displayed. New variables created with a syntax of #VAR name.# {x} will be created as arrays.

 

#WIN example2

:example2:#VAR newvar {just made this}

#SHOW @example2.newvar

     The first 2 lines create a child window then a variable in that child window. Then the variable @newvar from the example2 window is displayed.

 

#VAR example3 {}

#ADDKEY example3 third {just another example}

#SHOW @example3.third

     This one creates a record variable with a key of third. Then displays the value assigned there. New variables created with a syntax of #VAR name.word {x} will be created as records.

 

#VAR example4 {abc|def|ghi}

#ADDITEM example4 {jkl}

#SHOW @example4.4

     This one creates a list variable and then adds a new item to it. Then displays the forth item in the list.

 

#4 {#SHOW example%i = @{example%i}}

     This shows all 4 examples from above.



Contents Aliases SpeedWalking