注册 登录 查询

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


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

离线

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

~ACTION

format:     #action [{string}] [{command(s)}] [{priority}]

The [] signify optional arguments.

Have the client search for a certain string of text from the mud, if the
client receives that string, it will execute the command(s).  Variables
%0-9 are substituted from the input string, and can be used in the command(s)
side of the command. Previously, all actions were stored alphabetically in the
list, which meant that some of the important actions could exist at the end
of the list (which could result in slow reaction times for those actions).
Priorities have been added to actions now.  The third parameter of the command
will tell how important tintin should reguard this action (0 most important,
9 least important).  If no priority is given, a default value of 5 is assigned.

if the string to be searched for starts with a ^, only the beginning of the
line will be searched.

If #action is typed with no arguments, all actions defined are listed.

If #action is typed with only one argument, actions defined that match that
argument are displayed.  The * character is valid in this case to use
as a 'wildcard'.  See help wildcard.

examples:
#action {Grimmy has arrived} {smile grimmy} {2}
If Grimmy enters the room, you will automatically smile at her.  The priority
setting of two, means that it should be stored close to the top of the list.
(all actions with 1 and 0 set for priorities will be checked before this one).

#action {^TICKCOUNTER: 5 seconds} {sleep} {0}
Since this string is 'anchored', it will only be triggered if it starts at
the beginning of a line.  If your mud has a tickcounter set up like this,
this action will make you sleep at 5 seconds to tick.

#action
list all actions

#action *tell*
list all actions with the word 'tell' in them.

One of the important usage of action's priority is:
Suppose u have:
  #action {dangerous_message} {quit}
Then u see this message:
  XXX tell you: dangerous_message
To avoid the confusion, u can add another higher priority action:
  #action {tell you: } {#nop} {4}

See also: #unaction, #ignore, #substitute, #presub, #toggle stripcolor, #message action

~ALIAS

format:     #alias [{word}] [{command(s)}]
            #alias [word] [command]

the [] signify optional arguments.

Define a word that actually means a longer string.  Useful for commands
repeated often, or commands that are very lengthy.  You can have multiple
commands aliased to a single word, if you enclose the alias in {}.

If the command(s) include variables %0-9, these are substituted as part
of the parsing.  %0 is set to all text after the word was input, %1 is set
to the first word following the aliased word, and %2 is the second, and so on.

If the #alias command is typed without any arguments, all aliases defined will
be listed.

If the #alias command is typed with only 1 argument, occurrences matching the
input string are shown.  The * character is valid in this word to act as a
'wildcard'.  See help wildcard.

examples:
#alias gb get bread bag
typing gb at the prompt would be sent as 'get bread bag'.
#alias ws {wake;stand}
since ws aliases a multiple command, you must use the braces.
#alias heal cast 'heal' %1
typing 'heal valgar' at the prompt would be sent as 'cast 'heal' valgar' since
it will put the word valgar into %1
#alias
list all aliases
#alias he*
list all aliases that start with the letters 'he'

See also: #unalias, #al2variable, #var2alias, #message alias

~AL2VARIABLE

format:     #al2var {variable_to_assigne} {alias_to_convert}

example:    #alias test_alias {tell chitchat hi;tell chitchat question}
            #al2var test_var test_alias
Then the variable test_var is now: {tell chitchat hi;tell chitchat question}
Useful for process the alias, then after process, convert variable to alias.

See also: #var2alias, #variable, #alias

~ALL

format:      #all {string}
             #all string

Send a command to all active sessions.

example:
#all {shout I'm multicharing!}

See also: #session

~ANTISUBSTITUTE

format:      #antisubstitute {string}
             #antisubstitute string

Will cause any line that contains the string specified to not be checked for
substitutes and gags.  The ^ char starting a string will tell the client to
only antisubstitute lines that START with the string specified.

examples:
#antisub {^You}
any line starting with 'You' will not be checked for subs.
#antisub {^You%0hit.}
lines that start with 'You', and also contain 'hit.' will not be subbed.
#antisub {annihilate}
any line that contains the word 'annihilate' will not be subbed.

See also: #substitute

~BELL

format:       #bell [level=5]
                                         #bell threshold [threshold]

sends a beep to your terminal when level>=threshold.
default level and threshold are all 5.

              #bell option [option] [frequency] [duration]
