This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
script_syntax [2022/06/17 22:16] – justin | script_syntax [2023/11/06 14:13] (current) – 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==== | ||
+ | Bauxite also supports a dice notation similar to that of Dungeons & Dragons for generating random numbers. Specifically, | ||
+ | |||
+ | **Examples: | ||
+ | <code bauxite> | ||
+ | $result = 1d20; | ||
+ | </ | ||
+ | Gives the result of rolling a twenty-sided die. | ||
+ | |||
+ | <code bauxite> | ||
+ | $result = 2d8 + 1d6; | ||
+ | </ | ||
+ | Gives the result of rolling two eight-sided dice and one six-sided die. | ||
====Range==== | ====Range==== | ||
Line 230: | Line 244: | ||
</ | </ | ||
List of integers from 5 to, but not including, 0, with an increment of -1 (i.e. 5, 4, 3, 2, 1). | List of integers from 5 to, but not including, 0, with an increment of -1 (i.e. 5, 4, 3, 2, 1). | ||
+ | |||
+ | ====Duplicate==== | ||
+ | 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]]. | ||
+ | |||
+ | With the code below where the value in **$items** is simply stored into another variable, in this case **$items_copy**, | ||
+ | <code bauxite> | ||
+ | $items = codex[" | ||
+ | $items_copy = $items; | ||
+ | $items_copy[" | ||
+ | print($items[" | ||
+ | print($items_copy[" | ||
+ | </ | ||
+ | |||
+ | In the example below, a copy of **$items** is made using the " | ||
+ | <code bauxite> | ||
+ | $items = codex[" | ||
+ | $items_copy = duplicate($items); | ||
+ | $items_copy[" | ||
+ | print($items[" | ||
+ | print($items_copy[" | ||
+ | </ | ||
====Inverse==== | ====Inverse==== |