User Tools

Site Tools


script_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
Last revisionBoth sides next revision
script_syntax [2023/02/13 23:20] justinscript_syntax [2023/11/06 14:11] justin
Line 2: Line 2:
 ---- ----
  
-**Bauxite**, the scripting language for RPG in a Box, is a simple imperative language designed specifically for the engine. The syntax for Bauxite is useful to know for creating [[quick script|quick scripts]] for tiles and objects in the [[Map Editor]] or for script nodes in the [[Dialogue Editor]].+**Bauxite**, the scripting language for RPG in a Box, is designed specifically for the engine. The syntax for Bauxite is useful to know for creating [[quick script|quick scripts]] for tiles and objects in the [[Map Editor]] or for script nodes in the [[Dialogue Editor]].
  
 =====Statement Syntax===== =====Statement Syntax=====
Line 206: Line 206:
 </code> </code>
 Gives either ITEM_0001 or ITEM_0002 to the player, with a 25% chance that the item will be ITEM_0001. Gives either ITEM_0001 or ITEM_0002 to the player, with a 25% chance that the item will be ITEM_0001.
 +
 +====Dice Rolls====
 +In addition to the random number function, Bauxite also supports a dice notation similar to that of Dungeons & Dragons. Specifically, **XdY**, where "X" is the number of dice to roll and "Y" is how many sides the dice have.
 +
 +**Examples:**
 +<code bauxite>
 +$result = 1d6;
 +</code>
 +Gives the result of rolling one six-sided die.
 +
 +<code bauxite>
 +$result = 2d8 + 5;
 +</code>
 +Gives the result of rolling two eight-sided dice, adding them together, then adding 5 to the total.
  
 ====Range==== ====Range====
Line 243: Line 257:
 </code> </code>
  
-In the example below, a copy of **$items** is made using the "Duplicate" function. Since it's now a unique copy of the [[codex]], if the "count" key is changed to 10 for **$items_copy**, the original **$items** [[codex]] will remain unchanged. Therefore, the first "print" statement will display 5, while the second "print" statement will display 10.+In the example below, a copy of **$items** is made using the "Duplicate" function. Since it's now a unique copy of the [[codex]], if the "count" key is changed to 10 for the **$items_copy** variable, the original **$items** [[codex]] will remain unchanged. Therefore, the first "print" statement will display 5, while the second "print" statement will display 10.
 <code bauxite> <code bauxite>
 $items = codex["id": "ITEM_0001", "count": 5]; $items = codex["id": "ITEM_0001", "count": 5];
-$items_copy = duplicate($item_data);+$items_copy = duplicate($items);
 $items_copy["count"] = 10; $items_copy["count"] = 10;
 print($items["count"]); print($items["count"]);
script_syntax.txt · Last modified: 2023/11/06 14:13 by justin