-
Notifications
You must be signed in to change notification settings - Fork 0
/
stickmud.tin
executable file
·179 lines (168 loc) · 5.89 KB
/
stickmud.tin
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ALIAS {^login$}
{
#if {!&{connected}}
{
#nop {If your MUD supports SSL, set the ports here to the ports for your MUD.};
#if {$mudPort == 3102}
{
#ssl {$mudSessionName} {$mudAddress} {$mudPort}
};
#else
{
#session {$mudSessionName} {$mudAddress} {$mudPort}
}
};
#else
{
#send {%0}
}
}
{8}
#ALIAS {^CLEAN$}
{
#nop {Run clean before using the #write command on this file.};
#script {for module in modules/*.tin ; do echo "#class {$(basename "$module" .tin)} {kill}";done};
#unvariable {HOME};
#unvariable {result};
#showme {Cleaned environment of classes.}
}
{9}
#ALIAS {^CMOTD$}
{
#echo {@separator{}};
#system {fold -w $(tput cols) -s MOTD};
#echo {@separator{}}
}
{9}
#ALIAS {^mod{kill|load|reload} %S$}
{
CSAVE;
#nop {reload all modules};
#if {{%0} == {modreload all}}
{
#script {script} {for module in modules/*.tin ; do echo "$(basename "$module" .tin)";done};
#foreach {${script[%*]}} {z}
{
#if {&{${z}Shutdown}}
{
${${z}Shutdown}
}
};
#script {for module in modules/*.tin ; do if [ "$module" != "modules/msdp.tin" ] && [ "$module" != "modules/gmcp.tin" ] ; then echo "#class {$(basename "$module" .tin)} {kill};#class {$(basename "$module" .tin)} {read} {$module}";fi;done};
#foreach {${script[%*]}} {z}
{
#if {&{${z}Startup}}
{
#class {$z} {open};
${${z}Startup};
#class {$z} {close}
}
};
#unvariable {script};
#unvariable {z};
NOTIFY All modules except msdp and gmcp reloaded.;
NOTIFY To reload MSDP or GMCP you must close and reopen tintin.
};
#else
{
#nop {Kill, load, or reload a specified module.};
#if {{%2} != {{msdp|gmcp}}}
{
#if {{%1} == {{kill|reload}}}
{
NOTIFY Killing class %2;
#if {&{%2Shutdown}}
{
${%2Shutdown}
};
#class {%2} {kill}
};
#if {{%1} == {{load|reload}}}
{
#class {%2} {read} {modules/%2.tin};
#if {&{%2Startup}}
{
#class {%2} {open};
${%2Startup};
#class {%2} {close}
};
NOTIFY Loaded class %2
}
};
#else
{
NOTIFY Cowardly refusing to touch the %2 module. If you really want to do this, do it manually or close your client and restart.
}
}
}
{9}
#EVENT {SESSION CONNECTED}
{
SYNTH_PLAY connectedSound;
#nop {Set connected to true so if you accidentally type login it won't try to login twice.};
#variable {connected} {true};
#nop {Create the log directory if it doesn't exist. Log files are based on date and time.};
#script {logFilePath} {date +'log/%Y/%B/%d/'};
#variable {logFilePath} {${HOME}/${logFilePath[1]}};
#script {logFileName} {date +'%I_%M%p.log'};
#system {mkdir -p $logFilePath};
#log {overwrite} {${logFilePath}${logFileName[1]}};
#variable CLIENT_NAME %0;
#variable CLIENT_VERSION %1
}
#EVENT {PROGRAM START}
{
#nop {Clear the screen so that generic startup messages are not shown.};
#system {clear};
#nop {Set scrollable region to all but the top line and bottom two lines.};
#local {cols} {};
#local {rows} {};
#screen get rows rows;
#screen get cols cols;
#math {rows} {$rows - 2};
#nop #screen {scroll} {2} {1} {$rows} {$cols};
#split {1} {1};
#nop {Set the home directory variable.};
#script {HOME} {if [ -z "$XDG_CONFIG_HOME" ] ; then if ! [ -d "$HOME/.config/${tintinPackName}/" ] ; then mkdir -p "$HOME/.config/${tintinPackName}";fi;echo -n "$HOME/.config/${tintinPackName}";else if ! [ -d "$XDG_CONFIG_HOME/${tintinPackName}/" ] ; then mkdir -p "$XDG_CONFIG_HOME/-${tintinPackName}/";fi;echo -n "$XDG_CONFIG_HOME/${tintinPackName}";fi};
#variable {HOME} {${HOME[1]}};
#replace {HOME} {-n } {};
#nop {Load all the .tin files in the modules directory in classes named after the module name.};
#script {for module in modules/*.tin ; do echo "#class {$(basename "$module" .tin)} {read} {$module}";done};
#script {script} {for module in modules/*.tin ; do echo "$(basename "$module" .tin)";done};
#foreach {${script[%*]}} {z}
{
#if {&{${z}Startup}}
{
#class {$z} {open};
${${z}Startup};
#class {$z} {close}
}
};
#showme {@separator{}} {1};
#showme {@separator{}} {-2};
#nop {Display intro message.};
#echo {@separator{}};
#system {fold -w $(tput cols) -s MOTD};
#echo {@separator{}};
#echo {To get started type login};
#unvariable script;
#unvariable z
}
#EVENT {SESSION CONNECTED}
{
SYNTH_PLAY connectedSound;
#nop {Set connected to true so if you accidentally type login it won't try to login twice.};
#variable {connected} {true};
#nop {Create the log directory if it doesn't exist. Log files are based on date and time.};
#script {logFilePath} {date +'log/%Y/%B/%d/'};
#variable {logFilePath} {${HOME}/${logFilePath[1]}};
#script {logFileName} {date +'%I_%M%p.log'};
#system {mkdir -p $logFilePath};
#log {overwrite} {${logFilePath}${logFileName[1]}};
#var {CLIENT_NAME} {%0};
#var {CLIENT_VERSION} {%1}
}
#VARIABLE {CLIENT_NAME} {}
#VARIABLE {CLIENT_VERSION} {}
#VARIABLE {motd} {}
#VARIABLE {tintinPackName} {tintin-stickmud}