forked from tessa-/zscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation.lyx
593 lines (466 loc) · 10.3 KB
/
documentation.lyx
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
#LyX 2.0 created this file. For more info see http://www.lyx.org/
\lyxformat 413
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 1cm
\topmargin 1cm
\rightmargin 1cm
\bottommargin 1cm
\headheight 1cm
\headsep 1cm
\footskip 1cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
ZScripts Framework Server Scripts MSI/API Documentation
\end_layout
\begin_layout Paragraph
NOTE: This document only documents the MSI (Module Scripting Interface),
not end modules (e.g., ban_command) that aren't intended to be required by
other modules.
\end_layout
\begin_layout Part
CORE (main)
\end_layout
\begin_layout Description
loadModule(modname) Takes modname, loads the module.
\end_layout
\begin_layout Description
unloadModule(modname) Unloads modname.
\end_layout
\begin_layout Description
reloadModule(modname) Reloads modname
\end_layout
\begin_layout Description
registerHandler(handlername,
\begin_inset space ~
\end_inset
object,
\begin_inset space ~
\end_inset
propname=handlername) Registers object[propname] as handlername in the script
events.
\end_layout
\begin_layout Description
log(message) Logs the message.
Note: Overridden by logs.js.
\end_layout
\begin_layout Description
broadcast(m) Deprecated.
\end_layout
\begin_layout Description
modules: Contains all the modules loaded.
\end_layout
\begin_layout Part
text
\end_layout
\begin_layout Description
escapeHTML(text) Escapes html in text
\end_layout
\begin_layout Description
stripHTML(text) Converts html to plaintext (works so-so.)
\end_layout
\begin_layout Part
util
\end_layout
\begin_layout Description
bind(object,
\begin_inset space ~
\end_inset
function) Binds function to object, returns the bind.
\end_layout
\begin_layout Description
shuffle(array) Shuffles array in place.
\end_layout
\begin_layout Description
inspect(variant) Returns a human readable representation of variant.
Plaintext and '
\backslash
n' separated.
\end_layout
\begin_layout Part
time
\end_layout
\begin_layout Description
conversionFactors[factor] Object key is e.g.,
\begin_inset Quotes eld
\end_inset
day
\begin_inset Quotes erd
\end_inset
, output is number of miliseconds per.
Some are approximations (e.g.
month)
\end_layout
\begin_layout Description
diffToStr(dif) Converts number of miliseconds into a string length of time
(e.g., 62000 ->
\begin_inset Quotes eld
\end_inset
1 hour, 2 seconds
\begin_inset Quotes erd
\end_inset
or something.
\end_layout
\begin_layout Description
strToDiff(str) Converts diff string to number of miliseconds.
May or may not work depending on the input formatting.
\end_layout
\begin_layout Part
theme
\end_layout
\begin_layout Description
scriptHTML Internal
\end_layout
\begin_layout Description
scriptText Internal
\end_layout
\begin_layout Description
warnHTML Internal
\end_layout
\begin_layout Description
gameHTML Internal
\end_layout
\begin_layout Description
INFO Constant for formatAs (default)
\end_layout
\begin_layout Description
WARN Constant for formatAs
\end_layout
\begin_layout Description
CRITICAL Constant for formatAs
\end_layout
\begin_layout Description
GAME Constant for formatAs
\end_layout
\begin_layout Description
TOUR Constant for formatAs
\end_layout
\begin_layout Description
formatAs(text,
\begin_inset space ~
\end_inset
const) format text as const, -1 for raw
\end_layout
\begin_layout Part
com
\end_layout
\begin_layout Description
message(users,
\begin_inset space ~
\end_inset
msg,
\begin_inset space ~
\end_inset
type,
\begin_inset space ~
\end_inset
html,
\begin_inset space ~
\end_inset
chans,
\begin_inset space ~
\end_inset
servercode) Sends msg to all users formatted as type (see theme, use constant
or -1), in any of chans (unless chan is null, then all chans.) If servercode
is truthy then append it to the logs prefixed with servercode.
\end_layout
\begin_layout Description
broadcast(msg,
\begin_inset space ~
\end_inset
type,
\begin_inset space ~
\end_inset
html,
\begin_inset space ~
\end_inset
chans) Like message but for all users.
\end_layout
\begin_layout Part
io
\end_layout
\begin_layout Description
openDB(dbname) Opens database dbname, returns dbname.
Must not already be open.
\end_layout
\begin_layout Description
closeDB(dbname) Closes DB dbname.
\end_layout
\begin_layout Description
flushDB(dbname) Writes out DB to file (semi-slow with large databases [>
~100,000 keypair])
\end_layout
\begin_layout Description
commitDB(dbname) Commits changes to DB to file (/usually/ faster)
\end_layout
\begin_layout Description
backupDB(dbname) Makes a backup of DB (semi-slow with big databases [> ~100,000
keypair])
\end_layout
\begin_layout Description
purgeDB(dbname) Unimplemented.
\end_layout
\begin_layout Description
markDB(dbname) Mark dbname as changed.
May or may not do anything.
Might break your code if you only use it sometimes but not never or always.
\end_layout
\begin_layout Description
readConfig(cfgname,
\begin_inset space ~
\end_inset
defaultConfig) Read config.
\end_layout
\begin_layout Description
writeConfig(cfgname) Write config (DEPRECATED)
\end_layout
\begin_layout Part
logs
\end_layout
\begin_layout Description
DEBUG Debug constant
\end_layout
\begin_layout Description
INFO Information constant
\end_layout
\begin_layout Description
WARN Warning constant
\end_layout
\begin_layout Description
ERROR Error constant
\end_layout
\begin_layout Description
CRITICAL Critical constant
\end_layout
\begin_layout Description
logMessage(levl,
\begin_inset space ~
\end_inset
msg) Logs the message.
\end_layout
\begin_layout Part
sched
\end_layout
\begin_layout Description
at(time,
\begin_inset space ~
\end_inset
function) Runs function at time.
(will be deprecated in future but not yet, haven't coded alternative yet)
\end_layout
\begin_layout Part
profile
\end_layout
\begin_layout Description
database Object that keeps profiles.
This is an I/O database opened with the I/O module.
\end_layout
\begin_layout Description
relationaldatabase Object discarded on reload that holds relational database
information.
\end_layout
\begin_layout Description
profileID(src) Gets profile id for src.
\end_layout
\begin_layout Description
lastName(profid) Last name of profile ID.
\end_layout
\begin_layout Description
profileNames(prof) Names of prof.
\end_layout
\begin_layout Description
profileIPs(prof)
\end_layout
\begin_layout Description
profileUpdateInfo(prof,
\begin_inset space ~
\end_inset
src) Updates profile information for src.
\end_layout
\begin_layout Description
registerPlayer(src) Registers src a profile.
\end_layout
\begin_layout Description
...
Complete docs later, this module is not very important and big.
\end_layout
\begin_layout Part
security
\end_layout
\begin_layout Description
checkUsers()
\end_layout
\begin_layout Description
checkUser(src) kicks banned users.
\end_layout
\begin_layout Description
profIsMuted(prof) Boolean if profile is muted.
\end_layout
\begin_layout Description
profIsBanned(prof) Boolean if profile is banned.
\end_layout
\begin_layout Description
getMute(prof) Gets mute object for profile.
\end_layout
\begin_layout Description
setMute(prof,
\begin_inset space ~
\end_inset
muteObj) Sets mute object on profile.
\end_layout
\begin_layout Description
getBan(prof) Gets ban object for profile.
\end_layout
\begin_layout Description
setBan(prof,
\begin_inset space ~
\end_inset
banObj) Sets ban object on profile.
\end_layout
\begin_layout Description
checkMute(prof) Checks users mute for expiry
\end_layout
\begin_layout Description
checkBan(prof) Checks ban for expiry
\end_layout
\begin_layout Description
removeMute(prof) Removes mute on prof
\end_layout
\begin_layout Description
removeBan(prof) Removes ban on prof
\end_layout
\begin_layout Part
commands
\end_layout
\begin_layout Description
registerCommand(name,
\begin_inset space ~
\end_inset
obj,
\begin_inset space ~
\end_inset
prop=name) Registers name from obj[prop].
Obj must be a module.
\end_layout
\begin_layout Description
unregisterCommand(name) Usually you don't need to use this, the command
is remove at the unload event.
\end_layout
\begin_layout Description
issueCommand(...) Don't use.
\end_layout
\begin_layout Paragraph
Command Objects are of the following form:
\end_layout
\begin_layout Description
perm(src,
\begin_inset space ~
\end_inset
cmd,
\begin_inset space ~
\end_inset
chan) A permission function.
\end_layout
\begin_layout Description
code(src,
\begin_inset space ~
\end_inset
cmd,
\begin_inset space ~
\end_inset
chan) Executes the command.
\end_layout
\begin_layout Description
desc Descibes the command
\end_layout
\begin_layout Description
options Object with key descriptions of the command's options.
\end_layout
\begin_layout Part
chat
\end_layout
\begin_layout Description
registerCapture(src,
\begin_inset space ~
\end_inset
func,
\begin_inset space ~
\end_inset
module) Registers the capture for the module to user src.
\end_layout
\begin_layout Description
registerFilter(filter,
\begin_inset space ~
\end_inset
module) Registers the filter for the module.
\end_layout
\begin_layout Part
less
\end_layout
\begin_layout Description
less(src,
\begin_inset space ~
\end_inset
msg,
\begin_inset space ~
\end_inset
html) Sends msg to src.
html says if it's an HTML message.
User is presented with a special interface to read a very long message.
\end_layout
\end_body
\end_document