This option is for windows only: 0: soundcard, 1: speaker.
For speaker, user can specify the frequency (all) and duration (not for 95/98/Me) of the beep.

example:
#action {tells you} {#bell}
#action {you are in danger!!!} {#bell 9}
In normal case, both action will chime you.

Now you only want the 2nd case to send u a beep:
#bell threshold 6
Since #bell == #bell 5 is below the threshold 6, only
the second action will send a real beep.

~BOSS

format:       #boss [passwd]

Unix: puts some fake text on your screen so nobody knows you're mudding.
Windows: will hide all the yTin windows and the windows that you specified
  in View/Options menu. If add passwd, u need the same passwd to re-open
  all the hidden windows later.
  Default hehavior is send #boss command when ESC is hit.
  If one wants to add a hot key to send #boss some-command, use macro.

See also: #macro

~CHAR

format:       #char character

lets you redefine your tintin_character, the character that starts all commands.

example:
#char /
all commands must then start with a /, instead of a #.

If you load a script file, the first character of the file is set to your tintin char.

See also: #verbatim

~CHR

format:       #chr {string} {number}

Note: this command is from Perl.

example:
#chr {ctrlG} {7}
This will assign ascii char 7 to variable ctrlG, when u send out
$ctrlG, u actually send out a beep (^G).

another example:
#chr {_ESC} {39}
#var {_RED} {${_ESC}[31m}

