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() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_scr_frozen_state obj_pl.image_index = 0 obj_pl.image_speed = 0 }
()
10
        scr_text
scr_text

function scr_text() //gml_Script_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
                        return;
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() //gml_Script_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
            return;
100
        if (global.player_gold < 3)
101
        {
102
            other.scene = 4
103
            return;
104
        }
105
        else
106
            global.player_gold -= 3
107
        if instance_exists(obj_barn_dynamic_music)
108
            audio_sound_gain(mus_the_wild_east_barn, 0, 300)
109
        else
110
            audio_sound_gain(obj_radio.current_song, 0, 300)
111
        if (!instance_exists(obj_card_game_controller))
112
            instance_create(0, 0, obj_card_game_controller)
113
        scene++
114
    }
115
    else if (scene == 3)
116
    {
117
        if instance_exists(obj_card_game_controller)
118
            return;
119
        scr_text
scr_text

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

function scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out { var snd = argument0 var fade_len = argument1 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 }
(mus_card_game, 500)
154
                if instance_exists(obj_barn_dynamic_music)
155
                    audio_sound_gain(mus_the_wild_east_barn, 1, 800)
156
                else
157
                    audio_sound_gain(obj_radio.current_song, 1, 300)
158
            }
159
        }
160
    }
161
    else if (scene == 4)
162
    {
163
        scr_text
scr_text

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

function scr_audio_fade_out(argument0, argument1) //gml_Script_scr_audio_fade_out { var snd = argument0 var fade_len = argument1 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 }
(mus_card_game, 500)
172
            if instance_exists(obj_barn_dynamic_music)
173
                audio_sound_gain(mus_the_wild_east_barn, 1, 800)
174
            else
175
                audio_sound_gain(obj_radio.current_song, 1, 800)
176
        }
177
        if (!global.dialogue_open)
178
        {
179
            scene = 0
180
            interact_hold = false
181
            global.cutscene = false
182
        }
183
    }
184
}