User Tools

Site Tools


en:orx:config:syntax

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:orx:config:syntax [2013/05/02 16:21 (11 years ago)] – [Lists] sergeigen:orx:config:syntax [2023/05/15 20:19 (11 months ago)] (current) sausage
Line 132: Line 132:
  
 Key2 = Var2; <= this will still be added to the 'MySection' section</code> Key2 = Var2; <= this will still be added to the 'MySection' section</code>
 +
 +===== Command =====
 +The Command module allows you to execute Orx functions from both the console and .ini files. Syntax for .ini files is specified in https://github.com/orx/orx/blob/master/code/bin/SettingsTemplate.ini. Console usage is discussed here: [[en:tutorials:command:commandnotes|Command Module notes]].
  
  
Line 137: Line 140:
  
 ==== Basic types ==== ==== Basic types ====
 +
 +Boolean values are expressed with literals ''true'' and ''false'':
 +
 +<code ini>VSync = true</code>
  
 Floating points (float) values are expressed using a decimal separator ('.'). Floating points (float) values are expressed using a decimal separator ('.').
Line 161: Line 168:
 ==== Vector ==== ==== Vector ====
  
-Vectors are always defined using three components, separated by commas (',') and enclosed by either round brackets ('()') or curly brackets ('{}'), with no distinction.+Vectors are always defined using **three** components, separated by commas (',') and enclosed by either round brackets ('()') or curly brackets ('{}'), with no distinction.
  
 <code ini>MyVector      = (1.0, 2.0, 3.0) <code ini>MyVector      = (1.0, 2.0, 3.0)
Line 181: Line 188:
 Lists of values for a single key are also supported. All the elements are separated using the pound character ('#'). Lists can also contains random values as elements. Lists of values for a single key are also supported. All the elements are separated using the pound character ('#'). Lists can also contains random values as elements.
  
-<code ini>ListValue = Val1 # Val2 # RandVal3 ~ RandVal4 #Val5</code>+<code ini>ValueList = Val1 # Val2 # RandVal3 ~ RandVal4 # Val5</code>
  
-If spaces are defined around the list separators '#' they will be ignored.+If spaces are defined around the list separators '#'they will be ignored.
  
 **NB: Spaces around the list delimiter ('#') are trimmed and will simply be ignored by the config system.**\\ **NB: Spaces around the list delimiter ('#') are trimmed and will simply be ignored by the config system.**\\
 **NB: When querying lists using the config API, please look at the functions containing the word 'List' in their name. If you use a non-list function to query a key that contains a list value, any element of the list will be randomly returned.** **NB: When querying lists using the config API, please look at the functions containing the word 'List' in their name. If you use a non-list function to query a key that contains a list value, any element of the list will be randomly returned.**
  
-But let's visualize this with an example. =)\\+But let's visualize this with examples. =)\\
 Code Code
  
-<code c>orxFLOAT fMyFloat = orxConfig_GetFloat("MyFloat");</code>+<code c>orxVECTOR vMyVector; 
 +orxConfig_GetVector("MyVector", &vMyVector); 
 +orxFLOAT fMyFloat = orxConfig_GetFloat("MyFloat");</code>
  
 INI INI
  
-<code ini>MyFloat = 1.0 # 2.0 # 3.0</code>+<code ini>MyVector = (1, 2, 3) # (4.0, 5.0, 6.0) 
 +MyFloat = 1.0 # 2.0 # 3.0</code>
  
-The function will then randomly return 1.0, 2.0 or 3.0.\\ +The functions will then randomly return (1, 2, 3) or (4.0, 5.0, 6.0) for the vector one, and 1.0, 2.0 or 3.0 for the float one.\\ 
-If the value was define using a random separator ('~'), any float value between 1.0 and 3.0 could have been returned.\\+If the values were defined using a random separator ('~'), any vector between (1, 2, 3) and (4.0, 5.0, 6.0) or any float value between 1.0 and 3.0 could have been returned.\\
 Please also note that controlled randoms using lists works also with non-numerical values. Please also note that controlled randoms using lists works also with non-numerical values.
  
Line 209: Line 219:
        Var4  ; This list is now complete and contains 4 elements.        Var4  ; This list is now complete and contains 4 elements.
 Key3 = Var1 # Var2 ##; This list will not span on the next line but will contain a 3rd (and last) empty element.</code> Key3 = Var1 # Var2 ##; This list will not span on the next line but will contain a 3rd (and last) empty element.</code>
- 
-Lists of vectors can be defined in-place: 
-<code ini>atlasIndices = (0, 0, 0) # (0.5, 0.5, 0) # (1.0, 1.0, 0)</code> 
en/orx/config/syntax.1367536870.txt.gz · Last modified: 2017/05/30 00:50 (7 years ago) (external edit)