1#nop -------------------------------------------------------------------------
2#nop Learn by example
3#nop -------------------------------------------------------------------------
4
5#nop -------------------------------------------------------------------------
6#nop Loop through room 1 to 1000 and change the color of rooms with the
7#nop static (16) flag to <168>.
8#nop -------------------------------------------------------------------------
9
10#loop 1 1000 vnum
11{
12	#map at $vnum
13	{
14		#map get roomflags result;
15		#if {$result & 16}
16		{
17			#map set roomcolor <168>
18		}
19	}
20}
21
22#nop -------------------------------------------------------------------------
23#nop Capture system information. #script stores the output as a list,
24#nop hence the need to convert it into a normal variable.
25#nop -------------------------------------------------------------------------
26
27#script {dir} {pwd}
28#var dir $dir[1]
29
30#script {home} {echo $HOME}
31#var home $home[1]
32
33#nop -------------------------------------------------------------------------
34#nop Automatically reconnect on disconnect.
35#nop -------------------------------------------------------------------------
36
37#event {SESSION CONNECTED}
38{
39	#event {SESSION DISCONNECTED}
40	{
41		#gts #delay 5 {#session %0 %1 %3}
42	}
43}
44
45#nop -------------------------------------------------------------------------
46#nop Execute a random social at random time intervals.
47#nop -------------------------------------------------------------------------
48
49#tick {randomsocial}
50{
51	#delay {1d180}
52	{
53		#switch {1d4}
54		{
55			#case {1} {cheer}
56			#case {2} {greet all}
57			#case {3} {smile}
58			#case {4} {laugh self}
59		}
60	}
61}
62{200}
63
64#nop -------------------------------------------------------------------------
65#nop Maintain a friendlist. %i creates a case insensitive regex.
66#nop -------------------------------------------------------------------------
67
68#variable {friendlist}
69{
70	{bubba};{pamela};{cookie};{harry potter}
71}
72
73#function isfriend
74{
75	#return &friendlist[%i%0];
76}
77
78#act {%1 follows you.}
79{
80	#if {@isfriend{%1}}
81	{
82		group %1
83	};
84	#else
85	{
86		unfollow %1
87	}
88}
89
90#alias {addfriend}
91{
92	#format name %l {%0};
93
94	#var friendlist[$name] {};
95
96	#showme $name has been added to your friendlist.
97}
98
99#alias {delfriend}
100{
101	#format name %l {%0};
102
103	#if {@isfriend{$name}}
104	{
105		#unvar friendlist[$name];
106		#showme $name has been deleted from your friendlist.
107	};
108	#else
109	{
110		#showme $name is not on your friendlist.
111	}
112}
113
114#nop -------------------------------------------------------------------------
115#nop Append a goto to your current room when saving a map. You can use
116#nop #map return instead.
117#nop -------------------------------------------------------------------------
118
119#alias {savemap}
120{
121	#map write %0;
122	#map get roomvnum room;
123	#system echo '#map goto $room' >> %0
124}
125
126#nop -------------------------------------------------------------------------
127#nop Log all text to a file with a timestamp with decisecond precision.
128#nop -------------------------------------------------------------------------
129
130#function {timestamp}
131{
132	#format utime {%U};
133
134	#format result {%t.%m} {%Y-%m-%d %H:%M:%S} {$utime % 1000000 / 100000}
135}
136
137#event {RECEIVED LINE}
138{
139	#line log mylog.txt {<178>@timestamp{} \};
140	#line log mylog.txt
141}
142
143#nop -------------------------------------------------------------------------
144#nop Old school tick support.
145#nop -------------------------------------------------------------------------
146
147#tick {oldtick}
148{
149	#delay 50 #showme #10 SECONDS TO TICK!!;
150	#showme #TICK!!!
151}
152{60}
153
154#alias {ticklist}
155{
156	#info tickers save;
157
158	#echo {<128>%+20s %+20s %+20s} {Name} {Interval} {Remaining};
159
160	#draw Yellow scroll line 1 1 1 62;
161
162	#format utime %U;
163
164	#loop 1 &info[TICKERS][] index
165	{
166		#math uval $info[TICKERS][+$index][arg3] * 1000000;
167
168		#echo {%+20s %+20s %+20m}
169			{$info[TICKERS][+$index][arg1]}
170			{$info[TICKERS][+$index][arg3]}
171			{($uval - ($utime - $info[TICKERS][+$index][arg4]) % $uval) / 1000000.00}
172	}
173}
174
175#nop -------------------------------------------------------------------------
176#nop Execute speedwalks with .
177#nop -------------------------------------------------------------------------
178
179#alias {.%0}
180{
181	#var cnt {};
182
183	#parse {%0} {char}
184	{
185		#if {"$char" >= "0" && "$char" <= "9"}
186		{
187			#var cnt $cnt$char
188		};
189		#elseif {"$cnt" == ""}
190		{
191			#send $char
192		};
193		#else
194		{
195			#$cnt #send $char;
196			#var cnt {}
197		}
198	}
199}
200
201#nop -------------------------------------------------------------------------
202#nop Targetting script
203#nop -------------------------------------------------------------------------
204
205#var targets {}
206
207#alias {target}
208{
209	#if {"%0" == ""}
210	{
211		#showme {Current targets: $targets[]}
212	};
213	#elseif {&targets[%0]}
214	{
215		#unvar targets[%0];
216		#showme Target '%0' removed.
217	};
218	#else
219	{
220		#var targets[%0] {};
221		#showme Target '%0' added.
222	}
223}
224
225#act {%1 arrives}
226{
227	#if {&targets[%1]} {kill %1}
228}
229
230#act {%1 is standing here}
231{
232	#if {&targets[%1]} {kill %1}
233}
234
235#action {%1 is dead! R.I.P.}
236{
237	#if {&targets[%1]} {target %1}
238}
239
240#nop -------------------------------------------------------------------------
241#nop Show xterm 256 colors.
242#nop -------------------------------------------------------------------------
243
244#var temp {}
245
246#foreach {0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15} {var1}
247{
248	#showme {$var1 \e[38;5;${var1}m}
249}
250
251#foreach {a;b;c;d;e;f} {var1}
252{
253	#foreach {a;b;c;d;e;f} {var2}
254	{
255		#foreach {a;b;c;d;e;f} {var3}
256		{
257			#var temp {$temp <$var1$var2$var3><<888>$var1$var2$var3>}
258		};
259		#showme $temp;
260		#var temp {}
261	}
262}
263
264#loop 0 23 cnt
265{
266	#format temp {$temp <g%+02s><<888>g%+02s} {$cnt} {$cnt};
267}
268
269#showme $temp
270
271#nop -------------------------------------------------------------------------
272#nop Draw a health bar.
273#nop -------------------------------------------------------------------------
274
275#alias {hpbar}
276{
277	#math {hp_percent}{100 * %1 / %2};
278	#math {hpbars1}   {$hp_percent / 5};
279	#math {hpbars2}   {20 - $hpbars1};
280
281	#format {hpbar} {<011>%+${hpbars1}s<099><000>%+${hpbars2}s<099> };
282
283	#showme [$hpbar]
284}
285
286#alias {test}
287{
288	hpbar 30 100
289}
290
291#nop -------------------------------------------------------------------------
292#nop Syntax: sleep <seconds to delay> {commands}
293#nop
294#nop If there is already a pending sleep the delay will be stacked.
295#nop -------------------------------------------------------------------------
296
297#var sleeptime 0
298#var sleepcurr 0
299
300#alias {sleep %1 %2}
301{
302	#format sleeptime %U;
303
304	#if {$sleeptime > $sleepcurr}
305	{
306		#math sleepcurr $sleeptime + (%1) * 1000000;
307
308		#delay {%1} %2;
309	};
310	#else
311	{
312		#math sleepcurr $sleepcurr + (%1) * 1000000;
313
314		#delay {($sleepcurr - $sleeptime) / 1000000.000} %2
315	}
316}
317
318#nop -------------------------------------------------------------------------
319#nop This function and substitution will highlight spelling errors as red.
320#nop -------------------------------------------------------------------------
321
322#function spellcheck
323{
324	#format result %S %1;
325	#if {$result == 0}
326	{
327		#var result %1
328	};
329	#else
330	{
331		#var result <118>%1<900>
332	}
333}
334
335#substitute {{\b[a-zA-Z]+\b}} {@spellcheck{%1}}
336
337#nop -------------------------------------------------------------------------
338#nop This function and substitution will add a speed reader to the split line
339#nop -------------------------------------------------------------------------
340
341#split
342
343#function spellcheck
344{
345	#format result %S %1;
346	#if {$result == 0}
347	{
348		#var result %1
349	};
350	#else
351	{
352		#var result <118>%1<900>
353	};
354	#list speedread ins -1 {$result}
355}
356
357#substitute {{\b[a-zA-Z]+\b}} {@spellcheck{%1}}
358
359#tick {speedread}
360{
361	#if {&{speedread[]}}
362	{
363		#draw tile -2 1 -2 20 {$speedread[1]};
364		#list speedread delete 1
365	}
366}
367{0.1}
368
369#nop -------------------------------------------------------------------------
370#nop This function tests the random number engine
371#nop -------------------------------------------------------------------------
372
373#alias random
374{
375	#var random {};
376	#loop 1 1000 cnt
377	{
378		#math tmp 1d1000000000 % 10;
379		#math random[$tmp] $random[$tmp] + 1
380	};
381	#var random
382}
383
384#nop -------------------------------------------------------------------------
385#nop This macro allows pasting multi-line code fragments on pressing ctrl-v
386#nop -------------------------------------------------------------------------
387
388#macro {\cv}
389{
390	#cursor {convert meta} on;
391	#line oneshot #event {CATCH RECEIVED INPUT}
392	{
393		#line sub {esc} #var paste {%0};
394		#replace paste {\\n\\n} {;};
395		#replace paste {\\n} {};
396		#replace paste {\\t} {};
397		#replace paste {;;} {;};
398		#1 {$paste}
399	}
400}
401
402#nop -------------------------------------------------------------------------
403#nop This macro allows pasting multi-line code fragments on pressing ctrl-v
404#nop followed by pressing ctrl-enter
405#nop -------------------------------------------------------------------------
406
407#macro {\e[13;5u}
408{
409	#cursor get tmp;
410	#cursor home;
411	#cursor set {#line sub esc };
412	#cursor enter
413}
414
415#nop -------------------------------------------------------------------------
416#nop This event will cause tintin to always report your screen width as 80
417#nop columns
418#nop -------------------------------------------------------------------------
419
420#event {CATCH IAC DO NAWS}
421{
422	#screen get rows ROWS;
423	#format ROWS %a $ROWS;
424
425	#send {\xFF\xFB\x1F\xFF\xFA\x1F\x50\x00${ROWS}\x00\xFF\xF0\}
426}
427
428#nop -------------------------------------------------------------------------
429#nop Remove duplicate lines and add a counter. Does not work in gts because
430#nop it uses named delays.
431#nop -------------------------------------------------------------------------
432
433#var repeat[str] {}
434#var repeat[cnt] 1
435
436#act {~%+}
437{
438	#if {{%0} === {$repeat[str]}}
439	{
440		#math repeat[cnt] $repeat[cnt] + 1;
441		#delay {repeat} {repeat_show} {0}
442	};
443	#else
444	{
445		repeat_show;
446		#var repeat[str] {%0}
447	};
448	#line gag
449}
450
451#alias {repeat_check}
452{
453	#if {$repeat[cnt] <= 1}
454	{
455		#line ignore #showme {$repeat[str]}
456	};
457	#else
458	{
459		#line ignore #showme {($repeat[cnt]) %0}
460	};
461	#var repeat[str] {};
462	#var repeat[cnt] 1
463}
464
465#nop -------------------------------------------------------------------------
466#nop These macros will allow you to move around with the arrow keys while
467#nop holding down the control key. You can move ne by pressing arrow up +
468#nop right simultaniously. Move up by pressing arrow up + down simultaniously.
469#nop Move down by pressing arrow left + right simultaniously.
470#nop -------------------------------------------------------------------------
471
472#macro {\e[1;5A} {#cursor macro preserve;#delay {move} {#cursor macro reset;n} {0.05}}
473#macro {\e[1;5C} {#cursor macro preserve;#delay {move} {#cursor macro reset;e} {0.05}}
474#macro {\e[1;5B} {#cursor macro preserve;#delay {move} {#cursor macro reset;s} {0.05}}
475#macro {\e[1;5D} {#cursor macro preserve;#delay {move} {#cursor macro reset;w} {0.05}}
476
477#macro {\e[1;5A\e[1;5A} {#undelay {move};#cursor macro reset;n;n}
478#macro {\e[1;5C\e[1;5C} {#undelay {move};#cursor macro reset;e;e}
479#macro {\e[1;5B\e[1;5B} {#undelay {move};#cursor macro reset;s;s}
480#macro {\e[1;5D\e[1;5D} {#undelay {move};#cursor macro reset;w;w}
481
482#macro {\e[1;5A\e[1;5B} {#undelay {move};#cursor macro reset;u}
483#macro {\e[1;5B\e[1;5A} {#undelay {move};#cursor macro reset;u}
484
485#macro {\e[1;5C\e[1;5D} {#undelay {move};#cursor macro reset;d}
486#macro {\e[1;5D\e[1;5C} {#undelay {move};#cursor macro reset;d}
487
488#macro {\e[1;5A\e[1;5C} {#undelay {move};#cursor macro reset;ne}
489#macro {\e[1;5C\e[1;5A} {#undelay {move};#cursor macro reset;ne}
490
491#macro {\e[1;5B\e[1;5C} {#undelay {move};#cursor macro reset;se}
492#macro {\e[1;5C\e[1;5B} {#undelay {move};#cursor macro reset;se}
493
494#macro {\e[1;5D\e[1;5B} {#undelay {move};#cursor macro reset;sw}
495#macro {\e[1;5B\e[1;5D} {#undelay {move};#cursor macro reset;sw}
496
497#macro {\e[1;5D\e[1;5A} {#undelay {move};#cursor macro reset;nw}
498#macro {\e[1;5A\e[1;5D} {#undelay {move};#cursor macro reset;nw}
499
500#nop -------------------------------------------------------------------------
501#nop Place tells in the top 5 lines of the screen
502#nop -------------------------------------------------------------------------
503
504#VARIABLE {COMMS} {}
505
506#ACTION {~%1 tells you %2}
507{
508	addtowin %1 tells you %2
509}
510
511#ACTION {~%1 chats %2}
512{
513	addtowin %1 chats %2
514}
515
516#ALIAS {addtowin}
517{
518	#format temp {%w} {%0};
519
520	#loop {1} {&temp[]} {cnt}
521	{
522		#list COMMS ins -1 {$temp[$cnt]}
523	};
524	#while {&COMMS[] > 100}
525	{
526		#list COMMS del 1
527	};
528	showwin
529}
530
531#ALIAS {showwin}
532{
533	#screen clear square 1 1 5 -1;
534
535	#list temp create $COMMS[-5..-1];
536
537	#loop {1} {&temp[]} {cnt}
538	{
539		#regexp {$temp[$cnt]} {^$}
540		{
541			#nop
542		};
543		#else
544		{
545			#line ignore #showme {$temp[$cnt]} {$cnt} {1}
546		}
547	}
548}
549
550#ALIAS {test}
551{
552	#split 5 1;
553	#showme <138>Bubba tells you 'hello';
554	#showme <158>Pamela chats 'bye';
555}
556
557#nop -------------------------------------------------------------------------
558#nop Display two sessions next to each other
559#nop -------------------------------------------------------------------------
560
561#event {SCREEN RESIZE}
562{
563	#var ROWS %0;
564	#var COLS %1;
565	#draw line 1 {$COLS / 2} -3 {$COLS / 2};
566
567	#left #screen scroll 1 1 -3 {$COLS / 2 - 1};
568	#right #screen scroll 1 {$COLS / 2 + 1} -3 -1;
569}
570
571#event {PROGRAM START}
572{
573	#screen raise SCREEN RESIZE;
574	#ses right localhost 4321;
575	#ses left localhost 4321;
576}
577
578#event {SESSION CREATED}
579{
580	#var name %0;
581}
582
583#event {SESSION ACTIVATED}
584{
585	#gts #var active %0;
586}
587
588#event {RECEIVED OUTPUT}
589{
590	#if {"@gts{$active}" == "$name"}
591	{
592		#return;
593	};
594
595	#switch {"$name"}
596	{
597		#case {"left"} {#draw Red boxed foreground buffer 1 1 -3 {$COLS / 2 - 1};};
598		#case {"right"}{#draw Red boxed foreground buffer 1 {$COLS / 2 + 1} -3 -1};
599	};
600}
601
602#nop -------------------------------------------------------------------------
603#nop Follow the group leader on the map.
604#nop -------------------------------------------------------------------------
605
606#var short_dir
607{
608	{north}{n}
609	{northeast}{ne}
610	{east}{e}
611	{southeast}{se}
612	{south}{s}
613	{southwest}{sw}
614	{west}{w}
615	{northwest}{nw}
616}
617
618#action {%1 walks %2.$}
619{
620	#var {follow_targets[%1]} {$short_dir[%2]}
621}
622
623#action {^You follow %1.$}
624{
625	#if {&follow_targets[%1]}
626	{
627		#map move $follow_targets[%1]
628	}
629}
630
631#nop -------------------------------------------------------------------------
632#nop Use mouse click to change the input cursor's position.
633#nop -------------------------------------------------------------------------
634
635#config mouse on
636
637#split
638
639#event {SHORT-CLICKED MOUSE BUTTON ONE -1}
640{
641	#cursor position %1
642}
643
644#nop -------------------------------------------------------------------------
645#nop Move the VT100 map from the top to the right of the screen
646#nop -------------------------------------------------------------------------
647
648#map create
649#map flag vtmap
650#map flag unicode
651#map goto 1
652
653#split 0 1 0 -80;
654#map offset 1 82 -5 -1
655
656#screen resize horizontal 120
657
658#nop -------------------------------------------------------------------------
659#nop Add clickable session tabs at the top of the screen
660#nop -------------------------------------------------------------------------
661
662#event {PROGRAM START}
663{
664	#split 3 1;
665	#config mouse on;
666	#var active gts;
667	session_activated gts;
668}
669
670#event {SESSION CREATED}
671{
672	#gts session_activated %0
673}
674
675#event {SESSION ACTIVATED}
676{
677	#gts session_activated %0
678}
679
680#alias {session_activated}
681{
682	#line sub esc #var sessions[$active] {<138>\e]68;2;TABS;#$active\a\e[4;24m$active\e[24m};
683	#var active {%0};
684	#line sub esc #var sessions[%0] {<128>\e]68;2;TABS;#nop\a\e[4;24m%0\e[24m};
685	#draw foreground Azure table 1 1 3 -1 {$sessions[%*]}
686}
687
688#event {PRESSED SECURE LINK TABS MOUSE BUTTON ONE}
689{
690	%4
691}
692
693
694#nop -------------------------------------------------------------------------
695#nop Add basic MXP link and color handling
696#nop -------------------------------------------------------------------------
697
698#config mouse on
699
700#event {IAC DO MXP}
701{
702	#send {\xFF\xFB\x5B\}
703}
704
705#function {mxp_link}
706{
707	#line sub esc #var result {\e]68;1;%1;%2\a\e[4m%3\e[24m}
708}
709
710#act {~\e[1z<VERSION>} {#send {\e[4z<VERSION MXP=1.0 CLIENT=TINTIN++ VERSION=2.02.04>}}
711#act {~\e[1z<SUPPORT>} {#send {\e[4z<SUPPORTS +SEND +COLOR>}}
712
713#sub {~\e[4z<COLOR #%1>%2\e[4z</COLOR>} {<f%1>%2<900>}
714
715#sub {~\e[4z<SEND HREF="%1">%2\e[4z</SEND>} {@mxp_link{MXP;%1;%2}}
716
717#event {PRESSED LINK MXP MOUSE BUTTON ONE}
718{
719	#send {%4}
720}
721
722#sub {~\e[4z{<RExits>|</RExits>|<RDesc>|</RDesc>|<PROMPT>|</PROMPT>|<RName>|</RName>}} {}
723
724#sub {~\e[4z<RNum %d />} {}
725
726#sub {&lt;} {<}
727#sub {&gt;} {>}
728
729#nop -------------------------------------------------------------------------
730#nop Example script for using #list indexing.
731#nop -------------------------------------------------------------------------
732
733#var players[1] {{name}{bubba}{age}{15}{level}{24}}
734#var players[2] {{name}{pamela}{age}{19}{level}{2}}
735#var players[3] {{name}{ronald}{age}{69}{level}{13}}
736#var players[4] {{name}{bubba}{age}{26}{level}{30}}
737#var players[5] {{name}{ronald}{age}{11}{level}{31}}
738
739#alias {display}
740{
741	#var out {};
742
743	#loop 1 &players[] cnt
744	{
745		#var out[$cnt] {$cnt;$players[+$cnt][name];$players[+$cnt][age];$players[+$cnt][level]};
746	};
747	#draw scroll grid table 1 1 2+&players[]*2 80 $out[%*]
748}
749
750#alias {test1}
751{
752	#list players index name;
753	#list players order;
754	display
755}
756
757#alias {test2}
758{
759	#list players index name;
760	#list players order;
761	#list players reverse;
762	display;
763}
764
765#alias {test3}
766{
767	#list players index name;
768	#list players order;
769	#list players index level;
770	#list players order;
771	display
772}
773
774#nop -------------------------------------------------------------------------
775#nop This creates two input lines that can be switched between using the tab
776#nop key.
777#nop -------------------------------------------------------------------------
778
779#line quiet #split
780
781#macro {\t} {inputswitch}
782
783#var input[width] 1
784
785#alias {inputswitch}
786{
787	#cursor get {input[current]};
788	#cursor clear;
789	#cursor set {$input[buffer2]};
790	#cursor end;
791	#var input[buffer2] {$input[current]};
792	#draw Ebony tile {-1-$input[width]} 1 -2 -1 {$input[buffer2]}
793}
794
795#nop -------------------------------------------------------------------------
796#nop This allows for split screen scroll back, just use the mouse wheel in
797#nop the upper half of the screen.
798#nop -------------------------------------------------------------------------
799
800#event {PROGRAM START}
801{
802	#config mouse on;
803	#var SCROLL[MODE] 0;
804	#split 0 1;
805	#screen raise SCREEN RESIZE;
806}
807
808#event {SCREEN RESIZE}
809{
810	#var ROWS %0;
811	#var COLS %1;
812	#screen get SCROLL_TOP_ROW SCROLL[TOP_ROW];
813	#screen get SCROLL_TOP_COL SCROLL[TOP_COL];
814	#screen get SCROLL_BOT_ROW SCROLL[BOT_ROW];
815	#screen get SCROLL_BOT_COL SCROLL[BOT_COL];
816}
817
818#EVENT {SCROLLED MOUSE WHEEL UP}
819{
820	#if {$SCROLL[MODE] == 0}
821	{
822		#if {%0 < $ROWS / 2}
823		{
824			#var SCROLL[MODE] 1;
825			#var SCROLL[OLD_ROW] $SCROLL[BOT_ROW];
826			#math SCROLL[BOT_ROW] $SCROLL[OLD_ROW] / 2;
827			#var BUFFER {};
828			#screen scroll $SCROLL[TOP_ROW] $SCROLL[TOP_COL] $SCROLL[BOT_ROW] $SCROLL[BOT_COL];
829
830			#draw red teed line $SCROLL[BOT_ROW]+1 $SCROLL[TOP_COL] $SCROLL[BOT_ROW]+1 $SCROLL[BOT_COL];
831
832			#screen clear square $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL];
833		};
834	};
835	#if {$SCROLL[MODE] == 1}
836	{
837		#buffer up 1
838	}
839}
840
841#EVENT {SCROLLED MOUSE WHEEL DOWN}
842{
843	#if {$SCROLL[MODE] == 1}
844	{
845		#if {%0 < $ROWS / 2}
846		{
847			#buffer down 1;
848
849			#buffer info save SCROLL[INFO];
850
851			#if {$SCROLL[INFO][LINE] == -1}
852			{
853				#var SCROLL[MODE] 0;
854				#var SCROLL[BOT_ROW] $SCROLL[OLD_ROW];
855
856				#split 0 1;
857				#buffer end;
858			}
859		}
860	}
861}
862
863#event {RECEIVED LINE}
864{
865	#if {$SCROLL[MODE] == 1}
866	{
867		#if {&BUFFER[] > $ROWS}
868		{
869			#list BUFFER del 1
870		};
871		#list BUFFER add {%0};
872
873		#draw tile $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL] $BUFFER[%*];
874	}
875}
876
877#nop -------------------------------------------------------------------------
878#nop This is a script to connect to Gemstone 4.
879#nop Visit play.net/gs4, login, and hit the 'GO PLAY' button.
880#nop Select the Storm Front radio button and hit the 'GO PLAY' button.
881#nop Save the .sal file to your script directory and name it gemstone.sal.
882#nop Use the 'gemstone' alias to connect.
883#nop -------------------------------------------------------------------------
884
885#alias {gemstone}
886{
887	#var gemstone {};
888
889	#line oneshot #action {^GAMEHOST=%*} {#var gemstone[host] %%1};
890	#line oneshot #action {^GAMEPORT=%*} {#var gemstone[port] %%1};
891	#line oneshot #action {^KEY=%*} {#var gemstone[key] %%1};
892
893	#scan txt gemstone.sal;
894
895	#if {&gemstone[] != 3}
896	{
897		#showme Failed to load gemstone.sal file.;
898		#return
899	};
900	#ses gemstone $gemstone[host] $gemstone[port];
901	#send {$gemstone[key]};
902	#send {>/FE:JAVA}
903}
904
905#nop -------------------------------------------------------------------------
906#nop Start a dated log file in the logs directory when a session connects. See
907#nop #help time for the available date options for #format %t.
908#nop -------------------------------------------------------------------------
909
910#event {SESSION CONNECTED}
911{
912	#format date %t %Y-%m-%d-%H-%M;
913
914	#log append logs/%0_$date.log
915}
916
917#nop -------------------------------------------------------------------------
918#nop Sometimes an error doesn't give enough information and it's useful to
919#nop see the calling script.
920#nop -------------------------------------------------------------------------
921
922#event {RECEIVED ERROR}
923{
924	#echo <118>%h { TOKENIZER };
925	#info tokenizer -1;
926	#echo <118>%h
927}
928
929#nop -------------------------------------------------------------------------
930#nop
931#nop -------------------------------------------------------------------------
932
933#nop -------------------------------------------------------------------------
934#nop
935#nop -------------------------------------------------------------------------
936
937#nop -------------------------------------------------------------------------
938#nop
939#nop -------------------------------------------------------------------------
940
941#nop -------------------------------------------------------------------------
942#nop
943#nop -------------------------------------------------------------------------
944