User Tools

Site Tools


en:tutorials:config:guide_to_the_orx_console

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
tutorials:guide_to_the_orx_console [2017/11/08 18:43 (6 years ago)] – [Objects and the stack] sausageen:tutorials:config:guide_to_the_orx_console [2023/07/12 19:02 (9 months ago)] (current) – [Getting Help on a Command] iarwain
Line 1: Line 1:
-<WRAP center round box 60%> 
-This guide is in progress 
-</WRAP> 
- 
- 
 ===== Guide to the Orx Console and Commands ===== ===== Guide to the Orx Console and Commands =====
  
 Beginners and seasoned Orx developers may not have tapped into the power that the Orx Console gives you. Or may not even have realised it exists. This tool can give you access to your game objects and config values during live execution in realtime. Beginners and seasoned Orx developers may not have tapped into the power that the Orx Console gives you. Or may not even have realised it exists. This tool can give you access to your game objects and config values during live execution in realtime.
  
-It will let you alter any of these elements and values. You can experiment with commands which can be used in your own Tracks within your game.+It will let you alter any of these elements and values. You can experiment with commands which can then be used in Tracks within your game.
  
 All Orx applications and games have an Orx Console compiled directly in. All Orx applications and games have an Orx Console compiled directly in.
  
-This guide will take you on a tour of some of the power of the Console to help you get comfortable with it. Hopefully after working through this guide you will see the many possibilities that are available, and how it can be applied.+This guide will take you on a tour of some of the power of the Console to help you get comfortable using it. Hopefully after working through this guide you will see many possibilities that are available, and how they can be applied.
  
 The Orx Console will save you many hours of fiddly experimentation. The Orx Console will save you many hours of fiddly experimentation.
  
-{{ :tutorials:bounce-app-console.png |}}+{{ tutorials:command:bounce-app-console.png |}}
  
 ==== Starting with a Common Project ==== ==== Starting with a Common Project ====
  
-It will be helpful to use a common project that is available to everyone so that you can work with commands and configuration that will work immediately without messing around.+It will be helpful to use a common project that is available to everyone so that you can work with commands and configuration demonstrated in this guide.
  
