1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
// Evol functions.
// Authors:
// gumi
// Reid
// Description:
// script terminator functions
// goodbye_msg
// Tell a random goodbye sentence.
// Variables:
// .@rand = Random number between the number of "goodbye" choice.
function script goodbye_msg {
setarray .byemsg$[0],
l("See you!"),
l("See you later!"),
l("See you soon!"),
l("Bye!"),
l("Farewell."),
l("Bye then!"),
l("Goodbye."),
l("Bye for now."),
l("Talk to you soon!"),
l("Talk to you later!"),
l("Have a good day!"),
l("Cheers!"),
l("Take care!");
return .byemsg$[rand(getarraysize(.byemsg$))];
}
// cwarp
// Closes the dialog, then warps the player.
// You almost always want to use this instead of `warp`.
// usage:
// cwarp;
// cwarp x, y;
// cwarp map, x, y;
function script cwarp {
.@map$ = getarg(0, "");
.@x = getarg(1, 0);
.@y = getarg(2, 0);
if (getargcount() > 0 && getargcount() < 3)
{
.@npc$ = strnpcinfo(0);
.@map$ = getvariableofnpc(.map$, .@npc$);
.@x = getarg(0);
.@y = getarg(1);
}
getmapxy .@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC; // get char location
closedialog; // XXX: maybe send closeclientdialog in the future
if (getargcount() < 1)
{
warp .@pc_map$, .@pc_x, .@pc_y; // no arguments, just refresh
close;
}
if (.@map$ == .@pc_map$)
{
if (.@pc_x == .@x && .@pc_y == .@y)
{
close; // same location, don't move
}
else
{
slide .@x, .@y; // same map, slide instead of full warp
close;
}
}
warp .@map$, .@x, .@y; // different map, warp to given location
close;
}
// cshop
// closes the dialog, then opens a shop
// if no npc is given, calls "#<npc> $"
function script cshop {
closedialog; // XXX: maybe send closeclientdialog in the future
shop getarg(0, "#" + strnpcinfo(0) + " $");
//close; => the shop buildin already sends close, and is a terminator itself
}
// cstorage
// closes the dialog, then opens storage
function script cstorage {
closedialog; // XXX: maybe send closeclientdialog in the future
openstorage;
close;
}
// bye
// closes the dialog without waiting for the player to press close
// can also display an emote
function script bye {
.@emote = getarg(0, -1);
closedialog; // XXX: maybe send closeclientdialog in the future
if (.@emote >= 0)
emotion .@emote;
close;
}
// goodbye
// same as bye, but also displays a canned message
// can also display an emote
function script goodbye {
npctalkonce(goodbye_msg());
bye getarg(0, -1);
}
// goodbye2
// Waits for the player to press close, displays a canned message,
// ends execution.
// Can also display an emote
function script goodbye2 {
.@emote = getarg(0, -1);
close2;
npctalkonce(goodbye_msg());
if (.@emote >= 0)
emotion .@emote;
end;
}
|