Easy question

edited March 2009 in Help request
I have an easy question for you.
At the .ini file what does it mean - Position={50.0, 50.0, 0.0} ~ {750.0, 550.0, 0.0};

[Box]
Graphic=BoxGraphic;
Position={50.0, 50.0, 0.0} ~ {750.0, 550.0, 0.0};
Body=BoxBody;
Scale=2.0;


I took it from the Physic example.

Comments

  • edited March 2009
    Hi!

    The '~' character is used to specify a random value. It can be used for any numeric value in the config files (int, float, vector).

    So here it means, everytime the value for the key Position will be accessed in the section [Box], the engine will get a random value between (50, 50, 0) and (750, 550, 0).

    So basically, in this tutorial I create 100 objects of type [Box], they'll all have a random position between these 2 extrema, I didn't write any code for the random positionning of the boxes at start, this single line does it! :)

    There are more info on other special characters and features at the top of CreationTemplate.ini & SettingsTemplate.ini. Those 2 files from the /bin folder are very useful as they give you all the parameters you can use for all the different kind of structure you can create with data driven components.

    If you use the svn version, you'll also notice the possibility to store lists for a value using the character '#', that can be accessed with an index or like a normal value. In the second case, the returned value will be one taken randomly from the list.

    Ex:

    MyKey=FirstValue#MiddleValue#LastValue;

    If you then call orxConfig_GetListCounter( "MyKey" ), it will return 3 (the number of elements in your list).
    You can then access a specific element using orxConfig_GetListString, ex. orxConfig_GetListString( "MyKey", 1 ) => "MiddleValue".

    Or use the normal string accessor orxConfig_GetString( "MyKey" ).
    In this case, every call will randomly return either "FirstValue", "MiddleValue" or "EndValue".

    It's very powerful to create particle effects and for enemy/bullets spawning, for example.
  • edited April 2009
    Hi, instead of opening a new thread I'm going to use this one.
    I was looking at the Drops. It's a little bit tricky to understand how drops.ini is call in the program. It's quite obvious that the default.ini has the same name as the execute.exe. But I want to be sure. Thanks
  • edited April 2009
    Hi!

    You're totally right, the main config file is names after your executable.

    Actually, it uses the first param (argv[o]) sent to orx_Execute() that is then sent to the config module using orxConfig_SetBaseName().

    You can use any additional config file. You have 2 ways to do so:
    - load a config file using orxConfig_Load( "path/to/MyFile.ini" ) in code
    - include a directly from an already loaded config file using this syntax:
    @path/to/MyFile@ (as explained in the template files).

    Config can also be saved in files (separately or not) using filters to only save the section/keys you want, and using encryption or not depending if you want the final user to be able to read them.
    This system is really handy for configuration purposes (controls, for example) or savegames (as used in Drops).

    Hope this help!

    - iarwain
Sign In or Register to comment.