注册 登录 查询

迷你方式显示论坛 RSS订阅此版新信息  
首页 >> 论坛 >> ┈┋MUD 交流区┋┈ >> 武林群侠传 >> 机器人分享区 >> 查看帖子
 新帖 新投票 讨论区 精华区 上篇 刷新 平板 下篇


 帖子主题: yTin++相关资料.
 
头衔 小混混

离线

ivy
门派 秋林拾叶
职务 总舵主
人物等级 炉火纯青
江湖威望 +8
江湖阅历 30
门派贡献 1507
实战经验 22561
文章 534
注册 05-01-09 22:36
发表 2005-07-26 10:45:01 人气:296

~LOG

format:        #log {filename} [{option}]

Log messages in/out of the session to a file, if the file is in a directory
other than current, #log will try to create the last layer of directory for you.
Suggestion: always use an empty #log command to stop previous log event.

Example:
#log 1.log            <== #OK. LOGGING..... (RAWMODE=0)
#log 2.log +          <== #OK. LOGGING..... (RAWMODE=0 APPEND) -- log appended to file
#log                  <== #OK. LOGGING TURNED OFF.
#log 1.raw 1          <== #OK. LOGGING..... (RAWMODE=1) -- logs TELNET sequence as well
#log 2.raw 1+         <== #OK. LOGGING..... (RAWMODE=1 APPEND) -- guess ;-)

See also: #sysecho

~LOOP

format:        #loop {start,finish} {command(s)}

Like a for-next loop, will loop from start to finish incrementing or
decrementing by 1 each time through.  The value of the loop variable is
places in %0, and can be used in the command(s).  If start>finish, it will
loop backwards.

examples:
#loop {1,3} {get all %0.corpse}
equivalent to the following:
  get all 1.corpse;get all 2.corpse;get all 3.corpse
#var n 3
#loop {$n,1} {drop %0.key}
equivalent to
  drop 3.key;drop 2.key;drop 1.key

See also: #forall

~MACRO

format:        #macro {keycode1, keycode2} {macro_to_be_done}
               #macro 1

Example:
#macro {67, 47} {go west}
#macro {24, 47} {go east}
1st line means when Numlock, press '7' on Numpad will send go west,
2nd line means when nun-unlock, press '7' on Numpad will send go east.
Currently Alt/Ctrl/Shift states are not detected.

#macro 1   ==> dynamicly test the keycodes for the key u pressed,
               press ESC key to back to normal mode.

See also: unmacro
ps: Macros under unix is underway (thinking about compatibility with Windows).

See also: #boss

~MAP

format:        #map {direction}

Will add a direction to the end of the current path.  Useful for mapping
while following someone.

example:

#action {$leader leaves %0.} {#map {%%0}}
if the person stored in $leader leaves the room, the direction is added
to the end of the path.


~MARK

format:        #mark

Clear the path list and start the new path at your current location.

~MATH

format:        #math {variable} {expression}

Performs math functions and stored the result in a variable.  The math
follows a C-like precedence, as follows, with the top of the list having
the highest priority.

Operators                    Function
------------------------------------------------
!                            logical not
------------------------------------------------
//                           modulate (% in most languate, we use // to avoid confusion with variables)
/                            integer divide
*                            integer multiply
------------------------------------------------
+                            integer addition
-                            integer subtraction
------------------------------------------------
>                            greater than (result is non-zero or zero)
>=                           greater than or equal (result is non-zero or zero)
<                            less than (result is non-zero or zero)
<=                           less than or equal (result is non-zero or zero)
= or ==                      equals (result is non-zero or zero)
!=                           not equal (result is non-zero or zero)
------------------------------------------------
& or &&                      logical and (result is non-zero or zero)
| or ||                      logical or (result is non-zero or zero)
------------------------------------------------
Note: currently &, | are logic and/or, but please use && and ||, future version
might make &, | to bitwise and/or.

True is any non-zero number, and False is zero.  In the expression, you may
use T and F as true and false.  Parentheses () have highest precedence,
so inside the parentheses is always evaluated first.

examples:
#math {heals} {$mana/40}
Assuming there is a variable $mana, divide its value by 40 and store the
result in $heals.
#action {^You receive %0 experience} {updatexp %0}
#alias updatexp {#math {xpneed} {$xpneed-%%0}}
Let's say you have a variable which stores xp needed for your next
level.  The above will modify that variable after every kill, showing
the amount still needed.

See also: #variable, #if

~MESSAGE

format:        #message {type}

This will toggle off and on the messages dealing with a certain type of
command.  The possible message types are alias, action, antisub, sub
variable, and highlight.  This is very helpful if you are using
#math and #if, and setting a lot of variables, so you don't keep getting
the Variable Set messages.

