1 |
if (global.dialogue_open == false) |
2 |
{ |
3 |
if instance_exists(obj_pl) |
4 |
obj_pl.alarm[0] = 1 |
5 |
if (draw_alpha > 0) |
6 |
draw_alpha -= 0.2 |
7 |
else |
8 |
instance_destroy() |
9 |
return; |
10 |
} |
11 |
var MSG_ADVANCE = false |
12 |
var message_length = string_length(message[message_current]) |
13 |
if (message_reset == true) |
14 |
{ |
15 |
message_reset = false |
16 |
message = 0 |
17 |
event_perform(ev_create, 0) |
18 |
return; |
19 |
} |
20 |
if (keyboard_multicheck_pressed(1) && skippable == true) |
21 |
cutoff = message_length |
22 |
if (cutoff < message_length) |
23 |
{ |
24 |
if (counter == 0) |
25 |
{ |
26 |
cutoff += 1 |
27 |
message_length = string_length(message[message_current]) |
28 |
if (cutoff < message_length && (cutoff % 1) == 0) |
29 |
{ |
30 |
switch string_char_at(message[message_current], cutoff) |
31 |
{ |
32 |
case " ": |
33 |
case ".": |
34 |
break |
35 |
default: |
36 |
audio_play_sound(sndfnt, 1, false) |
37 |
break |
38 |
} |
39 |
|
40 |
} |
41 |
} |
42 |
} |
43 |
else if (keyboard_multicheck_pressed(0) && skippable == true) |
44 |
{ |
45 |
if (choice == false) |
46 |
MSG_ADVANCE = true |
47 |
} |
48 |
if (message_timer > -1 && cutoff == message_length) |
49 |
{ |
50 |
if (mT == -1) |
51 |
mT = message_timer |
52 |
if (mT > 0) |
53 |
mT -= 1 |
54 |
else if (mT == 0) |
55 |
{ |
56 |
mT = -1 |
57 |
MSG_ADVANCE = true |
58 |
} |
59 |
} |
60 |
scr_text_counter_customscr_text_counter_customfunction scr_text_counter_custom() //gml_Script_scr_text_counter_custom
{
var current_char = string_char_at(message[message_current], cutoff)
var counter_max = 1
var message_length = string_length(message[message_current])
var pause_duration = 5
if (cutoff > 0 && cutoff < message_length)
{
switch current_char
{
case ".":
case ",":
case "?":
case "!":
counter_max = pause_duration
break
default:
counter_max = 1
}
counter += argument[0]
if (counter >= counter_max)
counter = 0
}
else
counter = 0
} (0.2) |
61 |
script_execute(gml_Script_scr_text_choices) |
62 |
if (MSG_ADVANCE || force_skip) |
63 |
{ |
64 |
if ((message_current + 1) < array_length_1d(message)) |
65 |
{ |
66 |
message_current += 1 |
67 |
cutoff = 0 |
68 |
} |
69 |
else |
70 |
global.dialogue_open = false |
71 |
force_skip = false |
72 |
} |