public class 0600_Other_Commands extends Object
======================== |0600.- Other commands.| ========================
| 构造器和说明 |
|---|
0600_Other_Commands() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
atcommand()
atcommand "<command>";
This command will run the given command line exactly as if it was typed in from
the keyboard by the player connected to the invoking character, and that
character belonged to an account which had GM level 99.
// This will ask the invoker for a character name and then use the '@nuke'
// GM command on them, killing them mercilessly.
|
void |
atoi()
atoi("<string>")
axtoi("<string>")
strtol("<string>", base)
These commands are used to convert strings to numbers.
|
void |
bindatcmd()
bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
This command will bind a NPC event label to an atcommand.
|
void |
camerainfo()
camerainfo <range>,<rotation>,<latitude>{,<char id>};
This command will update the client's camera information with the given values where
the client can be the attached character or the player given by the char id parameter.
|
void |
charat()
charat(<string>,<index>)
Returns char at specified index.
|
void |
charcommand()
charcommand "<command>";
This command will run the given command line exactly as if it was typed in from
the keyboard from a character that belonged to an account which had GM level 99.
|
void |
charisalpha()
charisalpha("<string>",<position>)
This function will return 1 if the character number Position in the given string
is a letter, 0 if it isn't a letter but a digit or a space.
|
void |
charisupper()
charisupper(<string>,<index>)
charislower(<string>,<index>)
Returns 1 if character at specified index of specified string is
uppercase/lowercase.
|
void |
checkcell()
checkcell ("<map name>",<x>,<y>,<type>);
This command will return 1 or 0, depending on whether the specified cell has
the 'type' flag set or not.
|
void |
checkwall()
checkwall "<name>";
This command will return true if the wall with the given name exists, false otherwise.
|
void |
compare()
compare("<string>","<substring>")
This command returns 1 or 0 when the substring is in the main string (1) or not (0).
|
void |
countstr()
countstr(<input>, <search>{, <usecase>})
Counts all instances of a search string in the input.
|
void |
cutin()
cutin "<filename>",<position>;
This command will display a picture, usually an NPC illustration, also called
cutin, for the currently attached client.
|
void |
day()
day;
night;
These two commands will switch the entire server between day and night mode
respectively.
|
void |
debugmes()
debugmes "<message>";
This command will send the message to the server console (map-server window).
|
void |
defpattern()
defpattern <set number>,"<regular expression pattern>","<event label>";
activatepset <set number>;
deactivatepset <set number>;
deletepset <set number>;
This set of commands is only available if the server is compiled with regular
expressions library enabled.
|
void |
delchar()
delchar(<string>,<index>)
Returns the original string with the char at the specified index removed.
|
void |
distance()
distance(<x0>,<y0>,<x1>,<y1>)
Returns distance between 2 points.
|
void |
emotion()
emotion <emotion number>{,<target>};
This command makes an object display an emotion sprite above their own as
if they were doing that emotion.
|
void |
escape_sql()
escape_sql(<value>)
Converts the value to a string and escapes special characters so that it is safe to
use in query_sql().
|
void |
explode()
explode(<dest_array>,<string>,<delimiter>)
Breaks a string up into substrings based on the specified delimiter.
|
void |
getfreecell()
getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
Finds a free cell on the given map and stores the reference to the found cell
in <rX> and <rY>.
|
void |
getstrlen()
getstrlen("<string>")
This function will return the length of the string given as an argument.
|
void |
globalmes()
globalmes "<message>"{,"<NPC name>"};
This command will send a message to the chat window of all currently connected
characters.
|
void |
implode()
implode(<string_array>{,<glue>})
Combines all substrings within the specified string array into a single string.
|
void |
insertchar()
insertchar(<string>,<char>,<index>)
Returns the original string with the specified char inserted at the specified
index.
|
void |
logmes()
logmes "<message>";
This command will write the message given to the map server NPC log file, as
specified in 'conf/log_athena.conf'.
|
void |
md5()
md5("<string>")
Returns the md5 checksum of a number or string.
|
void |
min()
min(<number or array>{,<number or array>,...})
|
void |
misceffect()
misceffect <effect number>;
This command, if run from an NPC object that has a sprite, will call up a
specified effect number, centered on the NPC sprite.
|
void |
npcskill()
npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
This command causes the attached NPC object to cast a skill on the attached
player.
|
void |
open_roulette()
open_roulette( {char_id} )
Opens the roulette window for the currently attached character or the character
with the given character id.
|
void |
playBGM()
playBGM "<BGM filename>";
playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
These two commands will play a Background Music to either the invoking character
only ('playBGM') or multiple characters ('playBGMall').
|
void |
pow()
pow(<number>,<power>)
Returns the result of the calculation.
|
void |
preg_match()
preg_match(<regular expression pattern>,<string>{,<offset>})
Searches a string for a match to the regular expression provided.
|
void |
pvpon()
pvpon "<map name>";
pvpoff "<map name>";
These commands will turn PVP mode for the specified maps on and off.
|
void |
query_sql()
query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
Executes an SQL query.
|
void |
rand()
rand(<number>{,<number>});
This function returns a number ...
|
void |
readbook()
readbook <book id>,<page>;
This command will open a book item at the specified page.
|
void |
replacestr()
replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
Replaces all instances of a search string in the input with the specified
replacement string.
|
void |
round()
round(<number>,<precision>);
ceil(<number>,<precision>);
floor(<number>,<precision>);
Returns <number> rounded to multiple of <precision>.
|
void |
setcell()
setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
Each map cell has several 'flags' that specify the properties of that cell.
|
void |
setchar()
setchar(<string>,<char>,<index>)
Returns the original string with the char at the specified index set to the
specified char.
|
void |
setfont()
setfont <font>;
This command sets the current RO client interface font to one of the
fonts stored in data\*.eot by using an ID of the font.
|
void |
setiteminfo()
setiteminfo(<item id>,<type>,<value>)
This function will set some value of an item.
|
void |
setitemscript()
setitemscript(<item id>,<"{ new item script }">{,<type>});
Set a new script bonus to the Item.
|
void |
setwall()
setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
delwall "<name>";
Creates an invisible wall, an array of "setcell" starting from x,y and doing a
line of the given size in the given direction.
|
void |
showdigit()
showdigit <value>{,<type>};
Displays given numeric 'value' in large digital clock font on top of
the screen.
|
void |
soundeffect()
soundeffect "<effect filename>",<type>;
soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
These two commands will play a sound effect to either the invoking character
only ('soundeffect') or multiple characters ('soundeffectall').
|
void |
sprintf()
sprintf(<format>[,param[,param[,...]]])
|
void |
sqrt()
sqrt(<number>)
Returns the square-root of a number.
|
void |
sscanf()
sscanf(<string>,<format>[,param[,param[,...]]])
|
void |
strcmp()
strcmp("<string>","<string>")
This command compares two strings are returns a value:
1: string 1 > string 2
0: strings are equal
-1: string 1 < string 2
|
void |
strpos()
strpos(<haystack>,<needle>{,<offset>})
PHP style strpos.
|
void |
strtoupper()
strtoupper(<string>)
strtolower(<string>)
Returns the specified string in its uppercase/lowercase form.
|
void |
substr()
substr(<string>,<start_index>,<end_index>)
Returns the sub-string of the specified string inclusively between the set
indexes.
|
void |
unbindatcmd()
unbindatcmd "<command>";
This command will unbind a NPC event label from an atcommand.
|
void |
useatcmd()
useatcmd "<command>";
This command will execute a script-bound atcommand for the attached RID.
|
void |
viewpoint()
viewpoint <action>,<x>,<y>,<point number>,<color>;
This command will mark places on the mini map in the client connected to the
invoking character.
|
debugmes "<message>";
This command will send the message to the server console (map-server window). It
will not be displayed anywhere else.
// Displays "NAME has clicked me!" in the map-server window.
debugmes strcharinfo(0) + " has clicked me!";
logmes "<message>";
This command will write the message given to the map server NPC log file, as
specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
enabled, the message will go to the 'npclog' table, otherwise, it will go to the
same log file.
If logs are not enabled, nothing will happen.
globalmes "<message>"{,"<NPC name>"};
This command will send a message to the chat window of all currently connected
characters.
If NPC name is specified, the message will be sent as if the sender would be
the NPC with the said name.
The display name of the NPC won't get appended in front of the message.
rand(<number>{,<number>});
This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you specify -1.
(if you specify two) ... randomly positioned between the two numbers you specify.
rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(2,5) would result in 2,3,4 or 5
viewpoint <action>,<x>,<y>,<point number>,<color>;
This command will mark places on the mini map in the client connected to the
invoking character. It uses the normal X and Y coordinates from the main map.
The colors of the marks are defined using a hexadecimal number, same as the ones
used to color text in 'mes' output, but are written as hexadecimal numbers in C.
(They look like 0x<six numbers>.)
Action is what you want to do with a point, 1 will set it, while 2 will clear
it. 0 will also set it, but automatically removes the point after 15 seconds.
Point number is the number of the point - you can have several. If more than
one point is drawn at the same coordinates, they will cycle, which can be used
to create flashing marks.
// This command will show a mark at coordinates X 30 Y 40, is mark number 1,
// and will be red.
viewpoint 1,30,40,1,0xFF0000;
This will create three points:
viewpoint 1,30,40,1,0xFF0000;
viewpoint 1,35,45,2,0xFF0000;
viewpoint 1,40,50,3,0xFF0000;
And this is how you remove them:
viewpoint 2,30,40,1,0xFF0000;
viewpoint 2,35,45,2,0xFF0000;
viewpoint 2,40,50,3,0xFF0000;
The client determines what it does with the points entirely, the server keeps no
memory of where the points are set whatsoever.
cutin "<filename>",<position>;
This command will display a picture, usually an NPC illustration, also called
cutin, for the currently attached client. The position parameter determines the
placement of the illustration and takes following values:
0 bottom left corner
1 bottom middle
2 bottom right corner
3 middle of screen in a movable window with an empty title bar
4 middle of screen without the window header, but still movable
255 clear all displayed cutins
The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
and data folder, and is required to be a bitmap. The file extension .bmp can be
omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
placed on the size of the illustrations by the client, although loading of large
pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
Typically the size is about 320x480. New illustrations can be added by just
putting the new file into the location above.
The client is able to display only one cutin at the same time and each new one
will cause the old one to disappear. To delete the currently displayed
illustration without displaying a new one, an empty file name and position 255
must be used.
// Displays the Comodo Kafra illustration in lower right corner.
cutin "kafra_07",2;
// Typical way to end a script, which displayed an illustration during a
// dialog with a player.
mes "See you.";
close2;
cutin "",255;
end;
emotion <emotion number>{,<target>};
This command makes an object display an emotion sprite above their own as
if they were doing that emotion. For a full list of emotion numbers,
see 'src/map/script_constants.hpp' under 'ET_'. The not so obvious ones are 'ET_QUESTION'
(a question mark) and 'ET_SURPRISE' (the exclamation mark).
The optional target parameter specifies who will get the emotion on top of
their head. Use the target Game ID (GID).
misceffect <effect number>;
This command, if run from an NPC object that has a sprite, will call up a
specified effect number, centered on the NPC sprite. If the running code does
not have an object ID (a 'floating' NPC) or is not running from an NPC object at
all (an item script) the effect will be centered on the character who's RID got
attached to the script, if any. For usable item scripts, this command will
create an effect centered on the player using the item.
A full list of known effects is found in 'doc/effect_list.txt'. The list of
those that actually work may differ greatly between client versions.
soundeffect "<effect filename>",<type>;
soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
These two commands will play a sound effect to either the invoking character
only ('soundeffect') or multiple characters ('soundeffectall'). If the running
code does not have an object ID (a 'floating' NPC) or is not running from an NPC
object at all (an item script) the sound will be centered on the character who's
RID got attached to the script, if any. If it does, it will be centered on that
object. (an NPC sprite)
Effect filename is the filename in a GRF. It must have the .wav extension.
It's not quite certain what the 'type' actually does, it is sent to the client
directly. It probably determines which directory to play the effect from.
It's certain that giving 0 for the number will play sound files from '\data\wav\',
but where the other numbers will read from is unclear.
The sound files themselves must be in the PCM format, and file names should also
have a maximum length of 23 characters including the .wav extension:
soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
soundeffect "12345678901234567890.wav", 0; // throw gravity error
You can add your own effects this way, naturally.
playBGM "<BGM filename>";
playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
These two commands will play a Background Music to either the invoking character
only ('playBGM') or multiple characters ('playBGMall').
BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
It's not required to specify the extension inside the script.
If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
is omitted as well the BGM will be played for the entire server.
You can add your own BGMs this way, naturally.
pvpon "<map name>";
pvpoff "<map name>";
These commands will turn PVP mode for the specified maps on and off. Beside
setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
timer and ranking as will @pvpon GM command do.
atcommand "<command>";
This command will run the given command line exactly as if it was typed in from
the keyboard by the player connected to the invoking character, and that
character belonged to an account which had GM level 99.
// This will ask the invoker for a character name and then use the '@nuke'
// GM command on them, killing them mercilessly.
input .@player$;
atcommand "@nuke " + .@player$;
Note that for atcommands bound using 'bindatcmd', this command will execute the
original atcommand, not the script-bound atcommand.
charcommand "<command>";
This command will run the given command line exactly as if it was typed in from
the keyboard from a character that belonged to an account which had GM level 99.
The commands can also run without an attached rid.
// This would do the same as above, but now
// it doesn't need a player attached by default.
charcommand "#option 0 0 0 Roy";
bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
This command will bind a NPC event label to an atcommand. Upon execution of the
atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
one binding. If you rebind, it will override the original binding.
Note: The default level for atcommand is 0 while the default level for charcommand is 100.
The following variables are set upon execution:
.@atcmd_command$ = The name of the @command used.
.@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
.@atcmd_numparameters = The number of parameters defined.
Example:
When a user types the command "@test", an angel effect will be shown.
- script atcmd_example -1,{
OnInit:
bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
end;
OnAtcommand:
specialeffect2 EF_ANGEL2;
end;
}
unbindatcmd "<command>";
This command will unbind a NPC event label from an atcommand.
useatcmd "<command>";
This command will execute a script-bound atcommand for the attached RID. If the
supplied command is not bound to any script, this command will act like 'atcommand'
and attempt to execute a source-defined command.
The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
in this way.
camerainfo <range>,<rotation>,<latitude>{,<char id>};
This command will update the client's camera information with the given values where
the client can be the attached character or the player given by the char id parameter.
Note: This requires 2016-05-25aRagexeRE or newer.
The values given will be divided by 100 and transmitted as floating-point number.
range The zoomfactor of the camera.
Default: 230000 (230.0) when fully zoomed in
Maximum: 400000 (400.0) when fully zoomed out
rotation The rotation of the camera.
Default: 0 (0.0) when no rotation is applied
Maximum: 360000 (360.0°) when fully rotated
latitude The angle of the camera.
Default: -50000 (-50.0)
Maximum: -75000 (-75.0)
npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
This command causes the attached NPC object to cast a skill on the attached
player. The skill will have no cast time or cooldown. The player must be
within the default skill range or the command will fail silently.
The "stat point" parameter temporarily sets all NPC stats to the given value,
and "NPC level" is the temporary level of the NPC (used in some skills).
Neither value can be greater than the max level defined in config, and will
not work properly if the NPC has a mob sprite.
Before using skills, NPCs must have basic stats applied to them depending on the
skill being used: UNPC_ATKMIN, UNPC_ATKMAX, UNPC_MATKMIN, UNPC_MATKMAX, UNPC_STR,
UNPC_AGI, UNPC_VIT, UNPC_INT, UNPC_DEX, UNPC_LUK.
See 'setunitdata' for more information on usage.
// Casts Level 10 Heal on the attached player, calculated with
// all stats 99 and base level 60.
npcskill "AL_HEAL",10,99,60;
day;
night;
These two commands will switch the entire server between day and night mode
respectively. If your server is set to cycle between day and night by
configuration, it will eventually return to that cycle.
Example:
- script DayNight -1,{
OnClock0600:
day;
end;
OnInit:
// setting correct mode upon server start-up
if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
OnClock1800:
night;
end;
}
This script allows to emulate the day/night cycle as the server does, but also
allows triggering additional effects upon change, like announces, gifts, etc.
The day/night cycle set by configuration should be disabled when this script is used.
defpattern <set number>,"<regular expression pattern>","<event label>";
activatepset <set number>;
deactivatepset <set number>;
deletepset <set number>;
This set of commands is only available if the server is compiled with regular
expressions library enabled. Default compilation and most binary distributions
aren't, which is probably bad, since these, while complex to use, are quite
fascinating.
They will make the NPC object listen for text spoken publicly by players and
match it against regular expression patterns, then trigger labels associated
with these regular expression patterns.
Patterns are organized into sets, which are referred to by a set number. You can
have multiple sets patterns, and multiple patterns may be active at once.
Numbers for pattern sets start at 1.
'defpattern' will associate a given regular expression pattern with an event
label. This event will be triggered whenever something a player says is matched
by this regular expression pattern, if the pattern is currently active.
'activatepset' will make the pattern set specified active. An active pattern
will enable triggering labels defined with 'defpattern', which will not happen
by default.
'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
set number in this case will deactivate all pattern sets defined.
'deletepset' will delete a pattern set from memory, so you can create a new
pattern set in its place.
Using regular expressions is high wizardry. But with this high wizardry comes
unparalleled power of text manipulation. For an explanation of what a regular
expression pattern is, see a few web pages:
http://www.regular-expressions.info/
http://www.weitz.de/regex-coach/
For an example of this in use, see doc/sample/npc_test_pcre.txt
With this you could, for example, automatically punish players for asking for
Zeny in public places, or alternatively, automatically give them Zeny instead if
they want it so much.
pow(<number>,<power>)
Returns the result of the calculation.
Example:
.@i = pow(2,3); // .@i will be 8
sqrt(<number>)
Returns the square-root of a number.
Example:
.@i = sqrt(25); // .@i will be 5
distance(<x0>,<y0>,<x1>,<y1>)
Returns distance between 2 points.
Example:
.@i = distance(100,200,101,202);
min(<number or array>{,<number or array>,...});
minimum(<number or array>{,<number or array>,...});
max(<number or array>{,<number or array>,...});
maximum(<number or array>{,<number or array>,...});
Returns the smallest (or biggest) from the set of given parameters.
These parameters have to be either numbers or number arrays.
Example:
.@minimum = min( 1, -6, -2, 8, 2 ); // .@minimum will be equal to -6
.@maximum = max( 0, 5, 10, 4 ); // .@maximum will be equal to 10
.@level = min( BaseLevel, 70 ); // .@level will be the character's base level, capped to 70
setarray .@testarray, 4, 5, 12, 6, 7, 3, 8, 9, 10;
.@minimum = min( .@testarray ); // .@minimum will be equal to 3
.@maximum = max( .@testarray ); // .@maximum will be equal to 12
.@minimum = min( -6, 1, 2, 3, .@testarray ); // .@minimum will be equal to -6
.@maximum = max( -6, 1, 2, 3, .@testarray ); // .@maximum will be equal to 12
round(<number>,<precision>);
ceil(<number>,<precision>);
floor(<number>,<precision>);
Returns <number> rounded to multiple of <precision>.
`round` function will round the <number> up if its division with <precision> yield a remainder
with a value equals to or more than half of <precision>. Otherwise, it rounds the <number> down.
`ceil` always round the <number> up.
`floor` always round the <number> down.
md5("<string>")
Returns the md5 checksum of a number or string.
Example:
mes md5(12345);
mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
values, and will return the number of rows (i.e. array size) or -1 on failure.
Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
Example:
.@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
mes "Hall Of Fame: TOP5";
mes "1." + .@name$[0] + "(" + .@fame[0] + ")"; // largest fame value.
mes "2." + .@name$[1] + "(" + .@fame[1] + ")";
mes "3." + .@name$[2] + "(" + .@fame[2] + ")";
mes "4." + .@name$[3] + "(" + .@fame[3] + ")";
mes "5." + .@name$[4] + "(" + .@fame[4] + ")";
escape_sql(<value>)
Converts the value to a string and escapes special characters so that it is safe to
use in query_sql(). Returns the escaped form of the given value.
Example:
.@name$ = "John's Laptop";
.@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
setiteminfo(<item id>,<type>,<value>)
This function will set some value of an item.
Returns the new value on success, or -1 on fail (item_id not found or invalid type).
Valid types are:
0 - Buy Price; 1 - Sell Price; 2 - Item Type;
3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
if = 0, then monsters don't drop it at all (rare or a quest item)
if = 10000, then this item is sold in NPC shops only
4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
Example:
setiteminfo 7049,6,9990; // Stone now weighs 999.0
setitemscript(<item id>,<"{ new item script }">{,<type>});
Set a new script bonus to the Item. Very useful for game events.
You can remove an item's itemscript by leaving the itemscript argument empty.
Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
Type can optionally be used indicates which script to set (default is 0):
0 - Script
1 - OnEquip_Script
2 - OnUnequip_Script
Example:
setitemscript 2637,"{ if (isequipped(2236) == 0)end; if (getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
setitemscript 2637,"";
atoi("<string>");
axtoi("<string>");
strtol("<string>", base);
These commands are used to convert strings to numbers. 'atoi' will interpret
given string as a decimal number (base 10), while 'axtoi' interprets strings as
hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
is between 2 and 36 inclusive, or the special value0, which means auto-detection).
The 'atoi' and 'strtol' functions conform to the C functions with the same names,
and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
32 bit int range (INT_MIN ~ INT_MAX).
Examples:
.@var = atoi("11"); // Sets .@var to 11
.@var = axtoi("FF"); // Sets .@var to 255
mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
.@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
.@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
.@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
.@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
.@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
.@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
compare("<string>","<substring>")
This command returns 1 or 0 when the substring is in the main string (1) or not (0).
This command is not case sensitive.
Examples:
//dothis; will be executed ('Bloody Murderer' contains 'Blood').
if (compare("Bloody Murderer","Blood"))
dothis;
//dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
if (compare("Blood Butterfly","Bloody"))
dothat;
strcmp("<string>","<string>")
This command compares two strings are returns a value:
1: string 1 > string 2
0: strings are equal
-1: string 1 < string 2
getstrlen("<string>")
This function will return the length of the string given as an argument. It is
useful to check if anything input by the player exceeds name length limits and
other length limits and asking them to try to input something else.
charisalpha("<string>",<position>)
This function will return 1 if the character number Position in the given string
is a letter, 0 if it isn't a letter but a digit or a space.
The first letter is position 0.
charat(<string>,<index>)
Returns char at specified index. If index is out of range, returns empty string.
The first letter of a string is index 0.
Example:
charat("This is a string", 10); //returns "s"
setchar(<string>,<char>,<index>)
Returns the original string with the char at the specified index set to the
specified char. If index out of range, the original string will be returned.
Only the 1st char in the <char> parameter will be used.
Example:
setchar("Cat", "B", 0); //returns "Bat"
insertchar(<string>,<char>,<index>)
Returns the original string with the specified char inserted at the specified
index. If index is out of range, the char will be inserted on the end of the
string that it is closest. Only the 1st char in the <char> parameter will be used.
Example:
insertchar("laughter", "s", 0); //returns "slaughter"
delchar(<string>,<index>)
Returns the original string with the char at the specified index removed.
If index is out of range, original string will be returned.
Example:
delchar("Diet", 3); //returns "Die"
strtoupper(<string>);
strtolower(<string>);
Returns the specified string in its uppercase/lowercase form.
All non-alpha characters will be preserved.
Example:
strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
charisupper(<string>,<index>);
charislower(<string>,<index>);
Returns 1 if character at specified index of specified string is
uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
Example:
charisupper("rAthena", 1); //returns 1
substr(<string>,<start_index>,<end_index>)
Returns the sub-string of the specified string inclusively between the set
indexes. If indexes are out of range, or the start index is after the end
index, an empty string will be returned.
Example:
substr("foobar", 3, 5); //returns "bar"
explode(<dest_array>,<string>,<delimiter>)
Breaks a string up into substrings based on the specified delimiter. Substrings
will be stored within the specified string array. Only the 1st char of the
delimiter parameter will be used. If an empty string is passed as a delimiter,
the string will be placed in the array in its original form.
Example:
explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
//.@my_array$ contents will be...
//.@my_array$[0]: "Explode"
//.@my_array$[1]: "Test"
//.@my_array$[2]: "1965"
//.@my_array$[3]: "red"
//.@my_array$[4]: "PIE"
implode(<string_array>{,<glue>})
Combines all substrings within the specified string array into a single string.
If the glue parameter is specified, it will be inserted inbetween each substring.
Example:
setarray .@my_array$[0], "This", "is", "a", "test";
implode(.@my_array$, " "); //returns "This is a test"
sprintf(<format>[,param[,param[,...]]])
C style sprintf. The resulting string is returned same as in PHP. All C format
specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
The number of params is only limited by rA's script engine.
Example:
.@format$ = "The %s contains %d monkeys";
dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
sscanf(<string>,<format>[,param[,param[,...]]])
C style sscanf. All C format specifiers are supported.
More info: sscanf @ www.cplusplus.com. The number of params is only limited
by rA's script engine.
Example:
sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
dispbottom(.@num + " " + .@str$); //prints "42 foobar"
strpos(<haystack>,<needle>{,<offset>})
PHP style strpos. Finds a substring (needle) within a string (haystack).
The offset parameter indicates the index of the string to start searching.
Returns index of substring on successful search, else -1.
Comparison is case sensitive.
Example:
strpos("foobar", "bar", 0); //returns 3
strpos("foobarfoo", "foo", 0); //returns 0
strpos("foobarfoo", "foo", 1); //returns 6
replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
Replaces all instances of a search string in the input with the specified
replacement string. By default is case sensitive unless <usecase> is set
to 0. If specified it will only replace as many instances as specified
in the count parameter.
Example:
replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
replacestr("Donkey", "don", "mon", 0); //returns "monkey"
replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
countstr(<input>, <search>{, <usecase>})
Counts all instances of a search string in the input. By default is case
sensitive unless <usecase> is set to 0.
Example:
countstr("test test test Test", "test"); //returns 3
countstr("cake Cake", "Cake", 0); //returns 2
preg_match(<regular expression pattern>,<string>{,<offset>})
Searches a string for a match to the regular expression provided. The
offset parameter indicates the index of the string to start searching.
Returns offsets to captured substrings, or 0 if no match is found.
This command is only available if the server is compiled with the regular
expressions library enabled.
setfont <font>;
This command sets the current RO client interface font to one of the
fonts stored in data\*.eot by using an ID of the font. When the ID
of the currently used font is used, default interface font is used
again.
0 - Default
1 - RixLoveangel
2 - RixSquirrel
3 - NHCgogo
4 - RixDiary
5 - RixMiniHeart
6 - RixFreshman
7 - RixKid
8 - RixMagic
9 - RixJJangu
showdigit <value>{,<type>};
Displays given numeric 'value' in large digital clock font on top of
the screen. The optional parameter 'type' specifies visual aspects
of the "clock" and can be one of the following values:
0 - Displays the value for 5 seconds (default).
1 - Incremental counter (1 tick/second).
2 - Decremental counter (1 tick/second). Does not stop at zero,
but overflows.
3 - Decremental counter (2 ticks/second). Two digits only, stops
at zero.
Except for type 3 the value is interpreted as seconds and formatted
as time in days, hours, minutes and seconds. Note, that the official
script command does not have the optional parameter.
// displays 23:59:59 for 5 seconds
showdigit 86399;
// counter that starts at 60 and runs for 30 seconds
showdigit 60,3;
setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
Each map cell has several 'flags' that specify the properties of that cell.
These include terrain properties (walkability, shootability, presence of water),
skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
Each of these can be 'on' or 'off'. Together they define a cell's behavior.
This command lets you alter these flags for all map cells in the specified
(x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
The 'type' defines which flag to modify. Possible options see 'src/map/script_constants.hpp'.
Example:
setcell "arena",0,0,300,300,cell_basilica,1;
setcell "arena",140,140,160,160,cell_basilica,0;
setcell "arena",135,135,165,165,cell_walkable,0;
setcell "arena",140,140,160,160,cell_walkable,1;
This will add a makeshift ring into the center of the map. The ring will be
surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
the rest of the map will be marked as 'basilica', preventing observers from
casting any offensive skills or fighting among themselves. Note that the wall
will not be shown nor known client-side, which may cause movement problems.
Another example:
OnBarricadeDeploy:
setcell "schg_cas05",114,51,125,51,cell_walkable,0;
end;
OnBarricadeBreak:
setcell "schg_cas05",114,51,125,51,cell_walkable,1;
end;
This could be a part of the WoE:SE script, where attackers are not allowed
to proceed until all barricades are destroyed. This script would place and
remove a nonwalkable row of cells after the barricade mobs.
checkcell ("<map name>",<x>,<y>,<type>);
This command will return 1 or 0, depending on whether the specified cell has
the 'type' flag set or not. There are various types to check, all mimicking
the server's cell_chk enumeration. The types can be found in 'src/map/script_constants.hpp'.
The meaning of the individual types can be confusing, so here's an overview:
- cell_chkwall/water/cliff
these check directly for the 'terrain component' of the specified cell
- cell_chkpass/reach/nopass/noreach
passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
- cell_chknpc/basilica/landprotector/novending/nochat
these check for specific dynamic flags (their name indicates what they do)
Example:
mes "Pick a destination map.";
input .@map$;
mes "Alright, now give me the coordinates.";
input .@x;
input .@y;
if ( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
mes "Can't warp you there, sorry!";
close;
} else {
mes "Ok, get ready...";
close2;
warp .@map$, .@x, .@y;
end;
}
getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
Finds a free cell on the given map and stores the reference to the found cell
in <rX> and <rY>. Passing <x> and <y> with <rangeX> and <rangeY> allows for
searching within a specified area on the given map. The <flag> is a bitmask
and has the following possible values:
- 1 = Random cell on the map or from <x>,<y> range. (default)
- 2 = The target should be able to walk to the target tile.
- 4 = There shouldn't be any players around the target tile (use the no_spawn_on_player setting).
Examples:
getfreecell("prontera",.@x,.@y); // Find a random empty cell in Prontera and store it within .@x and .@y
getfreecell("prontera",.@x,.@y,150,150,5,5); // Find a random empty cell on 150,150 (with a range of 5x5) in Prontera and store it within .@x and .@y
setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
delwall "<name>";
Creates an invisible wall, an array of "setcell" starting from x,y and doing a
line of the given size in the given direction. The difference with setcell is
this one update client part too to avoid the glitch problem. Directions are the
same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
checkwall "<name>";
This command will return true if the wall with the given name exists, false otherwise.
readbook <book id>,<page>;
This command will open a book item at the specified page.
open_roulette( {char_id} )
Opens the roulette window for the currently attached character or the character
with the given character id.
Copyright © 工程的初始时间(可先)–2019. All rights reserved.