SCRIPTS 22 KB

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