1 |
function scr_draw_text_effect_twitchy_textbox_battle_item_usescr_draw_text_effect_twitchy_textbox_battle_item_usefunction scr_draw_text_effect_twitchy_textbox_battle_item_use()
{
var twitchy_text_probability = global.twitchy_text_probability;
var twitchy_text_intensity = global.twitchy_text_intensity;
str_indent = "";
str_indent_count = 0;
str_offset = -string_width(string_hash_to_newline(string_copy("A", 1, 1)));
battle_item_use_string_count = string_length(battle_item_use_string);
for (var i = 1; i <= battle_item_use_string_count; i += 1)
{
twitchy_text_offset_x = 0;
twitchy_text_offset_y = 0;
twitchy_text_number = irandom_range(1, twitchy_text_probability);
if (twitchy_text_number == twitchy_text_probability)
{
twitch_direction = irandom_range(1, 4);
switch (twitch_direction)
{
case 1:
twitchy_text_offset_x = 1;
twitchy_text_offset_y = 0;
break;
case 2:
twitchy_text_offset_x = -1;
twitchy_text_offset_y = 0;
break;
case 3:
twitchy_text_offset_x = 0;
twitchy_text_offset_y = 1;
break;
case 4:
twitchy_text_offset_x = 0;
twitchy_text_offset_y = -1;
break;
}
}
str_char = string_char_at(battle_item_use_string, i);
if (str_char == "#")
{
str_indent_count += 1;
if (str_indent_count == 1)
str_indent = "#";
else if (str_indent_count == 2)
str_indent = "##";
str_offset = -string_width(string_hash_to_newline(string_copy("A", 1, 1))) * 2;
}
str_offset += string_width(string_hash_to_newline(string_copy("A", 1, 1)));
if (string_lettersdigits(str_char) == "")
draw_text(obj_dialogue_box_battle.x + 20 + str_offset, obj_dialogue_box_battle.y + 20, string_hash_to_newline(str_indent + str_char));
else
draw_text(obj_dialogue_box_battle.x + 20 + str_offset + (twitchy_text_offset_x * twitchy_text_intensity), obj_dialogue_box_battle.y + 20 + (twitchy_text_offset_y * twitchy_text_intensity), string_hash_to_newline(str_indent + str_char));
}
} () |
2 |
{ |
3 |
var twitchy_text_probability = global.twitchy_text_probability; |
4 |
var twitchy_text_intensity = global.twitchy_text_intensity; |
5 |
str_indent = ""; |
6 |
str_indent_count = 0; |
7 |
str_offset = -string_width(string_hash_to_newline(string_copy("A", 1, 1))); |
8 |
battle_item_use_string_count = string_length(battle_item_use_string); |
9 |
for (var i = 1; i <= battle_item_use_string_count; i += 1) |
10 |
{ |
11 |
twitchy_text_offset_x = 0; |
12 |
twitchy_text_offset_y = 0; |
13 |
twitchy_text_number = irandom_range(1, twitchy_text_probability); |
14 |
if (twitchy_text_number == twitchy_text_probability) |
15 |
{ |
16 |
twitch_direction = irandom_range(1, 4); |
17 |
switch (twitch_direction) |
18 |
{ |
19 |
case 1: |
20 |
twitchy_text_offset_x = 1; |
21 |
twitchy_text_offset_y = 0; |
22 |
break; |
23 |
case 2: |
24 |
twitchy_text_offset_x = -1; |
25 |
twitchy_text_offset_y = 0; |
26 |
break; |
27 |
case 3: |
28 |
twitchy_text_offset_x = 0; |
29 |
twitchy_text_offset_y = 1; |
30 |
break; |
31 |
case 4: |
32 |
twitchy_text_offset_x = 0; |
33 |
twitchy_text_offset_y = -1; |
34 |
break; |
35 |
} |
36 |
} |
37 |
str_char = string_char_at(battle_item_use_string, i); |
38 |
if (str_char == "#") |
39 |
{ |
40 |
str_indent_count += 1; |
41 |
if (str_indent_count == 1) |
42 |
str_indent = "#"; |
43 |
else if (str_indent_count == 2) |
44 |
str_indent = "##"; |
45 |
str_offset = -string_width(string_hash_to_newline(string_copy("A", 1, 1))) * 2; |
46 |
} |
47 |
str_offset += string_width(string_hash_to_newline(string_copy("A", 1, 1))); |
48 |
if (string_lettersdigits(str_char) == "") |
49 |
draw_text(obj_dialogue_box_battle.x + 20 + str_offset, obj_dialogue_box_battle.y + 20, string_hash_to_newline(str_indent + str_char)); |
50 |
else |
51 |
draw_text(obj_dialogue_box_battle.x + 20 + str_offset + (twitchy_text_offset_x * twitchy_text_intensity), obj_dialogue_box_battle.y + 20 + (twitchy_text_offset_y * twitchy_text_intensity), string_hash_to_newline(str_indent + str_char)); |
52 |
} |
53 |
} |