This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
script_syntax [2023/02/13 23:11] – justin | script_syntax [2023/11/06 14:11] – justin | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- | ---- | ||
- | **Bauxite**, | + | **Bauxite**, |
=====Statement Syntax===== | =====Statement Syntax===== | ||
Line 206: | Line 206: | ||
</ | </ | ||
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, | ||
+ | |||
+ | **Examples: | ||
+ | <code bauxite> | ||
+ | $result = 1d6; | ||
+ | </ | ||
+ | Gives the result of rolling one six-sided die. | ||
+ | |||
+ | <code bauxite> | ||
+ | $result = 2d8 + 5; | ||
+ | </ | ||
+ | Gives the result of rolling two eight-sided dice, adding them together, then adding 5 to the total. | ||
====Range==== | ====Range==== | ||
Line 234: | Line 248: | ||
The **duplicate** function creates a unique copy of an [[array]] or [[codex]]. Since the copy is unique, you can modify its data without affecting the original [[array]] or [[codex]]. | The **duplicate** function creates a unique copy of an [[array]] or [[codex]]. Since the copy is unique, you can modify its data without affecting the original [[array]] or [[codex]]. | ||
- | Using the code below, **$items_copy** will contain a reference to the original | + | With the code below where the value in **$items** is simply stored into another variable, in this case **$items_copy**, the new variable or property |
<code bauxite> | <code bauxite> | ||
$items = codex[" | $items = codex[" | ||
$items_copy = $items; | $items_copy = $items; | ||
$items_copy[" | $items_copy[" | ||
+ | print($items[" | ||
+ | print($items_copy[" | ||
</ | </ | ||
- | In the example below, a copy of **$items** is made using the " | + | In the example below, a copy of **$items** is made using the " |
<code bauxite> | <code bauxite> | ||
$items = codex[" | $items = codex[" | ||
- | $items_copy = duplicate($item_data); | + | $items_copy = duplicate($items); |
$items_copy[" | $items_copy[" | ||
+ | print($items[" | ||
+ | print($items_copy[" | ||
</ | </ | ||