SCRIPTS 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  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. #nop -------------------------------------------------------------------------
  128. #nop Execute speedwalks with .
  129. #nop -------------------------------------------------------------------------
  130. #alias {.%0}
  131. {
  132. #var cnt {};
  133. #parse {%0} {char}
  134. {
  135. #if {"$char" >= "0" && "$char" <= "9"}
  136. {
  137. #var cnt $cnt$char
  138. };
  139. #elseif {"$cnt" == ""}
  140. {
  141. #send $char
  142. };
  143. #else
  144. {
  145. #$cnt #send $char;
  146. #var cnt {}
  147. }
  148. }
  149. }
  150. #nop -------------------------------------------------------------------------
  151. #nop Targetting script
  152. #nop -------------------------------------------------------------------------
  153. #var targets {}
  154. #alias {target}
  155. {
  156. #if {"%0" == ""}
  157. {
  158. #showme {Current targets: $targets[]}
  159. };
  160. #elseif {&targets[%0]}
  161. {
  162. #unvar targets[%0];
  163. #showme Target '%0' removed.
  164. };
  165. #else
  166. {
  167. #var targets[%0] {};
  168. #showme Target '%0' added.
  169. }
  170. }
  171. #act {%1 arrives}
  172. {
  173. #if {&targets[%1]} {kill %1}
  174. }
  175. #act {%1 is standing here}
  176. {
  177. #if {&targets[%1]} {kill %1}
  178. }
  179. #action {%1 is dead! R.I.P.}
  180. {
  181. #if {&targets[%1]} {target %1}
  182. }
  183. #nop -------------------------------------------------------------------------
  184. #nop Show xterm 256 colors.
  185. #nop -------------------------------------------------------------------------
  186. #var temp {}
  187. #foreach {0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15} {var1}
  188. {
  189. #showme {$var1 \e[38;5;${var1}m}
  190. }
  191. #foreach {a;b;c;d;e;f} {var1}
  192. {
  193. #foreach {a;b;c;d;e;f} {var2}
  194. {
  195. #foreach {a;b;c;d;e;f} {var3}
  196. {
  197. #var temp {$temp <$var1$var2$var3><<888>$var1$var2$var3>}
  198. };
  199. #showme $temp;
  200. #var temp {}
  201. }
  202. }
  203. #loop 0 23 cnt
  204. {
  205. #format temp {$temp <g%+02s><<888>g%+02s} {$cnt} {$cnt};
  206. }
  207. #showme $temp
  208. #nop -------------------------------------------------------------------------
  209. #nop Draw a health bar.
  210. #nop -------------------------------------------------------------------------
  211. #alias {hpbar}
  212. {
  213. #math {hp_percent}{100 * %1 / %2};
  214. #math {hpbars1} {$hp_percent / 5};
  215. #math {hpbars2} {20 - $hpbars1};
  216. #format {hpbar} {<011>%+${hpbars1}s<099><000>%+${hpbars2}s<099> };
  217. #showme [$hpbar]
  218. }
  219. #alias {test}
  220. {
  221. hpbar 30 100
  222. }
  223. #nop -------------------------------------------------------------------------
  224. #nop Syntax: sleep <seconds to delay> {commands}
  225. #nop
  226. #nop If there is already a pending sleep the delay will be stacked.
  227. #nop -------------------------------------------------------------------------
  228. #var sleeptime 0
  229. #var sleepcurr 0
  230. #alias {sleep %1 %2}
  231. {
  232. #format sleeptime %U;
  233. #if {$sleeptime > $sleepcurr}
  234. {
  235. #math sleepcurr $sleeptime + (%1) * 1000000;
  236. #delay {%1} %2;
  237. };
  238. #else
  239. {
  240. #math sleepcurr $sleepcurr + (%1) * 1000000;
  241. #delay {($sleepcurr - $sleeptime) / 1000000.000} %2
  242. }
  243. }
  244. #nop -------------------------------------------------------------------------
  245. #nop This function and substitution will highlight spelling errors as red.
  246. #nop -------------------------------------------------------------------------
  247. #function spellcheck
  248. {
  249. #format result %S %1;
  250. #if {$result == 0}
  251. {
  252. #var result %1
  253. };
  254. #else
  255. {
  256. #var result <118>%1<900>
  257. }
  258. }
  259. #substitute {{\b[a-zA-Z]+\b}} {@spellcheck{%1}}
  260. #nop -------------------------------------------------------------------------
  261. #nop This function tests the random number engine
  262. #nop -------------------------------------------------------------------------
  263. #alias random
  264. {
  265. #var random {};
  266. #loop 1 1000 cnt
  267. {
  268. #math tmp 1d1000000000 % 10;
  269. #math random[$tmp] $random[$tmp] + 1
  270. };
  271. #var random
  272. }
  273. #nop -------------------------------------------------------------------------
  274. #nop This macro allows pasting multi-line code fragments on pressing ctrl-v
  275. #nop -------------------------------------------------------------------------
  276. #macro {\cv}
  277. {
  278. #cursor {convert meta} on;
  279. #line oneshot #event {CATCH RECEIVED INPUT}
  280. {
  281. #line sub {esc} #var paste {%0};
  282. #replace paste {\\n\\n} {;};
  283. #replace paste {\\n} {};
  284. #replace paste {\\t} {};
  285. #replace paste {;;} {;};
  286. #1 {$paste}
  287. }
  288. }
  289. #nop -------------------------------------------------------------------------
  290. #nop This macro allows pasting multi-line code fragments on pressing ctrl-v
  291. #nop followed by pressing ctrl-enter
  292. #nop -------------------------------------------------------------------------
  293. #macro {\e[13;5u}
  294. {
  295. #cursor get tmp;
  296. #cursor home;
  297. #cursor set {#line sub esc };
  298. #cursor enter
  299. }
  300. #nop -------------------------------------------------------------------------
  301. #nop This event will cause tintin to always report your screen width as 80
  302. #nop columns
  303. #nop -------------------------------------------------------------------------
  304. #event {CATCH IAC DO NAWS}
  305. {
  306. #screen get rows ROWS;
  307. #format ROWS %a $ROWS;
  308. #send {\xFF\xFB\x1F\xFF\xFA\x1F\x50\x00${ROWS}\x00\xFF\xF0\}
  309. }
  310. #nop -------------------------------------------------------------------------
  311. #nop Remove duplicate lines and add a counter. Does not work in gts because
  312. #nop it uses named delays.
  313. #nop -------------------------------------------------------------------------
  314. #var repeat[str] {}
  315. #var repeat[cnt] 1
  316. #act {~%+}
  317. {
  318. #if {{%0} === {$repeat[str]}}
  319. {
  320. #math repeat[cnt] $repeat[cnt] + 1;
  321. #delay {repeat} {repeat_show} {0}
  322. };
  323. #else
  324. {
  325. repeat_show;
  326. #var repeat[str] {%0}
  327. };
  328. #line gag
  329. }
  330. #alias {repeat_check}
  331. {
  332. #if {$repeat[cnt] <= 1}
  333. {
  334. #line ignore #showme {$repeat[str]}
  335. };
  336. #else
  337. {
  338. #line ignore #showme {($repeat[cnt]) %0}
  339. };
  340. #var repeat[str] {};
  341. #var repeat[cnt] 1
  342. }
  343. #nop -------------------------------------------------------------------------
  344. #nop These macros will allow you to move around with the arrow keys while
  345. #nop holding down the control key. You can move ne by pressing arrow up +
  346. #nop right simultaniously. Move up by pressing arrow up + down simultaniously.
  347. #nop Move down by pressing arrow left + right simultaniously.
  348. #nop -------------------------------------------------------------------------
  349. #macro {\e[1;5A} {#cursor preserve;#delay {move} {#cursor reset_macro;n} {0.05}}
  350. #macro {\e[1;5C} {#cursor preserve;#delay {move} {#cursor reset_macro;e} {0.05}}
  351. #macro {\e[1;5B} {#cursor preserve;#delay {move} {#cursor reset_macro;s} {0.05}}
  352. #macro {\e[1;5D} {#cursor preserve;#delay {move} {#cursor reset_macro;w} {0.05}}
  353. #macro {\e[1;5A\e[1;5A} {#undelay {move};#cursor reset_macro;n;n}
  354. #macro {\e[1;5C\e[1;5C} {#undelay {move};#cursor reset_macro;e;e}
  355. #macro {\e[1;5B\e[1;5B} {#undelay {move};#cursor reset_macro;s;s}
  356. #macro {\e[1;5D\e[1;5D} {#undelay {move};#cursor reset_macro;w;w}
  357. #macro {\e[1;5A\e[1;5B} {#undelay {move};#cursor reset_macro;u}
  358. #macro {\e[1;5B\e[1;5A} {#undelay {move};#cursor reset_macro;u}
  359. #macro {\e[1;5C\e[1;5D} {#undelay {move};#cursor reset_macro;d}
  360. #macro {\e[1;5D\e[1;5C} {#undelay {move};#cursor reset_macro;d}
  361. #macro {\e[1;5A\e[1;5C} {#undelay {move};#cursor reset_macro;ne}
  362. #macro {\e[1;5C\e[1;5A} {#undelay {move};#cursor reset_macro;ne}
  363. #macro {\e[1;5B\e[1;5C} {#undelay {move};#cursor reset_macro;se}
  364. #macro {\e[1;5C\e[1;5B} {#undelay {move};#cursor reset_macro;se}
  365. #macro {\e[1;5D\e[1;5B} {#undelay {move};#cursor reset_macro;sw}
  366. #macro {\e[1;5B\e[1;5D} {#undelay {move};#cursor reset_macro;sw}
  367. #macro {\e[1;5D\e[1;5A} {#undelay {move};#cursor reset_macro;nw}
  368. #macro {\e[1;5A\e[1;5D} {#undelay {move};#cursor reset_macro;nw}
  369. #nop -------------------------------------------------------------------------
  370. #nop Place tells in the top 5 lines of the screen
  371. #nop -------------------------------------------------------------------------
  372. #VARIABLE {COMMS} {}
  373. #ACTION {~%1 tells you %2}
  374. {
  375. addtowin %1 tells you %2
  376. }
  377. #ACTION {~%1 chats %2}
  378. {
  379. addtowin %1 chats %2
  380. }
  381. #ALIAS {addtowin}
  382. {
  383. #format temp {%w} {%0};
  384. #loop {1} {&temp[]} {cnt}
  385. {
  386. #list COMMS ins -1 {$temp[$cnt]}
  387. };
  388. #while {&COMMS[] > 100}
  389. {
  390. #list COMMS del 1
  391. };
  392. showwin
  393. }
  394. #ALIAS {showwin}
  395. {
  396. #screen clear square 1 1 5 -1;
  397. #list temp create $COMMS[-5..-1];
  398. #loop {1} {&temp[]} {cnt}
  399. {
  400. #regexp {$temp[$cnt]} {^$}
  401. {
  402. #nop
  403. };
  404. #else
  405. {
  406. #line ignore #showme {$temp[$cnt]} {$cnt} {1}
  407. }
  408. }
  409. }
  410. #ALIAS {test}
  411. {
  412. #split 5 1;
  413. #showme <138>Bubba tells you 'hello';
  414. #showme <158>Pamela chats 'bye';
  415. }
  416. #nop -------------------------------------------------------------------------
  417. #nop Display two sessions next to each other
  418. #nop -------------------------------------------------------------------------
  419. #event {SCREEN RESIZE}
  420. {
  421. #var ROWS %0;
  422. #var COLS %1;
  423. #draw line 1 {$COLS / 2} -3 {$COLS / 2};
  424. #left #screen scroll 1 1 -3 {$COLS / 2 - 1};
  425. #right #screen scroll 1 {$COLS / 2 + 1} -3 -1;
  426. }
  427. #event {PROGRAM START}
  428. {
  429. #screen raise SCREEN RESIZE;
  430. #ses right localhost 4321;
  431. #ses left localhost 4321;
  432. }
  433. #event {SESSION CREATED}
  434. {
  435. #var name %0;
  436. }
  437. #event {SESSION ACTIVATED}
  438. {
  439. #gts #var active %0;
  440. }
  441. #event {RECEIVED OUTPUT}
  442. {
  443. #if {"@gts{$active}" == "$name"}
  444. {
  445. #return;
  446. };
  447. #switch {"$name"}
  448. {
  449. #case {"left"} {#draw Red boxed foreground buffer 1 1 -3 {$COLS / 2 - 1};};
  450. #case {"right"}{#draw Red boxed foreground buffer 1 {$COLS / 2 + 1} -3 -1};
  451. };
  452. }
  453. #nop -------------------------------------------------------------------------
  454. #nop Follow the group leader on the map.
  455. #nop -------------------------------------------------------------------------
  456. #var short_dir
  457. {
  458. {north}{n}
  459. {northeast}{ne}
  460. {east}{e}
  461. {southeast}{se}
  462. {south}{s}
  463. {southwest}{sw}
  464. {west}{w}
  465. {northwest}{nw}
  466. }
  467. #action {%1 walks %2.$}
  468. {
  469. #var {follow_targets[%1]} {$short_dir[%2]}
  470. }
  471. #action {^You follow %1.$}
  472. {
  473. #if {&follow_targets[%1]}
  474. {
  475. #map move $follow_targets[%1]
  476. }
  477. }
  478. #nop -------------------------------------------------------------------------
  479. #nop Use mouse click to change the input cursor's position.
  480. #nop -------------------------------------------------------------------------
  481. #config mouse on
  482. #split
  483. #event {SHORT-CLICKED MOUSE BUTTON ONE -1}
  484. {
  485. #cursor position %1
  486. }
  487. #nop -------------------------------------------------------------------------
  488. #nop Move the VT100 map from the top to the right of the screen
  489. #nop -------------------------------------------------------------------------
  490. #map create
  491. #map flag vtmap
  492. #map flag unicode
  493. #map goto 1
  494. #split 0 1 0 -80;
  495. #map offset 1 82 -5 -1
  496. #screen resize horizontal 120
  497. #nop -------------------------------------------------------------------------
  498. #nop Add clickable session tabs at the top of the screen
  499. #nop -------------------------------------------------------------------------
  500. #event {PROGRAM START}
  501. {
  502. #split 3 1;
  503. #config mouse on;
  504. #var active gts;
  505. session_activated gts;
  506. }
  507. #event {SESSION CREATED}
  508. {
  509. #gts session_activated %0
  510. }
  511. #event {SESSION ACTIVATED}
  512. {
  513. #gts session_activated %0
  514. }
  515. #alias {session_activated}
  516. {
  517. #line sub esc #var sessions[$active] {<138>\e]68;2;TABS;#$active\a\e[4;24m$active\e[24m};
  518. #var active {%0};
  519. #line sub esc #var sessions[%0] {<128>\e]68;2;TABS;#nop\a\e[4;24m%0\e[24m};
  520. #draw foreground Azure table 1 1 3 -1 {$sessions[%*]}
  521. }
  522. #event {PRESSED SECURE LINK TABS MOUSE BUTTON ONE}
  523. {
  524. %4
  525. }
  526. #nop -------------------------------------------------------------------------
  527. #nop Add basic MXP link and color handling
  528. #nop -------------------------------------------------------------------------
  529. #config mouse on
  530. #event {IAC DO MXP}
  531. {
  532. #send {\xFF\xFB\x5B\}
  533. }
  534. #function {mxp_link}
  535. {
  536. #line sub esc #var result {\e]68;1;%1;%2\a\e[4m%3\e[24m}
  537. }
  538. #act {~\e[1z<VERSION>} {#send {\e[4z<VERSION MXP=1.0 CLIENT=TINTIN++ VERSION=2.02.04>}}
  539. #act {~\e[1z<SUPPORT>} {#send {\e[4z<SUPPORTS +SEND +COLOR>}}
  540. #sub {~\e[4z<COLOR #%1>%2\e[4z</COLOR>} {<f%1>%2<900>}
  541. #sub {~\e[4z<SEND HREF="%1">%2\e[4z</SEND>} {@mxp_link{MXP;%1;%2}}
  542. #event {PRESSED LINK MXP MOUSE BUTTON ONE}
  543. {
  544. #send {%4}
  545. }
  546. #sub {~\e[4z{<RExits>|</RExits>|<RDesc>|</RDesc>|<PROMPT>|</PROMPT>|<RName>|</RName>}} {}
  547. #sub {~\e[4z<RNum %d />} {}
  548. #sub {&lt;} {<}
  549. #sub {&gt;} {>}
  550. #nop -------------------------------------------------------------------------
  551. #nop Example script for using #list indexing.
  552. #nop -------------------------------------------------------------------------
  553. #var players[1] {{name}{bubba}{age}{15}{level}{24}}
  554. #var players[2] {{name}{pamela}{age}{19}{level}{2}}
  555. #var players[3] {{name}{ronald}{age}{69}{level}{13}}
  556. #var players[4] {{name}{bubba}{age}{26}{level}{30}}
  557. #var players[5] {{name}{ronald}{age}{11}{level}{31}}
  558. #alias {display}
  559. {
  560. #var out {};
  561. #loop 1 &players[] cnt
  562. {
  563. #var out[$cnt] {$cnt;$players[+$cnt][name];$players[+$cnt][age];$players[+$cnt][level]};
  564. };
  565. #draw scroll grid table 1 1 2+&players[]*2 80 $out[%*]
  566. }
  567. #alias {test1}
  568. {
  569. #list players index name;
  570. #list players order;
  571. display
  572. }
  573. #alias {test2}
  574. {
  575. #list players index name;
  576. #list players order;
  577. #list players reverse;
  578. display;
  579. }
  580. #alias {test3}
  581. {
  582. #list players index name;
  583. #list players order;
  584. #list players index level;
  585. #list players order;
  586. display
  587. }
  588. #nop -------------------------------------------------------------------------
  589. #nop This creates two input lines that can be switched between using the tab
  590. #nop key.
  591. #nop -------------------------------------------------------------------------
  592. #line quiet #split
  593. #macro {\t} {inputswitch}
  594. #var input[width] 1
  595. #alias {inputswitch}
  596. {
  597. #cursor get {input[current]};
  598. #cursor clear;
  599. #cursor set {$input[buffer2]};
  600. #cursor end;
  601. #var input[buffer2] {$input[current]};
  602. #draw Ebony tile {-1-$input[width]} 1 -2 -1 {$input[buffer2]}
  603. }
  604. #nop -------------------------------------------------------------------------
  605. #nop This allows for split screen scroll back, just use the mouse wheel in
  606. #nop the upper half of the screen.
  607. #nop -------------------------------------------------------------------------
  608. #event {PROGRAM START}
  609. {
  610. #config mouse on;
  611. #var SCROLL[MODE] 0;
  612. #split 0 1;
  613. #screen raise SCREEN RESIZE;
  614. }
  615. #event {SCREEN RESIZE}
  616. {
  617. #var ROWS %0;
  618. #var COLS %1;
  619. #screen get SCROLL_TOP_ROW SCROLL[TOP_ROW];
  620. #screen get SCROLL_TOP_COL SCROLL[TOP_COL];
  621. #screen get SCROLL_BOT_ROW SCROLL[BOT_ROW];
  622. #screen get SCROLL_BOT_COL SCROLL[BOT_COL];
  623. }
  624. #EVENT {SCROLLED MOUSE WHEEL UP}
  625. {
  626. #if {$SCROLL[MODE] == 0}
  627. {
  628. #if {%0 < $ROWS / 2}
  629. {
  630. #var SCROLL[MODE] 1;
  631. #var SCROLL[OLD_ROW] $SCROLL[BOT_ROW];
  632. #math SCROLL[BOT_ROW] $SCROLL[OLD_ROW] / 2;
  633. #var BUFFER {};
  634. #screen scroll $SCROLL[TOP_ROW] $SCROLL[TOP_COL] $SCROLL[BOT_ROW] $SCROLL[BOT_COL];
  635. #draw red teed line $SCROLL[BOT_ROW]+1 $SCROLL[TOP_COL] $SCROLL[BOT_ROW]+1 $SCROLL[BOT_COL];
  636. #screen clear square $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL];
  637. };
  638. };
  639. #if {$SCROLL[MODE] == 1}
  640. {
  641. #buffer up 1
  642. }
  643. }
  644. #EVENT {SCROLLED MOUSE WHEEL DOWN}
  645. {
  646. #if {$SCROLL[MODE] == 1}
  647. {
  648. #if {%0 < $ROWS / 2}
  649. {
  650. #buffer down 1;
  651. #buffer info save SCROLL[INFO];
  652. #if {$SCROLL[INFO][LINE] == -1}
  653. {
  654. #var SCROLL[MODE] 0;
  655. #var SCROLL[BOT_ROW] $SCROLL[OLD_ROW];
  656. #split 0 1;
  657. #buffer end;
  658. }
  659. }
  660. }
  661. }
  662. #event {RECEIVED LINE}
  663. {
  664. #if {$SCROLL[MODE] == 1}
  665. {
  666. #if {&BUFFER[] > $ROWS}
  667. {
  668. #list BUFFER del 1
  669. };
  670. #list BUFFER add {%0};
  671. #draw tile $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL] $BUFFER[%*];
  672. }
  673. }
  674. #nop -------------------------------------------------------------------------
  675. #nop
  676. #nop -------------------------------------------------------------------------
  677. #nop -------------------------------------------------------------------------
  678. #nop
  679. #nop -------------------------------------------------------------------------
  680. #nop -------------------------------------------------------------------------
  681. #nop
  682. #nop -------------------------------------------------------------------------
  683. #nop -------------------------------------------------------------------------
  684. #nop
  685. #nop -------------------------------------------------------------------------
  686. #nop -------------------------------------------------------------------------
  687. #nop
  688. #nop -------------------------------------------------------------------------
  689. #nop -------------------------------------------------------------------------
  690. #nop
  691. #nop -------------------------------------------------------------------------
  692. #nop -------------------------------------------------------------------------
  693. #nop
  694. #nop -------------------------------------------------------------------------