This will assign 27 (Escape key, or ^[) to variable _ESC,
and assing ^[[33m, which is ansi color of RED, to variable _RED.

See also: #ord

~CR

format:              #cr [option]

Without option, it sends a carriage return to the session.
Useful for aliases that needs carriage returns.

With the option as 0-3, it sets the terminating string of each line
sent to MUD. Default of yTin is now 0("\n"). (Save 1 byte of net traffic?)
Available options are: 0("\n") 1("\r") 2("\r\n") 3("\n\r") .

Another usage is: #cr ?
This shows what is current settings now.

NOTE: If you want to edit some file in some versions of MudOS (suppose you are a wizard),
make sure to use #cr 2 change to TinTin++'s default.

See also: #raw

~CTOI

(For Chinese GB code only)
format:              #ctoi {x} {y}

converts chinese GB code y to digits.
Later version will also converts chinese direction
east/west et al to e,w,s,n,... (not implemented yet)
Can be disabled in compile option. (get rid of "-DCHINESE" flag)
#example: #ctoi {x} {三千四百五十一}
x will be 3451

See also: #variable, #math

~DECRYPT
format:       #decrypt <string>

Decrypt the password encrypted with the command #encrypt, it is just
a simple protection.

Example:
          #encrypt security
Ytin will show you the string: LY,[CC7ZLIH
Now you can relatively safely store your password in your tintinrc file:
          #var passwd {LY,[CC7ZLIH}
When the MUD ask you for password, u can type (mostly using #action):
          #decrypt $passwd
yTin made some effort to forbid any future use of #decrypt in the same
session later. (note: the effort here is just to forbid others to
know your exact password and/or change your password, if you write your
password into tintinrc file, others can still login using your script
if they got the file.)

See also: #encrypt

~DELIMITER

format:       #delimiter [<string>]

specify the delimiter string for splitting the items, default is " " (space)

See also: #getlistlength, #getitemnr, #forall

~ECHO

format:       #echo

Obsoleted by #toggle echo.

Echo is used to see what actions are being triggered.  #echo toggles this
feature on and off.

See also: #toggle echo, #action

~ENCRYPT

format:       #encrypt <password>

yTin will show you the encrypted password.

See also: #decrypt

~END

format:       #end

Unix: terminate tintin++ and return to unix.  On most systems, ctrl-C has the same
effect.
Windows: Try to avoid this command unless have to, buggy in some occasion.

See also: #zap

~FCLOSE

format:       #fclose {FILE}

FILE is $_ from #fopen.
the variable _ is assigned to 0 if successful, non-zero if failed.

See help on C function: int fclose(FILE* stream);
See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~FEOF

format:       #feof {FILE}

FILE is $_ from #fopen.
The variable _ is assigned to 1 if end of file or invalid FILE, otherwise 0.

See help on C function: int feof(FILE* stream);
See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~FGETS

format:       #fgets {buffer} {int limit} {FILE}

FILE is $_ from #fopen.
The variable _ is set to 0 if fail, non-zero if successful.
If n>=2048, n will be reduced to 2048.

See help on C function: char *fgets( char *string, int n, FILE *stream );
See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~FORALL

format:       #forall {list} {command}

Note:         this command is modified since v1.82b3, to be able to change
              delimiter, as a result, default delimiter changed from "," to " ".
Example:      if delimiter is still default " ",
              #forall {monster devil {mighty knight} target} {kill %0}
  will be same as: kill monster;kill devil;kill mighty knight;kill target
              #delim {,}
                                         #forall {a,b,c c,d} {#show %0}
  will show "a", "b", "c c" and "d".

See also: #delim, #geti, #getl

~FPUTS

format:         #fputs {string} {FILE}

FILE is $_ from #fopen.
The variable _ is set to a non - negative number on success, or -1 on error.
string length is limited to 2048.

See help on C function: int fputs(const char *s, FILE *stream);
See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho

~FOPEN

format:       #fopen {filename} {mode}
The variable _ is assigned to a FILE pointer that was opened if successful, 0 if failed.

Example:      #fopen {test.dat} {a+}
              #var {FilePointer} {$_}
              ... ...
              #fclose {$FilePointer}

For detailed help on the fopen, see the C help file on:
           FILE *fopen( const char *filename, const char *mode );

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

~FREAD

format:         #fread {buffer} {1} {length) {FILE}

FILE is $_ from #fopen.
The variable _ is set to the number of items successfully read.

If an error occurs, or the end-of-file is reached, the return
value is a short item count (or zero).
fread does not distinguish between end-of-file and  error

length is limited to 2048.

See help on C function: size_t  fread(  void *ptr, size_t size, size_t nmemb, FILE *stream);

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

~FSEEK

format:       #fseek {FILE} {offset} {start_position}

FILE is $_ from #fopen.
start_position must be one of SEEK_CUR, SEEK_END, SEEK_SET.
The variable _ is set to 0 if successful, non-zero on fail.

See help on C function: int fseek( FILE *stream, long offset, int origin );
See also: #fopen/#fclose, #feof, #fseek, #fgets, #fputs, #fread, #fwrite, #remove, #rename, #sysecho


~FUNCTION

A new list type which I decided to call functions. These are a mixture of aliases and
variables. The following examples will have to do to explain how to use functions:

Example:
#function {rnd} {#math temp ($_random//(%2-%1+1))+%1;#result {$temp};#unvar temp}
#showme A random number between 0 and 100: @rnd{0 100}

Functions are treated much like variables. Their value is
a command-line which is executed, and the functions are substituted
by the parameter last sent to the #result command

Example:
#function {lastfuncresult} {#nop}
#showme Last use of a function gave @lastfuncresult as result.

See also: #result, #unfunction

~FWRITE

format:         #fwrite {string} {1} {length) {FILE}

FILE is $_ from #fopen.
The variable _ is set to the number of items successfully written.

If an error occurs, or the end-of-file is reached, the return
value is a short item count (or zero).

length is limited to 2048; you cannot write bytes that contains '\0' either.

See help on C function: size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);


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

~GAG

format:        #gag {string}

A shortcut for #substitute {string} {},
Instruct yTin not to show any line that contains the string.

NOTE: #toggle presub 0 or 1 will decide if substituted/gagged message will trigger actions.

See also: #substitute, #presub, #action

~GBfilter

format:        #GBfilter [? | 0 | {string}]

Only for GB chinese code. Filters the "string" between chinese characters.
Common use is: #GBfilter { }

NOTE: Might be obsolete after a universal "filter" command is implemented.

See also: #ctoi

~HELP

format:       #help [command]

get a listing of commands, or get help and a specific command.

~HIGHLIGHT

format:       #highlight [{type}] [{string}]
              #highlight [type] [{string}]

The [] signify optional arguments.

The higlight command is used to allow you to highlight strings of text from
the mud.  The possible types are bold, reverse, faint, italic, blink, or
a number between 1 and 8.  The numbers correspond to colors 1 through 8
of your color pallette.

New to v1.5, you can now use the color names as well as the old convention of
#'s for colors.  Valid color names include:

red, blue, cyan, green, yellow, magenta, white, grey, black, brown, charcoal,
light red, light blue, light cyan, light magenta, light green, b red, b blue,
b cyan, b green, b yellow, b magenta, b white, b grey, b black, b brown,
b charcoal, b light red, b light blue, b light cyan, b light magenta,
b light green, bold, faint, blink, italic, reverse

The %0-9 variables can be used as 'wildcards' that will match with any text.
They are useful for highlighting a complete line.
You may start the string to highlight with a ^ to only highlight text
if it begins the line.

Note: This command is only compatible with ANSI/VT100 terminals or emulators.

examples:
#high {reverse} {Valgar}
print every occurrence of 'Valgar' in reverse video
#high {6} {%0tells you%1}
print every complete line that contains 'tells you' in color 6
#high bold {^You}
boldface any 'You' that starts a line
#high {red, blink} {Grimne}
each time the word Grimne appeared, it's be shown in a blinking red color.

~HISTORY

format:        #history

The history command will display a listing of the most recent keyboard
input.

Example, when you type #his, yTin will show:
 0 #help verb
 1 #cr ?
 2 test
 3 help
 4 say yes?
 5 reply no
 6 #his
Then !3 will send "help" to mud, !1 will send "#cr".
You can also type "!sa", this will search back and send "say yes?".

~IF

format:        #if {conditional} {command(s)}
               #if {conditional} {command(s)} else {else-command}

The if command is one of the most powerful commands added since TINTINv3.
It works similar to an if statement in other languages, and is loosely based
on the way C handles its conditional statements.  When an if command
is encountered, the conditional statement is evaluated, and if TRUE
(any non-zero result) the command(s) are executed; if FALSE (0), the else-command
will be executed if there is "else {else-command}" followed.  The if statement is
only evaluated if it is read, so you must nest the if statement inside
another statement (most likely an action command).  The conditional is
evaluated exactly the same as in the math command, only instead of storing
the result, the result is used to determine whether to execute the
command(s).  '#help math' for more information.

New: #if now also compares string, so the #ifstrequal command is obsolte.
The string comparison is marked in [ ] pair.

examples:
#action {%0 gives you %1 gold coins} {#if {%%1>5000} {thank %%0}}
if someone gives you more than 5000 coins, thank them.

the %%1 and %%0 belong to the action, and not to the if, and that is why
the double % are needed.
RULE: each { } pair will need one more % to match.

#action {^<hp:%0 } {#if {%%0<100} {flee}}
If your status prompt is of the form <hp:100 ma:50 mo:100>, this action
will get your hit points, compare them to 100, if less than 100, flee

#alias {walk} {#if {[%%0=1]}{#4 s;#2 e;enter};#if {[%%0=2]}{out;#2 w;#4 n};#if {[%%0=] || [%%0=help]}{#show 1: From camp to city, 2: From city to camp}}

See also: #math, #ifexist, #ifmatch

~IFEXIST

format:        #ifexist {var_name} {command-1}
               #ifexist {var_name} {command-1} else {command2}

This checks if the variable named "var_name" exists.

Example:       #ifexist {food} {eat $food} else {eat bread}
               #ife {leader} {say My leader is $leader!} else {say I have no leader!}

See also: #if, #ifmatch, #variable, #unvariable

~IFMATCH

Command: ifmatch - checks a string for a mask containing text and *'s

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!}

See also: #if, #ifexist

~IGNORE

format:        #ignore

Toggle actions on and off. If off, no actions will be checked for.
Same as #toggle ignore, this command won't be obsolte.

NEW: ignore now sets absolute value:
     #ignore 1        set actions off
     #ignore 0        turn actions on

See also: #action

~INFO

format:          #info

Displays the number of actions, aliases, variables, substitues,
antisubstitutes, and highlights for the current session.  If no session
is active, then the statistics on the defaults are given.

~KILLALL

format:                #killall

Killall deletes all aliases, actions, subs, antisubs, highlights, variables
in one fell swoop.  Useful now, so you don't have to exit yTin to
load up a new coms file.


点击这里给我发消息
相关帖子
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,295,2005-07-26 10:45:01)
    ~TABADDformat:... (ivy,390,2005-07-26 10:47:33)