1@alias 2#alias [name[=[command]]] 3 4Aliases are abbreviations for longer, frequently used commands. 5As all powwow commands, they are only recognized at the beginning 6of a line or directly after a semicolon, an open or a closed brace. 7When an alias is used, the first word following the alias name 8is placed in the variable $1, the second in $2, etc... up to $9. 9also, the whole string following alias name is placed in $0. 10 11Then, before executing <command>, every $n in <command> is replaced by its 12value. Examples: 13 14#alias summ=cast 'summon' $0 (then "summ thor" is replaced by 15 "cast 'summon' thor") 16#alias cs=cast '$1' $2 ("cs summon thor" is expanded to 17 "cast 'summon' thor") 18#alias summ (lets you edit the definition of summ) 19#alias summ= (removes the alias summ) 20#alias (displays all defined aliases) 21#alias ws={wake;stand} (note that you must use braces) 22 23Aliases are saved automatically if you started powwow with a file name as 24argument. Aliases are not expanded in verbatim mode. 25@action 26#action [[<|=|>|%][+|-]label] [{pattern | (expression)}=[command]] 27 28When 'pattern' is found in a line from the remote host, the 'command' is 29automatically executed. If the pattern contains $n, powwow matches one word 30of the remote line and puts it in the variable $n. Instead, if pattern contains 31&n, powwow places the shortest possible text (can be more than one word, less, 32or even one word) in the corresponding $n (NOT in &n). 33 34As in #alias, before executing <command>, every $n in <command> is replaced 35by its value. If the first character of the pattern is ^ (caret), the match 36will only be possible at the beginning of a line. 37If 'label' is specified, the action is labeled; otherwise it is numbered. 38The match is case-sensitive. Examples: 39 40#action >fount ^There is a fountain here={#print;drink water} 41#action -fount (turns off action) 42#action +fount (turns it back on) 43#action =fount (lets you edit it) 44#action <fount (removes action) 45 46If you use % instead of >, you define an action that uses an Extended POSIX 47regexp to match instead of the standard matcher. 48 49#action %first ^([[:alpha:]]+) ([[:digit:]]+)=#print $2 counted $3. 50 (matches abc 123) 51 52Note that if the pattern starts with '(', it is evaluated, which means that 53a regexp that starts with '(' has to be surrounded by ("...") 54 55#action %second ("(..+)-\\1")=#print Double $1 56 (matches xyz-xyz) 57For regexp actions, $0 = the line, $1 = the whole match and $2... contain the 58submatches. 59@bind 60#bind [edit|key[=[command]]] 61 62You can bind most function keys and control keys to enter a command for you 63when the key is pressed. You cannot (yet) redefine a key already used for an 64editing function (such as the arrow keys). 'key' is the name of the key you 65want to define; When defining a new key, you will be asked to press it so 66powwow can record the control sequence your terminal sends. Examples: 67 68#bind (lists all key bindings) 69#bind f1=recite scroll of recall (you'll have to press f1 then) 70#bind f1=cast 'sanctuary' (change exiting definition) 71#bind f1 (lets you edit the definition) 72#bind f1= (removes the key) 73#bind edit (lists editing keys) 74 75By default, the vt100 numeric keypad is partially used to walk around 76@key 77#key name 78 79If 'name' is the name of one of the key defined with #bind, #key executes the 80corresponding command. Example: 81 82#bind f1=flee (binds the f1 key to the 'flee' command) 83At any time, then, you can either: 84- Press your f1 key on you keyboard 85- Execute the command '#key f1' 86and powwow will execute the command 'flee' for you. 87@reset 88#reset {all|list-name} 89 90Argument: Effect: 91all clear everything (apply all lines below this) 92alias clear all aliases 93action clear all actions 94bind clear all key bindings and restart with default 95 settings. Note that also editing keys are resetted 96 to default function. 97at clear all delayed commands 98in (same thing) 99mark clear all markers 100var clear all variables 101@mark 102#mark [text[=[attribute]]] 103 104This command highlights a text in your output in the way you choose 105(if your terminal supports it). Attributes: 106one or more of bold, blink, inverse, underline and/or 107[<foreground>] [on <background>], where the colors are: 108black, red, green, yellow, blue, magenta, cyan, white and 109BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, none. 110Wildcards are allowed ($ for a single word, & for any string). Examples: 111 112#mark Sizzler=bold (mark Sizzler in bold) 113#mark Sizzler (lets you edit the above definition) 114#mark Sizzler= (Sizzler is no longer put in bold) 115#mark (lists all markers) 116#mark *&*=inverse (mark in reverse any string in * *) 117@module 118#module [module name] 119 120This loads a shared library module by name, if supported by your system. The 121name of the module should be included in the documentation that came with the 122powwow extension, for example to load the perl module you would use: 123 124#module perl 125 126Which gives you the perl command that can be used like: 127 128#perl powwow::exec( "say it is " . scalar(localtime()) ) 129 130The commands added and their syntax varies depending on the module. 131 132@history 133#history [number] 134 135#history alone shows you the last commands in history, up to the number 136of lines in your screen. 137#history -n shows the last n commands in history, and 138#history n executes the n-th command of the history. 139 140#history commands are not placed in history. 141@hilite 142#hilite [attribute] 143 144This sets the attribute of your entered text to the given attribute. 145Just #hilite turns it off. 146 147Attributes: one or more of bold, blink, inverse, underline and/or 148[<foreground>] [on <background>], where the colors are: 149black, red, green, yellow, blue, magenta, cyan, white and 150BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, none. 151@host 152#host [hostname port] 153 154Sets the default host that powwow shall try to connect to when you use 155#connect. 156If you type #host without any arguments, the current host and port are 157shown (provided that you have specified them). 158@color 159#color [attrib] 160 161(This command exists only if BUG_TELNET is defined, to cope with 162 deficiencies of NCSA telnet 2.2) 163Set your standard foreground and background to the colours you specify. 164#color sets default colors 165@connect 166#connect [session-id [initstr] [address port]] 167 168Connect a new session. 169 170To connect your first session, use: 171#connect main <address> <port> 172where <address> and <port> indicate the host you want to connect to. 173 174If no address/port is defined, you either get connected to the default 175host and port (if you have no open connection) or a list of open 176connections is shown. 177 178Last opened session will be the default one. 179 180If <initstr> is specified, it is sent to host on connection. 181@keys 182Default editing keys: 183 184^A &begin-of-line 185^E &end-of-line 186^B &prev-char M-b &prev-word 187^F &next-char M-f &next-word 188^P &prev-line 189^N &next-line 190^D &del-char-right M-d &del-word-right 191BS &del-char-left M-BS &del-word-left 192^K &kill-to-eol M-k &redraw-line-noprompt 193^L &redraw-line M-l &downcase-word 194^T &transpose M-t &transpose-words 195^Q &clear-line 196 M-u &upcase-word 197^W &to-history 198^Z &suspend 199Tab &complete-word M-Tab &complete-line 200Ret &enter-line 201LF &enter-line 202 203not assigned: &insert-string 204 205M-<key> means press escape and then <key>, or press meta/alt key at the same 206time as <key>. ^ means control. 207If your terminal has arrow keys, they are set for default to move cursor and to 208step around history. 209@wrap 210#wrap [on|off] 211 212Normally, powwow wraps words that would have been cut by the right 213margin to the next line. This command lets you turn it off and on. 214@compact 215#compact [on|off] 216 217Normally, powwow does not touch the prompts on screen while you play. 218In #compact mode, instead, lines containing only a prompt are deleted when 219further messages arrive from the remote host. 220@echo 221#echo [on|off] 222 223Normally, powwow echoes on your screen each command sent to remote 224host but not directly typed (example: aliases and actions sending text 225to the MUD). When #echo is off, such commands are still sent to host, 226but not echoed on screen. 227@info 228#info [on|off] 229 230Normally, powwow prints on screen some messages each time you 231define/edit/delete an #alias, #action, #bind and similar. 232When #info is off, those messages are not typed at all. 233(But errors are still printed on screen) 234@debug 235#debug [on|off] 236 237Normally, powwow does not print on screen the command lines it 238executes. When #debug is on, every line executed by powwow is also 239echoed on screen (warning: this prints LOTS of lines on your screen) 240@delim 241#delim [normal|program|{custom <chars>} 242 243By default, when powwow adds words to the word completion buffer, 244it uses only SPACE (' ') and SEMI-COLON (';') as delimeters. You 245can change this behaviour by specifying "program" or "custom" mode. 246The "program" mode uses ' <>!=(),.;"'{}[]+-/*%=' as separators, which 247is suitable if you are doing some kind of on-line programming. 248You can also make a customized setting with the "custom" mode (space 249is always used as a delimeter). 250This setting also affects &transpose-words (usually bound as M-t) 251@for 252#for ([init];check;[loop]) command 253 254Directly copied from C language, this command evaluates 'init' 255(if specified), then repeats the following cycle: 256 1) evaluate 'check', if result is 0 (false) stop repetition 257 2) execute 'command' 258 3) evaluate 'loop' (if specified) 259 4) restart from 1) 260 261As with #while, #for performs the parameter substitution in 'command'. Example: 262#for (@0=32; @0<=47; @0++) read @0 (read messages 32-47) 263@at 264@in 265#at [label [(time-expression) [command]]] 266or 267#in [label [(delay in millisec.) [command]]] 268 269If you want to tell powwow to execute the command 'kill wolf' 2702 seconds after you type it, use this command: 271#in attack (2000) kill wolf 272 273If you do not specify the command, powwow assumes the label is already 274defined, and changes its delay. 275A delay less than zero means the delayed label is disabled. 276A delay of zero deletes the delayed label. 277 278If you specify only a label, powwow lists it. 279If you specify nothing, all delayed labels are listed. 280 281The #at command is almost the same as #in, but assumes the expression 282in ( ) is a time. 283For example (114520) means 11:45:20 and ("114520") is the same. 284 285After executing a delayed command, powwow does not delete it, but simply 286disables it. 287@stop 288#stop 289 290Disables all delayed commands (not delete). 291Useful if you start an infinite loop with a self-reactivating delayed command 292@add 293#add {text|(expression)} 294 295Add the text or result of expression (calculator is used to evaluate the 296expression) to the word completion list. Example: 297 298#action >reply ^$1 tells you={#print;#add $1} 299 (from now on, you can use TAB to complete that name) 300@addstatic 301#addstatic {text|(expression)} 302 303Add the text or result of expression (calculator is used to evaluate the 304expression) to the static word completion list. Example: 305 306#addstatic Tintin Milou (from now on you can always use Tab to complete 307 these two names) 308 309Note that the static list is not saved when you run #save, and its 310words will never be overwritten as new words are added. 311 312It is best used from your #init command, for example: 313 314#init ={#identify;#exe <static-completions} 315 316If the 'static-completions' file contains a number of #addstatic 317commands, all those words will always be possible to Tab-complete on. 318 319@option 320#option [+-=]<option> | list 321 322This command lets you list or change various options of powwow. 323 324 #option lists all current option settings 325 #option list long list of current options 326 #option =<option> edit current setting of <option> 327 #option +<option> enable <option> 328 #option -<option> disable <option> 329 #option <option> toggle <option> 330 331@put 332#put {text|(expression)} 333 334If a text is specified, powwow puts it in history. If an expression is 335specified, powwow uses the inline calculator to evaluate it, and then puts the 336result in history. 337@() 338@ () 339#(expression) or # (expression) 340 341Evaluate expression with calculator, and trash result. Examples: 342 343#(@7=45) (set value of variable @7 to 45) 344#alias set=#($-1 = \$0) (copy parameter $0 of the alias into $-1) 345@print 346#print [<|!][string|(expression)] 347 348If a string is specified, powwow simply prints it on screen. If an expression 349is specified, powwow uses the inline calculator to evaluate it, and then 350prints the result. 351 352If a #print without arguments is found, powwow prints the value of the 353variable $0 (this is a special feature of #print, and is not present in #send, 354#exe, #emulate or #var). 355 356If < precedes the text or expression, #print assumes text (or result of 357expression) to be name of a file, and displays the contents of that file. 358 359Instead if ! precedes the text or expression, #print assumes text (or result of 360expression) to be a Bourne shell command, whose output is displayed. 361Examples: 362 363#action disint ^&1 disintegrates &2=#print $1 DISINTEGRATES $2 364#action disint ^&1 disintegrates &2=#print (\$1+" DISINTEGRATES "+\$2) 365#print <mytext (display a text on screen) 366#print !more mytext (same thing, but uses 'more' as text viewer) 367#print (@-7) (print value of variable on screen) 368#print <($2) (display the contents of file whose name is in 369 variable $2) 370 371Further feature (supported also by #send, #exe, #emulate and #var): 372If < or ! is specified, and you use an expression after it, you can also 373specify starting and ending line of the file/command output that you want 374to use (the other lines will be ignored), in this way: 375 376#print {<|!}(string-expr;[start];[end]) 377@send 378#send [<|!]{text|(string-expr)} 379 380The simplest use of #send is to evaluate an expression and to send 381the result to the MUD. More generally, #send is very similar to #print, 382with the only difference that the final text is sent to the MUD rather 383than displayed on screen. 384The meaning of < and ! is the same, and #send do the expected things 385when they are used. Examples: 386 387#send <mytext (stuff a text into the mud) 388#send !awk ' {print "tell arthur " $0} ' file (say a file to your friend) 389#send ("say I have been playing for " + %(timer/86400000) + " hours") 390@exe 391#exe [<|!]{text|(expression)} 392 393Evaluate the expression and get result, then execute result as if typed from 394keyboard. If < or ! is specified, #exe behaves exactly like #print, but 395executes the final text as if typed. Examples: 396 397#exe ("sigh") (is the same as typing sigh from keyboard) 398#bind control_s=#exe ("#capture emergency" + %(@-7++)) 399 (each time you press control_s, a different 400 file is opened as capture) 401#exe <mytext (read the file mytext and execute it) 402@emulate 403#emulate [<|!]{text|(expression)} 404 405Evaluate the expression and get result, then parse result as if received from 406remote host. If < or ! is specified, #emulate behaves exactly like #print, 407but parses the final text as if received from host. Examples: 408 409#emulate The assassin is dead! R.I.P. (powwow reacts in the same way as 410 if received the text from remote host) 411#emulate <mytext (read the file mytext and parse it as 412 if received) 413@var 414#var $number = [<|!]{text|(expression)} 415#var @number = [<|!]{text|(expression)} 416 417Evaluate the expression and get result, then put result in the indicated 418variable. If < or ! is specified, #var behaves exactly like #print, but puts 419the final text in the variable. 420You can also use an expression instead of 'number'. Examples: 421 422#var @(-1*4) = 27 (same as #(@(-1*4)=27) ) 423#var @1=!echo '5.6+6.48' | bc -l (use bc calculator and put result in @1) 424#var $test = this is a very very very long text (you do not need quotes) 425#var $-6 = ("a short text") (since there are parentheses, you must 426 also use quotes as in calculator) 427#var $-1 = <myfile (if myfile is longer than 1024 bytes, 428 powwow will read only the first 1024) 429 430#var variable 431will let you edit the current value of the variable 432 433#var variable= 434will delete the variable 435@write 436#write [>|!](text;name) 437 438Evaluate expression and get result, then append result to 'name' file. 439If > is specified, 'name' file is truncated before actually writing result. 440 441If ! is specified, 'name' shell command is executed, and result is written 442to its standard input. Examples: 443 444#write ($test; "myfile") (append contents of $test to the end of myfile) 445#write !("55+12"; "bc -l") (eval 55+12 using bc program) 446@if 447#if (expression) command1 [#else command2] 448 449Evaluate the expression: if result is 'true' execute command1, 450otherwise (if there is an #else) execute command2. 451If expression is false and there is no #else, execute nothing. 452remember that you must use braces {} if command1 or command2 453contain more than one instruction. 454@settimer 455#settimer (expr) 456 457Evaluate the expression and get result, then set 'timer' to restart from the 458corresponding number of milliseconds. Examples: 459 460#settimer (0) (reset internal timer to 0) 461#settimer (20000) (make internal timer restart from 20000 milliseconds) 462@while 463#while (expression) command 464 465This construct repeats a command while expression keeps true. As with #alias, 466#action and #for, the $n and @n in command are replaced by their values. 467Examples: 468 469#while (@0<13) {read @0;#(\@0++)} (read messages 0-12) 470 (As you can see, the last @0 is escaped to avoid it to be 471 substituted with its value - we want to decrease the variable!) 472@math 473The inline calculator is used to evaluate expressions inside 474#(), #print (), #exe (), #send (), #if (), #while (), #for (), #do (), etc. 475and (if you use this syntax) expressions in pattern of #actions 476 477The inline calculator recognizes the following objects: 478 479numbers (only integers are supported) 480 decimal numbers: 481 simply write them. 482 483 hexadecimal numbers: 484 use '#' as prefix: #F is 15, #a0 is 160, and so on 485 486 numbers in any other base: 487 use base# as prefix: 2#101 is 5, 7#14 is 11... 488 489 if you use negative non-decimal numbers, you must put '-' 490 before the base: -2#101 is -5, 2#-101 causes an error. 491 492quoted-strings (i.e.: strings in " "). 493NOTE: powwow unescapes them when they are evaluated 494 495timer (number of milliseconds since last timer reset) 496 497map (string containing the map shown by #map command) 498 499variables: 500 @n with n within -50 and 9, are numeric-variables 501 $n with n within -50 and 9, are string-variables 502 503 Variables with negative index (@-1...@-50 and $-1...$-50) are global, 504 while variables with positive or zero index are parameters: they are local to 505 the #alias, #action, #while or #for powwow is executing, and each time 506 powwow executes one of these commands, a new set of parameters is created. 507 508 @name are numeric-variables 509 $name are string-variables 510 511 Every character of the name must be either: 512 a letter (uppercase or lowercase) 513 an underscore '_' 514 a number 515 Exception: the first char of the name must NOT be a number 516 517operators between numbers: 518 ++ -- + - 519 * / % 520 + - 521 << >> 522 < <= > >= == != 523 & | ^ 524 && || ^^ 525 = *= /= %= += -= <<= >>= &= ^= |= &&= ^^= ||= 526 , 527 ( ) 528(no help on these operators, see a C-language manual) 529(note: unlike C, operators && and || always eval both arguments) 530(also, % and %= always return non-negative values) 531 532random number generator: 533 534 rand positive-number (return a random number between 0 and n-1) 535 536operators between strings: 537 + chain two strings 538 = assign a string to a string-variable 539 += append a string to a string-variable 540 - compare two strings: result -1 if s1<s2, +1 if s1>s2, 541 0 if s1==s2 542 < <= > >= == != compare two strings 543 .? number of chars in a string 544 :? number of words in a string 545 ? position of first occurrence of second string in the first 546 * convert first char of a string into its ASCII code or vice versa 547 % convert string into its numeric value or vice versa 548 549operators between a string and a number: 550 (string is first argument) 551 : n-th word of a string 552 . n-th char of a string 553 :< :> <: >: .< .> <. >. return part of a string, in this way: 554 : before > or < means 'mark the n-th word from start' 555 . before > or < means 'mark the n-th char from start' 556 : after > or < means 'mark the n-th word from end' 557 . after > or < means 'mark the n-th char from end' 558 > means: return from marked word/char to end 559 < means: return from start to marked word/char 560 561Examples: 562 563#print($5="Hello, world") (assign "Hello, world" to $5 and print it) 564 565#action >+exp ^You have scored $1 exp={#print;#print ("You gained " + 566 %($1 - @-5) + " exp. points since last score"); #(@-5 = $1)} 567 (when you type 'score' in MUME, one of the lines you get is: 568 You have scored xxx experience points ... ) 569@warranty 570 NO WARRANTY 571 572 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 573FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 574OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 575PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 576OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 577MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 578TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 579PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 580REPAIR OR CORRECTION. 581 582 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 583WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 584REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 585INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 586OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 587TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 588YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 589PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 590POSSIBILITY OF SUCH DAMAGES. 591