SCRIPTS 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  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 and substitution will add a speed reader to the split line
  262. #nop -------------------------------------------------------------------------
  263. #split
  264. #function spellcheck
  265. {
  266. #format result %S %1;
  267. #if {$result == 0}
  268. {
  269. #var result %1
  270. };
  271. #else
  272. {
  273. #var result <118>%1<900>
  274. };
  275. #list speedread ins -1 {$result}
  276. }
  277. #substitute {{\b[a-zA-Z]+\b}} {@spellcheck{%1}}
  278. #tick {speedread}
  279. {
  280. #if {&{speedread[]}}
  281. {
  282. #draw tile -2 1 -2 20 {$speedread[1]};
  283. #list speedread delete 1
  284. }
  285. }
  286. {0.1}
  287. #nop -------------------------------------------------------------------------
  288. #nop This function tests the random number engine
  289. #nop -------------------------------------------------------------------------
  290. #alias random
  291. {
  292. #var random {};
  293. #loop 1 1000 cnt
  294. {
  295. #math tmp 1d1000000000 % 10;
  296. #math random[$tmp] $random[$tmp] + 1
  297. };
  298. #var random
  299. }
  300. #nop -------------------------------------------------------------------------
  301. #nop This macro allows pasting multi-line code fragments on pressing ctrl-v
  302. #nop -------------------------------------------------------------------------
  303. #macro {\cv}
  304. {
  305. #cursor {convert meta} on;
  306. #line oneshot #event {CATCH RECEIVED INPUT}
  307. {
  308. #line sub {esc} #var paste {%0};
  309. #replace paste {\\n\\n} {;};
  310. #replace paste {\\n} {};
  311. #replace paste {\\t} {};
  312. #replace paste {;;} {;};
  313. #1 {$paste}
  314. }
  315. }
  316. #nop -------------------------------------------------------------------------
  317. #nop This macro allows pasting multi-line code fragments on pressing ctrl-v
  318. #nop followed by pressing ctrl-enter
  319. #nop -------------------------------------------------------------------------
  320. #macro {\e[13;5u}
  321. {
  322. #cursor get tmp;
  323. #cursor home;
  324. #cursor set {#line sub esc };
  325. #cursor enter
  326. }
  327. #nop -------------------------------------------------------------------------
  328. #nop This event will cause tintin to always report your screen width as 80
  329. #nop columns
  330. #nop -------------------------------------------------------------------------
  331. #event {CATCH IAC DO NAWS}
  332. {
  333. #screen get rows ROWS;
  334. #format ROWS %a $ROWS;
  335. #send {\xFF\xFB\x1F\xFF\xFA\x1F\x50\x00${ROWS}\x00\xFF\xF0\}
  336. }
  337. #nop -------------------------------------------------------------------------
  338. #nop Remove duplicate lines and add a counter. Does not work in gts because
  339. #nop it uses named delays.
  340. #nop -------------------------------------------------------------------------
  341. #var repeat[str] {}
  342. #var repeat[cnt] 1
  343. #act {~%+}
  344. {
  345. #if {{%0} === {$repeat[str]}}
  346. {
  347. #math repeat[cnt] $repeat[cnt] + 1;
  348. #delay {repeat} {repeat_show} {0}
  349. };
  350. #else
  351. {
  352. repeat_show;
  353. #var repeat[str] {%0}
  354. };
  355. #line gag
  356. }
  357. #alias {repeat_check}
  358. {
  359. #if {$repeat[cnt] <= 1}
  360. {
  361. #line ignore #showme {$repeat[str]}
  362. };
  363. #else
  364. {
  365. #line ignore #showme {($repeat[cnt]) %0}
  366. };
  367. #var repeat[str] {};
  368. #var repeat[cnt] 1
  369. }
  370. #nop -------------------------------------------------------------------------
  371. #nop These macros will allow you to move around with the arrow keys while
  372. #nop holding down the control key. You can move ne by pressing arrow up +
  373. #nop right simultaniously. Move up by pressing arrow up + down simultaniously.
  374. #nop Move down by pressing arrow left + right simultaniously.
  375. #nop -------------------------------------------------------------------------
  376. #macro {\e[1;5A} {#cursor preserve;#delay {move} {#cursor reset_macro;n} {0.05}}
  377. #macro {\e[1;5C} {#cursor preserve;#delay {move} {#cursor reset_macro;e} {0.05}}
  378. #macro {\e[1;5B} {#cursor preserve;#delay {move} {#cursor reset_macro;s} {0.05}}
  379. #macro {\e[1;5D} {#cursor preserve;#delay {move} {#cursor reset_macro;w} {0.05}}
  380. #macro {\e[1;5A\e[1;5A} {#undelay {move};#cursor reset_macro;n;n}
  381. #macro {\e[1;5C\e[1;5C} {#undelay {move};#cursor reset_macro;e;e}
  382. #macro {\e[1;5B\e[1;5B} {#undelay {move};#cursor reset_macro;s;s}
  383. #macro {\e[1;5D\e[1;5D} {#undelay {move};#cursor reset_macro;w;w}
  384. #macro {\e[1;5A\e[1;5B} {#undelay {move};#cursor reset_macro;u}
  385. #macro {\e[1;5B\e[1;5A} {#undelay {move};#cursor reset_macro;u}
  386. #macro {\e[1;5C\e[1;5D} {#undelay {move};#cursor reset_macro;d}
  387. #macro {\e[1;5D\e[1;5C} {#undelay {move};#cursor reset_macro;d}
  388. #macro {\e[1;5A\e[1;5C} {#undelay {move};#cursor reset_macro;ne}
  389. #macro {\e[1;5C\e[1;5A} {#undelay {move};#cursor reset_macro;ne}
  390. #macro {\e[1;5B\e[1;5C} {#undelay {move};#cursor reset_macro;se}
  391. #macro {\e[1;5C\e[1;5B} {#undelay {move};#cursor reset_macro;se}
  392. #macro {\e[1;5D\e[1;5B} {#undelay {move};#cursor reset_macro;sw}
  393. #macro {\e[1;5B\e[1;5D} {#undelay {move};#cursor reset_macro;sw}
  394. #macro {\e[1;5D\e[1;5A} {#undelay {move};#cursor reset_macro;nw}
  395. #macro {\e[1;5A\e[1;5D} {#undelay {move};#cursor reset_macro;nw}
  396. #nop -------------------------------------------------------------------------
  397. #nop Place tells in the top 5 lines of the screen
  398. #nop -------------------------------------------------------------------------
  399. #VARIABLE {COMMS} {}
  400. #ACTION {~%1 tells you %2}
  401. {
  402. addtowin %1 tells you %2
  403. }
  404. #ACTION {~%1 chats %2}
  405. {
  406. addtowin %1 chats %2
  407. }
  408. #ALIAS {addtowin}
  409. {
  410. #format temp {%w} {%0};
  411. #loop {1} {&temp[]} {cnt}
  412. {
  413. #list COMMS ins -1 {$temp[$cnt]}
  414. };
  415. #while {&COMMS[] > 100}
  416. {
  417. #list COMMS del 1
  418. };
  419. showwin
  420. }
  421. #ALIAS {showwin}
  422. {
  423. #screen clear square 1 1 5 -1;
  424. #list temp create $COMMS[-5..-1];
  425. #loop {1} {&temp[]} {cnt}
  426. {
  427. #regexp {$temp[$cnt]} {^$}
  428. {
  429. #nop
  430. };
  431. #else
  432. {
  433. #line ignore #showme {$temp[$cnt]} {$cnt} {1}
  434. }
  435. }
  436. }
  437. #ALIAS {test}
  438. {
  439. #split 5 1;
  440. #showme <138>Bubba tells you 'hello';
  441. #showme <158>Pamela chats 'bye';
  442. }
  443. #nop -------------------------------------------------------------------------
  444. #nop Display two sessions next to each other
  445. #nop -------------------------------------------------------------------------
  446. #event {SCREEN RESIZE}
  447. {
  448. #var ROWS %0;
  449. #var COLS %1;
  450. #draw line 1 {$COLS / 2} -3 {$COLS / 2};
  451. #left #screen scroll 1 1 -3 {$COLS / 2 - 1};
  452. #right #screen scroll 1 {$COLS / 2 + 1} -3 -1;
  453. }
  454. #event {PROGRAM START}
  455. {
  456. #screen raise SCREEN RESIZE;
  457. #ses right localhost 4321;
  458. #ses left localhost 4321;
  459. }
  460. #event {SESSION CREATED}
  461. {
  462. #var name %0;
  463. }
  464. #event {SESSION ACTIVATED}
  465. {
  466. #gts #var active %0;
  467. }
  468. #event {RECEIVED OUTPUT}
  469. {
  470. #if {"@gts{$active}" == "$name"}
  471. {
  472. #return;
  473. };
  474. #switch {"$name"}
  475. {
  476. #case {"left"} {#draw Red boxed foreground buffer 1 1 -3 {$COLS / 2 - 1};};
  477. #case {"right"}{#draw Red boxed foreground buffer 1 {$COLS / 2 + 1} -3 -1};
  478. };
  479. }
  480. #nop -------------------------------------------------------------------------
  481. #nop Follow the group leader on the map.
  482. #nop -------------------------------------------------------------------------
  483. #var short_dir
  484. {
  485. {north}{n}
  486. {northeast}{ne}
  487. {east}{e}
  488. {southeast}{se}
  489. {south}{s}
  490. {southwest}{sw}
  491. {west}{w}
  492. {northwest}{nw}
  493. }
  494. #action {%1 walks %2.$}
  495. {
  496. #var {follow_targets[%1]} {$short_dir[%2]}
  497. }
  498. #action {^You follow %1.$}
  499. {
  500. #if {&follow_targets[%1]}
  501. {
  502. #map move $follow_targets[%1]
  503. }
  504. }
  505. #nop -------------------------------------------------------------------------
  506. #nop Use mouse click to change the input cursor's position.
  507. #nop -------------------------------------------------------------------------
  508. #config mouse on
  509. #split
  510. #event {SHORT-CLICKED MOUSE BUTTON ONE -1}
  511. {
  512. #cursor position %1
  513. }
  514. #nop -------------------------------------------------------------------------
  515. #nop Move the VT100 map from the top to the right of the screen
  516. #nop -------------------------------------------------------------------------
  517. #map create
  518. #map flag vtmap
  519. #map flag unicode
  520. #map goto 1
  521. #split 0 1 0 -80;
  522. #map offset 1 82 -5 -1
  523. #screen resize horizontal 120
  524. #nop -------------------------------------------------------------------------
  525. #nop Add clickable session tabs at the top of the screen
  526. #nop -------------------------------------------------------------------------
  527. #event {PROGRAM START}
  528. {
  529. #split 3 1;
  530. #config mouse on;
  531. #var active gts;
  532. session_activated gts;
  533. }
  534. #event {SESSION CREATED}
  535. {
  536. #gts session_activated %0
  537. }
  538. #event {SESSION ACTIVATED}
  539. {
  540. #gts session_activated %0
  541. }
  542. #alias {session_activated}
  543. {
  544. #line sub esc #var sessions[$active] {<138>\e]68;2;TABS;#$active\a\e[4;24m$active\e[24m};
  545. #var active {%0};
  546. #line sub esc #var sessions[%0] {<128>\e]68;2;TABS;#nop\a\e[4;24m%0\e[24m};
  547. #draw foreground Azure table 1 1 3 -1 {$sessions[%*]}
  548. }
  549. #event {PRESSED SECURE LINK TABS MOUSE BUTTON ONE}
  550. {
  551. %4
  552. }
  553. #nop -------------------------------------------------------------------------
  554. #nop Add basic MXP link and color handling
  555. #nop -------------------------------------------------------------------------
  556. #config mouse on
  557. #event {IAC DO MXP}
  558. {
  559. #send {\xFF\xFB\x5B\}
  560. }
  561. #function {mxp_link}
  562. {
  563. #line sub esc #var result {\e]68;1;%1;%2\a\e[4m%3\e[24m}
  564. }
  565. #act {~\e[1z<VERSION>} {#send {\e[4z<VERSION MXP=1.0 CLIENT=TINTIN++ VERSION=2.02.04>}}
  566. #act {~\e[1z<SUPPORT>} {#send {\e[4z<SUPPORTS +SEND +COLOR>}}
  567. #sub {~\e[4z<COLOR #%1>%2\e[4z</COLOR>} {<f%1>%2<900>}
  568. #sub {~\e[4z<SEND HREF="%1">%2\e[4z</SEND>} {@mxp_link{MXP;%1;%2}}
  569. #event {PRESSED LINK MXP MOUSE BUTTON ONE}
  570. {
  571. #send {%4}
  572. }
  573. #sub {~\e[4z{<RExits>|</RExits>|<RDesc>|</RDesc>|<PROMPT>|</PROMPT>|<RName>|</RName>}} {}
  574. #sub {~\e[4z<RNum %d />} {}
  575. #sub {&lt;} {<}
  576. #sub {&gt;} {>}
  577. #nop -------------------------------------------------------------------------
  578. #nop Example script for using #list indexing.
  579. #nop -------------------------------------------------------------------------
  580. #var players[1] {{name}{bubba}{age}{15}{level}{24}}
  581. #var players[2] {{name}{pamela}{age}{19}{level}{2}}
  582. #var players[3] {{name}{ronald}{age}{69}{level}{13}}
  583. #var players[4] {{name}{bubba}{age}{26}{level}{30}}
  584. #var players[5] {{name}{ronald}{age}{11}{level}{31}}
  585. #alias {display}
  586. {
  587. #var out {};
  588. #loop 1 &players[] cnt
  589. {
  590. #var out[$cnt] {$cnt;$players[+$cnt][name];$players[+$cnt][age];$players[+$cnt][level]};
  591. };
  592. #draw scroll grid table 1 1 2+&players[]*2 80 $out[%*]
  593. }
  594. #alias {test1}
  595. {
  596. #list players index name;
  597. #list players order;
  598. display
  599. }
  600. #alias {test2}
  601. {
  602. #list players index name;
  603. #list players order;
  604. #list players reverse;
  605. display;
  606. }
  607. #alias {test3}
  608. {
  609. #list players index name;
  610. #list players order;
  611. #list players index level;
  612. #list players order;
  613. display
  614. }
  615. #nop -------------------------------------------------------------------------
  616. #nop This creates two input lines that can be switched between using the tab
  617. #nop key.
  618. #nop -------------------------------------------------------------------------
  619. #line quiet #split
  620. #macro {\t} {inputswitch}
  621. #var input[width] 1
  622. #alias {inputswitch}
  623. {
  624. #cursor get {input[current]};
  625. #cursor clear;
  626. #cursor set {$input[buffer2]};
  627. #cursor end;
  628. #var input[buffer2] {$input[current]};
  629. #draw Ebony tile {-1-$input[width]} 1 -2 -1 {$input[buffer2]}
  630. }
  631. #nop -------------------------------------------------------------------------
  632. #nop This allows for split screen scroll back, just use the mouse wheel in
  633. #nop the upper half of the screen.
  634. #nop -------------------------------------------------------------------------
  635. #event {PROGRAM START}
  636. {
  637. #config mouse on;
  638. #var SCROLL[MODE] 0;
  639. #split 0 1;
  640. #screen raise SCREEN RESIZE;
  641. }
  642. #event {SCREEN RESIZE}
  643. {
  644. #var ROWS %0;
  645. #var COLS %1;
  646. #screen get SCROLL_TOP_ROW SCROLL[TOP_ROW];
  647. #screen get SCROLL_TOP_COL SCROLL[TOP_COL];
  648. #screen get SCROLL_BOT_ROW SCROLL[BOT_ROW];
  649. #screen get SCROLL_BOT_COL SCROLL[BOT_COL];
  650. }
  651. #EVENT {SCROLLED MOUSE WHEEL UP}
  652. {
  653. #if {$SCROLL[MODE] == 0}
  654. {
  655. #if {%0 < $ROWS / 2}
  656. {
  657. #var SCROLL[MODE] 1;
  658. #var SCROLL[OLD_ROW] $SCROLL[BOT_ROW];
  659. #math SCROLL[BOT_ROW] $SCROLL[OLD_ROW] / 2;
  660. #var BUFFER {};
  661. #screen scroll $SCROLL[TOP_ROW] $SCROLL[TOP_COL] $SCROLL[BOT_ROW] $SCROLL[BOT_COL];
  662. #draw red teed line $SCROLL[BOT_ROW]+1 $SCROLL[TOP_COL] $SCROLL[BOT_ROW]+1 $SCROLL[BOT_COL];
  663. #screen clear square $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL];
  664. };
  665. };
  666. #if {$SCROLL[MODE] == 1}
  667. {
  668. #buffer up 1
  669. }
  670. }
  671. #EVENT {SCROLLED MOUSE WHEEL DOWN}
  672. {
  673. #if {$SCROLL[MODE] == 1}
  674. {
  675. #if {%0 < $ROWS / 2}
  676. {
  677. #buffer down 1;
  678. #buffer info save SCROLL[INFO];
  679. #if {$SCROLL[INFO][LINE] == -1}
  680. {
  681. #var SCROLL[MODE] 0;
  682. #var SCROLL[BOT_ROW] $SCROLL[OLD_ROW];
  683. #split 0 1;
  684. #buffer end;
  685. }
  686. }
  687. }
  688. }
  689. #event {RECEIVED LINE}
  690. {
  691. #if {$SCROLL[MODE] == 1}
  692. {
  693. #if {&BUFFER[] > $ROWS}
  694. {
  695. #list BUFFER del 1
  696. };
  697. #list BUFFER add {%0};
  698. #draw tile $SCROLL[BOT_ROW]+2 $SCROLL[TOP_COL] $SCROLL[OLD_ROW] $SCROLL[BOT_COL] $BUFFER[%*];
  699. }
  700. }
  701. #nop -------------------------------------------------------------------------
  702. #nop
  703. #nop -------------------------------------------------------------------------
  704. #nop -------------------------------------------------------------------------
  705. #nop
  706. #nop -------------------------------------------------------------------------
  707. #nop -------------------------------------------------------------------------
  708. #nop
  709. #nop -------------------------------------------------------------------------
  710. #nop -------------------------------------------------------------------------
  711. #nop
  712. #nop -------------------------------------------------------------------------
  713. #nop -------------------------------------------------------------------------
  714. #nop
  715. #nop -------------------------------------------------------------------------
  716. #nop -------------------------------------------------------------------------
  717. #nop
  718. #nop -------------------------------------------------------------------------
  719. #nop -------------------------------------------------------------------------
  720. #nop
  721. #nop -------------------------------------------------------------------------