example:
#message {variable}
toggles whether messages dealing with variables will be shown.
#message {variable} {1}
toggles it to be TRUE.

See also: #action, #variable, ...

~NOP

format:        #nop [string]

A null operation, is ignored by the client.  It is useful for commenting
in your coms file, any text after the nop and before a semicolon or
end of line is ignored.

example:
#nop This is the start of my autoactions
#ifexits {myvar} {#nop} else {#var myvar 0}

~ORD

format:        #ord {variable} {string}

Note: this name is from similar Perl function.

Converts the 1st character of string to its ascii code and assign it
to variable. See similar Perl function ord().

See also: #chr

~PING2

format:        #ping2 [0]

Pseudo ping, using telnet sequence TIMING(0x06).
#ping 0 to force reset upon network timeout.

Note: MudOS and most Unix hosts support it. Some MudOS needs to send a "\n" after that.
#ping2 not work with some Mud that does not implement some basic telnet response,
as an alternate, use system pseudo variable $_msec and some self-made actions to
do similar work.

Example:
#al PING2 {#ping2;#al ping2Act #nop;#al ping2Act %0;#act {^#TELNET PSEUDO PING RESPONSE: %0 ms}{#unact {^#TELNET PSEUDO PING RESPONSE: %0 ms};#var ping2 $0;ping2Act}}

#al riskyAction1 {PING2 {#if {$ping2<300}{#bell;#show HERE WE GO!;some-action...} else {#show TOO LAG, LET'S PLAY SAFE}}}

See also: #telnet

~PATH

format:        #path

Show your current path.

~PATHDIR

format:               #pathdir {odd_dir} {what speedwalk should interpret it as}

New for v1.5, this command will allow those player who play on muds that
have diag./odd directions to use speedwalk.

example:
#pathdir {nw} {nw}
each time {nw} is excountered in the speedwalk, tintin++ will send a {nw} to
the mud.

~PAUSE
format: #pause [{seconds}]

Description:  This command will toggle specify pause mode.
     Example:
     #pause       <= show the current pause mode
     #pause 0     <= toggle pause mode to OFF
     #pause 0.5   <=  each command written to mud are buffered, sending
                      out in 0.5 seconds interval
See also: #sleep, #purge, #slow


~PRESUB

format:        #presub

Toggle whether actions are processed before substitutes, or after.  With
presub on, actions are performed on the substituted buffer, and if
you are gagging heavily, it will increase the speed of execution.
There are also many times you don't want to check for actions on
lines you have gagged, and this will allow that.

See also: #action, #substitute, #gag

~PURGE

format: #purge

This will purge all pending commands that will otherwise
send to mud by using #pause or #sleep command.

Example:
#purge             <== same as #purge 1, clear the pending commands due to
                       #pause, #sleep and #slow
#purge 0           <== clear the pending commands due to #pause, #slow

See also: #pause, #slow, #sleep

~PURIST

format: #purist

This currently works for Windows version or split mode under Unix version.
Disable the default "local echo" mode. Commands typed will not show locally.

See also: #unpurist

~RAW

format:        #raw

usage:         #raw test          <= send "test" without newline appended
example:       #func chr {#chr _ {%%0};#res $_}
                                           #raw @chr{4}       <= will send ctrl-D (^D 的十进制 ascii 码是 4)
               #raw @chr{27}      <= will send ESC
               #raw @chr{1}d      <= send ctrl-A, d ...
see also:      #toggle raw

~REDRAW

format:        #redraw

If redraw is on, and you're not in split mode, the input
line will be redrawn when any text arrives, or tintin++ prints any
messages.  This helps you avoid your input being spread out and
unreadable when there is heavy text flow from the mud.  In split mode,
this variable is ignored.

~REMOVE

format:        #remove {filename}

Delete a file.
Variable _ is assigned 0 if the file is successfully deleted; otherwise set to -1.

See help on C function: int remove( const char *path );

See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~RENAME

format:        #rename {filename_old} {filename_new}

Rename a file or directory.
variable _ is set to 0 if it is successful, set to non-zero on error.

See help on C function: int rename( const char *oldname, const char *newname );

See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~RETAB

format:                #retab [tab_file]

#retab allows you to re-load the tab completion file, default is tab.txt.

See also: #tabadd, #tabdelete, #tablist, #tabsave, tab.txt

~RETURN

format:        #return

Pop the last move off the top of the path, and move the opposite direction.

~READ

format:        #read {filename}
            or #read filename

Reads a script/coms file into memory.  The coms file is merged in with the
currently loaded commands.  Duplicate commands are overwritten.

See also: #message read

~SAVEPATH

format:        #savepath {alias name}

