⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifications

📁 Linux下的MUD客户端程序
💻
字号:
*****************************************************************      Modifications I've made to tintin++v1.61dev******************************************************************NB! My version is NOT an official tintin version in any way!NB! I've not written tintin myself! I only modified some of the code in    the original tintin and added a few commands myself...*** New and modified commands:Command: loop - added evaluation of the parameters (BUGFIX)Syntax:  #loop {a,b} {do this}Example: The update means that the following line now works           #loop {$a,$b} {#shomwe %0}         provided 'a' and 'b' are variables which contain numbers.Command: if - added an else statement (MODIFIED)Syntax:  #if {-test-} {do this} else {do this instead}Example: #if {1=2} {say WOW! It's a strange world we live in...} else {say It's a dull life we live.. nothing         changes!}Command: ifexists - checks if a variable exists or not (NEW)Syntax:  #ifexists {varname} {do this} else {do this instead}Example: #ife {leader} {say My leader is $leader!} else {say I have no leader!}Command: ifmatch - checks a string for a mask containing text and *'s (NEW)Syntax:  #ifmatch {mask} {string} {do this} else {do this instead}Example: #ifm {*Iny*} {This is a test string: Iny!} {#shomwe Works fine!} else {#showme Call 911 - the procedure         doesn't work!}Command: ifstrequal - string comparisment (NEW)Syntax:  #ifstrequal {string1} {string2} {do this} else {do this instead}Example: #alias {tell} {#ifs {$1} {$whoami} {#showme [Tell to self]: %0} else {Tell %0}}Command: random - create a random number (NEW)Syntax:  #random {[var]} ( {from,to} )Info:    If no second parameter is given, a random number between 0 and 100 is created.Example: #ran number 50,60   <- number = random number 50..60         #ran number         <- number = 0..100Command: getvarvalue - get the contents of a variable (NEW)Syntax:  #getvarvalue {dest var} {source var}Example: #getv {numberofmobs} {mobThe Spirit Guard}Info:    The variable name can contain any character; not just alpha chars!         This function was made more or less redundant when I introduced the         improved naming of variables by allowing brackets around the name.         ( ${variablename} ). But it's kept for compability with earlier comfiles.Command: do - just enables you to put a group of commands in brackets to prevent              early evaluation of variables (NEW)Syntax:  #do {do this}Example: #ali calc {#math {calctmp} {%0};#do {say %0 = $calctmp};#unvar calctmp}}Info:    The effect could be achieved earlier by for instance #1 {do this}         but I found a separate #do command to be less confusing...Command: revstring - reverses a string/stores it backwards (NEW)Syntax:  #revstring {dest var} {string}Example: #revs myname Happy Iny <-- stores 'ynI yppaH' in the variable 'myname'Command: postpad - pads a variable with spaces AFTER given text until variable                   is of desired length (truncates if too long)  (NEW)Syntax:  #postpad {dest var} {length} {text}Example: #postpad mobname 15 A huge, ancient tree, walking on giant roots,         #postpad myname 15 InyCommand: postpad - pads a variable with spaces BEFORE given text until variable                   is of desired length (truncates if too long)  (NEW) Syntax: #prepad {dest var} {length} {text}Syntax: #prepad mobname 15 A huge, ancient tree, walking on giant roots,        #prepad myname 15 Iny*** Commands which can be used to simulate lists/arrays:I've defined a list the following way:  1. is a textstring  2. contains any number of elements  3. each element is either ONE word OR enclosed in a set of bracketsExamples:#var alignlist {evil neutral good}   <--- creates a list with 3 elements: 1. evil, 2. neutral, 3. good#var rndsocial {smile {say WHEE!} bounce}  <---- creates a list with 3 elements: 1. smile, 2. say WHEE!,                                                  3. bounceThe following commands have been created to allow manipulations of lists:Command: getlistlength - returns the length of a list (NEW)Syntax:  #getlistlength {dest var} {list}Example: #getl Length {$alignlist}   <--- returns 3 in the Length variableCommand: getitemnr - retrieves specified element from a list (NEW)Syntax:  #getitemnr {destination variable} {item number} {list}Example: #geti {dothis} {2} {smile {say Hi!} flip bounce}  <--- sets dothis to 'say Hi!'Example: #getl Length {$rndsocial};#ran itemnr {1,$Length};#geti temp {$itemnr} {$rndsocial};#do {$temp}         (will perform a random social from the 'rndsocial' list)*** Added features:IMPROVED VARIABLE NAMING:Added the possibility to add non-alpha characters (numbers,space,etc.) in variable names.(Which kind of makes the #getvarvalue command redundant, but it's kept for compatibility).Usage will hopefully be demonstrated by this example:#var {spellcost holy sphere} {150}#ali {holy} {#if {$manaleft < ${spellcost holy sphere}} {say Don't have enough mana to cast holy!}     else {cas 'holy sphere'}}OR this more complex one:----->8---- cut here ---->8-------#nop GENERAL STUFF#ali {===}  {#nop}#ali {clv}  {#var %0 0}#ali {incv} {#math {%%0} {$%%0+1}}=== GENERAL LOG THINGIE ===#var logname Default; === Set the default logname#var {GETLOGSIZE}   {#ifex {$logname} {#var logsize ${$logname}} else {clv logsize;#var {$$logname} 0}}#var {SHOWLOGTITLE} {#showme {== LOG: $logname ==  SIZE: $logsize ==}}#var {SHOWCONTENTS} {#loop {1,$$logsize} {#var logmsg ${$logname %%0};#showme {$logmsg}};#unvar logmsg}#ali {writelog}     {$$GETLOGSIZE;incv logsize;#do {#var {$$logname} {$$logsize}};#do {#var {$$logname $$logsize}                    {%%%0}}}#ali {showlog}      {$$GETLOGSIZE;$$SHOWLOGTITLE;#if {$logsize>0} {$$$SHOWCONTENTS}}#ali {clearlog}     {#unvar {$$logname*};MSG The log "$logname" has been cleared !}=== MOB COUNTER THINGIE ===#act {%0 is dead! R.I.P.} {#var ripname %0}#act {^You receive %1 experience points.} {#ifex {mob $$ripname} {#var MobCount ${mob $ripname};incv MobCount;     #do {#var {mob $$ripname} $MobCount}} else {#var {mob $$ripname} 1;#var logname Mobs;writelog $ripname}}#var {SHOWMOBS} {#loop {1,$$logsize} {#var logmsg ${$logname %%0};     #do {#showme {$logmsg - RIPS: ${mob $logmsg}}}};#unvar logmsg}#ali {showmobs} {#var logname Mobs;$$GETLOGSIZE;#if {$logsize>0} {$$$SHOWMOBS}}#ali {clearmoblog} {#var logname Mobs;clearlog;#unvar mob *}=== Clear temporary variables ===#unvar GETLOGSIZE;#unvar SHOWLOGTITLE;#unvar SHOWCONTENTS#unvar SHOWMOBS--->8--- cut here --->8----Example which uses the commands above:Let's say the text inside the ---cut--- lines have been loaded and that the following lineshas been received on the mud:  The Spirit Guard is dead! R.I.P.                       ] occured 3 times  You receive your share of 354325 experience points.    ]  The Spirit Sergeant is dead! R.I.P.                    ] occured 2 times  You receive your share of 345552 experience points.    ]Using the alias 'showmobs' will then display the following list(providing the alias 'clearmoblog' was run first):---The Spirit Guard - RIPS: 3The Spirit Sergeant - RIPS: 2---TICKCOUNTER:============A variable containing the number of seconds to tick from tintin's internal tickcounterhas been implemented.NB! The variable is only SIMULATED which means it won't be shown in the #variable list.Example: say There's approximately $secstotick seconds again to the tick.I also removed the annoying TICK messages from tintin... which means the tickcounter willrun silently.FUNCTIONS:==========Added a new list type which I decided to call functions. These are a mixture of aliases andvariables. The following examples will have to do to explain how to use functions:Example:#function {rnd} {#random {temp} {%1,%2};#result {$temp};#unvar temp}#showme A random number between 0 and 100: @rnd{0 100}Functions are treated much like variables. Their value isa command-line which is executed, and the functions are substitutedby the parameter last sent to the #result commandExample:#function {lastfuncresult} {#nop}#showme Last use of a function gave @lastfuncresult as result.*** Function related commands:Command: result - write a string to the function buffer (NEW)Syntax:  #result {-result-}Example: #func {ctof} {#math result %0*9/5+32;#do {#result $result degrees fahrenheit};#unvar result}         #showme 30 degrees celsius equals @ctof{30}.Example: #func {ftoc} {#math result (%0-32)*5/9;#do {#result $result degrees celsius};#unvar result}         #showme 80 degrees fahrenheit equals @ftoc{80}.Command: function - make a function (NEW)Syntax:  #function {func name} {-function contents- (;#result -function result-)}Info:    Will display all functions if no parameter is givenExample: (see example for the 'result' command)Command: unfunction - remove a function (NEW)Syntax:  #unfunction {func name}Note: Functions also allow the 'new' format used for variables. that is      @{name}{params} to allow complex names containing non-alpha chars.AUTODETECT SCREENSIZE:======================Used for splitmode - code is stolen from the 1.64dev version.SPLITMODE IMPROVED:===================Fixed lots of bugs in the code which messed up splitmode.Added a 'statusline' command to write text to the splitline!Command: statusline - write to the splitline (NEW) Syntax:  #statusline {text}Example: #status ========= This line is my splitline ==========Info:    Must be in splitmode to useCommand: split - initialize a splitmode session (MODIFIED)Syntax:  #split ( {lines,columns} )Info:    If no argument is given tintin will try to automatically detect your screensizeExample: #split;#status ========= BE HAPPY =======Example: #split 40,120   <--- initialize splitmode in a screen with 40 lines and wrap after 120 columnsLOADING OF SCRIPTFILES:=======================TinTin now allows for linebreaks in command files.If last non-whitespace character on a line is '\' thenthe command is continued from the first non-whitespacecharacter on the next line. A leading '/' character willignored, but the line will be read from thereon.Blank lines are also ignored.Example:The following lines in a scriptfile...#action {^$leader tells your group 'HP:%1 MV:%2'} \   {\     #if {%1<500} \       {cast 'heal' $leader} \     else #if {%2<40} \       {cast 'vitalize' $leader}\   } {3}...will be the same as writing it all on one line, as in...#action {^$leader tells your group 'HP:%1 MV:%2'} {#if {%1<500} {cast 'heal' $leader} else #if {%2<40} {cast 'vitalize' $leader}} {3}...--------------------FEATURE CHANGES:1. Attempts to divide by zero is now trapped and an error message is displayedThat's all I could think of that I've modified on the 1.61dev version. If you find any bugs orerrors in the docs above please write me a note about it.I'd also like suggestions to new commands/features or changes which can be made toalready existing commands.//Sverre is Happy Iny (sverreno@stud.ntnu.no)  (www.stud.ntnu.no/~sverreno)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -