This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
script_syntax [2021/04/21 19:04] – justin | script_syntax [2021/05/05 12:12] – justin | ||
---|---|---|---|
Line 32: | Line 32: | ||
**Examples: | **Examples: | ||
<code bauxite> | <code bauxite> | ||
- | $rand_num = random(1, 20) | + | $rand_num = random(1, 20); |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
- | entity[" | + | entity[" |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
- | player.stat[" | + | player.stat[" |
</ | </ | ||
Line 50: | Line 50: | ||
<code bauxite> | <code bauxite> | ||
if global.property[" | if global.property[" | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
Line 57: | Line 57: | ||
| | ||
| | ||
- | | + | |
else | else | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
$rand_num = random(1, 20); | $rand_num = random(1, 20); | ||
if $rand_num > 15 then | if $rand_num > 15 then | ||
- | | + | |
elseif $rand_num > 10 then | elseif $rand_num > 10 then | ||
- | | + | |
else | else | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Line 82: | Line 82: | ||
while global.property[" | while global.property[" | ||
| | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Line 93: | Line 93: | ||
display_message(" | display_message(" | ||
for $slime_entity in group[" | for $slime_entity in group[" | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Deals 5 damage to each [[entity]] in the " | Deals 5 damage to each [[entity]] in the " | ||
+ | <code bauxite> | ||
+ | for $item_id in $item_list do | ||
+ | | ||
+ | end; | ||
+ | </ | ||
+ | Gives one of every item in $item_list to the player by iterating over the entire [[array]]. This assumes you have previously defined an $item_list variable that contains an [[array]] of [[string|string]] values for each item ID. | ||
<code bauxite> | <code bauxite> | ||
for $i in range(1, 4) do | for $i in range(1, 4) do | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Gives the following items to the player: one of ITEM_0001, two of ITEM_0002, and three of ITEM_0003. | Gives the following items to the player: one of ITEM_0001, two of ITEM_0002, and three of ITEM_0003. | ||
Line 131: | Line 137: | ||
<code bauxite> | <code bauxite> | ||
for $slime_entity in group[" | for $slime_entity in group[" | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Deals 2 damage to all entities in the " | Deals 2 damage to all entities in the " | ||
<code bauxite> | <code bauxite> | ||
if player.tags contains " | if player.tags contains " | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Displays the message if the player model' | Displays the message if the player model' | ||
Line 145: | Line 151: | ||
load_map($dungeon_map_list[random(0, | load_map($dungeon_map_list[random(0, | ||
$item_list = array[" | $item_list = array[" | ||
- | give_item($item_list[random(0, | + | give_item($item_list[random(0, |
</ | </ | ||
Loads a random map from the " | Loads a random map from the " | ||
Line 155: | Line 161: | ||
<code bauxite> | <code bauxite> | ||
if x == null then | if x == null then | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
if entity[" | if entity[" | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
Line 167: | Line 173: | ||
$target_tile = tile[7, 8, 0]; | $target_tile = tile[7, 8, 0]; | ||
if $target_tile == null then | if $target_tile == null then | ||
- | | + | |
else | else | ||
- | | + | |
- | end | + | end; |
</ | </ | ||
Line 183: | Line 189: | ||
**Examples: | **Examples: | ||
<code bauxite> | <code bauxite> | ||
- | wait(random(1, | + | wait(random(1, |
</ | </ | ||
Waits for a random amount of time between 1 and 5 seconds. | Waits for a random amount of time between 1 and 5 seconds. | ||
Line 189: | Line 195: | ||
<code bauxite> | <code bauxite> | ||
if random(0, 100) <= 25 then | if random(0, 100) <= 25 then | ||
- | give_item(" | + | give_item(" |
else | else | ||
- | give_item(" | + | give_item(" |
- | end | + | end; |
</ | </ | ||
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. | ||
Line 233: | Line 239: | ||
**Examples: | **Examples: | ||
<code bauxite> | <code bauxite> | ||
- | rotate_player_to_direction(inverse(entity[" | + | rotate_player_to_direction(inverse(entity[" |
</ | </ | ||
Rotates the player character to be facing in the opposite direction that the goblin is facing. | Rotates the player character to be facing in the opposite direction that the goblin is facing. | ||
Line 243: | Line 249: | ||
<code bauxite> | <code bauxite> | ||
$counter += 1; | $counter += 1; | ||
- | $new_tile_id = " | + | $new_tile_id = " |
</ | </ | ||
<code bauxite> | <code bauxite> | ||
$string_with_num = " | $string_with_num = " | ||
- | $new_value = num($string_with_num) + 1 | + | $new_value = num($string_with_num) + 1; |
</ | </ | ||
- | ~~NOCACHE~~ | ||
~~NOTOC~~ | ~~NOTOC~~ |