Save the current path to an alias, which can then be saved to a coms file.
The alias name provided will be the new name of the alias to represent
that path.  Useful for after mapping to be able to get back to the place
again.

~SESSION

format:        #session {session_id} {ip port}
               #session {session_id}
               #session

Use this command to connect to mud, or show sessions already on.

example:
    #session {temp} {123.45.67.89 6666}
This command will connect to 123.45.67.89 6666 with session_id "temp".
Later if in any case session "temp" is not on the top, use #temp
to bring it back.
So it is recommended that do not use numbers as session_id since it
conflicts with tintin's repeat command.

When port is set to 0, instead of make a real connection,
tintin++ create a dummy session connects to nowhere. This session is useful
to keep auto-login, a feature lacked from tintin for long. In this case,
the port field will be the 1st message shown when the dummy session was
created.

See also: #snoop

~SHOWME

format:        #showme {string}

Display the string to the terminal, do not send to the mud.  Useful for
status, warnings, etc.

example:
#action {%0 ultraslays you} {#showme {###### argh! we were ultraslayed ######}}

#chr _ESC 27
#al showg #showme {${_ESC}[32m%%0${_ESC}[2;37;0m}
showg WHAT COLOR IS IT?             <== show message in green

~SLEEP

format: #sleep {seconds};other_commands

Description: replace the hack of using #system sleep seconds
to generate pauses. The advantages over #system sleep are:
  1) seconds are nolonger limited by interger
  2) the tintin will not hang for SECONDS
  3) #purge command make it more flexible to use.
NOTE: #10 {#10 practice;#sleep 3} won't work.
      if one wants to do so, can: #alias aa {#10 practice;#sleep 3;aa},
      ofcoz in real case shall add variable control for jump out of the loop.
See also: #pause, #purge, #slow

~SLOW

format: #slow {interger}
#slow 0: disable SLOW mode

#slow 1: means when the server give 1 response (net packet),
the client will send one more commands. (Compare to zmud,
zMud need users' action to determine if the client will continute
to send more commands, but in yTin, this is done automatically,
although the server response might not be what was generated
by user's last command, in most case it is much easier to
use and sufficient).

#slow 5:
will send 5 command from queue when sever gives 1 response.
The benefit is: when net is lag, it sends
commands much faster than #slow 1, which is very like zmud's
behavior.

See also: #purge, #pause, #sleep

~SNOOP

format:        #snoop {session name}

If there are multiple sessions active, this command allows you to see what
is going on the the sessions that are not currently active.  The lines
of text from other sessions will be prefixed by 'session name%'.

See also: #session

~SPEEDWALK

format:        #speedwalk [option]

Toggle speedwalking on and off.  Speedwalking allows you to type multiple
directions not seperated by semicolons, and now it lets you prefix a
direction with a number, to signify how many times to go that direction.

When #toggle speedwalk 2, speedwalk will be in smart option, i.e.,
single nw, ne, sw, se, su, sd, ... will not be interpereted as n;w,
n;e, s;w, s;e  ...

example:
without speedwalk:
s;s;w;w;w;w;w;s;s;s;w;w;w;n;n;w
with speedwalk:
2s5w3s3w2nw

NEW: replaced by #toggle speedwalk, example: #toggle speedwalk 0

~SPLIT

format:        #split {line #}
               #split line #

Unix: with a vt100 or ANSI emulator, this will allow you to set up
a split screen.  The keyboard input will be displayed in the bottom window,
while mud text is displayed in the upper window.  This requires a fairly
decent emulator, but works on most I have tested.  The screen will be split
at the line indicated by line #, and should be around 3 lines above the
bottom of the screen.  When the enter key is pressed, the text will
be sent to the mud, and also be echoed to the upper window.

If the line # is negative, the screen will be split that many lines above
the bottom of the console.  This allows you to specify the height of the
bottom window, while a positive line # lets you specify the height of the
top window.

If a line # isn't specified, the screen is split three lines above the
bottom.

examples:
#split 35
split the screen at line 35.
#split -3
split the screen three lines above the bottom.

Note: split mode may mess up the scrollback buffer in some older terminal
emulators.  It has been tested and is compatible with XTerm, RXVT and Apple
Terminal.  It should be compatible with most modern emulators.

~STRIPANSI

format:       #stripansi {var1} {string2}

Similar to #variable command, assign string2 to variable var1. In addition,
#stripansi strips the ansi-code (colors et al) before assignment.

See also: #variable, #toggle stripcolor

~STRNCMP

format:       #strncmp {string1} {string2} {interger N}

Similar to C function strncmp(char* str1, char* str2, int n).
Return value is 0 if string1 and string2 are same for the Nth beginning
characters, nonzero if not same.

See also: #strrchr, #strstr, #substr, #ord, #chr

~STRRCHR