-  +If you are using the [[https://github.com/orx/orx | git repo version of Orx]], you can use the [[en:tutorials:config:bounce_demo|Bounce Demo]]. Start it by executing: ''code/bin/orxd.exe''
-If you are using the git repo version of orx, you can use the Bounce Demo. Start it by executing: ''code/bin/orxd.exe''+
  
 The Bounce Demo is not available in the downloadable release versions of Orx. Otherwise just use a project of your own. The Bounce Demo is not available in the downloadable release versions of Orx. Otherwise just use a project of your own.
  
  
-{{ :tutorials:bounce-app.png |}}+{{ tutorials:command:bounce-app.png |}}
  
 ==== Starting the Orx Console ==== ==== Starting the Orx Console ====
  
-When running the game, press the ''backquote'' key:+When running your game, to start the Console, press the ''backquote'' key:
  
 ''`'' ''`''
  
-The backquote key is below the ''ESC'' key and above the ''Tab'' key. This will open the console. Press backquote again to close the console.+The backquote key is below the ''ESC'' key and above the ''Tab'' key. Press backquote again to close the console.
  
  
-{{ :tutorials:bounce-app-console.png |}}+{{ tutorials:command:bounce-app-console.png |}}
  
 ==== Finding Commands and Navigating ==== ==== Finding Commands and Navigating ====
Line 47: Line 41:
 ''Command.ListCommands'' (then press enter) ''Command.ListCommands'' (then press enter)
  
-All commands will be printed to the screen. The list can be scrolled with the mouse wheel or the ''PageUp'' or ''PageDown'' keys.+All commands will be printed to the screen. The list can be scrolled with the mouse wheel or the ''PageUp'' and ''PageDown'' keys.
  
-Partial commands can be typed using the ''Tab'' key to auto complete. For example, if we wanted to get the Orx version, the command would be: +Partial commands can be typed and then use the ''Tab'' key to auto complete. For example, if we wanted to get the Orx version, the command would be: 
  
 ''Command.Version'' ''Command.Version''
Line 61: Line 55:
 ''Command.ListAliases'' ''Command.ListAliases''
  
-You could type: ''Command.List'' <tab>+You could type: ''Command.Lis'' <tab>
  
 Both ''Command.ListAliases'' and ''Command.ListCommands'' would be listed.  Both ''Command.ListAliases'' and ''Command.ListCommands'' would be listed. 
Line 73: Line 67:
 Different executables (debug/release) will have different histories. So when you key up or down through histories, these will be tied to a different project configurations/executables. Different executables (debug/release) will have different histories. So when you key up or down through histories, these will be tied to a different project configurations/executables.
  
-Command histories are saved in the same folder as your executable, with a ''.cih'' extension. If your exe is calledmygame.exe then you'll have a mygame.cih created/updated whenever you quit your game. This is just a text file. Very handy for getting a copy of any command that you have used in the console. We'll cover some uses later.+Command histories are saved in the same folder as your executable, with a ''.cih'' extension. If your exe is calledmygame.exe then you'll have a mygame.cih created/updated whenever you quit your game. This is just a text file. Very handy for getting a copy of any command that you have used in the console. We'll cover some uses later.
  
 The ''Insert'' key switches between Overwrite and Insert modes. The ''Insert'' key switches between Overwrite and Insert modes.
Line 87: Line 81:
 The info in between the ''{}'' is the return value. Then the command itself. Values in between ''()'' are required values. Values in between ''[]'' are optional values. The info in between the ''{}'' is the return value. Then the command itself. Values in between ''()'' are required values. Values in between ''[]'' are optional values.
  
 +Commands utilize the following types:
 +
 +  * ''orxBOOL'': Must be either 'true' or 'false'.
 +  * ''orxFLOAT'': Any floating point value.
 +  * ''orxS32'': signed 32-bit value
 +  * ''orxS64'': signed 64-bit value
 +  * ''orxU32'': unsigned 32-bit value
 +  * ''orxU64'': unsigned 64-bit value
 +  * ''orxNUMERIC'': Any numerical type, ie. a string that can be interpreted as a vector, an int (decimal, hexa, octal, binary) or a float
 +  * ''orxSTRING'': Any String value.
 +  * ''orxVECTOR'': a 3-component vector (mathematics) 
 +
 +==== Copy/Paste Commands ====
 +
 +Rather than typing all your commands, you have the choice to copy commands from this tutorial directly into the console using the clipboard. Select the following command and copy it into your clipboard:
 +
 +''Command.Version''
 +
 +Now paste with Control-V into the command bar of the Orx Console. Your command will be pasted in, and you can press enter to execute it.
  
 ==== Basic Commands ==== ==== Basic Commands ====
Line 130: Line 143:
 ==== More Getting and Setting: turning things on ==== ==== More Getting and Setting: turning things on ====
  
-Two very handy settings in your game, are turning on physics debugging and showing the FPS. These settings can be changed from the Console+Two very handy settings available in Orx are turning on physics debugging and showing the FPS. These settings can be changed from the Console
  
 If you wanted to check if the ShowFPS property is on or off you can use: If you wanted to check if the ShowFPS property is on or off you can use:
Line 162: Line 175:
 These are good examples, and you can also do exactly the same thing with all properties in your configuration files. These are good examples, and you can also do exactly the same thing with all properties in your configuration files.
  
-So far you might be thinking that the commands are little long. Soon we will address this by introducing aliasesfor commonly used commands. For now we'll stick to common longhand commands.+So far you might be thinking that the commands are little long. Soon we will address this by introducing aliases for commonly used commands. For now we'll stick to common longhand commands.
  
  
Line 184: Line 197:
 </code> </code>
  
-Notice that the objects being spawned are instantly balls.+Notice that the objects being spawned are now balls. 
  
  
Line 203: Line 217:
 </code> </code>
  
-You can specify which item in the list via an index value:+You can retrieve a specific item in the list via an index value:
  
 ''Config.GetValue Fade SlotList 1'' ''Config.GetValue Fade SlotList 1''
Line 240: Line 254:
 </code> </code>
  
-When you press tab, it inserts the last object ID in place.+When you press tab, it inserts the result of the last command in place. In this case, the object ID.
  
 Now that there are two Wall1 objects, we can cycle between.  Now that there are two Wall1 objects, we can cycle between. 
Line 267: Line 281:
 Not only can we get object IDs, and affect objects using their ID, objects can also be pushed onto the stack. Not only can we get object IDs, and affect objects using their ID, objects can also be pushed onto the stack.
  
-Values can be pushed onto the stack as well. They can then be popped and used on other commands.+Values can be pushed onto the stack as well. They can then be popped and used with other commands.
  
 ''> Object.FindNext Wall1'' ''> Object.FindNext Wall1''
Line 281: Line 295:
 The ''<'' symbol above means to pop the last saved value from the stack and use it within the command. This simply means: set the position of the object ID popped from the stack to (100, 100, 0). The ''<'' symbol above means to pop the last saved value from the stack and use it within the command. This simply means: set the position of the object ID popped from the stack to (100, 100, 0).
  
-The result of any command can be popped onto the stack. (CHECK THIS).+The result of any command can be pushed onto the stack. 
  
  
Line 297: Line 312:
 </code> </code>
  
-If you are not familiar with the @ syntax, this is a merging of another section. Specifically: MyNewBall is actually a normal object. The Graphic property would normally be set to a seperate Graphic section. But rather than do that, @ lets us specify properties normally in a Graphic section, in the Object section instead. Very handy.+If you are not familiar with the @ syntax, this is a merging of another section. Specifically: MyNewBall is actually a regular object. The Graphic property would normally be set to a separate Graphic section. But rather than do that, @ lets us specify properties normally in a Graphic section, in the Object section instead. Very handy.
  
 Next, we can set the Texture property: Next, we can set the Texture property:
Line 321: Line 336:
  
 You should see a large ball in the middle of the screen. You should see a large ball in the middle of the screen.
 +
  
  
Line 326: Line 342:
  
 You can also perform math on values in the stack. You can also perform math on values in the stack.
 +
 +
  
 **Addition on a value in the stack** **Addition on a value in the stack**
Line 346: Line 364:
 </code> </code>
  
-The above means: store the result of this calculation on the stack. Use addition with the ''+'' symbol. Pop the last value from the stack which was the 300. Add ''2'' to this. 302 is stored in the stack.+The above means: store the result of this calculation onto the stack. Use addition with the ''+'' symbol. Pop the last value from the stack which was the 300. Add ''2'' to this. 302 is stored in the stack. 
  
  
Line 361: Line 380:
 </code> </code>
  
-In same way as the addition example: store the result of this calculation on the stack. Use division with the ''/'' symbol. Pop the last value from the stack which was the 300. Divide this by ''2''. 150 is stored in the stack.+In the same way as the addition example: store the result of this calculation on the stack. Use division with the ''/'' symbol. Pop the last value from the stack which was the 300. Divide this by ''2''. 150 is stored in the stack. 
  
  
Line 385: Line 405:
 In the above, the result is to be saved back to the stack. Addition is the mode selected with ''+''. The vector from the stack is popped, and the (-1, 0, 0) vector is added. So only the first value in the vector is affected. The last two values in the vector, are 0 so no change. In the above, the result is to be saved back to the stack. Addition is the mode selected with ''+''. The vector from the stack is popped, and the (-1, 0, 0) vector is added. So only the first value in the vector is affected. The last two values in the vector, are 0 so no change.
  
-As indicated in the output above, the resulting vector is (-301, -250, 1).+As indicated in the output above, the resulting vector placed back on the stack is (-301, -250, 1).
  
-And of course the resulting vector saved on the stack can be placed back onto the object.+Pressing tab will just give us the vector. Without losing our vector on the stack, get the Alien ID with: 
 + 
 +''> Object.FindNext Wall1'' 
 +<code ini> 
 +: 0x00000007000000EF 
 +</code> 
 + 
 +Set the wall's new position:
  
 ''Object.SetPosition <tab> <'' ''Object.SetPosition <tab> <''
Line 395: Line 422:
 **NOT Operator** **NOT Operator**
  
-You can also perform operations on values, for example, a not operator.+You can perform operations on values, for example, a **not** operator.
  
 In ''BounceAlt.ini'' is the following section and property: In ''BounceAlt.ini'' is the following section and property:
Line 409: Line 436:
 </code> </code>
  
-''not'' the value popped from the stack and store the result back to the stack:+''not'' the value that is popped from the stackand store the result back to the stack:
  
 ''> not <'' ''> not <''
Line 441: Line 468:
 ''? Config.GetValue'' ''? Config.GetValue''
  
-We've used Config.GetValue and Config.SetValue throughout this guide quite a lot. It's a little mean to not mention until now that there was an alias for both of them:+We've used Config.GetValue and Config.SetValue throughout this guide quite a lot. It's a little mean to wait until now to mention that there was an alias for both of them:
  
 ''Get'' ''Get''
Line 461: Line 488:
 ''d 0''  ''d 0'' 
  
-... in order to turn on and off Physics debugging.+... in order to turn off Physics debugging.
  
-We'd use the ''Command.AddAlias'' for this, but we'll first check how to use the command:+We'd use the ''Command.AddAlias'' for this, but we'll check how to use the command first:
  
 ''? Command.AddAlias'' ''? Command.AddAlias''
Line 478: Line 505:
 This command is only temporary. If you exit your game or application, it is gone. This command is only temporary. If you exit your game or application, it is gone.
  
-However, you can store alias in your config to persist them. You can do this by adding a ''Console'' section to your config file (say: BounceAlt.ini), and placing an alias:+However, you can store aliases in your config to persist them. You can do this by adding a ''Console'' section to your config file (say: orx.ini), and placing an alias:
  
 +<code ini>
 [Console] [Console]
 d = Config.SetValue Physics ShowDebug d = Config.SetValue Physics ShowDebug
 +</code>
  
-The above meanswhen using the ''d'' command, turn on or off physics debugging. You can use any letter or command you wish if it is not already used. You will need to restart your application to pick up the new setting and re-enter the Orx Console. +The above meanswhen using the ''d'' command and pass a valueit will turn on or off physics debugging. You can use any letter or command you wish if it is not already used. You will need to restart your application to pick up the new setting and re-enter the Orx Console. 
  
-You can even go further and have a tricky little toggle command to the same thing without passing a value. Try this:+You can even go further and have a tricky little toggle command to do the same thing without passing a value. If we used the following command sequence in the Console, Physics debug would toggle:
  
 +''> Config.GetValue Physics ShowDebug, > not <, Config.SetValue Physics ShowDebug <''
  
-??? HOW TO DO AS A CONFIG??? +However, we can't add this to the ''[Console]'' section as a command. It's something we could add to a track perhaps (too messy). Alternatively we can add it to a section, and collect it as part of Orx's lazy execution:
-21. Create toggle command for physics debug:+
  
-Config.GetValue Physics ShowDebug, > not <, Config.SetValue Physics ShowDebug < +<code ini> 
-?????+[ComplexCommandSets]  
 +TogglePhysicsDebug = % get Physics ShowDebug, > not <, set Physics ShowDebug <  
 +</code>
  
 +I'm not covering lazy execution in this guide, as that is another subject. However, do note that the ''%'' symbol here means, if the value is retrieved, it be be executed.
 +
 +Next, add the getting of the value (and execute it) as the ''d'' command:
 +
 +<code ini>
 +[Console] 
 +d = get "ComplexCommandSets TogglePhysicsDebug"
 +</code>
  
 +Restart your application, and type:
  
 +''d'' as a command in your Console to toggle the physics debug.
  
  
Line 515: Line 556:
 ==== Disabling the Orx Console or changing the key that activates it ==== ==== Disabling the Orx Console or changing the key that activates it ====
  
-Sometimes you might want want to choose a different key to toggle the Orx Console. You may not want to use the default backquote ''`'' key.+Sometimes you might want to choose a different key to toggle the Orx Console. You may not want to use the default backquote ''`'' key.
  
 You can do this by changing the ''ToggleKey'' with: You can do this by changing the ''ToggleKey'' with:
Line 521: Line 562:
 <code ini> <code ini>
 [Console] [Console]
-ToggleKey = \+ToggleKey = KEY_SPACE
 </code> </code>
  
Line 534: Line 575:
 ==== Dynamic Values versus Static Values ==== ==== Dynamic Values versus Static Values ====
  
-Some values in the config are static, and some are dynamic. It is not always clear which is which. Some values such as the ''ShowDebug'' property in the ''Physics'' section is dynamic. If you change this value, Orx will reload it and apply it immediately. Random value ranges are not dynamic. Lists are dynamic values:+Some values in the config are static, and some are dynamic. It is not always clear which is which. Some values such as the ''ShowDebug'' property in the ''Physics'' section is dynamic. If you change this value, Orx will reload it and apply it immediately. Random value ranges are dynamic. Lists are dynamic values:
  
 <code ini> <code ini>
Line 552: Line 593:
 </code> </code>
  
-By converting this property into a list, the value with become dynamic:+By converting this property into a list, the value will become dynamic:
  
 <code ini> <code ini>
Line 564: Line 605:
 Hopefully this guide was helpful and is giving you some great ideas of what is possible. Anything you do here in the Console can be used in tracks giving you the same power in-game. Hopefully this guide was helpful and is giving you some great ideas of what is possible. Anything you do here in the Console can be used in tracks giving you the same power in-game.
  
-Check out some of the track tutorials and examples to see how you can apply this.+Check out some of the [[en:tutorials:main#timelinestracks|track tutorials]] and [[en:examples:tracks_commands:main|track examples]] to see how you can apply this.
  
en/tutorials/config/guide_to_the_orx_console.1510195414.txt.gz · Last modified: 2017/11/08 22:43 (6 years ago) (external edit)