diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Config.demo | 401 | ||||
-rw-r--r-- | doc/Hacking | 48 | ||||
-rw-r--r-- | doc/Makefile.am | 5 | ||||
-rw-r--r-- | doc/README.follow | 18 | ||||
-rw-r--r-- | doc/README.modules | 34 | ||||
-rw-r--r-- | doc/README.term | 26 | ||||
-rw-r--r-- | doc/TODO | 46 | ||||
-rw-r--r-- | doc/powwow.doc | 2219 | ||||
-rw-r--r-- | doc/powwow.help | 590 |
9 files changed, 3387 insertions, 0 deletions
diff --git a/doc/Config.demo b/doc/Config.demo new file mode 100644 index 0000000..7eb537e --- /dev/null +++ b/doc/Config.demo @@ -0,0 +1,401 @@ +#savefile-version 1 +#("We use an old version number to force creation of sane default #binds") + +#init ={#(@oldxp=0);mapend;#option +compact -info -echo} + +#("Connect to MUME") +#host mume.pvv.org 4242 + +#("Some aliases to use labeled #actions") +#alias ac=#action $0 +#alias <=#action <$0 +#alias \==#action =$0 +#alias >=#action >$0 +#alias +=#action +$0 +#alias -=#action -$0 + +#("Some variables") +#(@emergency = 1, @xp = -0) +#($E_col = "bold") +#($Elbereth = "Grima Slinket Crug Camaro") +#($S_col = "inverse") +#($Sauron = "Homie Aridhol Quigley Mournblade ") + +#("Some useful binds -- they all are on numeric keypad") +#alias ?=#history 1 +#alias ??=#history $0 +#bind * ^[Oj=stat +#bind + ^[Ol=open honeycomb +#bind - ^[Om=close honeycomb +#bind . ^[On=sneak +#bind / ^[Oo=! +#bind 0 ^[Op=? +#bind 1 ^[Oq=hide +#bind 2 ^[Or=s +#bind 3 ^[Os=d +#bind 4 ^[Ot=w +#bind 5 ^[Ou=exits +#bind 6 ^[Ov=e +#bind 7 ^[Ow=look +#bind 8 ^[Ox=n +#bind 9 ^[Oy=u + +#alias plusminus={#bind +=open $1;#bind -=close $1} +#action >+close The $1 is open={#print;plusminus $1} +#action >+open2 The $1 seems to be closed={#print;plusminus $1} +#action >+open1 The $1 is closed={#print;plusminus $1} + +#("Bindings for function keys") +#alias HELP=#alias HELP={remove ring;narrate HELP! EMERGENCY TRANSFER! rings off!} +#bind F01 ^[OP=HELP +#alias wi=change wimpy $0 +#alias wq=wi 100 +#alias ww=wi 1000 +#bind F02 ^[OQ=ww +#bind F03 ^[OR=wq +#bind F04 ^[OS=examine +#bind F05 ^[m=now +#bind F06 ^[[17~=#option compact +#bind F07 ^[[18~=listen all +#bind F08 ^[[19~=listen none +#alias ck=change mood berserk +#alias ca=change mood aggressive +#alias cb=change mood brave +#alias cn=change mood normal +#alias cp=chan mood prudent +#alias cw=change mood wimpy +#bind F09 ^[[20~=cw +#bind F10 ^[[21~=ca +#alias pi={remove sword;draw} +#alias sla={sheath;wield sword} +#bind F11 ^[[23~=pi +#bind F12 ^[[24~=sla + +#("Two nice aliases") +#alias ,e=emote leaves east +#alias emsay=emote says '$0' + +#("Teleporting") +#alias ll=cast 'locate life' $0 +#alias tp=cast 'teleport' $0 +#alias portal=cast 'portal' $0 +#alias go={#if (!*\$0:>2) #(\$0+="tp"); #else #if (\$0:>2=="portal") #(\$0+=" u"); #exe (\$0:>2+" "+\$0:1)} + +#alias loc={#var $talias=$1; #action +tkey; ll $2} +#action >tkey Key: '$1'={#print; #action -tkey; #alias ${talias}=go $1 \$0} + +#alias zharlond=go whicewhile $0 +#alias zmichdelv=go sillelega $0 +#alias zbree=go dorwhimile $0 +#alias 1=zHarlond +#alias 2=zMichDelv +#alias 3=zBree + +#("An emote for enchanting weapons") +#alias ench=cast 'enchant weapon' $0 +#alias enchant={, makes a swift gesture and the $0 starts floating in mid air...;EnchSet +;ench $0} +#alias EnchSet={#action $1EnchSucc;#action $1EnchFail;#action $1BackFire} +#action >-BackFire Your spell backfired!={#print;, starts swearing loudly;EnchSet -} +#action >-EnchFail You lost your concentration!={#print;, frowns and exclaims, 'This cannot be! I failed!';EnchSet -} +#action >-EnchSucc $1 glows blue.={#print;, gestures again, and arcane runes flare on the $1!;EnchSet -} + +#("Keep count of game time and also put it in the prompt") + #mark Game time =underline +#("length of a game tick in milliseconds :") + #(@tick = 61500) +#("this is to synchronize") + #action >+clock ^The current time is $1:$2 $3.={#print;#if (\@0=$1*@tick+$2*@tick/60, \$3=="pm" ^^ $1==12) #(\@0+=12*@tick); #settimer (\@0);settick} +#("print time") + #alias time={#if ((\@1=timer%@tick*60/@tick) < 10) #(\$1=":0"); #else #(\$1=":");#print ("Game time "+%(timer/@tick%24)+\$1+%\@1)} +#("manually set time") + #alias now={#if (*\$1) #(\@0=$1*@tick+0$2*@tick/60); #else #if ((\@0=timer-(\@1=timer%@tick)), \@1 >= @tick/2) #(\@0+=@tick); #settimer (\@0)} +#("put time into the prompt. works for MUME.") +#("change to use appropriate patterns for other MUDs") + #prompt %+empty ^[o\\*]>={#isprompt -1; timeprompt} + #prompt %+full ^[o\\*] [^>]*>={#isprompt -1; timeprompt} + #alias timeprompt={#if ((\@1=timer%@tick*60/@tick) < 10) #(\$1=":0"); #else #(\$1=":");#($prompt=$prompt.1+" "+%(timer/@tick%24)+\$1+%\@1+$prompt.>2)} +#("automatically print time at every tick. type `settick' to activate") +#("or change #alias `now' and #action `clock' to run it") + #alias settick=set tick 0 time + #alias set=#exe ("#in $1 ("+%((-timer-1)%@tick+2)+") {"+\$0:>3+";#in $1 ((-timer-1)%@tick+2)}") + +#("Code to help mapping mazes -- keeps track of room number") +#("using binary numbers -- 1 copper == 1, 2 coppers == 0") +#("doesn't work anymore as you now get `six pile of coins' etc. tough luck.") +#alias d1=drop 1 copper +#alias d2=drop 2 copper +#alias m=#for (\@1=$1; \@1; \@1/=2) #if (\@1&1) d1; #else d2 +#alias mapend={- copper-penny;- pile-of-coins;#(@map=0)} +#alias mapstart={+ copper-penny;+ pile-of-coins;#(@map=0);#in map-timeout (-1) {#print ("Room: "+%@map);#(@map=0)}} +#alias mapcount={#(@map*=2, @map+=$1);#in map-timeout (100)} +#action >-pile-of-coins ^A pile of coins=mapcount 0 +#action >-copper-penny ^One miserable copper penny=mapcount 1 + +#("Spells and fight") +#($self = "Cosmos") +#alias self=#($self=$(0)) +#alias k=kill $0 +#alias f=flee +#alias ff=order followers assist ${self} +#alias fw=order followers assist waran +#alias of=order followers $0 +#alias ol=of k lord +#alias on=of k noble +#alias he={#if (!*$(0)) #($(0)=$self);#send ("cast 'heal' "+$(0))} +#alias in={#if (!*$(0)) #($(0)=$self);#send ("cast 'invisibility' "+$(0))} +#alias rp={#if (!*$(0)) #($(0)=$self);#send ("cast 'remove poison' "+$(0))} +#alias sct={#if (!*$(0)) #($(0)=$self);#send ("cast 'sanctuary' "+$(0))} +#alias str={#if (!*$(0)) #($(0)=$self);#send ("cast 'strength' "+$(0))} +#alias ar={#if (!*$(0)) #($(0)=$self);#send ("cast 'armour' "+$(0))} +#alias sspell=#exe ("#alias $1={#if (!*$(0)) #($(0)=$self);#send (\\"cast '"+\$0:>2+"' \\"+$(0))}") +#alias sto=cast 'store' $0 +#alias stb=sto fireball +#alias stl=sto call lightning +#alias stp=sto teleport +#alias stq=sto earthquake +#alias sty=sto colour spray +#alias bd=cast 'block door' $0 +#alias bl=cast 'blindness' $0 +#alias bob=cast 'breath of briskness' +#alias ch=cast 'charm' $0 +#alias cwt=cast 'control weather' $0 +#alias b=cast 'fireball' $0 +#alias j=cast 'lightning bolt' $0 +#alias li=cast 'call lightning' $0 +#alias sl=cast 'sleep' $0 +#alias sle=sl $0 + +#($target = "assassin") +#alias .=$0 ${target} +#alias bl.=bl ${target} +#alias b.=b ${target} +#alias j.=j ${target} +#alias k.=k ${target} +#alias li.=li ${target} +#alias sl.=sl ${target} +#alias blo=bl orc +#alias blt=bl troll +#alias jo=j orc +#alias jt=j troll +#alias ka=k assassin +#alias kw=k wolf + +#alias tr=track $0 +#alias to=tr orc +#alias tt=tr troll +#alias tr.=tr ${target} + +#alias bs=backstab $0 +#alias bs.=bs ${target} +#alias nn=$0 Necromancer + +#("Misc stuff") +#($water = "skin") +#alias dw=drink water +#alias dk=drink ${water} +#alias lk=look in ${water} +#alias po=pour water ${water} +#alias sk=sip ${water} +#alias cv=cast 'create water' $0 +#alias cvk=cv ${water} + +#($pack = "backpack") +#alias gp=get $0 ${pack} +#alias pp=put $0 ${pack} +#alias lp=look in ${pack} + +#($light = "lantern") +#alias hl=wear ${light} +#alias rl=remove ${light} +#alias vl=cover ${light} +#alias ul=uncover ${light} +#alias cl=cast 'create light' $0 +#alias cll=cl ${light} + +#alias lg=look in moneybag +#alias gg=get $1 gold moneybag +#alias pg=put $1 gold moneybag +#alias ggj=get ruby moneybag +#alias pgj=put ruby moneybag + +#alias cf=cast 'create food' +#alias gf=get food +#alias ef=eat food +#alias food={cf;gf;ef} + +#alias bc=#if (*$(1)) butcher $1.corpse; #else butcher corpse +#alias lc=#if (*$(1)) look in $1.corpse; #else look in corpse +#alias ga=#if (*$(1)) get all $1.corpse; #else get all corpse +#alias gc=#if (*$(1)) get coins $1.corpse; #else get coins corpse +#alias gx=#if (*$(2)) get $1 $2.corpse; #else get $1 corpse +#alias xc={hl;gc $0;rl} +#alias gl=get all +#alias glc={get all.coins;get all.copper} +#action >-greed is dead! R.I.P.={#print;gc} + +#alias ldh=#if (*($1)) lead $1.horse; #else lead horse +#alias rdh=#if (*$(1)) ride $0.horse; #else ride horse +#alias ldp=#if (*($1)) lead $1.pony; #else lead pony +#alias rdp=#if (*$(1)) ride $1.pony; #else ride pony +#alias ds=dismount +#action >-Ct ^Clip-clop...the riding horse= +#action >-Cp ^Clip-clop...a pony= +#action >-Cb ^The Horse= +#action >-At ^A riding horse= +#action >-Ap ^A cute and docile pony= +#action >-Ab ^A beautiful horse= + +#alias re=t Alsbreth $0 +#action >+reply ^$1 tells you '={#print;#alias re=t $1 \$0} +#action >-xeval ^$1 tells you 'calc &2'={#print;#alias re=t $1 \$0;if (\$2?";" || \$2?"$" || \$2?"@") {tell $1 *grin*;#()}; #else #send ("t $1 "+%($2))} + +#alias rep={+ report;score} +#action >-report $1 hit, $2 mana and $3 moves.={#print;, has $1 hit, $2 mana and $3 moves.;- report} +#alias rd={#opt +speedwalk;4ensenwdnenne;#opt -speedwalk} +#alias fd={#opt +speedwalk;wsswsuwwdww;#opt -speedwalk} + +#alias lr={look n;look s;look e;look w;look u;look d} +#alias x=#alias $0 +#alias kk=#bind $0 +#alias l=examine $0 +#alias gr=group $0 +#alias le=group ${self} +#alias mm=#mark $0 +#alias sa=#save +#alias se=search $0 +#alias mo=help month +#alias ng=, nods gravely. +#alias nh=, nods happily. +#alias ns=, nods sadly. +#alias p=' open +#alias rf=rem staff +#alias rn=read next +#alias rs=rem stone +#alias rt=rem ticket +#alias sms=, smiles sadly. +#alias ss=spam +#alias fade=emote quickly wraps in his cloak and vanishes. +#alias matz=emote unwraps his cloak and materializes. +#alias fun={fade;$0;matz} +#alias tele={fade;tp $0;matz} +#alias title=chan title the Hungry +#alias tm=t Meryaten $0 +#alias wavall=, waves good-bye to you. +#alias wf=weather fog +#alias wg=weather global +#alias wh=where human +#alias wk={wake;st} +#alias wl=weather local +#alias wr={wake;rest} +#alias grz=na --- === *** C O N G R A T U L A T I O N S !! *** === --- +#alias lin={#lines $0;chan height $0} +#alias lv=na --- === *** L E V E L !! *** === --- +#alias macintosh={#bind ~home ^[OH=eq;#bind ~~home ^[O@=eq;#bind ~F01 ^[OP=#key F01;#bind ~F02 ^[OQ=ww;#bind ~F03 ^[OR=wq;#bind ~F04 ^[OS=examine;#bind ~F05 ^[m=now;#bind ~+ ^[Ok=open patch;#bind ~~F05 ^[[16~=now} + + +#alias listadd=#for (\@0=1; *$$1:\@0 && $$1:\@0!=*13; \@0++) #exe ("#mark "+$$1:\\@0+"="+$$2)} +#alias listclear={#for (\@0=1; *$$1:\@0 && $$1:\@0!=*13; \@0++) #exe ("#mark "+$$1:\\@0+"=");#($$1="")} +#alias elb={listclear Elbereth;#ac +elbereth;t elbereth list} +#alias elblist=#print ("Elf Enemies: "+$Elbereth) +#alias sauronclean={#for (\@0=1; *\$-1:\@0; \@0++) #($-1=$-1:<\\@0<.2+" "+$-1:>(\\@0+1))} +#alias pk={listclear Sauron;#ac +sauron0;#ac +sauron1;t sauron list} +#alias pklist=#print ("PKillers: "+$Sauron) +#action >-elbereth ^Elbereth Gilthoniel tells you 'Elf Enemies: &1'={#($Elbereth=\$1);listadd -5 -6;#ac -elbereth;#print} +#action >-sauron2 ^ &1more to come.'={#($Sauron+=$-1=\$1<.3+",");sauronclean;#ac -sauron2;listadd -3 -4;#($Sauron+=$-1, $-1="");#print} +#action >-sauron1 ^Sauron tells you 'My Envoys: &1={#($Sauron=$-1=\$1<.2+",");sauronclean;#ac -sauron0;#ac -sauron1;#ac +sauron2;listadd -3 -4;#($Sauron=$-1);#print} +#action >-sauron0 ^Sauron tells you 'My Envoys: &1more to come.'={#($-1=\$1<.3+",");sauronclean;#ac -sauron0;#ac -sauron1;listadd -3 -4;#($Sauron=$-1);#print} + +#action >+disappear disappears into nothing.= +#action >+exp ^Needed: $1 xp={#print;#if (\@1=-$1, !@oldxp) #(@oldxp=@xp=\@1);#print ("Exp: "+%(\@1-@xp)+" from last score, "+%(\@1-@oldxp)+" from start of session");#(@xp=\@1)} +#action >+hunt *&1* leaves $2={#mark $2=bold;#print;#mark $2=} +#action >+save Saving=#print ("---> "+\$0+" <---") +#action >-someone ^Your blood freezes as you hear $1 =#if (\$1!="The" && \$1!="the" && \$1!="A" && \$1!="a" && \$1!="An" && \$1!="an") #print +#action >+Willow A sudden drowsiness overcomes you, you yawn and...={#print;wk} + +#mark sitting=bold +#mark resting=bold +#mark sleeping=bold +#mark Room: =bold +#mark tells you=underline +#mark YOU=bold red +#mark is dead! R.I.P.=bold +#mark glows with a bright light!=bold +#mark victim shocked=bold +#mark You feel a watchful eye=bold + +#mark The corpse of *&*=bold +#mark *an Orc*=bold yellow on red +#mark *$ the Orc*=bold yellow on red +#mark *a Troll*=bold cyan on yellow +#mark *$ the Troll*=bold cyan on yellow +#mark *a Human*=blue on cyan +#mark *$ the Human*=blue on cyan +#mark *$ the Numenorean*=blue on cyan +#mark *$ the Black Numenorean*=blue on cyan +#mark *a Dwarf*=bold cyan on magenta +#mark *$ the Dwarf*=bold cyan on magenta +#mark *an Elf*=blue on green +#mark *$ the Elf*=blue on green +#mark *a Hobbit*=bold yellow on blue +#mark *$ the Hobbit*=bold yellow on blue +#alias mumecolor={change col all default;change col shout bold yellow;change col damage bold red;change col hit bold blue} +#alias nocolors={#mark *an Orc*=inverse;#mark *$ the Orc*=inverse;#mark *a Troll*=inverse;#mark *$ the Troll*=inverse;#mark *a Human*=inverse;#mark *$ the Human*=inverse;#mark *$ the Numenorean*=inverse;#mark *$ the Black Numenorean*=inverse;#mark *a Dwarf*=inverse;#mark *$ the Dwarf*=inverse;#mark *an Elf*=inverse;#mark *$ the Elf*=inverse;#mark *a Hobbit*=inverse;#mark *$ the Hobbit*=inverse} +#alias colors={#mark *an Orc*=bold yellow on red;#mark *$ the Orc*=bold yellow on red;#mark *a Troll*=bold cyan on yellow;#mark *$ the Troll*=bold cyan on yellow;#mark *a Human*=blue on cyan;#mark *$ the Human*=blue on cyan;#mark *$ the Numenorean*=blue on cyan;#mark *$ the Black Numenorean*=blue on cyan;#mark *a Dwarf*=bold cyan on magenta;#mark *$ the Dwarf*=bold cyan on magenta;#mark *an Elf*=blue on green;#mark *$ the Elf*=blue on green;#mark *a Hobbit*=bold yellow on blue;#mark *$ the Hobbit*=bold yellow on blue} + +#bind >del ^[[P=&del-char-right +#bind A-bs ^[[071q=&clear-line +#bind A-del ^[[M=&kill-to-eol +#bind A-left ^[[160q=&begin-of-line +#bind A-return ^[[100q=&to-history +#bind A-right ^[[169q=&end-of-line +#bind M-B ^[b=&prev-word +#bind M-D ^[d=&del-word-right +#bind M-F ^[f=&next-word +#bind M-backsp ^[=&del-word-left +#bind M-bs ^[^H=&del-word-left +#bind M-tab ^[^I=&complete-line +#bind ^2 ^[[186q={s;hide} +#bind ^3 ^[[194q={d;hide} +#bind ^4 ^[[174q={w;hide} +#bind ^6 ^[[192q={e;hide} +#bind ^8 ^[[182q={n;hide} +#bind ^9 ^[[190q={u;hide} +#bind ^A ^A=&begin-of-line +#bind ^B ^B=&prev-char +#bind ^D ^D=&del-char-right +#bind ^E ^E=&end-of-line +#bind ^F ^F=&next-char +#bind ^K ^K=&kill-to-eol +#bind ^L ^L=&redraw-line +#bind ^N ^N=&next-line +#bind ^P ^P=&prev-line +#bind ^Q ^Q=&clear-line +#bind ^S ^S=#capture +#bind ^T ^T=&transpose +#bind ^V ^V=#stop +#bind ^W ^W=&to-history +#bind ^X ^X=#exe ("#capture emergency"+%@emergency++) +#bind ^Z ^Z=&suspend +#bind ^bs ^[[085q=&del-word-left +#bind ^del ^[[142q=&del-word-right +#bind ^left ^[[159q=&prev-word +#bind ^right ^[[168q=&next-word +#bind ^tab ^[[072q=&complete-line +#bind backsp =&del-char-left +#bind bs ^H=&del-char-left +#bind del ^[[3~=jo +#bind down ^[OB=&next-line +#bind end ^[[4~=jt +#bind enter ^[OM=flee +#bind home ^[[1~=stat +#bind ins ^[[2~=time +#bind left ^[OD=&prev-char +#bind lf ^J=&enter-line +#bind pgdwn ^[[6~=jh +#bind pgup ^[[5~=score +#bind return ^M=&enter-line +#bind right ^[OC=&next-char +#bind tab ^I=&complete-word +#bind up ^[OA=&prev-line +#bind ~^Q ^[~q=&clear-line +#bind ~^S ^[~s=#capture diff --git a/doc/Hacking b/doc/Hacking new file mode 100644 index 0000000..2063884 --- /dev/null +++ b/doc/Hacking @@ -0,0 +1,48 @@ +Some notices for you who would like to hack the source in order to +improve powwow, fix bugs or just have fun: + +* Try not to run large chunks of existing code through your C + beautifier if the indentation style doesn't please you. This will + only greatly confuse the original author (if he can't recognize and + maintain his own code, who can?). If you write any new functions, + ok, use your own style as long as it's clear and consistent. + +* Document your changes! A brief report of changes in the Changelog file is + absolutely necessary. So is updating the doc files (powwow.doc, powwow_help + and README) Also, sending an e-mail to the code author/mantainer documenting + your changes will be appreciated. + +Report from cancan's "Hacking": + +******************************************************************************* + Remember, that although I (Yorick) am the original author, I don't dictate + the code; it is explicitly in the public domain. I am merely trying to keep + some kind of order; if versions are permitted to diverge, they are very + painful to merge later. Also, different version branches are very confusing, + and makes it hard to define the "latest and best" version. Please try to + synchronize your hacks into one - the latest - version! +******************************************************************************* + +Well, Yorick refused to merge Powwow and Cancan, so now they both exist +indipendently... Now I (Cosmos) say exactly the same thing Yorick said +('do not let version diverge'), but I fear this will happen again :( +Only difference is that powwow is now GPL-ed and not Public Domain. +I hope this will help a little. + +* Rather than you just distributing your hacked version, I _really_ prefer you + to send back to me your changes, so that I can put them into the following + release. You lose nothing doing so, since even in case I refuse to include + your changes you can still distribute your version if you absolutely want :) + + Even if you decide to distribute such a modified version, please + make it clear that it is not the original version, use a version number + which can't be confused with an original version, and put your name + in Changelog and in POWWOW_VERSION. + +* I've tried to make the code obey the following rules for modularity: + - All exported things from one .c file is declared in its .h file. + - Conversely, symbols are imported by #including .h files, + not by local extern declarations. + - Everything that can be static should be (this is not quite true yet) + + Please obey these rules (or improve them). diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..f5fc784 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,5 @@ +pkgdata_DATA = powwow.doc powwow.help +EXTRA_DIST = README.follow README.term README.modules \ + TODO Hacking Config.demo \ + powwow.doc powwow.help + diff --git a/doc/README.follow b/doc/README.follow new file mode 100644 index 0000000..9ef923b --- /dev/null +++ b/doc/README.follow @@ -0,0 +1,18 @@ + + follow 0.1 README + +This mini-program is mainly intended for debugging powwow. +It is completely standalone, and needs to be called with a file-name +(example: "follow mycapture"). +Hitting ESC or ^C quits "follow", hitting RETURN prints the next line +of the file, any other key prints the next character (only one) of the file + +I know it is a _stupid_ program, but it is useful if you find screen-related +bugs in powwow, i.e. powwow does not print some lines or prints something +wrong. +In that case, if you redirect powwow output to a file and reproduce the bug, +you can use "follow your-filename" to examine the file and see what is wrong + +How to send a copy of powwow output to a file: +powwow your-arguments | tee your-filename + diff --git a/doc/README.modules b/doc/README.modules new file mode 100644 index 0000000..8f8eae8 --- /dev/null +++ b/doc/README.modules @@ -0,0 +1,34 @@ +There is a sample module included to test module support. To build +it run: + +make plugtest.so + +from your powwow source directory. This will build a test plugin that +can be loaded using: + +#module plugtest + +If it works, when you do "#help" you will see a new command called +"#plugtest" that is listed. It will just echo the arguments back +to the terminal. This is the minimum required to make a functional +module for powwow 1.2.7 and later. + +Modules are loaded using the libdl interface with RTLD_LAZY so that +symbol resolution is deferred until as late as possible. This means +that you should test any commands you create since just because a +module loads, that doesn't mean that there are no undefined references. + +The basic requirements for a module are: + +1) define a cmdstruct with your command name, help text, and function to + call +2) add your cmdstruct to the global command list via cmd_add_command in + your powwow_init function. You can also initialize anything else you + need here, it will be called once at module load time. +3) perform whatever extentions you want at runtime in your custom functions + +For a more complete example, you should look at the powwow-perl package +which creates the bindings from powwow using the #perl command and allows +access to powwow internals from perl via the powwow:: namespace in perl. +It also includes autoconf support and is probably the most complete +module for powwow currently. diff --git a/doc/README.term b/doc/README.term new file mode 100644 index 0000000..6dfad6c --- /dev/null +++ b/doc/README.term @@ -0,0 +1,26 @@ + +'term' was written by Michael O'Reilly. + +If you don't know what term is, then you can ignore this file. :) + +Otherwise, if you want term support, read on... + +You need to edit the Makefile and edit the TERMDIR variable to the +directory of your term source and client.a. + +If you don't want 'term' compression on for powwow, take out the +-DTERM_COMPRESS in the CFLAGS variable in the Makefile. + +Edit any of the other variables you find neccessary. + +Read the original README for information you might need to know. + +Then do "make termpowwow" + +Note: Unfortunately one of the setbacks of termpowwow is that it won't +detect unknown hosts, nor will it detect if the host refused the connection. +If you don't get any output from a host after a few moments, then you'll +have to ^C. I don't think there's any way around this. + +(note - term support does not allow multiple sessions...) + diff --git a/doc/TODO b/doc/TODO new file mode 100644 index 0000000..6112fe9 --- /dev/null +++ b/doc/TODO @@ -0,0 +1,46 @@ +-*-indented-text-*- + +From the authors of cancan: + + THINGS TO DO + Cancan should know the codes of at least some keys + by looking in the TERMCAP. (especially control keys are trivial!) + + - Run (a)lint! + + - There seems to be problems with running cancan on exotic terminals. + This defeats the very purpose of all the carefully terminal- + independent code with TERMCAP, and is generally embarrassing. + + - more system calls should be checked for EINTR for sysV unices + + - negotiate the telnet BINARY option + + - support the telnet IAC GA command to identify prompts + (But what for? Prompts have to be identified as such in the absence + of GA anyway, and there doesn't seem to be a need for it right + now.) + + - implement reverse-incremental-search (like ^R in GNU Readline) + + KNOWN BUGS + - Deleting more than one character with deletechar() might leave + ugly traces on lines that are entirely deleted. + + - using #hilite with coloured background might have effects beyond the + input line, depending on the terminal (don't do that, then :-) + + FUTURE POSSIBLE IMPROVEMENTS + Do some more for portability (clean up the terminal mess) + The source should be more modular + Filtering output through shell command (grep etc) + + +THINGS TO DO/PLANNED IMPROVEMENTS on powwow: + - make a better #help + - add termcap "end of bold", "end of blink" etc. + + If you have ideas, suggestions or whatever, e-mail them to me + (max@Linuz.sns.it) and if I find them interesting, I will add them. + Also, I am trying to keep powwow updated with further releases + of cancan. diff --git a/doc/powwow.doc b/doc/powwow.doc new file mode 100644 index 0000000..0404328 --- /dev/null +++ b/doc/powwow.doc @@ -0,0 +1,2219 @@ + P O W W O W + + doc for version 1.2.21 + last modified Oct 09, 2007 + +INTRODUCTION + + powwow is a client program, which replaces telnet for the lazy + mudder who wants some (only some?) extra features. + It is primarily designed for DikuMUDs, but nothing prevents its use + for other types of muds. powwow is based on another client, cancan, + and cancan was originally inspired by tintin (yet another client) + by Peter Unold (pjunold@daimi.aau.dk), but is entirely re-written. + powwow also implements the MUME remote editing protocol, which + enables you to edit texts on the mud using your own favourite + editor, several texts at once if you have a windowing terminal. + +STARTING POWWOW + + Powwow maintains definition files where aliases, actions and + mud addresses are saved. Powwow is then called by: + + $ powwow definition-file + + (the $ above stands for your prompt, do NOT type it) + + If the definition file doesn't exist (as the first time you + use powwow) you are asked for a host name and port number. + This will then be stored in the file. The file will be updated + every time you type '#save' or when powwow terminates. + The file is in plain text, so you can edit it if you want. + It makes sense to have one file for each mud you play, or for + each set of definitions you use in the same mud. + + If the environment variable POWWOWDIR exists, that directory + is first searched for definition files and new files are + created there rather than in the current directory, unless + definition-file contains a slash ("/"). + + The file 'Config.demo' is a demonstrative definition file provided + together with powwow to help you building your own configuration. + Look at it: there are many useful examples and non-trivial code + to fully use powwow. + + You may also start powwow with: + + $ powwow netaddress portnumber + + but nothing will then be saved. + + In alternative you can simply type: + + $ powwow + + and you will enter test-mode: you will be able to use internal commands + but you will need to start a session manually + (#connect main <address> <port>) if you want to connect to a MUD. + + To solve the problem met in MUME, where you may have to try many + different servers to connect to the game, a fourth syntax has been + added: + + $ powwow definition-file netaddress portnumber + + With this syntax powwow reads settings from definition file, + but overwrites the old address with the newly specified one. + + Note: If you have several sessions (different invokations) + with the same definition file active simultaneously, the + settings changed in one session can be overwritten by a change + in another session. + +QUITTING POWWOW + + At any time, you can type #quit to exit from powwow. Be + careful, as #quit brutally closes the connection to the mud, + without renting your character. Normally, you want to log out + gracefully from the mud before doing that. If you wish to cut + your link manually, you can also press the break key on your + system twice (usually Control-C or DEL) (You must hit it twice + because hitting only once is used to stop command parsing - + see the bottom of this file). + +POWWOW TEST MODE + + There are various ways to enter powwow test mode: + + 1) typing `powwow' from you command shell + (You will have to load your definition file manually if you need it, + using the following command: #load <save-file> ) + + 2) starting powwow with a definition file that does not contain + a '#host' line or contains a '#host' alone, without any address + + 3) starting powwow opening one or more MUD connections, + then closing them all. (You'll need to have #option quit + disabled or powwow will exit when closing the last connection) + + Remember that to connect to a MUD from test mode you must use: + #connect main <address> <port> + +COMMAND CHAINING + + Powwow allows you to type several commands on one line + separated by the ; character. If you want to use a semicolon + literally, prefix it by a backslash (\). (Backslashes must of + course be escaped too if used literally.) + + Examples: + > n;get coins;s rapidly rescue some money + > say No beer? \;) semicolon must be escaped + + In addition, you must also surround every list of commands by braces: + '{' and '}'. The only exception (as you can see from the example above) + is when you type multiple commands from keyboard: in that case, + and only in that, braces are not needed. + Also, if you want to use a { or } literally, prefix it with a backslash + as you do with semicolons. + + Another use of semicolons is to send a <new-line> character to the MUD + you are connected to. Infact powwow sends a <new-line> every time it + meets a null command (0 chars) followed by a semicolon. + + Examples: + > press <return> only: send a <new-line> + > ; press ; and then <return>: same effect + > ;; send two <new-line> + > ;;; three <new-line> ... + + Of course multiple <new-line> are considered as multiple commands, + so you usually have to surrond them with braces. If directly typed + from keyboard, the braces are optional. + + > {} do nothing + > {;} send a <new-line> + > {;;} send two <new-line> + > {;;;} and so on... + + The verbatim mode disables this special meaning of semicolons and + braces, and the #quote command lets you switch between verbatim and + normal mode. + +COMMAND CONTINUATION + + Long lines can be continued by ending each intermediate line with a + backslash (\). This way long and complicated aliases can be written + a somewhat readable format. For example: + + #al drau={#send ("get tail "+$hcon);#send ("get fur "+$hcon);#send ("get vial "+$hcon);#send ("get tarragon "+$hcon);put tail kit;put fur kit;put vial kit;put tarragon kit} + + Could be written (somewhat) more legibly as: + + #al drau={\ + #send ("get tail "+$hcon);\ + #send ("get fur "+$hcon);\ + #send ("get vial "+$hcon);\ + #send ("get tarragon "+$hcon);\ + put tail kit;\ + put fur kit;\ + put vial kit;\ + put tarragon kit\ + } + + Note that when powwow saves your aliases (e.g. you leave #file defined) + that it will not preserve this formatting, so it is most useful if + you use a file that is not saved over on exit. For example, if + you use a single configuration file that calls several smaller + configuration files that are grouped by similar intent, like having + an xp counter script, a prompt script, etc. + +SPECIAL COMMANDS: ALIASES AND ACTIONS + + Powwow parses all lines beginning with the character '#' as + special commands. To send a line that begins with '#' itself, precede + it with a backslash. The commands are case-sensitive. + Commands can be abbreviated as much as you want. + ----------------------------------------------------------- + Alias definition + #alias [name[=[command]]] + + Aliases are abbreviations for longer, frequently used commands. + As all powwow commands, they are only recognized at the beginning + of a line or directly after a semicolon, an open or closed brace. + When an alias is used, the first word following the alias name + is placed in the variable $1, the second in $2, etc... up to $9. + also, the whole string following alias name is placed in $0. + + Then, before executing <command>, every $n in <command> is replaced + by its contents. + + Example: + #alias summ=cast 'summon' $0 (then "summ thor" is replaced by + "cast 'summon' thor") + #alias cs=cast '$1' $2 ("cs summon thor" is expanded to + "cast 'summon' thor") + #alias summ (lets you edit the definition of summ) + #alias summ= (removes the alias summ) + #alias (display all defined aliases) + #alias ws={wake;stand} (note that you must use braces) + + As noted above, aliases are saved automatically if you started powwow + with a file name as argument. + Aliases can contain other aliases, and an alias can also contain itself + (be careful, or powwow will enter a long - but not infinite - loop) + Aliases are not expanded in verbatim mode. + + Where aliases contain other aliases, one or more '\' can be prepended + to $n to delay text substition or to use the symbol $n literally. + + Example: + #alias ac=#alias $1=cast '$2' \$0 + (then "ac sm summon" will give you a new alias + "#alias sm=cast 'summon' $0") + + #alias \==score + (this defines = as an alias for 'score', Note that you must + escape the first = to force powwow to consider it literally) + + #alias \`=#history $0 + (this defines \ as an alias for '#history'. Note that you must + use ` to escape the \ . Just doing \= would escape the = ) + + Aliases starting with `#' are allowed and do work, + but cannot override any special command. + ----------------------------------------------------------- + Automatic command execution triggered on output + #action [[<|=|>|%][+|-]label] [{pattern | (expression)}=[command]] + + When 'pattern' is found in a line from the remote host, the + 'command' is automatically executed. If the pattern contains $n, + powwow matches one word of the remote line and puts it in the + variable $n. If the pattern contains &n, powwow matches a string + (possibly more than one word) of the shortest possible length + from the remote line and puts it in the variable $n. + + As in aliases, $n can be from $1 to $9. NOTE: $0 is a variable as well, + but #action automatically places in it the whole line from remote host. + As well, &n can be from &1 to &9. + + Warning: powwow does NOT print on screen lines from MUD that are + intercepted with an #action. So if you want to print them, you + must explicitly use a #print or set the #option +autoprint + (the help on #print and #option is below in this text) + If you want to intercept a prompt, use #prompt instead of #action. + (the help on #prompt is near the end of this file) + + If the first character of the pattern is ^ (caret), the match + will only be possible at the beginning of a line. + The match is case-sensitive. + If 'label' is specified, the action is labeled; otherwise it is + numbered. + + If an <expression surrounded by parentheses> is used insted of pattern, + powwow evaluates the expression with the inline calculator (see below) + and then uses the result as pattern. + + Examples: + #action ^You are hungry=eat bread + #action ^You are hungry= (removes the action) + #action ^$1 hugs you={#print;kiss $1} + #action ^$1 says &2=say $1 said $2 (note you must use $, not & + after the =) + #action Jehova={#print;say Who said that? Stone him!} + + Labeled actions: + > means define, < means delete, = is edit, + is turn on, - is turn off. + Also, >- means define and turn off, while >+ means define and turn on + ( > alone is the same as >+ ) + + #action >fount ^There is a fountain here={#print;drink water} + (named action) + #action -fount (turns off action) + #action +fount (turns it back on) + #action =fount (lets you edit it) + #action <fount (removes action) + + #action >-loot is dead! R.I.P.={#print;get all from corpse} + (define and turn off the action) + + #action >joke ("^$1 says '&2;)'")= wink $1 + (you must either use this syntax or escape the + ; to force it to be considered literally) + + #action >argh ^$1 tells you 'hello \`=tell $1 I heard you + (as in #alias, \ must be followed by ` when you + need the \ to be followed by a special char + and you do not want this char to be escaped) + + If you have compiled powwow with -DUSE_REGEXP and use % instead of > + you define an action that uses an Extended POSIX regexp to match + instead of the standard matcher. + + #action %first ^([[:alpha:]]+) ([[:digit:]]+)=#print $2 counted $3. + (matches abc 123) + + Note that if the pattern starts with '(', it is evaluated, which means + that a regexp that starts with '(' has either to be surrounded by + ("...") or to be prepended by a backslash. + Also note that powwow requires parentheses to be balanced: + for example, \(.+|) would be a valid regexp pattern as the backslash + gets removed by the unescaping, but powwow will choke on it + as the first parenthesis is escaped while the second is not. + + #action %second ("(..+)-\\1")=#print Double $1 + (matches xyz-xyz) + #action %third \(..+\)-\\1=#print Double $1 + (same as above) + For regexp actions, $0 = the line, $1 = the whole match and $2... + contain the submatches. + + Actions and aliases can run other powwow commands, including + #action and #alias. + Example: + #alias calc=#! echo '$0' | bc -l + #alias hungryon=#action ^You are hungry=eat bread + + As with aliases, additional \'s can be prepended to $n to + delay text substitution in actions. + Example: + #action >reply ^$1 tells you={#print; #alias reply=tell $1 \$0} + ----------------------------------------------------------- + +ACTION GROUPS + + Groups allow related triggers to be enabled and disabled together + using a single command, instead of toggling them all on or off + individually. To put actions in to a group specify the group name + after an '@' when the action is defined. For example: + + #action >+auto-ride@non-pk ZBLAM! A &1 doesn't want you={#print;stand;ride} + + Would create the action auto-ride in the non-pk group. Then if you + wanted to toggle off all non-pk actions, you could do it using: + + #group non-pk off + + And then later to turn them back on, use: + + #group non-pk on + +MISSING: #PROMPT + + There is another special command quite similar to #action: + #prompt [[<|=|>|%][+|-]label] [{pattern | (expression)}=[command]] + + You will need to use it only if you want to mess with the prompt + that your MUD sends, which is often not needed. Also, to use it + you need to understand exactly how powwow recognizes prompts, + so the description is considered an advanced topic and is placed + near the end of this file, in the "ADVANCED TOPIC: #PROMPT" section. + +MISSING: SUBSTITUTION AND UNESCAPING + + Also, only intuitive definitions of substitution, delayed substition + and escaping/unescaping have been given so far. If you want the real, + rigorous thing, read the "ADVANCED TOPIC: SUBSTITUTIONS AND UNESCAPING" + section near the end of this file. That section also explains + `just in time' substitution, not yet introduced. + ----------------------------------------------------------- + +SPECIAL COMMANDS: ALL OTHERS + + This is the rest of #commands recognized by powwow. + ----------------------------------------------------------- + Toggle verbatim mode + #quote [on | off] + + In verbatim mode, no alias expansion takes place and + semicolons, escapes, braces and ` are sent as typed, + unless the command line begins with a #, so you can still issue + powwow - specific commands. + This is useful if you want to paste a text from an editor into + a powwow session. + Type #quote to turn on the verbatim mode, and type #quote again + to turn it off. + ----------------------------------------------------------- + Show/execute commands in history + #history [number] + + #history alone shows you the last commands in history, up to the number + of lines in your screen. + #history -n shows the last n commands in history, and + #history n executes the n-th command of the history. + + Recursive #history commands (i.e. an #history <n> calling itself or + another #history <n>) are allowed only up to levels of 128 recursions. + + Example: + + #history 1 (repeat last command) + ----------------------------------------------------------- + Add a text or expression to word completion list (not to history) + #add {text | (expression)} + + #add puts the text or result of expression (calculator is used to + evaluate the expression) in the word completion list. + Useful if used together with #action. + Example: + + #action >reply ^$1 tells you={#print;#add $1} + (from now on, you can use TAB to complete that name) + ----------------------------------------------------------- + Put a text or expression into history (and to word completion list) + #put {text | (expression)} + + #put puts the text or result of expression (uses calculator) in the + history, so that you can use cursor-up key to recall the text as if + typed from keyboard. + Also, you can execute the text using the #history command. + Example: + + #action >safeflee ^You flee head over heels.= + {#print;#put #print You have already fled away!} + + (If you type 'flee' from keyboard, you can keep trying to flee using + cursor-up (which gets the last command in history) and <RETURN> key. + When you finally manage to flee, the message above is put in history, + so that further attempts to flee do not lead you again in danger) + ----------------------------------------------------------- + Bind keys to enter commands + #bind [edit | name [sequence][=[command]]] + + You can bind most function keys and control keys to enter a command + for you when the key is pressed. Also, you can redefine a key already + used for an editing function (such as the arrow keys). + 'name' is the label of the key you want to define; you can just use + what is written upon it. When defining a new key binding, you will + be asked to press it so powwow can record the control sequence + your terminal sends. + If you want, you can specify the control sequence directly in the #bind + command instead of having to press the key on your keyboard. + + Examples: + + #bind (lists all user key bindings) + #bind edit (lists all line editing keys) + #bind f1=recite scroll (you'll have to press f1 then) + #bind f1=cast 'sanctuary' (change existing definition) + #bind f1 (lets you edit the definition) + #bind f1= (removes the key) + #bind f1 [[A=cast 'heal' (also tell powwow that f1 on your + keyboard sends ESC [ [ A, so you + do not have to press it) + + NOTE: if there is already something on your input line, powwow + does not ruin it when you press f1 (or any other #bind), but executes + the command you want and then shows you again the input line. + + #bind f5=&prev-line (&prev-line is one of the reserved commands for + line-editing functions, see bottom + of this file) + #bind Up=u (Up is an editing key, but can be redefined) + + By default, the vt100 numeric keypad is partially used to walk around + with: + Key string sent + 2 s + 3 d + 4 w + 5 exits + 6 e + 7 look + 8 n + 9 u + + The reserved names that powwow identifies as line-editing functions + are at the end of this file, together with the default keys used for + them. + + Remember that ALL keys can be redefined... + ----------------------------------------------------------- + Change the keyboard sequence associated to an existing key binding + #rebind name [sequence] + + If you just want to change the control sequence of a binding, but not + its name or its effect, you can just tell powwow to 'rebind' it. + If #rebind is invoked with only the name of a binding, you are asked + to press the key you want to rebind. + Of course, you will not be asked to press the key if you specify + its control codes in the #rebind command. + Examples: + + #rebind f1 ^[OP (tell powwow that your f1 key sends ESC O P + and not ESC [ [ A) + #rebind f1 (you are asked to press again f1, useful if you + changed terminal in the meanwhile) + ----------------------------------------------------------- + Change the keyboard sequence of all existing key bindings + #rebindall + #rebindALL + + #rebindall runs #rebind on most key bindings (skips trivial ones like + ^A, ^B, etc.), asking you to press each corresponding key. + + #rebindALL does the same, but for really every key binding. + ----------------------------------------------------------- + Execute a key as if pressed on keyboard + #key name + + If 'name' is the label of one of the key defined with #bind, + (see above) #key executes the corresponding command. + + Example: + If you have already typed + #bind f1=cast 'heal' + + At any time, then, you can either: + - Press your f1 key on you keyboard + - Execute the command "#key f1" + and powwow will execute the command "cast 'heal'" for you. + + Using #key, for example, can be useful from inside an + #alias or #action, since powwow cannot press f1 for you. + + Since 1.1.5, powwow allows #key also for editing functions. + If you have already + #bind Up=&prev-line + and you execute + #key Up + powwow will do what you expect: step to the previous line in history. + + Warning: powwow does not distinguish at all between a real key pressed + on the keyboard and one faked with #key, so commands executed with #key + will also be written in the #record file. + + ----------------------------------------------------------- + Execute an editing function as if pressed on keyboard + #keyedit function + + If 'function' is the name of one of the reserved commands + for line-editing functions, #keyedit function will run it. + + For example, if you already have + #bind Up=&prev-line + the following are all equivalent: + * pressing the key Up on your keyboard + * executing #key Up + * executing #keyedit &prev-line + + Anyway, if you type #key or #keyedit directly from the keyboard + the effect is slightly different, as you have to press ENTER + to run them and the function &enter-line (which is executed by ENTER) + has a few side effects. + ----------------------------------------------------------- + Clear aliases, actions or what you specify + #reset {all | name of a list} + + Argument: Effect: + all clear everything (apply all lines below) + alias clear all aliases + action clear all actions + bind clear all key bindings and restart with default + settings. Note that also editing keys are resetted + to default function. + at clear all delayed commands + in (same thing) + mark clear all markers + prompt clear all prompts + var clear all variables + ----------------------------------------------------------- + Mark certain output + #mark [pattern[=[attribute]]] + + This command highlights a part of a line in your output in the way you + choose (if your terminal supports it). + See the section "ATTRIBUTES: COLORS AND OTHER HILIGHTINGS" + about the syntax of attributes. + + Wildcards are allowed in the pattern, and syntax is very similar to + #action: $ matches a single word, & matches any string. + + Examples: + #mark Sizzler=bold (mark `Sizzler' in bold) + #mark Sizzler (lets you edit the above definition) + #mark Sizzler= (Sizzler is no longer put in bold) + #mark (lists all markers) + #mark {&}=inverse (mark in reverse any string in { } + note that also the { } are highlited) + #mark ^You=yellow (mark `You' in yellow only if it appears + at the beginning of a line) + #mark \^=on blue (mark a literal ^ ) + ----------------------------------------------------------- + #module [module name] + + This loads a shared library module by name, if supported by your system. The + name of the module should be included in the documentation that came with the + powwow extension, for example to load the perl module you would use: + + #module perl + + Which gives you the perl command that can be used like: + + #perl powwow::exec( "say it is " . scalar(localtime()) ) + + The commands added and their syntax varies depending on the module. + ----------------------------------------------------------- + Set/show priority for new actions/marks + #nice [{number | (expression)} [command]] + + When #nice is 0 (default) powwow puts new actions at the bottom of the + action list (and same thing for marks). If you want to put new + actions/marks in another point of the list, just set #nice to the + corresponding value: + + If you specify a command after 'number', the new #nice value is used + only for that command, then the old value is restored. + + Examples: + + #nice 12 (tells powwow to put new actions/marks in the 12th + (place of the list) + + #nice 4 #mark Grizzly=red on blue (put the mark in the 4th place of + the list) + + Note that #nice works only for new actions/marks: if an action/mark + is already defined, you cannot change its place in the list. + ----------------------------------------------------------- + Input highlighting + #hilite [attribute] + + This sets the attribute of your entered text to the given attribute. + Just #hilite turns it off. + See "ATTRIBUTES: COLORS AND OTHER HILIGHTINGS" below for more syntax. + ----------------------------------------------------------- + Set standard colours + #color [attrib] + + (This command exists only if BUG_TELNET is defined, to cope with + deficiencies of NCSA telnet 2.2) + Set your standard foreground and background to the colours you specify. + #color returns to the default colors for your screen + ----------------------------------------------------------- + Capture output to file + #capture [[>]filename] + + This captures all output from the main MUD connection and your typed + commands to a local disk file. To close the file and end the + capturing, type #capture without argument. + If the filename starts with a '>', new text will be appended to the + end of the file instead of overwriting it. + You can only capture output to one file at a time. + Example: + > #capture message + > look at board + > #capture + + It is possible to capture in the #capture file even text that you have + _already_ received: see #setvar buffer. + ----------------------------------------------------------- + Record typed commands to file + #record [filename] + + This records all text typed from keyboard to a local disk file. + (output from remote host is not recorded) + To close the file and end the recording, type #record without argument. + You can only record typed text to one file at a time, but #capture and + #record can be active at the same time on different files. + Example: + > #record walk-home + > n;e;e;u;n;w;s + > open door + > s + > close door + > sleep + > #record + ----------------------------------------------------------- + Capture output to file, with timestamps + #movie [filename] + + This is similar to #capture, but adds timestamps to each line + received from the main MUD connection or typed from the keyboard, + to allow replay at correct speed. + The program `powwow-movieplay' for replay is included with powwow sources. + Usage: `powwow-movieplay <filename>' + To convert a movie to plain ASCII, the program `powwow-movie2ascii' + is included too. + Usage: `powwow-movie2ascii <infile> <outfile>'. + + It is possible to capture in the #movie file even text that you have + _already_ received: see #setvar buffer. + ----------------------------------------------------------- + Execute a shell command + #! command + + Executes a command using /bin/sh. Powwow waits until your shell + finishes, but you can put jobs in the background with & as usual. + Example: + > #! who | sort | less + > #! nethack + > #! xbiff & + + Note that semicolons, escapes and braces need to be escaped if they + are to be sent to the shell. + If your shell has job control, you can also suspend powwow + with ^Z as usual. + ----------------------------------------------------------- + Put a string in the edit buffer automatically + #prefix [string] + + Each new line you type will automatically begin with the prefix string. + You can of course edit or delete the inserted string as usual. To + remove the prefix, just issue a #prefix command without arguments. + This is handy when you are talking to someone, for example. + > #prefix tell arthur + ----------------------------------------------------------- + Help + #help [keys | math | command] + + Shows a list of powwow's commands. + '#help keys' shows the editing keys. + '#help math' show help on inline calculator. + You can also have help on specific commands, using for example + '#help alias' or in general '#help <command-name>'. + A help file is needed and provided for this last feature of #help, + and powwow will look for the file "powwow_help" in the directory + specified by the environment variable POWWOWHELP. If this variable + does not exist, powwow looks in current directory. + ----------------------------------------------------------- + Command repetition + #n command + + This repeats the command n times. Example: + > #5 buy bread (buy five breads) + + + Alternatively, you can use this syntax to repeat a command n times: + #do (expr) command + + In this case, powwow evaluates the expression, and uses the result + as counter. + Example: + > #do (3*8) north (go north 24 times) + ----------------------------------------------------------- + Iterate a command + #while (expression) command + + This syntax repeats a command while expression (evaluated with + calculator) keeps true. (see below for help about calculator) + As with #alias and #action, the $n and @n in command are + replaced by their values. (Even if you can, using @n after the = + in #action and #alias is useless, because you have no way to + assign them a non-zero value. This is the reason why we did not talk + about them in the #alias and #action section) + + Example: + + #while (@0<13) {read @0;#(\@0++)} read messages 0-12 + As you can see, the last @0 is escaped to avoid it to be + substituted with its value. (We want to increase the variable!) + ----------------------------------------------------------- + Iterate a command + #for ([init];check;[loop]) command + + Directly copied from C language, this command evaluates 'init' + with calculator (if specified), then repeats the following cycle: + 1) evaluate 'check', if result is 0 (false) stop repetition + 2) execute 'command' + 3) evaluate 'loop' (if specified) + 4) restart from 1) + + As with #while, #for performs the parameter substitution in 'command', + so the only significative difference between #while and #for is that + #for allows you to execute an initialization before the repeat cycle. + + Example: + + #for (@1=32; @1<=47; @1++) read @0 (read messages 32-47) + ----------------------------------------------------------- + Branch execution command + #if (expression) command1 [; #else command2] + + Evaluate the expression: if result is 'true' execute command1, + otherwise (if there is an #else) execute command2. + If expression is false and there is no #else, execute nothing. + remember that you must use braces {} if command1 or command2 + contain more than one instruction. + + Note that nested #if-#else are allowed, and that #if-#else itself + is not a multiple command. + + WARNING: using an alias for #if is very dangerous and will cause + powwow to make confusion when the full #if-#else syntax is used. + ----------------------------------------------------------- + Automapping control + #map [-[number] | walksequence] + + With no argument, "#map" shows the map of the directions you + travelled up to now. "#map -" clears the last number of steps + from the map. + + Example: + #map (displays "#current map: e3su" after above walk) + #map -1 (leaves the map as "esss") + #map - (clears the whole map and starts fresh) + #map nsssue (add the list of directions to map) + ----------------------------------------------------------- + Retrace steps + #retrace [number] + + This command walks you in the reverse direction of the last + number of steps. If number is 0 or left blank, you walk all + the way back to where automapping started. + ----------------------------------------------------------- + Explicitly execute a speedwalk + #speedwalk [walksequence] + + This command can be used to execute a speedwalk sequence even + if you have the speedwalk option disabled. This is useful if you + do not like to have typos evaluated as speedwalk commands but still + want to be able to easily execute a speedwalk. + ----------------------------------------------------------- + Connect initialization string + #init [=[command]] + + This command sets up the initialization string to send to + the host on establishing a connection. + + Example: + #init (shows the string) + #init ={#identify;#speedwalk} (sets the string) + #init = (clears the whole string) + ----------------------------------------------------------- + Identify as an editing client + #identify [startedit [endedit]] + + This command sends an identification string to the server, to + indicate that the client supports editing functions. It is + best attached to an action trigged by a string in the login + screen, but can also be entered by hand. + This command must be issued for the cooperative editing to work + on servers that support it (currently only MUME). + The startedit/endedit parameters are commands issued when an editing + session starts/ends (for changing your title, emoting etc). + + Example: + + #action >mume *** MUME=#identify + #identify foo bar + (where foo and bar are aliases that do something useful) + ----------------------------------------------------------- + Identify as a IAC GA compliant client + #request prompt + + This command sends an identification string to the server, to + indicate that the client supports (and wants) the special sequence + IAC GA at the end of each prompt. This helps the client + to automatically detect the prompt, and can be used as alternative + to #prompt / #isprompt if all you want with the prompt is detecting + it (and not altering it) + + BIG WARNING: + this is experimental and not tested! + + Example: + + #action >mume *** MUME={#print;#identify;#request prompt} + #request prompt + ----------------------------------------------------------- + List all editing sessions + #edit + + This command shows your active editing sessions, with a brief + description and their number. + ----------------------------------------------------------- + Cancel an editing session + #cancel [number] + + Without an argument, all editing sessions are cancelled; + otherwise, only the given session is cancelled. The corresponding + editor processes are brutally killed. + ----------------------------------------------------------- + List/turn various options on/off + #option [[+|-|=]option-name] + + Currently available option names are: + exit, history, wrap, compact, debug, echo, info, keyecho, + speedwalk, wrap, autoprint, buffer, reprint, sendsize, + autoclear + + #option +name turns an option on + #option -name turns it off + #option name toggles it + #option =name reports its status + + ------------- + #option exit + + If the `exit' option is on, powwow automatically quits when the last + connection is closed. Otherwise, to quit powwow you need to manually + type `#quit' + ------------- + #option history + + With `history' option on, powwow writes into your savefile also + all your commands in history + ------------- + #option words + + With `words' option on, powwow writes into your savefile also + your word completion list + ------------- + #option compact + + Normally, powwow does not touch the prompts on screen while you play. + In `compact' mode, instead, lines containing only a prompt are deleted + when further messages arrive from the remote host. + + WARNING: this command works correctly only if you have #prompts which + correctly run #isprompt. Otherwise it may occasionally erase + some lines from the screen. + ------------- + #option debug + + Normally, powwow does not print on screen the command lines it + executes. When `debug' is on, every line executed by powwow is also + echoed on screen, so that you can check if your code works correctly + (warning: this prints LOTS of lines on your screen) + ------------- + #option echo + + Normally, powwow echoes on your screen each command sent to remote + host but not directly typed (example: aliases and actions sending text + to the MUD). When `echo' is off, such commands are still sent to host, + but not echoed on screen. + ------------- + #option info + + Normally, powwow prints on screen some messages each time you + define/edit/delete an #alias, #action, #bind and similar. + When `info' is off, those messages are not typed at all. + (But errors are still printed on screen) + ------------- + #option keyecho + + Normally, powwow echoes on your screen the commands sent to remote host + when you hit a key associated to a #bind. When `keyecho' is off, such + commands are still sent to host, but not echoed on screen. + ------------- + #option speedwalk + + With `speedwalk' on, a command consisting of only lowercase + n, e, s, w, u, d and numeric digits is considered to be a + walk sequence. The numeric digits specify the number of + times to repeat the direction immediately following. + + Example: + esssu (walk east, 3 south, up) + e3su (same as above) + ------------- + #option wrap + + Normally, powwow wraps words that would have been cut by the right + margin to the next line. This command lets you turn it off and on. + ------------- + #option autoprint + + If `autoprint' is on, powwow prints lines matched by an #action + even without an explicit #print. + ------------- + #option sendsize + + Usually powwow does not send the window size to the MUD unless asked. + If you want to send the window size automatically upon connecting, + you may enable this option. + ------------- + #option autoclear + + Powwow normally erases the input line before executing commands + from spawned programs, but that is slow and causes flicker. + If autoclear is disabled flicker reduces to minimum, + on the other hand spawned programs must then execute #clear + before sending anything to screen. + ------------- + #option reprint + + If `reprint' is on (off by default), powwow prints again commands + sent to the mud but not yet executed. + WARNING: it works only if you use #prompts which correctly run + #isprompt. + + ++++ example: ++++ + *>look + south + down + + The High Path + + *>Path Climbing a Hill + + *> + Alas, you cannot go that way. + + *> + ++++ becomes: ++++ + *>look + south + down + + The High Path + + *>(south) + Path Climbing a Hill + + *>(down) + Alas, you cannot go that way. + + *> + ----------------------------------------------------------- + Show current version + #ver + + Displays the current version, some compile options and (if + your compiler supports it) when powwow was compiled. + ----------------------------------------------------------- + Multiple connections handling commands + #connect [session-id [initstr] [host port]] + connect a new session / list sessions + #snoop session-id toggle output display for session + #zap session-id disconnect a session + ##<session-id> set <session-id> as default session + ##<session-id> command execute command on <session-id> session + + No docs here. If multiplaying is allowed on you MUD (and many + do NOT allow) you can experiment a little to find how they work. + Or you can open two connections to two different MUDs :) + ----------------------------------------------------------- + Spawn an external program + #spawn session-id command + + Creates a new session, connected to a shell command instead of a MUD. + Writing to ##<session-id> sends data to the command's standard input, + while the command's standard output is executed as if typed + from keyboard. Useful if you are a programmer and you want to create + very complex filters or robots, for which #actions are too limited. + Command's standard output *MUST* terminate with a newline ('\n') in + order for powwow to execute it. + You can send multiple commands at once terminating each of them + by either a semi-colon ';' or a newline '\n', except for the last one + which (I repeat) *MUST* terminate with a newline. + + You can close these sessions with #zap and list them with #connect + as usual. + + Depending on how lazy you are, you can choose two different ways + to have spawned programs print to screen: + + The first is automatic, but slow: with `#option +autoclear' + powwow clears the input line before executing every line received + from the program. This is of course slow and causes flickering. + + The second is more complex, but faster and reduces flickering to the + minimum: set `#option -autoclear' from the beginning, then have + the program execute `#clear' before printing. + ----------------------------------------------------------- + Exit from powwow + #quit + + Very little to say here. Just remember that #quit brutally + closes all mud connections that are still open, without + renting your characters. Quite likely, you want to rent them all + before quitting. + ----------------------------------------------------------- + Set definition-file and save settings to it. + #save [definition-file] + + Useful after you write large chunks of code. + Remember anyway that powwow automatically saves the settings + before exiting. + + #save actually writes settings to a temporary file and overwrites + the definition file only if write succeeds. This is to avoid wiping out + definition file in case of `disk full' or other errors. + ----------------------------------------------------------- + Set definition-file and load settings from it. + #load [definition-file] + + Useful if you want to undo the changes in your settings. + + NOTE: current settings are completely erased before actually loading + from file. In case of errors, powwow reloads the default editing keys. + + If you just want to add the contents of a file to your current settings + use #exe <filename instead of #load. + ----------------------------------------------------------- + Set/show/clear definition-file name + #file [=[definition-file]] + + As default, the definition-file is the one loaded when you start + powwow. Remember that powwow automatically saves your settings to it + before exiting. If you want to disable this autosave, use #file = + ----------------------------------------------------------- + Various commands: + #net show amount of data transmitted to and received from + the remote host. + #cpu show the CPU time used by powwow. + (if powwow does not find the symbol CLOCKS_PER_SEC + defined at compile time, the result may not be in + seconds...) + #time show current time/date. Useful if you want to use #at. + + #beep ring your terminal's bell (like #print (*7)) + ----------------------------------------------------------- + List/delete/define/edit delayed commands + #at [label [(time-expression) [command]]] + or + #in [label [(delay in millisec.) [command]]] + + If you want to tell powwow to execute the command 'kill wolf' + 2 seconds after you type it, use this command: + #in attack (2000) kill wolf + Let's explain the command: + 'attack' is a label, exactly as in #actions, and is used only to have + a quick reference to the delayed command; + (2000) means wait 2000 millisec., i.e. 2 seconds; + 'kill wolf' simply executes kill wolf, as if typed from keyboard. + + Of course, you can use an expression (as complex as you like) + instead of the number in parentheses, + and the command can also be an alias, internal command or even + another #at or #in. (of course you can use multiple commands by + placing them in { } ) + + If you do not specify the command, powwow assumes the label is already + defined, and changes its delay. + A delay less than zero means the delayed label is disabled, + but still in powwow's memory, similar to what happems when you + turn off an #action. + A delay of zero deletes the delayed label. + + If you specify only a label, powwow lists it. + If you specify nothing, all delayed labels are listed. + + The #at command is nearly equal to #in, but assumes the expression + in ( ) is a time. For example (114520) means 11:45:20 , + and ("114520") is the same. + After evaluating the time, powwow converts it into a delay, + and places the delayed label in the same list of #in. + NOTE: it is not possible to delete a delayed label using #at, + since (0) means midnight. + One more thing: it is not possible do define disabled labels using #at, + because a time < 0 is an error, and a time < current-time is assumed + to be refering to the following day. + + Last note: after executing a delayed command, powwow does not delete + it, but simply disables it. + ----------------------------------------------------------- + Disable all delayed commands + #stop + + All active delayed commands are set to 'disabled', but are not deleted + from memory. Useful to stop infinite loops due to self-reactivating + delayed commands. + ----------------------------------------------------------- + Set save file options + #option [none]|[words][history] + + Controls wether command history and completion words shall be saved + in the save file. + + Without arguments, #option displays the current settings. + To turn off both words and history, use #option none; otherwise + use #option followed by words and/or history. + + ----------------------------------------------------------- + Evaluate expression with calculator, and trash result. + # (expression) or #(expression) + + ----------------------------------------------------------- + Print a text or result of an expression on screen. + (does NOT send it to the MUD) + #print [< | !][text | (expression)] + + If a string is specified, powwow simply prints it on screen. + If an expression is specified, powwow uses the inline calculator + to evaluate it, and then prints the result. + + If a #print without arguments is found, powwow prints the value + of the variable $0 (this is a special feature of #print, and is not + present in #exe, #send, #emulate or #var). + This is usually used to print a line from remote host that was + intercepted by an #action, in fact #action places the whole line in $0 + + If < precedes the text or expression, #print assumes text (or result + of expression) to be name of a file, and displays the contents of + that file. + + Instead if ! precedes the text or expression, #print assumes text (or + result of expression) to be a Bourne shell command, whose output is + displayed. + + Example: + + #action >disint ^&1 disintegrates &2=#print $1 DISINTEGRATES $2 + put the text in upper case + #action >disint ^&1 disintegrates &2=#print ($(1)+" DISINTEGRATES "+$(2)) + same thing, but using calculator + + #print <mytext display a text on screen + #print !("more mytext") same thing, but uses 'more' + as text viewer and alternate syntax + #print (@-7) print value of variable on screen + #print <($2) display the contents of file whose + name is in variable $2 + + Further feature: + + If < is specified, and you use an expression after it, you can also + specify starting and ending line of the file that you want to use, + in this way: + + #print <(string-expr;[start];[end]) + + Note: if you use a plain text as file name (like in #print <myfile ) + you cannot specify starting and ending line. + + If starting line is not specified, powwow begins from the first line, + if ending line is not specified, powwow stops at the end of the file: + + #print <("myfile";3;42) print lines from 3 to 42 of myfile + + #print <("myfile";;57) print lines from start of file to 57 + + #print <("myfile";;) print whole file + + Note that you can use expressions instead of filename, starting line + and ending line: + + #print <($5;4;3+@0) print file whose name is in variable $5 + from line 4 to line 3+@0 + + Of course, you can still use the whole file in the old way: + #print <("myfile") or #print <myfile + + + Further feature (another): + + The starting and ending line can be specified ALSO when you use a ! + before an expression: + + #print !(string-expr;[start];[end]) + + In this case, powwow executes the Bourne shell command contained in + the string, and prints ONLY lines from <start> to <end> of its output. + + Also here, you can use expressions instead of Bourne shell command, + start and end, and powwow still begins from first line if <start> + is not specified and/or stops at the end of the output if <end> + is not specified. + + Both these special features are supported ALSO in #send, #exe, + #emulate and #var. + ----------------------------------------------------------- + Send text or result of an expression to MUD + #send [< | !]{text | (expression)} + + The simplest use of #send is to evaluate an expression and to send + the result to the MUD. More generally, #send is very similar to #print, + with the only difference that the final text is sent to the MUD rather + than displayed on screen. + The meaning of < and ! is the same, and #send does the expected things + when they are used. + + Example: + + #send <mytext stuff a text into the mud + #send !awk ' {print "tell arthur " $0} ' file + say a file to your friend + #send ("say I have been playing for " + %(timer/86400000) + " hours") + timer is a variable holding the number of millisec + elapsed since last timer reset, and the big number + after it converts the elapsed time in hours. + ----------------------------------------------------------- + Execute text or result of an expression + #exe [< | !]{text | (expression)} + + Evaluate the expression and get result, + then execute result as if typed from keyboard. + If < or ! is specified, #exe behaves exactly like #print, + but executes the final text as if typed. + + Example: + #exe ("sigh") is the same as typing sigh from keyboard. + + #bind control_s=#exe ("#capture emergency" + %(@-7++)) + (control_s must be a user defined key) + safe capture to file: each time you press control_s, + a different file is opened as capture. + + #exe <mytext read the file mytext and execute all the + commands in it, one line at time. + Very useful to read a set of #alias for example + ----------------------------------------------------------- + Process a text/expression/file as if received from remote host + #emulate [< | !]{text | expression} + + Evaluate expression and get result, then process result as if received + from remote host + If < or ! is specified, #emulate behaves exactly like #print, + but processes the final text as if received from remote host + (check for matching #actions, extract prompt, etc.) + + This command is particularly useful to test and debug #actions. + Example: + + #emulate The assassin is dead! R.I.P. + #emulate <myfile + ----------------------------------------------------------- + Put a text or expression in a variable / delete a variable + #var variable[=[[< | !]{text | (expression)}]] + + Evaluate expression and get result, then put result + in the specified variable. + If < or ! is specified, #var behaves exactly like #print, + but puts the final text into the specified variable. + If you specify no right-hand expression, powwow puts the current value + of the variable on input line, to allow you edit it. + If you specify no right-hand expression, BUT YOU USE the =, powwow + deletes the variable and frees memory used by it. + + Note: If you use a numbered variable rather than a named one, + instead of a number you can place an expression after the $ or @ + and before the = + Example: + + #var @7=22 (same as #(@7=22) ) + #var $-4 = hello (note that you do not need quotes + since you are using a plain text) + #var $-4 = ("hello") (if you use parenthesis, you must also + use quotes) + #var $test= long sentence (all the spaces but the first following + the = are placed in the variable) + #var $(2+4) = <myfile (put the whole file in $6. Remember + that string variables cannot be longer + than 1024 characters...) + #alias calc=#var @-1 = !echo '$0' | bc -l + (place result from bc calculator into @-1) + + #var $target (put current value on input line) + + #var $my_variable= (delete $my_variable and free memory) + ----------------------------------------------------------- + Write text to a file + #write [> | !](expression ; file) + + Evaluate expression and get result, then write result into file. + By default, text is appended at the end of the file. + + If > is specified, #write deletes the contents of the file before + actually writing the text. + + If ! is specified, #write assumes second parameter to be + a Bourne shell command (instead of a file name) that is executed + using the text as its input. + + Example: + + #write ($test; "myfile") (append contents of $test to myfile) + + #write !("55+12";"bc -l") (execute 'bc -l' writing text to its + standard input) + + Advanced `#write' usage: + + If you are using a terminal allowing multiple windows (an X11 graphic + terminal for example) it is possible to duplicate/split powwow output + to multiple windows using #write. This is more a UNIX topic rather + than a powwow-specific one, but that's it. Here is a brief summary: + + First, compile the `catrw' mini-program i.e. type + $ make_it catrw + if the above worked, type + $ mkfifo fifo + This will create a special file named `fifo' in the directory + (any other name would do, of course) + Then you have to open another window. This depends on the terminal + you're using, but for X11 terminals the following works: + $ xterm & + On the second window, type + $ exec catrw fifo + (in case this gives you an error, try just `catrw fifo') + Now return to the first window and start powwow normally. + To send text to the second window from within powwow, type: + #write ("some text"; "fifo") + You should see `some text' (without the quotes) immediately + appear in the second window. + + Of course you may now want to send text automatically + to the second window: just use #write ( <your-text> ; "fifo") + from within an #alias, #action or whatever you like. + + P.S.: + for experienced users: if you are using the `bash' shell, + you don't need `catrw' as you can use + $ exec cat <> fifo + instead of the above + $ exec catrw fifo + ----------------------------------------------------------- + Set/show internal variables + #setvar name[={number|(expr)}] + + Evaluate the expression and get result, then set the internal + variable `name' to that value. + + Known internal variables are: + + buffer with `buffer' different from zero, powwow saves + the most recent text from the MUD in a circular list + (which is `buffer' bytes long) and writes it + at the beginning of #capture and #movie files when + you open them. This is useful if something important + happens suddenly and you want to log it somewhere: + you can start #capture and/or #movie even _after_ the event + has happened and it will still get written to the file. + + if `buffer' is zero (default), powwow starts logging + text from the MUD only at the moment you activate + #capture or #movie. + + To discard the text stored in memory by `buffer', + change its value (for example, set it to zero + and then back to a non-zero value). + + lines the number of lines your terminal has. Powwow usually + autodetects it correctly, but on few terminals you may + have to set it manually. + + mem the maximum length of a text or string, in bytes. + The default is 0 (zero) which means no limit. + I added it only to prevent bringing down the whole system + with things like + #while (1) #($foo += $foo + "x") + Consider it an emergency setting, as powwow _discards_ text + and strings longer than the limit. + The failsafe limit set when loading a savefile from an older + version is 1Megabyte, which won't give any problem + (like increased memory usage) as powwow allocates memory + only when it *has* to. + + timer the number of milliseconds since program start. + It can be changed to synchronize with an external clock + like MUD ticks. + + Example: + + #setvar timer=0 (reset internal timer to 0) + #setvar timer=20000 (make internal timer restart from + 20000 milliseconds) + #setvar timer (show timer and let you edit it) + + #setvar mem=1048576 (max strings length is now 1Megabyte) + ----------------------------------------------------------- + Send raw data to MUD + #rawsend {text | (expression)} + + This is mostly a MUD debugging tool, but it can be useful in some cases. + Like its cousin #send, #rawsend evaluates the expression (or unescapes + the text) and sends the result to the MUD. The difference is that + #rawsend does NOT add a final newline, nor does IAC escaping to protect + ASCII 255 characters. On the other hand, #rawsend can handle ASCII 0 + characters, while plain #send can't. + ----------------------------------------------------------- + Send raw data to screen + #rawprint {text | (expression)} + + Like its cousin #print, #rawprint evaluates the expression (or + unescapes the text) and sends the result to the screen. The difference + is that #rawprint does NOT add a final newline. On the other hand, + #rawprint can handle ASCII 0 characters, while plain #print can't. + ----------------------------------------------------------- + +INLINE CALCULATOR: + + The inline calculator is used to evaluate expressions inside + #(), #print (), #exe (), #send (), #if (), #while(), #for (), #do (), + expressions in pattern of #actions and in other commands allowing () + + The inline calculator recognizes the following objects: + + numbers (only integers are supported) + decimal numbers: + simply write them. + + hexadecimal numbers: + use '#' as prefix: #F is 15, #a0 is 160, and so on. + + numbers in any other base: + use base# as prefix: 2#101 means 101 in base 2 (that gives 5) + 7#14 gives 11, etc... + + if you use negative non-decimal numbers, you must put '-' + before the base: - 2#101 is -5, 2#-101 causes an error. + + it is possible to chain more than one '#': + 3#12#100 = (3#12)#100 = 5#100 = 25 + + both base and argument must be numbers, not variables: + things like 7#@count or @count#7 are not allowed, you will + have to use an #exe for that. + + quoted-strings (i.e.: strings in " ") + + NOTE: + since version 0.6d, powwow performs unescaping on quoted strings + when they are evaluated. For example "\"" is the string that contains + the character " only. + + timer (number of milliseconds since last timer reset) + + map (string containing the last 999 steps you walked, + as the #map command) + + variables: + @n with n within -50 and 9, are numeric-variables + $n with n within -50 and 9, are string-variables + + Since version 0.8, also named variables are supported: + + @any_name1 + $any_name2 + + The name following @ or $ can contain any of these chars: + uppercase or lowercase letters ('A'...'Z' and 'a'...'z') + underscore ('_') + numbers ('0'...'9') + Anyway, the first char of the name must NOT be a number. + + Remember that powwow is case sensitive: + $test and $Test are NOT the same variable + + Named variables are created the first time you use them + and can be deleted only using the #var command + + A special named variable is $prompt, which contains + the current prompt. It cannot be deleted. + Another special variable is $last_line, which contains + the last non-empty line received from the MUD. Again, + it cannot be deleted. + + Difference between the various kind of variables: + + Numbered variables with negative counter (@-50..@-1 and $-50..$-1) + and named variables are global: + They can be accessed at any time, but cannot be used for the + substitution performed by #alias, #action, #while and #for. + + Instead, numbered variables with positive counter (@0..@9 and + $0..$9) are local: + A new set is created (and initialized to zero) every time powwow + executes an #alias, #action, #while or #for, and the old set + is made invisible. After the #alias (or #action, #while, #for) + is executed, the old set is restored. + Note that also @0..@9 can be used for parameter substitution, + and not only $0..$9. + + Variable names as expressions: + + The symbols $ and @ are implemented as normal operators, + which means that variable names can be arbitrary expressions. + For example, + $(1-3) is the numbered variable $-2 + @("foo"+"bar") is the named variable @foobar + $$1 is the variable whose name is in $1 + + operators between numbers: + ++ -- + - + * / % + + - + << >> + < <= > >= == != + & | ^ + && || ^^ + = *= /= %= += -= <<= >>= &= ^= |= &&= ^^= ||= + , + ( ) + (% and %= always return non-negative values) + (no help on these operators, see a C-language manual) + (note: unlike C, operators &&, ^^ and || always eval both arguments) + + random number generator: + + rand positive-number (return a random number between 0 and n-1) + + operators between strings: + + chain two strings + = assign a string to a string-variable + += append a string to a string-variable + - compare two strings: result -1 if s1<s2, +1 if s1>s2, + 0 if s1==s2 + < <= > >= == != compare two strings + .? number of chars in a string + :? number of words in a string + ? position of first occurrence of second string in the first + * convert first char of a string into its ASCII code or vice versa + % convert string into its numeric value or vice versa + + operators between a string and a number: + (string is first argument) + : n-th word of a string + . n-th char of a string + :< :> <: >: .< .> <. >. return part of a string, in this way: + : before > or < means 'mark the n-th word from the left' + . before > or < means 'mark the n-th char from the left' + : after > or < means 'mark the n-th word from the right' + . after > or < means 'mark the n-th char from the right' + > means: return from marked word/char to end + < means: return from start to marked word/char + + so we get: + :< n first n words + :> n from the n-th word (include) to the end + <: n from the begin to the n-th word (included) + >: n last n words + + and similarly for .< .> <. >. + + * repeat a string n times: "ab" * 3 gives "ababab" + *= usual shortcut: `$x *= n' is the same as `$x = $x * n' + + functions for low-level color handling: + + noattr (string containing the escape sequence to reset terminal + colors and attributes -- bold, underline, inverse) + + attr "quoted-string" + (return the escape sequence needed to turn on + the attributes and colors in the string. + Syntax of the string is the same as #mark, #hilite, etc) + + + Examples: + + #print ($5="Hello, world") (assign "Hello, world" to $5 + and print it) + #print ("This is a test">:3) (print from the 3rd word from the right + till the end of the string) + Result: "is a test" is printed on screen + + #action >+exp ^You have scored $1 exp={#print;#print ("You gained " + + ( $1 - @-5) + " exp. points since last score"); #(@-5 = $1)} + + (when you type 'info' in MUME, one of the lines you get is: + You have scored xxx exp. points ... + The #action above intercepts this line, prints it, prints the + difference between your current score and the contents of + variable @-5, then copies your current score in @-5) + + #print ($5 = (attr "bold green") + "Hello, world!" + noattr) + + (same as first example, but with colors/attributes. + Rememeber to print noattr at the end of every colored line, + or everything appearing on the screen after your line + will be colored as well) + ----------------------------------------------------------- + +HOW INLINE CALCULATOR IS IMPLEMENTED + + Info and hints to get the most out of calculator and/or hack it. + + The structure `op_list[]' defined in xeval.c contains definitions for + all the implemented operators, one for each line. Have a look at it + to find things like: + + precedence (first number in each line) + associativity (LEFT or RIGHT) + LEFT means that 1+2+3 actually is (1+2)+3 + RIGHT means that 1+2+3 actually is 1+(2+3) + (replace numbers and operators with what you are actually using) + if it is unary, i.e. needs ONE argument + PRE_UNARY means that the operator comes before its argument, + POST_UNARY is the opposite + or binary i.e. needs TWO arguments + + Note that stuff like `attr', `rand', `@' and `$' are actually + implemented as PRE_UNARY operators (named variables are treated as an + exception to this), thus `$(1+5)' and `attr ("bold"+" "+"inverse")' + are fully allowed. Also note that using `$(5)' is a good way to avoid + the parameter substitution performed by aliases, #action, #for, #while + and use instead the actual variables. + + `timer', `map', `noattr' are implemented as read-only values: + the calculator simply substitutes them with their value + + Remember that there is a , (comma) operator: + Instead of `#(foo);#(bar)' you can use `#(foo, bar)' + Using comma operator is easier for both you and powwow, since it uses + a single command instead of two. + ----------------------------------------------------------- + +ATTRIBUTES: COLORS AND OTHER HILIGHTINGS + + Some commands use attributes to specify the visual appearance of text. + The following attributes are available: + bold, blink, underline, inverse + -- the obvious effects + reverse -- same as inverse + [color] [on color] -- foreground and/or background + Colors are: + black, red, green, yellow, blue, magenta, cyan, white and + BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, none + ('none' means to use default and is implemented as a color) + + Examples: The following are all valid attributes: + none -- no attribute, use default + green -- only foreground + on white -- only background + yellow on cyan -- foreground and background + inverse bold -- + blink red on blue -- you can use multiple attributes, + but you must put 'bold' 'inverse' + and/or 'underline' BEFORE colors + + Observe that bold, blink, underline and reverse work with all terminals + that support these attributes, but colors only on terminals that + support ANSI color escape sequences. + + Capitalized colors (BLACK..WHITE) are non-ANSI high intensity colors, + and will not work on all terminals (They work on the 'aixterm' terminal + emulator under AIX, but they may work on other terminals as well. + Let me know if you find other terminals that support them). + + Notes for IBM PC and compatibles with VGA or SVGA cards in text mode: + -- yellow is actually brown + -- bold is usually represented as high intensity + -- blink can be represented either with actual blink or + high intensity background - depends from card configuration + (it is possible to reprogram it - I can send details if asked) + ----------------------------------------------------------- + +HISTORY + + Powwow keeps in memory the last 127 lines you typed from keyboard. + If you want to recall one of them (to correct a mistake for example) + you just need to press your arrow-up key or control-p to scroll through + the whole history, one step at time (see COMMAND LINE EDITING below + in the text for details about editing keys). + + Another way to find a certain line in the history is to type the first + few chars of it, and then press M-TAB to tell powwow to complete the + line for you. If you hit M-TAB repeatedly, powwow will cycle + through all the possible completions. + + Also, you can use the '#put' command to add a line to history + as if you typed it (see above for help on #put). + ----------------------------------------------------------- + +WORD COMPLETION LIST + + Powwow also remembers the last 512 words you typed from keyboard. + This list of words is named `word completion list'. If you have already + typed a long or difficult word, you can type the first few chars of it + and then press TAB key to ask powwow to complete it for you. + Again, if you hit TAB repeatedly powwow will cycle through + all the possible completions. + + Powwow can also complete the name of any built-in command even if + not present in the word completion list. + + Also, you can use the '#add' command to add a word to word completion + list (see above for help on #add). + ----------------------------------------------------------- + +COMMAND LINE EDITING + + The default key bindings for line editing follow quite closely Emacs: + These are all the keys, together with the reserved names that identify + their function (they can be listed typing '#bind edit'): + + Key: Function name: Description: + + ^A &begin-of-line beginning of line + ^E &end-of-line end of line + ^B &prev-char backward one character + ^F &next-char forward one character + ^P &prev-line use previous line in history (step backward) + ^N &next-line use next line in history (step forward) + ^D &del-char-right delete character under cursor + BS &del-char-left delete character left of cursor + ^K &kill-to-eol kill to end of line + ^T &transpose transpose previous character with next + (if at the end of the line, the two last) + ^L &redraw-line redraw your command line. + This is useful if something garbles your input + line. + ^Q &clear-line clear input line. + ^W &to-history put current line in history and clear input + line. This is useful when you are typing a long + line and need to send another urgent command + first. + ^Z &suspend suspend powwow in the background + Tab &complete-word complete the word being typed to the last + matching word in the history (or added with an + #add command; see above). + Hit multiple times to browse the possible + completions. + This is similar to the GNU Emacs M-/ command. + M-Tab &complete-line complete the line being typed to the last + matching line in the history. + Hit multiple times to browse the possible + completions. + M-f &next-word forward one word + M-k &redraw-line-noprompt + redraw command line, discarding prompt + M-b &prev-word backward one word + M-d &del-word-right delete word right of cursor + M-BS &del-word-left delete word left of cursor + M-l &downcase-word turn word to lowercase + M-t &transpose-words transpose previous word with next + M-u &upcase-word turn word to uppercase + Ret &enter-line the most obvious: execute the typed line + LF &enter-line same thing, but for ^J key (some terminals + send this when you hit return) + (none) &insert-string insert on command line the specified chars + + M-x means pressing the META or Alt key at the same time as x, + or pressing and releasing the escape key, then typing x. The former + way doesn't work on all terminals. + + ^x means pressing the Control key at the same time as x. + + If your terminal has arrow keys, they can be used to move the + cursor and step around in history. In addition, you can define your + own key bindings for sending quick commands (see the #bind command). + If you have a vt100-compatible terminal, the numeric keypad is + predefined for movement (keys 2, 3, 4, 5, 6, 7, 8 and 9). + + Remember that ALL keys can be redefined... + + + A brief note about &insert-string: + + By default no key is bound to this function, and it works somewhat + differently than other editing functions. + + For example, say you don't have `{' and `}' on you keyboard + (it happens on all italian keyboards -- like mine -- and other ones). + Obviously, typing { or } gets quite difficult. A solution is: + + #bind F11=&insert-string \173 + #bind F12=&insert-string \175 + + where \173 and \175 are typed normally: a backslash and three digits. + Once you defined these two bindings, hitting F11 will be exactly like + typing { and hitting F12 will be exactly like typing } . + + Another possible use is to enter strange characters or strings: + + #bind F10=&insert-string Ro\353ntgen + does exactly what you expect: insert "Roëntgen" on the input line + ( ë is the ASCII char (octal)353 or (decimal)234 ) + as if you typed it (of course you could also type the first few chars + of the name then hit TAB if that name is already in the word completion + list...). + ----------------------------------------------------------- + +SECURITY + + When you define an #action that automatically sends something back to + the MUD you are connected to, you must be VERY careful since you may + allow other players to force you to execute commands. + Let's explain better: Suppose you define the following #action: + + #action >+autogroup ^&1 starts following you.={#print;group $1} + + Even though this may look harmless, such an action is potentially + lethal, for the following reason: + If you receive a text from the MUD containing something like + + Cauldron ;remove all;drop all;kill dragon starts following you. + (for example it may be an emote, many MUDs allow it) + + powwow will realize that the line matches with the action you defined + (remember that &n can match text of every length, even if containing + spaces or ; ) and will execute this: + + {#print;group Cauldron ;remove all;drop all;kill dragon} + + The consequences of such a command can be easily imagined... + There are two strategies to avoid such embarassing situations: + 1) Use #send and calculator. In fact this is NOT dangerous: + + #action >+autogroup ^&1 starts following you.= + {#print;#send ("group "+$(1))} + + (in the worst case you will send some semicolon-separated commands + to the MUD, but I saw no MUDs accepting multiple commands as clients + do...): + + 2) Try to use $n instead of &n, so that semicolons and spaces + are skipped. + + #action >+autogroup ^$1 starts following you.= + {#print;group $1} + + WARNING: + versions older than 0.7a were bugged and they did NOT skip + semicolons (but they skipped spaces), so also using $n was + dangerous! + + If you really need to use a &n, check you are not losing security, + and if you cannot write safe code, use calculator as in point 1). + Note that this is NOT dangerous too: + + #action >+autogroup ^&1 starts following you.=group $1 + + since if someone tries to force you as explained above + it will not work, because #action allows only ONE command to follow + the pattern and you did not place braces around "group $1", + so only the first command (in this case "group <name>") + will be executed. + + In every case, remember the best strategy is: check what you are doing, + and do not lose control. If you are not sure a command is safe, better + not to use it. + ----------------------------------------------------------- + +LIMITS + + Powwow has the following limitations: + + Numeric variables are defined as 'long', that means 32-bit integers + on most systems. + + String variables, text lines and commands by default have no length + limits. If you want, you _can_ set a max limit with `#setvar mem'. + Powwow discards text and strings longer than such a limit. + + Exceptions: the labels/patterns of #aliases, #actions, #prompts, + #marks, #in/#at etc. cannot be longer than 4095 chars. + The same limit (4095 chars) applies for the input line. + (the number can be changed by modifying the symbol BUFSIZE) + + Unnamed ('numbered') variables must have indexes from -50 to 9. + (the 50 can be changed modifying the symbol NUMVAR, the 9 cannot + be increased due to hardcoded limits) + + Inline calculator can hold up to 100 suspended operations, due to + parentheses and/or inverted priority of operators. + (the number can be changed by modifying the symbol MAX_STACK) + + The depth of nested/recursive aliases, actions, prompts, #while and + #for commands is limited to 100 nested calls. + (the number can be changed by modifying the symbol MAX_STACK) + + The number of loops of a #while or #for is limited to 10000. + (the number can be changed by modifying the symbol MAX_LOOP) + + Automap can be at most 999 steps. + (the number can be changed by modifying the symbol MAX_MAPLEN) + + History can contain at most 127 lines. + (the number can be changed by modifying the symbol MAX_HIST) + #history commands can execute other #history commands, up to + MAX_HIST levels of recursion. + + Word completion list can contain at most 512 words. + (the number can be changed by modifying the symbol MAX_WORDS) + + Up to 32 MUD (or spawned) connections can be open simultaneously. + (the number can be changed by modifying the symbol MAX_FDSCAN) + + For all other resources, the only limit is the available memory. + ----------------------------------------------------------- + +THE BREAK KEY + + It is usually Control-C or DEL (it depends from the terminal you use). + + Powwow cannot redefine it, but you need to hit it twice in a row + to actually stop powwow. + This is because hitting it only once is used to stop command parsing: + if you enter a long loop using internal commands + (for example: #while (1) drop 1 coin) + you can simply press your break key and powwow will immediatly exit + from the loop with this message: `#interrupted. Press again to quit.' + + If you press the break key again, you will exit powwow. + Otherwise, if you first type something, then you press break key once + more, you will get again: `#interrupted. Press again to quit.' + ----------------------------------------------------------- + +ADVANCED TOPIC: SUBSTITUTIONS AND UNESCAPING + + WARNING: + this is a bit complicated and not recommended for beginners, + as the explanation given at the beginning about $n and \'s might + suffice in many cases. So you might skip this paragraph if you want. + + Still reading? Ok, this is it: + + We described in the beginning that adding \'s to $n delays text + substitution in aliases and actions. Actually, every time powwow + is asked to execute a command, it can make one or more of the + following operations on the command itself before executing it: + + Step (a) : `PARAMETER SUBSTITUTION' or simply `substitution' + + (a1) place in $1..$9 the correct words + + (a2) replace every occurrence of $1..$9 with the contents of the + corresponding variable. Also replace every occurrence of @1..@9 + with the contents of the corresponding variable. + Note that if one or more \ are preceding a $n or @n, + it will be NOT substituted. + + Step (b) : `JUST IN TIME SUBSTITUTION' or `jit' in short + + (b1) replace every occurence of #{expression} with the value of the + expression. Also replace every occurrence of ${name} and @{name} + with the contents of the corresponding variable. Again, + if one or more \ are preceding a #{expr}, ${name} or @{name}, + it will NOT be substituted. This substitution works also + for numbered variables ${number} and @{number}. + + Step (c) : `UNESCAPING' + + (c1) Remove ONE \ from every list of consecutive escapes, + unless they are followed by one or more ` (i.e. reverse-escaped) + For example, \\\$1 is replaced with \\$1 + + (c2) Remove ONE ` from every list of consecutive escapes immediately + followed by a list of consecutive ` + For example, @``` is not modified, + while \\` is replaced with \\ + and \\``` is replaced with \\`` + + The steps actually executed vary from command to command, + but are always ran in order: + if both present, (a) always precedes (b) + if both present, (a) always precedes (c) + if both present, (b) always precedes (c). + + ----------------------------------------------------------- + + When each step is performed/not performed: + + Step (a) (substitution) is performed when executing one of the + following: + aliases, actions, prompts, #for or #while + + Step (b) (jit) is performed when executing _any_ command that allows + a single instruction, and is executed on that instruction before + running it. The list is: + #alias, #action, #prompt, #at, #bind, #connect, #do, #for, #identify, + #if-#else, #in, #init, #nice, #while. + + Also performed on normal (not yet implemented for regexp) patterns + of #actions before matching them. On regexp patterns, step (c) + is made instead. + + Step (c) (unescaping) is performed any time that step (a) + and/or step (b) are performed. + + In addition, unescaping is also performed on text + (not on expressions) following all #commands that allow plain text: + #add, #emulate, #exe, #mark, #print, #put, #send, #var + + on labels of all #commands that allow labels: + #alias, #action, #prompt, #at, #in + + and last, on text that is not a #command nor an alias + before sending it to the MUD, unless the last operation on the + text was _already_ an unescaping. + + Examples: + + #alias fb=cast 'fireball' ${target} + #var $target=troll + fb (effect: cast 'fireball' troll) + #var $target=dragon + fb (effect: cast 'fireball' dragon) + + #action >chase ^${target} leaves $1={#print; #alias f=$1} + (whenever `dragon' leaves the room, + the alias 'f' is set to follow it) + + #action >chase2 ^\${target} leaves $1={#print; #alias f=$1} + (the text `${target}' will be matched + literally) + WARNINGS: + + Step (b) is NOT automatically performed on text typed from the keyboard + so for example `#print ${target}' just prints literally `${target}' + and not the contents of the variable. + If you need step (b) on text you type, you can do something like: + #alias /=$0 + and then prepend all commands with `/ ' : + / #print ${target} + + Step (b) is not yet implemented for regexp actions/prompt due to + internal difficulties. As a workaround, step (c) (unescaping) + is instead performed on regexp patterns. + + Since powwow 1.1.3, unescaping is performed also on the text coming + from substition and jit. This causes subtle incompatibilities with + previous versions in case $n contains any \ or \` . + I tried to avoid this incompatibility, but it is really complicated + to do since I want the text coming from substitution to be subject + to jit as well. So you (and me) will have to live with it :-( + ----------------------------------------------------------- + +ADVANCED TOPIC: SPECIAL COMMAND #PROMPT + + Automatic command execution triggered on prompts + #prompt [[<|=|>|%][+|-]label] [{pattern | (expression)}=[command]] + + WARNING: + this is quite a complicated topic too. You will only need to read this + paragraph if you want to mess with prompts in strange ways, as powwow + usually handles prompts correctly. + + Second warning: + #prompt works only on the main MUD connection. + + O.K, since you are still reading, let's get a bit technical about + powwow internals: + + (WARNING: this changed since powwow 1.1.7:) + + Unless you use #actions, powwow sends immediately to the screen + whatever text it receives from the MUD. It sends to screen both + newline-ended lines (we'll name these `full lines') + and lines not ended with a newline (`incomplete lines'). + Now, there are two problems: + 1) there's no way to know whether an incomplete line is actually + finished or there is a continuation we still have to receive. + 2) powwow cannot know if the line, or an initial part of it, + is a prompt. + + When powwow receives a line (either full or incomplete), + its beginning part may be a prompt, so it matches #prompts on the line. + If the beginning part is _actually_ a prompt, #prompt should + execute #isprompt on it, to let powwow recognize the prompt as such. + + To be exact #isprompt must also specify how long the initial prompt is, + so that powwow can split it from the rest of the line. + For this reason, #isprompt is invoked with a numerical argument: + #isprompt <number> + or + #isprompt (expression) + + a)If the number (or the result of the expression) is positive + and equals to (n), #isprompt declares that the initial prompt + is (n) characters long. + b)If the number is negative and equals to (-n), #isprompt declares + that the initial prompt is the same length as the parameter $n. + c)If the number is 0 (or is missing), #isprompt declares + the whole line as a prompt. + + Also, if a #prompt does not run #isprompt, it is interpreted as + 'this text is not a prompt' + + Putting #isprompt in a #prompt inhibits further attempts to match + that part of the line against both #prompts and #actions + (so should be used only on a complete prompt, not on a part of it) + + NOTE: Since a prompt may be followed by other text, when using + regexp patterns in #prompt it is important not to end the pattern + with $ (which matches the 'end of line') + + Examples: + + On MUME the prompt starts with either `o' or `*' and finishes with `>' + So the regexp pattern ^[o\*].*> will match all prompts and nothing else + To do the same using normal patterns, one should use two patterns + (and two #prompts): ^o&1> and ^*&1> + + On other MUDs of course the possible prompts will vary, so one must + find which pattern (or patterns) will match all the possible prompts. + If it also matches strings that are not prompts, care is required + _not_ to run #isprompt in such cases. + + Let's continue with the MUME example: using regexp patterns, + a correct #prompt is: + + #prompt %default ^[o\\*][^>]*>= + {#isprompt -1; #($prompt = "xyz " + attr "bold" + $prompt + noattr)} + + Note that the pattern contains _two_ backslashes instead of one, + as powwow unescapes regexp patterns. + Also, [^>]*> is used instead of .*> to stop matching at the _first_ `>' + (regexp by default would match the longest text possible, + stopping at the _last_ `>' in the line) + + The #prompt above correctly matches every MUME prompt, + runs #isprompt -1 on it + (which declares that the prompt is as long as $1 + since in regexp patterns $1 is the whole match, it is a good choice) + then modifies the prompt in a custom way + (puts it in bold then appends it to "xyz ") + + Of course #prompts may do whatever one wants, but with a limitation: + they must run #isprompt _before_ modifying the prompt, or unpredictable + things could happen. + + To have the same effect with normal patterns, the following + would be needed: + + #prompt >default1 ^o&1>= + {#isprompt (2+.?$(1)); #($prompt = "xyz " + attr "bold" + $prompt + noattr)} + + #prompt >default2 ^*&1>= + {#isprompt (2+.?$(1)); #($prompt = "xyz " + attr "bold" + $prompt + noattr)} + + The expression after #isprompt meanxs "2 plus the length of $1" + which is obviously the correct length, as $1 does not contain + `o' (or `*') and `>'. + + Final note: + If the prompt is longer than a whole line, it may be drawn incorrectly + and may interfere with the input line (yep, it's a bug). + + MUME players who happen to own a Valar+ character will find this + useful too: + #prompt >default3 ^+&1>={#isprompt (2+.?$(1))} + or, to use regexp patterns: + #prompt %default ^[o\\*\\+][^>]*>={#isprompt -1} + + ----------------------------------------------------------- diff --git a/doc/powwow.help b/doc/powwow.help new file mode 100644 index 0000000..82c7399 --- /dev/null +++ b/doc/powwow.help @@ -0,0 +1,590 @@ +@alias +#alias [name[=[command]]] + +Aliases are abbreviations for longer, frequently used commands. +As all powwow commands, they are only recognized at the beginning +of a line or directly after a semicolon, an open or a closed brace. +When an alias is used, the first word following the alias name +is placed in the variable $1, the second in $2, etc... up to $9. +also, the whole string following alias name is placed in $0. + +Then, before executing <command>, every $n in <command> is replaced by its +value. Examples: + +#alias summ=cast 'summon' $0 (then "summ thor" is replaced by + "cast 'summon' thor") +#alias cs=cast '$1' $2 ("cs summon thor" is expanded to + "cast 'summon' thor") +#alias summ (lets you edit the definition of summ) +#alias summ= (removes the alias summ) +#alias (displays all defined aliases) +#alias ws={wake;stand} (note that you must use braces) + +Aliases are saved automatically if you started powwow with a file name as +argument. Aliases are not expanded in verbatim mode. +@action +#action [[<|=|>|%][+|-]label] [{pattern | (expression)}=[command]] + +When 'pattern' is found in a line from the remote host, the 'command' is +automatically executed. If the pattern contains $n, powwow matches one word +of the remote line and puts it in the variable $n. Instead, if pattern contains +&n, powwow places the shortest possible text (can be more than one word, less, +or even one word) in the corresponding $n (NOT in &n). + +As in #alias, before executing <command>, every $n in <command> is replaced +by its value. If the first character of the pattern is ^ (caret), the match +will only be possible at the beginning of a line. +If 'label' is specified, the action is labeled; otherwise it is numbered. +The match is case-sensitive. Examples: + +#action >fount ^There is a fountain here={#print;drink water} +#action -fount (turns off action) +#action +fount (turns it back on) +#action =fount (lets you edit it) +#action <fount (removes action) + +If you use % instead of >, you define an action that uses an Extended POSIX +regexp to match instead of the standard matcher. + +#action %first ^([[:alpha:]]+) ([[:digit:]]+)=#print $2 counted $3. + (matches abc 123) + +Note that if the pattern starts with '(', it is evaluated, which means that +a regexp that starts with '(' has to be surrounded by ("...") + +#action %second ("(..+)-\\1")=#print Double $1 + (matches xyz-xyz) +For regexp actions, $0 = the line, $1 = the whole match and $2... contain the +submatches. +@bind +#bind [edit|key[=[command]]] + +You can bind most function keys and control keys to enter a command for you +when the key is pressed. You cannot (yet) redefine a key already used for an +editing function (such as the arrow keys). 'key' is the name of the key you +want to define; When defining a new key, you will be asked to press it so +powwow can record the control sequence your terminal sends. Examples: + +#bind (lists all key bindings) +#bind f1=recite scroll of recall (you'll have to press f1 then) +#bind f1=cast 'sanctuary' (change exiting definition) +#bind f1 (lets you edit the definition) +#bind f1= (removes the key) +#bind edit (lists editing keys) + +By default, the vt100 numeric keypad is partially used to walk around +@key +#key name + +If 'name' is the name of one of the key defined with #bind, #key executes the +corresponding command. Example: + +#bind f1=flee (binds the f1 key to the 'flee' command) +At any time, then, you can either: +- Press your f1 key on you keyboard +- Execute the command '#key f1' +and powwow will execute the command 'flee' for you. +@reset +#reset {all|list-name} + +Argument: Effect: +all clear everything (apply all lines below this) +alias clear all aliases +action clear all actions +bind clear all key bindings and restart with default + settings. Note that also editing keys are resetted + to default function. +at clear all delayed commands +in (same thing) +mark clear all markers +var clear all variables +@mark +#mark [text[=[attribute]]] + +This command highlights a text in your output in the way you choose +(if your terminal supports it). Attributes: +one or more of bold, blink, inverse, underline and/or +[<foreground>] [on <background>], where the colors are: +black, red, green, yellow, blue, magenta, cyan, white and +BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, none. +Wildcards are allowed ($ for a single word, & for any string). Examples: + +#mark Sizzler=bold (mark Sizzler in bold) +#mark Sizzler (lets you edit the above definition) +#mark Sizzler= (Sizzler is no longer put in bold) +#mark (lists all markers) +#mark *&*=inverse (mark in reverse any string in * *) +@module +#module [module name] + +This loads a shared library module by name, if supported by your system. The +name of the module should be included in the documentation that came with the +powwow extension, for example to load the perl module you would use: + +#module perl + +Which gives you the perl command that can be used like: + +#perl powwow::exec( "say it is " . scalar(localtime()) ) + +The commands added and their syntax varies depending on the module. + +@history +#history [number] + +#history alone shows you the last commands in history, up to the number +of lines in your screen. +#history -n shows the last n commands in history, and +#history n executes the n-th command of the history. + +#history commands are not placed in history. +@hilite +#hilite [attribute] + +This sets the attribute of your entered text to the given attribute. +Just #hilite turns it off. + +Attributes: one or more of bold, blink, inverse, underline and/or +[<foreground>] [on <background>], where the colors are: +black, red, green, yellow, blue, magenta, cyan, white and +BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, none. +@host +#host [hostname port] + +Sets the default host that powwow shall try to connect to when you use +#connect. +If you type #host without any arguments, the current host and port are +shown (provided that you have specified them). +@color +#color [attrib] + +(This command exists only if BUG_TELNET is defined, to cope with + deficiencies of NCSA telnet 2.2) +Set your standard foreground and background to the colours you specify. +#color sets default colors +@connect +#connect [session-id [initstr] [address port]] + +Connect a new session. + +To connect your first session, use: +#connect main <address> <port> +where <address> and <port> indicate the host you want to connect to. + +If no address/port is defined, you either get connected to the default +host and port (if you have no open connection) or a list of open +connections is shown. + +Last opened session will be the default one. + +If <initstr> is specified, it is sent to host on connection. +@keys +Default editing keys: + +^A &begin-of-line +^E &end-of-line +^B &prev-char M-b &prev-word +^F &next-char M-f &next-word +^P &prev-line +^N &next-line +^D &del-char-right M-d &del-word-right +BS &del-char-left M-BS &del-word-left +^K &kill-to-eol M-k &redraw-line-noprompt +^L &redraw-line M-l &downcase-word +^T &transpose M-t &transpose-words +^Q &clear-line + M-u &upcase-word +^W &to-history +^Z &suspend +Tab &complete-word M-Tab &complete-line +Ret &enter-line +LF &enter-line + +not assigned: &insert-string + +M-<key> means press escape and then <key>, or press meta/alt key at the same +time as <key>. ^ means control. +If your terminal has arrow keys, they are set for default to move cursor and to +step around history. +@wrap +#wrap [on|off] + +Normally, powwow wraps words that would have been cut by the right +margin to the next line. This command lets you turn it off and on. +@compact +#compact [on|off] + +Normally, powwow does not touch the prompts on screen while you play. +In #compact mode, instead, lines containing only a prompt are deleted when +further messages arrive from the remote host. +@echo +#echo [on|off] + +Normally, powwow echoes on your screen each command sent to remote +host but not directly typed (example: aliases and actions sending text +to the MUD). When #echo is off, such commands are still sent to host, +but not echoed on screen. +@info +#info [on|off] + +Normally, powwow prints on screen some messages each time you +define/edit/delete an #alias, #action, #bind and similar. +When #info is off, those messages are not typed at all. +(But errors are still printed on screen) +@debug +#debug [on|off] + +Normally, powwow does not print on screen the command lines it +executes. When #debug is on, every line executed by powwow is also +echoed on screen (warning: this prints LOTS of lines on your screen) +@delim +#delim [normal|program|{custom <chars>} + +By default, when powwow adds words to the word completion buffer, +it uses only SPACE (' ') and SEMI-COLON (';') as delimeters. You +can change this behaviour by specifying "program" or "custom" mode. +The "program" mode uses ' <>!=(),.;"'{}[]+-/*%=' as separators, which +is suitable if you are doing some kind of on-line programming. +You can also make a customized setting with the "custom" mode (space +is always used as a delimeter). +This setting also affects &transpose-words (usually bound as M-t) +@for +#for ([init];check;[loop]) command + +Directly copied from C language, this command evaluates 'init' +(if specified), then repeats the following cycle: + 1) evaluate 'check', if result is 0 (false) stop repetition + 2) execute 'command' + 3) evaluate 'loop' (if specified) + 4) restart from 1) + +As with #while, #for performs the parameter substitution in 'command'. Example: +#for (@0=32; @0<=47; @0++) read @0 (read messages 32-47) +@at +@in +#at [label [(time-expression) [command]]] +or +#in [label [(delay in millisec.) [command]]] + +If you want to tell powwow to execute the command 'kill wolf' +2 seconds after you type it, use this command: +#in attack (2000) kill wolf + +If you do not specify the command, powwow assumes the label is already +defined, and changes its delay. +A delay less than zero means the delayed label is disabled. +A delay of zero deletes the delayed label. + +If you specify only a label, powwow lists it. +If you specify nothing, all delayed labels are listed. + +The #at command is almost the same as #in, but assumes the expression +in ( ) is a time. +For example (114520) means 11:45:20 and ("114520") is the same. + +After executing a delayed command, powwow does not delete it, but simply +disables it. +@stop +#stop + +Disables all delayed commands (not delete). +Useful if you start an infinite loop with a self-reactivating delayed command +@add +#add {text|(expression)} + +Add the text or result of expression (calculator is used to evaluate the +expression) to the word completion list. Example: + +#action >reply ^$1 tells you={#print;#add $1} + (from now on, you can use TAB to complete that name) +@addstatic +#addstatic {text|(expression)} + +Add the text or result of expression (calculator is used to evaluate the +expression) to the static word completion list. Example: + +#addstatic Tintin Milou (from now on you can always use Tab to complete + these two names) + +Note that the static list is not saved when you run #save, and its +words will never be overwritten as new words are added. + +It is best used from your #init command, for example: + +#init ={#identify;#exe <static-completions} + +If the 'static-completions' file contains a number of #addstatic +commands, all those words will always be possible to Tab-complete on. + +@option +#option [+-=]<option> | list + +This command lets you list or change various options of powwow. + + #option lists all current option settings + #option list long list of current options + #option =<option> edit current setting of <option> + #option +<option> enable <option> + #option -<option> disable <option> + #option <option> toggle <option> + +@put +#put {text|(expression)} + +If a text is specified, powwow puts it in history. If an expression is +specified, powwow uses the inline calculator to evaluate it, and then puts the +result in history. +@() +@ () +#(expression) or # (expression) + +Evaluate expression with calculator, and trash result. Examples: + +#(@7=45) (set value of variable @7 to 45) +#alias set=#($-1 = \$0) (copy parameter $0 of the alias into $-1) +@print +#print [<|!][string|(expression)] + +If a string is specified, powwow simply prints it on screen. If an expression +is specified, powwow uses the inline calculator to evaluate it, and then +prints the result. + +If a #print without arguments is found, powwow prints the value of the +variable $0 (this is a special feature of #print, and is not present in #send, +#exe, #emulate or #var). + +If < precedes the text or expression, #print assumes text (or result of +expression) to be name of a file, and displays the contents of that file. + +Instead if ! precedes the text or expression, #print assumes text (or result of +expression) to be a Bourne shell command, whose output is displayed. +Examples: + +#action disint ^&1 disintegrates &2=#print $1 DISINTEGRATES $2 +#action disint ^&1 disintegrates &2=#print (\$1+" DISINTEGRATES "+\$2) +#print <mytext (display a text on screen) +#print !more mytext (same thing, but uses 'more' as text viewer) +#print (@-7) (print value of variable on screen) +#print <($2) (display the contents of file whose name is in + variable $2) + +Further feature (supported also by #send, #exe, #emulate and #var): +If < or ! is specified, and you use an expression after it, you can also +specify starting and ending line of the file/command output that you want +to use (the other lines will be ignored), in this way: + +#print {<|!}(string-expr;[start];[end]) +@send +#send [<|!]{text|(string-expr)} + +The simplest use of #send is to evaluate an expression and to send +the result to the MUD. More generally, #send is very similar to #print, +with the only difference that the final text is sent to the MUD rather +than displayed on screen. +The meaning of < and ! is the same, and #send do the expected things +when they are used. Examples: + +#send <mytext (stuff a text into the mud) +#send !awk ' {print "tell arthur " $0} ' file (say a file to your friend) +#send ("say I have been playing for " + %(timer/86400000) + " hours") +@exe +#exe [<|!]{text|(expression)} + +Evaluate the expression and get result, then execute result as if typed from +keyboard. If < or ! is specified, #exe behaves exactly like #print, but +executes the final text as if typed. Examples: + +#exe ("sigh") (is the same as typing sigh from keyboard) +#bind control_s=#exe ("#capture emergency" + %(@-7++)) + (each time you press control_s, a different + file is opened as capture) +#exe <mytext (read the file mytext and execute it) +@emulate +#emulate [<|!]{text|(expression)} + +Evaluate the expression and get result, then parse result as if received from +remote host. If < or ! is specified, #emulate behaves exactly like #print, +but parses the final text as if received from host. Examples: + +#emulate The assassin is dead! R.I.P. (powwow reacts in the same way as + if received the text from remote host) +#emulate <mytext (read the file mytext and parse it as + if received) +@var +#var $number = [<|!]{text|(expression)} +#var @number = [<|!]{text|(expression)} + +Evaluate the expression and get result, then put result in the indicated +variable. If < or ! is specified, #var behaves exactly like #print, but puts +the final text in the variable. +You can also use an expression instead of 'number'. Examples: + +#var @(-1*4) = 27 (same as #(@(-1*4)=27) ) +#var @1=!echo '5.6+6.48' | bc -l (use bc calculator and put result in @1) +#var $test = this is a very very very long text (you do not need quotes) +#var $-6 = ("a short text") (since there are parentheses, you must + also use quotes as in calculator) +#var $-1 = <myfile (if myfile is longer than 1024 bytes, + powwow will read only the first 1024) + +#var variable +will let you edit the current value of the variable + +#var variable= +will delete the variable +@write +#write [>|!](text;name) + +Evaluate expression and get result, then append result to 'name' file. +If > is specified, 'name' file is truncated before actually writing result. + +If ! is specified, 'name' shell command is executed, and result is written +to its standard input. Examples: + +#write ($test; "myfile") (append contents of $test to the end of myfile) +#write !("55+12"; "bc -l") (eval 55+12 using bc program) +@if +#if (expression) command1 [#else command2] + +Evaluate the expression: if result is 'true' execute command1, +otherwise (if there is an #else) execute command2. +If expression is false and there is no #else, execute nothing. +remember that you must use braces {} if command1 or command2 +contain more than one instruction. +@settimer +#settimer (expr) + +Evaluate the expression and get result, then set 'timer' to restart from the +corresponding number of milliseconds. Examples: + +#settimer (0) (reset internal timer to 0) +#settimer (20000) (make internal timer restart from 20000 milliseconds) +@while +#while (expression) command + +This construct repeats a command while expression keeps true. As with #alias, +#action and #for, the $n and @n in command are replaced by their values. +Examples: + +#while (@0<13) {read @0;#(\@0++)} (read messages 0-12) + (As you can see, the last @0 is escaped to avoid it to be + substituted with its value - we want to decrease the variable!) +@math +The inline calculator is used to evaluate expressions inside +#(), #print (), #exe (), #send (), #if (), #while (), #for (), #do (), etc. +and (if you use this syntax) expressions in pattern of #actions + +The inline calculator recognizes the following objects: + +numbers (only integers are supported) + decimal numbers: + simply write them. + + hexadecimal numbers: + use '#' as prefix: #F is 15, #a0 is 160, and so on + + numbers in any other base: + use base# as prefix: 2#101 is 5, 7#14 is 11... + + if you use negative non-decimal numbers, you must put '-' + before the base: -2#101 is -5, 2#-101 causes an error. + +quoted-strings (i.e.: strings in " "). +NOTE: powwow unescapes them when they are evaluated + +timer (number of milliseconds since last timer reset) + +map (string containing the map shown by #map command) + +variables: + @n with n within -50 and 9, are numeric-variables + $n with n within -50 and 9, are string-variables + + Variables with negative index (@-1...@-50 and $-1...$-50) are global, + while variables with positive or zero index are parameters: they are local to + the #alias, #action, #while or #for powwow is executing, and each time + powwow executes one of these commands, a new set of parameters is created. + + @name are numeric-variables + $name are string-variables + + Every character of the name must be either: + a letter (uppercase or lowercase) + an underscore '_' + a number + Exception: the first char of the name must NOT be a number + +operators between numbers: + ++ -- + - + * / % + + - + << >> + < <= > >= == != + & | ^ + && || ^^ + = *= /= %= += -= <<= >>= &= ^= |= &&= ^^= ||= + , + ( ) +(no help on these operators, see a C-language manual) +(note: unlike C, operators && and || always eval both arguments) +(also, % and %= always return non-negative values) + +random number generator: + + rand positive-number (return a random number between 0 and n-1) + +operators between strings: + + chain two strings + = assign a string to a string-variable + += append a string to a string-variable + - compare two strings: result -1 if s1<s2, +1 if s1>s2, + 0 if s1==s2 + < <= > >= == != compare two strings + .? number of chars in a string + :? number of words in a string + ? position of first occurrence of second string in the first + * convert first char of a string into its ASCII code or vice versa + % convert string into its numeric value or vice versa + +operators between a string and a number: + (string is first argument) + : n-th word of a string + . n-th char of a string + :< :> <: >: .< .> <. >. return part of a string, in this way: + : before > or < means 'mark the n-th word from start' + . before > or < means 'mark the n-th char from start' + : after > or < means 'mark the n-th word from end' + . after > or < means 'mark the n-th char from end' + > means: return from marked word/char to end + < means: return from start to marked word/char + +Examples: + +#print($5="Hello, world") (assign "Hello, world" to $5 and print it) + +#action >+exp ^You have scored $1 exp={#print;#print ("You gained " + + %($1 - @-5) + " exp. points since last score"); #(@-5 = $1)} + (when you type 'score' in MUME, one of the lines you get is: + You have scored xxx experience points ... ) +@warranty + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. |