format:       #strrchr {string1} {string2}

Similar to C function strrchr(char* str, char ch).
Reverse search of the 1st occurrence of char string2 (actually it is
the 1st char of string2) in string1, then assign the 0 based
index of string1 to the default variable $_.
assign -1 to $_ if search does not match.
(well, here we used some Perl convention.)

See also: #strrchr, #strstr, #substr, #ord, #chr

~STRSTR

format:       #strstr {string1} {string2}

Similar to C function strstr(char* str1, char* str2).
Find the 1st occurence of str2 from str1, then return 0 based
index of str1. Return value is assigned to $_.
If there is no match, -1 is assigned to $_.

See also: #strrchr, #strncmp, #substr, #ord, #chr

~SUBSTR

format:       #substr {string} {index1} {length}

Similar to Perl function substr().
Currently is not as smart as Perl yet. Need specify explicitly
0 based index1 and length.
When length is <0, will count from the tail.
Return value is assigned to $_.

example:
#substr {01234567} {3} {4}
will assign {3456} to $_.
#substr {0123456789} {3} {-5}
will assign {34} to $_ since the last 5 {56789} is truncated.

Note: we do not need "strcat" command in yTin, #var {str1} {$str1$str2} will do it.

See also: #strrchr, #strstr, #strncmp, #ord, #chr

~SUBSTITUTE

format:        #substitute [{text}] [{new text}]

The [] signify optional arguments.

Allows you to replace original text from the mud with different text, or
delete it altogether.  This is helpful for if you have a slow modem, or
there is a lot of text sent during battles, and the like.  the %0-9
variables can be used to capture text and use it as part of the new output,
and the ^ char is valid to only check the beginning of the line for the
text specified.

If a . is the only character in the new text argument, if the line is
matched, it will be deleted.

If only one argument is given, all subs that match the string are displayed.
The * char is valid in this instance.  See help wildcard.

If no argument is given, all subs are displayed.

examples:
#sub {leaves} {.}
gag any line that has the word 'leaves' in it.
#sub {^Zoe%0} {ZOE%0}
any line that starts with the name Zoe will be replaced by a line that
starts with 'ZOE'
#sub {%0massacres%1} {%0MASSACRES%1}
replace all occurrences of 'massacres' with 'MASSACRES'

See also: #gag, #action, #presub

~SYSTEM

format:        #system {command} [{option}]

Executes the command specified as a shell command.  The name of the system
command can be changed in tintin.h for your security.

#system {command} {option}
options: (default is 0)

option 1: add "> tintin.out", then show the contents of tintin.out in yTin screen (can be
actioned).
option 0: do not apprend " > tintin.out" to cmdline, default TinTin++ style. Under unix,
          this will show stdout, but will not be able to set action on the stdout.

Notice: if use some commands like vi, please DONOT use option {1}.

NEW from yTin1.82 (windows):
#system perl {script.pl}
This will try to call perl56.dll and will not show annoying DOS prompt.
Limit: NO stdin/stdout/stderr yet, but one can always let the perl script write to
a file, then use #sysecho to show on the screen, or #read/#textin to execute the
command.

See also: #sysecho, #syscat, #system2

~SYSTEM2

format:        #system2 {command}

Executes the command as a new process. The current ytin won't wait till the new
process terminates. For Windows only.

Example:
#system c:/progra~1/ytin/ytin.exe
#system {"c:\\program files\\ytin\\ytin.exe"}
#system {c:/progra~1/ytin/ytin.exe "c:\\my documents\\tintinrc.txt"}

See also: #system

~SYSCAT

format:        #syscat  {filename}

This is a handy port for #system cat filename.
It was not nice to use #system cat/type under Windows version; for portability
of your scripts and speed, it is recommended that you use #syscat instead
of #sys cat. (Plus: messages from #syscat will be actioned.)

See also: #sysecho, #system

~SYSECHO
format:        #sysecho {string} {>}  {filename}
               #sysecho {string} {>>} {filename}
This is a handy port for #system echo string > filename.
It was not nice to use #system echo under Windows version; for portability
of your scripts and speed, it is recommended that you use #sysecho instead
of #sys echo.

#sysecho has another feature: if the filename contains directory info, it will
try to create the last layer of directory for you.

See also: #fclose/#fopen, #feof, #fseek, #fgets, #log


点击这里给我发消息
相关帖子
yTin++相关资料. (ivy,6955,2005-07-26 10:36:39)
    help available on th... (ivy,281,2005-07-26 10:38:37)
    ~ACTIONformat:... (ivy,1897,2005-07-26 10:43:52)
    ~LOGformat:... (ivy,296,2005-07-26 10:45:01)
    ~TABADDformat:... (ivy,390,2005-07-26 10:47:33)