Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_npc_cardguy_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
if (interact == true)
3
    interact_hold = true;
4
if (interact_hold == true)
5
{
6
    is_talking = 1;
7
    if (scene == 0)
8
    {
9
        scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() { global.cutscene = true; obj_pl.state = scr_frozen_state; obj_pl.image_index = 0; obj_pl.image_speed = 0; }
();
10
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
11
        with (msg)
12
        {
13
            if (other.npc_flag == 0)
14
            {
15
                ch_msg = 4;
16
                ch[1] = "Sure";
17
                ch[2] = "Nope";
18
                message[0] = "* Greetings.";
19
                message[1] = "* May I interest you in a game of#  Six-Shooter?";
20
                message[2] = "* It is a simple card game of the#  matching variety.";
21
                message[3] = "* It costs 3G to play with a#  potential of profit.";
22
                message[4] = "* Intrigued?";
23
                if (outcome == 1)
24
                {
25
                    if (global.player_gold < 3)
26
                    {
27
                        instance_destroy();
28
                        other.scene = 4;
29
                        exit;
30
                    }
31
                    message[5] = "* I will explain its rules so#  listen carefully.";
32
                }
33
                if (outcome == 2)
34
                {
35
                    message[5] = "* Very well.";
36
                    other.interact_hold = false;
37
                    global.cutscene = false;
38
                }
39
                if (!global.dialogue_open)
40
                {
41
                    other.npc_flag = 1;
42
                    other.scene = 1;
43
                }
44
            }
45
            else if (other.npc_flag == 1)
46
            {
47
                ch_msg = 0;
48
                ch[1] = "Yes";
49
                ch[2] = "No thanks";
50
                message[0] = "* Are you interested in a round#  of Six-Shooter?";
51
                if (outcome == 1)
52
                {
53
                    message[1] = "* Then let us play.";
54
                    other.scene = 2;
55
                }
56
                if (outcome == 2)
57
                {
58
                    message[1] = "* Very well.";
59
                    other.interact_hold = false;
60
                    global.cutscene = false;
61
                }
62
                if (!global.dialogue_open)
63
                    other.scene = 2;
64
            }
65
        }
66
    }
67
    else if (scene == 1)
68
    {
69
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
70
        with (msg)
71
        {
72
            ch_msg = 11;
73
            ch[1] = "Yes";
74
            ch[2] = "No";
75
            message[0] = "* A stack of 36 cards will be#  split into 20, then laid on the#  table separately.";
76
            message[1] = "* There are six card types, each#  with a different familiar face.";
77
            message[2] = "* You must match cards of the#  same face but only if they are#  touching.";
78
            message[3] = "* Once two are matched, they will#  be removed from the grid.";
79
            message[4] = "* Two more cards from the#  reserved 16-card-deck will#  replace them.";
80
            message[5] = "* Your goal is to empty the table#  by matching every card.";
81
            message[6] = "* If you win in under 45 seconds,#  you will be rewarded 25G.";
82
            message[7] = "* Under a minute, and you will be#  rewarded 15G.";
83
            message[8] = "* Any time after that will allow#  you to break even with 3G.";
84
            message[9] = "* If the deck is empty and there#  are no possible matches left...";
85
            message[10] = "* You will lose with no reward.";
86
            message[11] = "* Do you understand?";
87
            if (outcome == 1)
88
            {
89
                message[12] = "* Let us play.";
90
                other.scene = 2;
91
            }
92
            if (outcome == 2)
93
                message[12] = "* I shall repeat them in that case.";
94
        }
95
    }
96
    else if (scene == 2)
97
    {
98
        if (global.dialogue_open)
99
            exit;
100
        if (global.player_gold < 3)
101
        {
102
            other.scene = 4;
103
            exit;
104
        }
105
        else
106
        {
107
            global.player_gold -= 3;
108
        }
109
        if (instance_exists(obj_barn_dynamic_music))
110
            audio_sound_gain(mus_the_wild_east_barn, 0, 300);
111
        else
112
            audio_sound_gain(obj_radio.current_song, 0, 300);
113
        if (!instance_exists(obj_card_game_controller))
114
            instance_create(0, 0, obj_card_game_controller);
115
        scene++;
116
    }
117
    else if (scene == 3)
118
    {
119
        if (instance_exists(obj_card_game_controller))
120
            exit;
121
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
122
        with (msg)
123
        {
124
            ch_msg = 1;
125
            ch[1] = "Sure";
126
            ch[2] = "Nope";
127
            switch (other.card_game_result)
128
            {
129
                case 0:
130
                    message[0] = "* A shame.";
131
                    break;
132
                case 1:
133
                    message[0] = "* An honest effort.";
134
                    break;
135
                case 2:
136
                    message[0] = "* Well done.";
137
                    break;
138
                case 3:
139
                    message[0] = "* A most admirable victory.";
140
                    break;
141
            }
142
            message[1] = "* Would you like to play again?";
143
            if (outcome == 1)
144
            {
145
                message[2] = "* Then let us play.";
146
                other.scene = 2;
147
            }
148
            if (outcome == 2)
149
            {
150
                message[2] = "* Very well.";
151
                other.interact_hold = false;
152
                other.scene = 0;
153
                global.cutscene = false;
154
                scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(arg0, arg1) { var snd = arg0; var fade_len = arg1; if (!audio_is_playing(snd)) return false; audio_sound_gain(snd, 0, fade_len); if (instance_exists(obj_audio_fade_helper)) { with (obj_audio_fade_helper) { if (audio_to_fade == snd) return false; } } with (instance_create(0, 0, obj_audio_fade_helper)) audio_to_fade = snd; }
(485, 500);
155
                if (instance_exists(obj_barn_dynamic_music))
156
                    audio_sound_gain(mus_the_wild_east_barn, 1, 800);
157
                else
158
                    audio_sound_gain(obj_radio.current_song, 1, 300);
159
            }
160
        }
161
    }
162
    else if (scene == 4)
163
    {
164
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
165
        with (msg)
166
        {
167
            message[0] = "* I am afraid you lack sufficient#  funds.";
168
            message[1] = "* Farewell.";
169
        }
170
        if (audio_is_playing(mus_card_game))
171
        {
172
            scr_audio_fade_out
scr_audio_fade_out

function scr_audio_fade_out(arg0, arg1) { var snd = arg0; var fade_len = arg1; if (!audio_is_playing(snd)) return false; audio_sound_gain(snd, 0, fade_len); if (instance_exists(obj_audio_fade_helper)) { with (obj_audio_fade_helper) { if (audio_to_fade == snd) return false; } } with (instance_create(0, 0, obj_audio_fade_helper)) audio_to_fade = snd; }
(485, 500);
173
            if (instance_exists(obj_barn_dynamic_music))
174
                audio_sound_gain(mus_the_wild_east_barn, 1, 800);
175
            else
176
                audio_sound_gain(obj_radio.current_song, 1, 800);
177
        }
178
        if (!global.dialogue_open)
179
        {
180
            scene = 0;
181
            interact_hold = false;
182
            global.cutscene = false;
183
        }
184
    }
185
}