summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/script_commands.txt3332
1 files changed, 1680 insertions, 1652 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index e1f68916e..204723905 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -57,7 +57,7 @@ you didn't, get used to it, that's how big boys do it. If a command can
optionally take an unspecified number of arguments, you'll see a list like
this:
-command <argument>{,<argument>...<argument>}
+command(<argument>{, <argument>...<argument>})
This still means they will want to be separated by commas.
@@ -386,7 +386,7 @@ Unless you use 'attachrid' to explicitly attach a character to the script
first (see player-related commands).
Whenever we say 'invoking character', we mean 'the character who's RID is
-attached to the running script. The script function "playerattached" can
+attached to the running script. The script function playerattached() can
be used to check which is the currently attached player to the script (it
will return 0 if the there is no player attached or the attached player no
longer is logged on to the map-server).
@@ -395,8 +395,8 @@ But what about GID?
--- ---- ----- ----
GID stands for the Game ID of something, this can either be the GID of a
-mob obtained through the monster script command (if only summoned one),
-the GID of a NPC obtained through the getnpcid script command or the
+mob obtained through the monster() script command (if only summoned one),
+the GID of a NPC obtained through the getnpcid() script command or the
account ID of a character (same as its RID). Another way would be to right
click on a mob, NPC or char as GM sprited char to view its GID.
@@ -487,7 +487,7 @@ nothing - A permanent variable attached to the character, the default
".@" - A scope variable.
They are unique to the character, script and scope. Each script
execution has its own scope that ends when the script ends.
- Calling a function with callsub/callfunc starts a new scope,
+ Calling a function with callsub()/callfunc() starts a new scope,
returning from the function ends it. When a scope ends, its
variables are converted to values ('return .@var;' returns a
value, not a reference).
@@ -750,10 +750,10 @@ other, but you can not compare numbers to strings.
< - True if the first value is less than the second value.
!= - True if the first value IS NOT equal to the second one.
~= - True if the second value (as regular expression) matches the first
- value. Both values must be strings. See the script function pcre_match
+ value. Both values must be strings. See the script function pcre_match()
for more details and advanced features.
~! - True if the second value (as regular expression) DOES NOT match the
- first value. Both values must be strings. See script function pcre_match
+ first value. Both values must be strings. See script function pcre_match()
for more details and advanced features.
Examples:
@@ -787,12 +787,12 @@ Logical bitwise operators work only on numbers, and they are the following:
Example:
b = 2;
a = b << 3;
- mes a;
+ mes(a);
a = a >> 2;
- mes a;
- The first mes command would display 16, which is the same as:
+ mes(a);
+ The first mes() command would display 16, which is the same as:
2 x (2 x 2 x 2) = 16.
- The second mes command would display 4, which is the same as:
+ The second mes() command would display 4, which is the same as:
16 / 2 = 8; 8 / 2 = 4.
& - And.
| - Or.
@@ -824,13 +824,18 @@ Logical bitwise operators work only on numbers, and they are the following:
active (1) in both. Resulting in the bit 0010, which is 2.
- Basic example of creating and using a bit-mask:
.@options = 2|4|16; // (note: this is the same as 2+4+16, or 22)
- if (.@options & 1) mes "Option 1 is activated";
- if (.@options & 2) mes "Option 2 is activated";
- if (.@options & 4) mes "Option 3 is activated";
- if (.@options & 8) mes "Option 4 is activated";
- if (.@options & 16) mes "Option 5 is activated";
- This would return the messages about option 2, 3 and 5 being shown
- (since we've set the 2,4 and 16 bit to 1).
+ if (.@options & 1)
+ mes("Option 1 is activated");
+ if (.@options & 2)
+ mes("Option 2 is activated");
+ if (.@options & 4)
+ mes("Option 3 is activated");
+ if (.@options & 8)
+ mes("Option 4 is activated");
+ if (.@options & 16)
+ mes("Option 5 is activated");
+ This would print the messages about option 2, 3 and 5 (since we've set
+ the 2,4 and 16 bit to 1).
^ - Xor.
The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if
both numbers have the same value in the said position. On the other
@@ -842,19 +847,19 @@ Logical bitwise operators work only on numbers, and they are the following:
- First let's set the quests that are currently in progress:
inProgress = 1|8|16; // quest 1,8 and 16 are in progress
- After playing for a bit, the player starts another quest:
- if( inProgress&2 == 0 ){
+ if (inProgress&2 == 0) {
// this will set the bit for quest 2 (inProgress has that bit set to 0)
inProgress = inProgress^2;
- mes "Quest 2: find a newbie and be helpful to him for an hour.";
- close;
+ mes("Quest 2: find a newbie and be helpful to him for an hour.");
+ close();
}
- After spending some time reading info on Xor's, the player finally
completes quest 1:
- if( inProgress&1 && isComplete ) {
+ if (inProgress&1 && isComplete) {
// this will unset the bit for quest 1 (inProgress has that bit set to 1)
inProgress = inProgress^1;
- mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
- close;
+ mes("Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.");
+ close();
}
Unary operators with only with a single number, which follows the
@@ -866,16 +871,16 @@ operator, and are the following:
Example:
.@myvar = 10;
- mes "Negative 10 is "+(-.@myvar);
+ mes("Negative 10 is "+(-.@myvar));
! - Logical Not.
- Reverses the boolean result of an expression. True will become false
- and false will become true.
+ Reverses the boolean result of an expression. True will become false
+ and false will become true.
Example:
- if(!callfunc("F_dosomething")) {
- mes "Doing something failed.";
- close;
+ if (!callfunc("F_dosomething")) {
+ mes("Doing something failed.");
+ close();
}
~ - Bitwise Not.
@@ -886,7 +891,7 @@ operator, and are the following:
- Ensure, that quest 2 is disabled, while keeping all other active, if
they are.
inProgress = inProgress&(~2);
- // same as set inProgress,inProgress&0xfffffffd
+ // same as set inProgress, inProgress&0xfffffffd
Ternary operators take three expressions (numbers, strings or boolean),
and are the following:
@@ -895,13 +900,13 @@ and are the following:
Very useful e.g. to replace
if (Sex == SEX_MALE)
- mes "You're Male.";
+ mes("You're Male.");
else
- mes "You're Female.";
+ mes("You're Female.");
clauses with simple
- mes "Welcome, " + (Sex == SEX_MALE ? "Mr." : "Mrs.") + " " + strcharinfo(0);
+ mes("Welcome, " + (Sex == SEX_MALE ? "Mr." : "Mrs.") + " " + strcharinfo(PC_NAME));
or to replace any other simple if-else clauses. It might be worth
mentioning that ?: has low priority and has to be enclosed with
@@ -1000,8 +1005,8 @@ OnDay<month><day>:
This will execute when the server clock hits the specified date or time.
Hours and minutes are given in military time. ('0105' will mean 01:05 AM).
-Weekdays are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01
-to 31. Remember the zero. :)
+Weekdays are Sun, Mon, Tue, Wed, Thu, Fri, Sat. Months are 01 to 12, days are
+01 to 31. Remember the zero. :)
OnInit:
OnInterIfInit:
@@ -1099,8 +1104,8 @@ OnCountFunds:
This special label is triggered when a player opens a trader NPC object that
is NST_CUSTOM. It is used to define different currency types to the trader via
-*setcurrency. Should be used along with OnPayFunds, see /doc/sample/npc_trader_sample.txt
-for more information.
+setcurrency(). Should be used along with OnPayFunds, see
+doc/sample/npc_trader_sample.txt for more information.
OnPayFunds:
@@ -1119,14 +1124,14 @@ must be started with "On".
Example:
-monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
+monster("prontera", 123, 42, "Poringz0rd", 2341, 23, "Master::OnThisMobDeath");
amatsu,13,152,4 script Master 767,{
- mes "Hi there";
- close;
+ mes("Hi there");
+ close();
OnThisMobDeath:
- announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
+ announce("Hey, "+strcharinfo(PC_NAME)+" just killed a Poringz0rd!", bc_blue|bc_all);
end;
}
@@ -1134,12 +1139,12 @@ Each time you kill one, that announce will appear in blue to everyone.
"Global" labels
-There's a catch with labels and doevent. If you call a label (using
-doevent) and called label is in NPC that has trigger area, that label must
-end with "Global" to work globally (i.e. if RID is outside of the trigger
-area, which usually happens since otherwise there would be no point
-calling the label with doevent, because OnTouch would do the job). For
-further reference look for npc_event in npc.c.
+There's a catch with labels and doevent(). If you call a label (using
+doevent()) and called label is in NPC that has trigger area, that label must
+end with "Global" to work globally (i.e. if RID is outside of the trigger area,
+which usually happens since otherwise there would be no point calling the label
+with doevent(), because OnTouch would do the job). For further reference look
+for npc_event in npc.c.
Scripting commands and functions
--------------------------------
@@ -1147,16 +1152,11 @@ Scripting commands and functions
The commands and functions are listed here in no particular order. There's
a difference between commands and functions - commands leave no 'return
value' which might be used in a conditional statement, as a command
-argument, or stored in a variable. Calling commands as if they were
-functions will sometimes work, but is not advised, as this can lead to
-some hard to track errors. Calling functions as if they were commands will
-mess up the stack, so 'return' command will not return correctly after
-this happens in a particular script.
+argument, or stored in a variable.
-All commands must end with a ';'. Actually, you may expect to have
-multiple commands on one line if you properly terminate them with a ';',
-but it's better if you don't, since it is not certain just whether the
-scripting engine will behave nicely if you do.
+All instructions must end with a ';'. Actually, you may expect to have multiple
+instructions on one line if you properly terminate them with a ';', but it's
+consider ill practice, since it impairs legibility of the script.
Please note that command and function names are case sensitive.
@@ -1193,7 +1193,7 @@ From here on, we will have the commands sorted as followed:
//=====================================
---------------------------------------
-*mes "<string>";
+*mes("<string>")
This command will displays a box on the screen for the invoking character,
if no such box is displayed already, and will print the string specified
@@ -1202,7 +1202,7 @@ unless you create one with 'close' or 'next', and while it's open the
player can't do much else, so it's important to create a button later. If
the string is empty, it will show up as an empty line.
- mes "Text that will appear in the box";
+ mes("Text that will appear in the box");
Inside the string you may put color codes, which will alter the color of
the text printed after them. The color codes are all '^<R><G><B>' and
@@ -1213,13 +1213,13 @@ a color that is considered transparent whenever the client is drawing
windows on screen, so printing text in that color will have kind of a
weird effect. You may also use C_ constants accompany with "F_MesColor"
function for the color effect, see the full list of the available ones
-in 'db/constants.conf'
-under 'C_'. Once you've set a text's color to something, you have to set
-it back to black unless you want all the rest of the text be in that color:
+in 'db/constants.conf' under 'C_'. Once you've set a text's color to something,
+you have to set it back to black unless you want all the rest of the text be in
+that color:
+
+ mes("This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.");
+ mes(callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE");
- mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
- mes callfunc("F_MesColor", C_BLUE) +"This message is now in BLUE";
-
Notice that the text coloring is handled purely by the client. If you use
non-English characters, the color codes might get screwed if they stick to
letters with no intervening space. Separating them with spaces from the
@@ -1229,18 +1229,18 @@ If you're using a client from 2011-10-10aRagexe.exe onwards, you can also
use automatic navigation and open URLs in browser by using some HTML-like
labels. For example:
- mes "go to <NAVI>[Hat Maker]<INFO>izlude,131,148,</INFO></NAVI> to make hats";
+ mes("go to <NAVI>[Hat Maker]<INFO>izlude,131,148,</INFO></NAVI> to make hats");
Will make the [Hat Maker] text clickable in the client and start a navigation
to that point.
- mes "You can <URL>Google<INFO>http://www.google.com/</INFO></URL> anything";
+ mes("You can <URL>Google<INFO>http://www.google.com/</INFO></URL> anything");
Clicking Google will open the browser and point to Google website.
---------------------------------------
-*mesf("<format>"{,<param>{, <param>{, ...}}})
+*mesf("<format>"{, <param>{, <param>{, ...}}})
This command will display a box on the screen for the invoking character,
if no such box is displayed already, and will print the string specified
@@ -1257,27 +1257,26 @@ for more details.
---------------------------------------
-*next;
+*next()
This command will display a 'next' button in the message window for the
invoking character. Clicking on it will cause the window to clear and
-display a new one. Used to segment NPC-talking, next is often used in
-combination with 'mes' and 'close'.
+display a new one. Used to segment NPC-talking, next() is often used in
+combination with mes() and close().
If no window is currently on screen, one will be created, but once the
invoking character clicks on it, a warning is thrown on the server console
and the script will terminate.
- mes "[Woman]";
- mes "This would appear on the page";
- next;
- // This is needed since it is a new page and the top will now be blank
- mes "[Woman]";
- mes "This would appear on the 2nd page";
+ mes("[Woman]");
+ mes("This would appear on the page");
+ next();
+ mes("[Woman]"); // This is needed since it is a new page and the top will now be blank
+ mes("This would appear on the 2nd page");
---------------------------------------
-*close;
+*close()
This command will create a 'close' button in the message window for the
invoking character. If no window is currently on screen, the script
@@ -1285,14 +1284,14 @@ command 'end;' must be used. This is one of the ways to end a speech from
an NPC. Once the button is clicked, the NPC script execution will end, and
the message box will disappear.
- mes "[Woman]";
- mes "I am finished talking to you, click the close button.";
- close;
- mes "This command will not run at all, since the script has ended.";
+ mes("[Woman]");
+ mes("I am finished talking to you, click the close button.");
+ close();
+ mes("This command will not run at all, since the script has ended.");
---------------------------------------
-*close2;
+*close2()
This command will create a 'close' button in the message window for the
invoking character. WARNING: If no window is currently on screen, the
@@ -1302,35 +1301,36 @@ closed, the script execution will not stop, and commands after 'close2'
will still run, meaning an 'end' has to be used to stop the script, unless
you make it stop in some other manner.
- mes "[Woman]";
- mes "I will warp you now.";
- close2;
- warp "place",50,50;
+ mes("[Woman]");
+ mes("I will warp you now.");
+ close2();
+ warp("place", 50, 50);
end;
-
+
Don't expect things to run smoothly if you don't make your scripts 'end'.
---------------------------------------
-*end;
+*end
-This command will stop the execution for this particular script.
-It is required for any script not using 'mes'.
+This instruction will stop the execution for this particular script.
+Note that this is to be considered a special instruction (not a regular
+command or function), and as such doesn't require parentheses.
if (BaseLevel <= 10) {
- npctalk "Look at that you are still a n00b";
+ npctalk("Look at that you are still a n00b");
end;
}
if (BaseLevel <= 20) {
- npctalk "Look at that you are getting better, but still a n00b";
+ npctalk("Look at that you are getting better, but still a n00b");
end;
}
if (BaseLevel <= 30) {
- npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
+ npctalk("Look at that you are getting there, you are almost 2nd profession now right???");
end;
}
if (BaseLevel <= 40) {
- npctalk "Look at that you are almost 2nd profession";
+ npctalk("Look at that you are almost 2nd profession");
end;
}
@@ -1340,8 +1340,7 @@ lines, the use of 'end' stops this, and ends the script.
---------------------------------------
-*set <variable>,<expression>;
-*set(<variable>,<expression>)
+*set(<variable>, <expression>)
This command will set a variable to the value that the expression results
in. This isn't the only way to set a variable directly: you can set them
@@ -1349,83 +1348,83 @@ much like any other programming language as stated before (refer to the
'Assigning variables' section).
This command is deprecated and it shouldn't be used in new scripts, except
-some special cases (mostly, set getvariableofnpc). Use direct value
+some special cases (mostly, set(getvariableofnpc(), <value>)). Use direct value
assignment instead.
---------------------------------------
-*setd "<variable name>",<value>;
+*setd("<variable name>", <value>)
-Works almost identically as set, except the variable name is identified as
-a string and can thus be constructed dynamically.
+Works almost identically as set(), except the variable name is
+identified as a string and can thus be constructed dynamically.
This command is equivalent to:
- set getd("variable name"),<value>;
+ set(getd("variable name"), <value>);
Examples:
- setd ".@var$", "Poporing";
- mes .@var$; // Displays "Poporing".
+ setd(".@var$", "Poporing");
+ mes(.@var$); // Displays "Poporing".
- setd ".@" + .@var$ + "123$", "Poporing is cool";
- mes .@Poporing123$; // Displays "Poporing is cool".
+ setd(".@" + .@var$ + "123$", "Poporing is cool");
+ mes(.@Poporing123$); // Displays "Poporing is cool".
---------------------------------------
*getd("<variable name>")
Returns a reference to a variable, the name can be constructed dynamically.
-Refer to 'setd' for usage.
+Refer to setd() for usage.
This can also be used to set an array dynamically:
- setarray getd(".array[0]"), 1, 2, 3, 4, 5;
+ setarray(getd(".array[0]"), 1, 2, 3, 4, 5);
Examples:
- mes "The value of $varReference is: " + getd("$varRefence");
- set .@i, getd("$" + "pikachu");
+ mes("The value of $varReference is: " + getd("$varRefence"));
+ set(.@i, getd("$" + "pikachu"));
---------------------------------------
-*getvariableofnpc(<variable>,"<npc name>")
+*getvariableofnpc(<variable>, "<npc name>")
Returns a reference to a NPC variable (. prefix) from the target NPC.
This can only be used to get . variables.
Examples:
-//This will return the value of .var, note that this can't be used, since
+//This will return the value of .var, note that this can't be used, since
//the value isn't caught.
- getvariableofnpc(.var,"TargetNPC");
+ getvariableofnpc(.var, "TargetNPC");
-//This will set the .v variable to the value of the TargetNPC's .var
+//This will set the .@v variable to the value of the TargetNPC's .var
//variable.
- .v = getvariableofnpc(.var,"TargetNPC");
+ .@v = getvariableofnpc(.var, "TargetNPC");
//This will set the .var variable of TargetNPC to 1.
- set getvariableofnpc(.var,"TargetNPC"), 1;
+ set(getvariableofnpc(.var, "TargetNPC"), 1);
-Note: even though function objects can have .variables, getvariableofnpc
-will not work on them.
+Note: even though function objects can have .variables,
+getvariableofnpc() should not be used on them.
---------------------------------------
-*goto <label>;
+*goto(<label>)
This command will make the script jump to a label, usually used in
-conjunction with other command, such as "if", but often used on it's own.
+conjunction with other instructions, such as "if", but often used on its own.
...
- goto Label;
- mes "This will not be seen";
+ goto(Label);
+ mes("This will not be seen");
Label:
- mes "This will be seen";
+ mes("This will be seen");
Gotos are considered to be harmful and should be avoided whenever possible.
---------------------------------------
-*menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
+*menu("<option_text>", <target_label>{, "<option_text>", <target_label>, ...})
This command will create a selectable menu for the invoking character.
Only one menu can be on screen at the same time.
@@ -1440,36 +1439,36 @@ prompt() instead.
Options can be grouped together, separated by the character ':'.
- menu "A:B",L_Wrong,"C",L_Right;
+ menu("A:B", L_Wrong, "C", L_Right);
It also sets a special temporary character variable @menu, which contains
the number of option the player picked. Numbering of options starts at 1.
This number is consistent with empty options and grouped options.
- menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
- L_Wrong:
- // If they click "A" or "B" they will end up here
- // @menu == 1 if "A"
- // @menu == 2 will never happen because the option is empty
- // @menu == 3 if "B"
+ menu("A::B", L_Wrong, "", L_Impossible, "C", L_Right);
+ L_Wrong:
+ // If they click "A" or "B" they will end up here
+ // @menu == 1 if "A"
+ // @menu == 2 will never happen because the option is empty
+ // @menu == 3 if "B"
L_Impossible:
- // Empty options are not displayed and therefore can't be selected
- // this label will never be reached from the menu command
- L_Right:
- // If they click "C" they will end up here
- // @menu == 5
+ // Empty options are not displayed and therefore can't be selected
+ // this label will never be reached from the menu command
+ L_Right:
+ // If they click "C" they will end up here
+ // @menu == 5
If a label is '-', the script execution will continue right after the menu
command if that option is selected, this can be used to save you time, and
optimize big scripts.
- menu "A::B:",-,"C",L_Right;
- // If they click "A" or "B" they will end up here
- // @menu == 1 if "A"
- // @menu == 3 if "B"
- L_Right:
- // If they click "C" they will end up here
- // @menu == 5
+ menu("A::B:", -, "C", L_Right);
+ // If they click "A" or "B" they will end up here
+ // @menu == 1 if "A"
+ // @menu == 3 if "B"
+ L_Right:
+ // If they click "C" they will end up here
+ // @menu == 5
Both these examples will perform the exact same task.
@@ -1486,7 +1485,7 @@ populate it with the strings that should go into the menu at this
execution, making sure not to leave any gaps. Normally, you do it with a
loop and an extra counter, like this:
- setarray .@possiblemenuitems$[0],<list of potential menu items>;
+ setarray(.@possiblemenuitems$[0], <list of potential menu items>);
.@j = 0; // That's the menu lines counter.
// We loop through the list of possible menu items.
@@ -1495,21 +1494,17 @@ loop and an extra counter, like this:
// That 'condition' is whatever condition that determines whether
// a menu item number .@i actually goes into the menu or not.
- if (<condition>)
- {
+ if (<condition>) {
// We record the option into the list of options actually
// available.
-
- set .@menulist$[.@j],.@possiblemenuitems$[.@i];
+ .@menulist$[.@j] = .@possiblemenuitems$[.@i];
// We just copied the string, we do need it's number for later
// though, so we record it as well.
-
- set .@menureference[.@j],.@i;
+ .@menureference[.@j] = .@i;
// Since we've just added a menu item into the list, we
// increment the menu lines counter.
-
++.@j;
}
@@ -1520,17 +1515,17 @@ This will create you an array .@menulist$ which contains the text of all
items that should actually go into the menu based on your condition, and
an array .@menureference, which contains their numbers in the list of
possible menu items. Remember, arrays start with 0. There's less of them
-than the possible menu items you've defined, but the menu command can
+than the possible menu items you've defined, but the menu() command can
handle the empty lines - only if they are last in the list, and if it's
made this way, they are. Now comes a dirty trick:
// X is whatever the most menu items you expect to handle.
- menu .@menulist$[0],-,.@menulist$[1],-,...,.@menulist$[<X>],-;
+ menu(.@menulist$[0], -, .@menulist$[1], -, ..., .@menulist$[<X>], -);
This calls up a menu of all your items. Since you didn't copy some of the
possible menu items into the list, it's end is empty and so no menu items
-will show up past the end. But this menu call doesn't jump anywhere, it
-just continues execution right after the menu command. (And it's a good
+will show up past the end. But this menu() call doesn't jump anywhere, it
+just continues execution right after the menu() command. (And it's a good
thing it doesn't, cause you can only explicitly define labels to jump to,
and how do you know which ones to define if you don't know beforehand
which options will end up where in your menu?)
@@ -1541,7 +1536,7 @@ starting with 1 for the first option. You know now which option the user
picked and which number in your real list of possible menu items it
translated to:
- mes "You selected "+.@possiblemenuitems$[.@menureference[@menu-1]]+"!";
+ mes("You selected "+.@possiblemenuitems$[.@menureference[@menu-1]]+"!");
@menu is the number of option the user picked.
@menu-1 is the array index for the list of actually used menu items that
@@ -1553,7 +1548,7 @@ And .@possiblemenuitems$[.@menureference[@menu-1]] is the string that we
used to display the menu line the user picked. (Yes, it's a handful, but
it works.)
-You can set up a bunch of 'if (.@menureference[@menu-1]==X) goto Y'
+You can set up a bunch of 'if (.@menureference[@menu-1]==X) goto(Y)'
statements to route your execution based on the line selected and still
generate a different menu every time, which is handy when you want to, for
example, make users select items in any specific order before proceeding,
@@ -1564,17 +1559,17 @@ array-based menu technique for teleport lists, but it's much simpler and
doesn't use @menu, probably since that wasn't documented anywhere.
See also 'select', which is probably better in this particular case.
-Instead of menu, you could use 'select' like this:
+Instead of menu(), you could use select() like this:
+
+ .@dummy = select(.@menulist$[0], .@menulist$[1], ..., .@menulist$[<X>]);
- .@dummy = select(.@menulist$[0],.@menulist$[1],...,.@menulist$[<X>]);
-
For the purposes of the technique described above these two statements are
perfectly equivalent.
---------------------------------------
-*select("<option>"{,"<option>",...})
-*prompt("<option>"{,"<option>",...})
+*select("<option>"{, "<option>", ...})
+*prompt("<option>"{, "<option>", ...})
This function is a handy replacement for 'menu' that doesn't use a complex
label structure. It will return the number of menu option picked,
@@ -1582,7 +1577,7 @@ starting with 1. Like 'menu', it will also set the variable @menu to
contain the option the user picked.
if (select("Yes:No") == 1)
- mes "You said yes, I know.";
+ mes("You said yes, I know.");
And like 'menu', the selected option is consistent with grouped options
and empty options.
@@ -1592,45 +1587,45 @@ clicks the Cancel button, this function will return 255 instead.
---------------------------------------
-*input(<variable>{,<min>{,<max>}})
+*input(<variable>{, <min>{, <max>}})
This command will make an input box pop up on the client connected to the
invoking character, to allow entering of a number or a string. This has
many uses, one example would be a guessing game, also making use of the
'rand' function:
- mes "[Woman]";
- mes "Try and guess the number I am thinking of.";
- mes "The number will be between 1 and 10.";
- next;
- .@number = rand(1,10);
- input .@guess;
+ mes("[Woman]");
+ mes("Try and guess the number I am thinking of.");
+ mes("The number will be between 1 and 10.");
+ next();
+ .@number = rand(1, 10);
+ input(.@guess);
if (.@guess == .@number) {
- mes "[Woman]";
- mes "Well done that was the number I was thinking of";
- close;
+ mes("[Woman]");
+ mes("Well done that was the number I was thinking of");
+ close();
} else {
- mes "[Woman]";
- mes "Sorry, that wasn't the number I was thinking of.";
- close;
+ mes("[Woman]");
+ mes("Sorry, that wasn't the number I was thinking of.");
+ close();
}
-If you give the input command a string variable to put the input in, it
+If you give the input() command a string variable to put the input in, it
will allow the player to enter text. Otherwise, only numbers will be
allowed.
- mes "[Woman]";
- mes "Please say HELLO";
- next;
- input .@var$;
+ mes("[Woman]");
+ mes("Please say HELLO");
+ next();
+ input(.@var$);
if (.@var$ == "HELLO") {
- mes "[Woman]";
- mes "Well done you typed it correctly";
- close;
+ mes("[Woman]");
+ mes("Well done you typed it correctly");
+ close();
} else {
- mes "[Woman]";
- mes "Sorry you got it wrong";
- close;
+ mes("[Woman]");
+ mes("Sorry you got it wrong");
+ close();
}
Normally you may not input a negative number with this command.
@@ -1641,32 +1636,31 @@ receive free Zeny as a result.
The command has two optional arguments and a return value.
The default value of 'min' and 'max' can be set with 'input_min_value' and
'input_max_value' in conf/map/script.conf.
-For numeric inputs the value is capped to the range [min,max]. Returns 1
+For numeric inputs the value is capped to the range [min, max]. Returns 1
if the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
For string inputs it returns 1 if the string was longer than 'max', -1 is
shorter than 'min' and 0 otherwise.
---------------------------------------
-*callfunc "<function>"{,<argument>,...<argument>};
-*callfunc("<function>"{,<argument>,...<argument>})
+*callfunc("<function>"{, <argument>, ...<argument>})
This command lets you call up a function NPC. A function NPC can be called
-from any script on any map server. Using the 'return' command it will come
-back to the place that called it.
+from any script on any map server. Using the 'return' instruction it
+will come back to the place that called it.
place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
- mes "[Woman]"
- mes "Lets see if you win";
- callfunc "funcNPC";
- mes "Well done you have won";
- close;
+ mes("[Woman]");
+ mes("Lets see if you win");
+ callfunc("funcNPC");
+ mes("Well done you have won");
+ close();
}
function%TAB%script%TAB%funcNPC%TAB%{
.@win = rand(2);
if (.@win == 0)
return;
- mes "Sorry you lost";
+ mes("Sorry you lost");
end;
}
@@ -1674,35 +1668,36 @@ You can pass arguments to your function - values telling it what exactly
to do - which will be available there with getarg() (see 'getarg').
Notice that returning is not mandatory, you can end execution right there.
-If you want to return a real value from inside your function NPC, it is
-better to write it in the function form, which will also work and will
-make the script generally cleaner:
+If you want to return a real value from inside your function NPC, you
+may do so:
place,50,50,6%TAB%script%TAB%Man%TAB%115,{
- mes "[Man]"
- mes "Gimme a number!";
- next;
- input .@number;
- if (callfunc("OddFunc",.@number)) mes "It's Odd!";
- close;
+ mes("[Man]");
+ mes("Gimme a number!");
+ next();
+ input(.@number);
+ if (callfunc("OddFunc", .@number))
+ mes("It's Odd!");
+ close();
}
function%TAB%script%TAB%OddFunc%TAB%{
- if (getarg(0)%2==0) return 0;// it's even
+ if (getarg(0)%2==0)
+ return 0;// it's even
return 1;// it's odd
}
Alternately, user-defined functions may be called directly without the use
-of the 'callfunc' script command.
+of the callfunc() script command.
function<TAB>script<TAB>SayHello<TAB>{
- mes "Hello " + getarg(0);
+ mes("Hello " + getarg(0));
return 0;
}
place,50,50,6<TAB>script<TAB>Man<TAB>115,{
- mes "[Man]";
- SayHello strcharinfo(0);
- close;
+ mes("[Man]");
+ SayHello(strcharinfo(PC_NAME));
+ close();
}
Note:
@@ -1714,8 +1709,7 @@ Note:
---------------------------------------
-*callsub <label>{,<argument>,...<argument>};
-*callsub(<label>{,<argument>,...<argument>})
+*callsub(<label>{, <argument>, ...<argument>})
This command will go to a specified label within the current script (do
NOT use quotes around it) coming in as if it were a 'callfunc' call, and
@@ -1728,36 +1722,53 @@ without creating extra NPC objects which are needed with 'callfunc'. A
label is not callable in this manner from another script.
Example 1: callsub for checking (if checks pass, return to script)
- callsub S_CheckFull, "guild_vs2",50;
- switch( rand(4) ) {
- case 0: warp "guild_vs2",9,50; end;
- case 1: warp "guild_vs2",49,90; end;
- case 2: warp "guild_vs2",90,50; end;
- case 3: warp "guild_vs2",49,9; end;
+ callsub(S_CheckFull, "guild_vs2", 50);
+ switch (rand(4)) {
+ case 0:
+ warp("guild_vs2", 9, 50);
+ end;
+ case 1:
+ warp("guild_vs2", 49, 90);
+ end;
+ case 2:
+ warp("guild_vs2", 90, 50);
+ end;
+ case 3:
+ warp("guild_vs2", 49, 9);
+ end;
}
-
-...
+ end;
S_CheckFull:
if (getmapusers(getarg(0)) >= getarg(1)) {
- mes "I'm sorry, this arena is full. Please try again later.";
- close;
+ mes("I'm sorry, this arena is full. Please try again later.");
+ close();
}
return;
Example 2: callsub used repeatedly, with different arguments
// notice how the Zeny check/delete is reused, instead of copy-pasting for
// every warp.
- switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
- case 1: callsub S_DunWarp,"hu_fild05",192,207;
- case 2: callsub S_DunWarp,"ama_in02",119,181;
- case 3: callsub S_DunWarp,"moc_fild20",164,145;
- case 4: callsub S_DunWarp,"ayo_fild02",279,150;
- case 5: callsub S_DunWarp,"cmd_fild07",132,125;
+ switch (select("Abyss Lake", "Amatsu Dungeon", "Anthell", "Ayothaya Dungeon", "Beacon Island, Pharos")) {
+ case 1:
+ callsub(S_DunWarp, "hu_fild05", 192, 207);
+ break;
+ case 2:
+ callsub(S_DunWarp, "ama_in02", 119, 181);
+ break;
+ case 3:
+ callsub(S_DunWarp, "moc_fild20", 164, 145);
+ break;
+ case 4:
+ callsub(S_DunWarp, "ayo_fild02", 279, 150);
+ break;
+ case 5:
+ callsub(S_DunWarp, "cmd_fild07", 132, 125);
+ break;
// etc
}
-...
+// ...
S_DunWarp:
// getarg(0) = "mapname"
@@ -1765,15 +1776,15 @@ S_DunWarp:
// getarg(2) = y
if (Zeny >= 100) {
Zeny -= 100;
- warp getarg(0),getarg(1),getarg(2);
+ warp(getarg(0), getarg(1), getarg(2));
} else {
- mes "Dungeon warp costs 100 Zeny.";
+ mes("Dungeon warp costs 100 Zeny.");
}
- close;
+ close();
---------------------------------------
-*getarg(<index>{,<default_value>})
+*getarg(<index>{, <default_value>})
This function is used when you use the 'callsub' or 'callfunc' commands.
In the call you can specify variables that will make that call different
@@ -1785,25 +1796,28 @@ Argument numbering starts with 0, i.e. the first argument you gave is
number 0. If no such argument was given, a zero is returned.
place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
- mes "[Woman]";
- mes "Lets see if you win";
- callfunc "funcNPC",2;
- mes "Well done you have won";
-
- ...
+ mes("[Woman]");
+ mes("Lets see if you win");
+ callfunc("funcNPC", 2);
+ mes("Well done you have won");
+ // ...
+ }
place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
- mes "[Woman]";
- mes "Lets see if you win";
- callfunc "funcNPC",5;
- mes "Well done you have won";
-
- ...
+ mes("[Woman]");
+ mes("Lets see if you win");
+ callfunc("funcNPC", 5);
+ mes("Well done you have won");
+ // ...
+ }
function%TAB%script%TAB%funcNPC%TAB%{
.@win = rand(getarg(0));
- if(.@win==0) return;
- mes "Sorry you lost";
+ if (.@win == 0)
+ return;
+ mes("Sorry you lost");
+ close();
+ }
"woman1" NPC object calls the funcNPC. The argument it gives in this call
is stated as 2, so when the random number is generated by the 'rand'
@@ -1813,7 +1827,7 @@ number 0 when calling the function, so the random number could be 0, 1, 2,
You can pass multiple arguments in a function call:
- callfunc "funcNPC",5,4,3;
+ callfunc("funcNPC", 5, 4, 3);
getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
@@ -1822,7 +1836,7 @@ If the target argument exists, it is returned.
Otherwise, if <default_value> is present it is returned instead, if not
the script terminates immediately.
-In previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
+In previous example getarg(2, -1) would be 3 and getarg(3, -1) would be -1.
---------------------------------------
@@ -1833,38 +1847,37 @@ In the call you can specify arguments. This function will return the
number of arguments provided.
Example:
- callfunc "funcNPC",5,4,3;
- ...
+ callfunc("funcNPC", 5, 4, 3);
+ // ...
function%TAB%script%TAB%funcNPC%TAB%{
.@count = getargcount(); // 3
- ...
+ //...
}
---------------------------------------
-*return {<value>};
+*return {<value>}
-This command causes the script execution to leave previously called
-function with callfunc or script with callsub and return to the location,
-where the call originated from. Optionally a return value can be supplied,
-when the call was done using the function form.
+This instruction causes the script execution to leave previously called
+function with callfunc() or script with callsub() and return to the
+location, where the call originated from. Optionally a return value can
+be supplied.
Using this command outside of functions or scripts referenced by callsub
will result in error and termination of the script.
- callfunc "<your function>";// when nothing is returned
- <variable> = callfunc("<your function>");
- // when a value is being returned
+ callfunc("<your function>"); // when nothing is returned
+ <variable> = callfunc("<your function>"); // when a value is being returned
---------------------------------------
*function <function name>;
-*<function name>{(<argument>,...<argument>)};
+*<function name>{(<argument>, ...<argument>)};
*function <function name> {
<code>
}
-This works like callfunc, and is used for cleaner and faster scripting.
+This works like callfunc(), and is used for cleaner and faster scripting.
The function must be defined and used within a script, and works like a
label with arguments.
Note that the name may only contain alphanumeric characters and underscore.
@@ -1886,21 +1899,22 @@ prontera,154,189,4 script Item Seller 767,{
function SF_Selling;
if (Zeny > 50) {
- mes "Welcome!";
+ mes("Welcome!");
/* Function call */
- SF_Selling;
+ SF_Selling();
+ } else {
+ mes("You need 50z, sorry!");
}
- else mes "You need 50z, sorry!";
- close;
+ close();
/* Function definition */
function SF_Selling {
- mes "Would you like to buy a phracon for 50z?";
- next;
- if(select("Yes","No, thanks") == 1) {
+ mes("Would you like to buy a phracon for 50z?");
+ next();
+ if (select("Yes", "No, thanks") == 1) {
Zeny -= 50;
- getitem 1010,1;
- mes "Thank you!";
+ getitem(Phracon, 1);
+ mes("Thank you!");
}
return;
}
@@ -1912,17 +1926,17 @@ prontera,150,150,0 script TestNPC 123,{
/* Function declaration */
function MyAdd;
- mes "Enter two numbers.";
- next;
- input .@a;
- input .@b;
+ mes("Enter two numbers.");
+ next();
+ input(.@a);
+ input(.@b);
/* Function call */
- mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
- close;
+ mes(.@a+" + "+.@b+" = "+MyAdd(.@a, .@b));
+ close();
/* Function definition */
function MyAdd {
- return getarg(0)+getarg(1);
+ return(getarg(0)+getarg(1));
}
}
@@ -1937,20 +1951,19 @@ It returns 1 if function is found, or 0 if it isn't.
Example:
function script try {
- dothat;
+ dothat();
}
- script test FAKE_NPC,{
.@try = is_function("try"); // 1
- .@not = is_function("not"); // 0
+ .@not = is_function("notafunction"); // 0
}
---------------------------------------
-*if (<condition>) <statement>;
+*if (<condition>) <statement or block>
-This is the basic conditional statement command, and just about the only
-one available in this scripting language.
+This is the basic conditional command.
The condition can be any expression. All expressions resulting in a
non-zero value will be considered True, including negative values. All
@@ -1959,138 +1972,147 @@ expressions resulting in a zero are false.
If the expression results in True, the statement will be executed. If it
isn't true, nothing happens and we move on to the next line of the script.
- if (1) mes "This will always print.";
- if (0) mes "And this will never print.";
- if (5) mes "This will also always print.";
- if (-1) mes "Funny as it is, this will also print just fine.";
+ if (true)
+ mes("This will always print.");
+ if (0)
+ mes("And this will never print.");
+ if (5)
+ mes("This will also always print.");
+ if (-1)
+ mes("Funny as it is, this will also print just fine.");
For more information on conditional operators see the operators section
above.
Anything that is returned by a function can be used in a condition check
without bothering to store it in a specific variable:
- if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
+ if (strcharinfo(PC_NAME) == "Daniel Jackson")
+ mes("It is true, you are Daniel!");
More examples of using the 'if' command in the real world:
Example 1:
.@var1 = 1;
- input .@var2;
+ input(.@var2);
if (.@var1 == .@var2)
- close;
- mes "Sorry that is wrong";
- close;
+ close();
+ mes("Sorry that is wrong");
+ close();
Example 2:
.@var1 = 1;
- input .@var2;
+ input(.@var2);
if (.@var1 != .@var2)
- mes "Sorry that is wrong";
- close;
+ mes("Sorry that is wrong");
+ close();
(Notice examples 1 and 2 have the same effect.)
Example 3:
- ++.@var1;
- mes "[Forgetfull Man]";
- if (.@var == 1) mes "This is the first time you have talked to me";
- if (.@var == 2) mes "This is the second time you have talked to me";
- if (.@var == 3) mes "This is the third time you have talked to me";
- if (.@var == 4) mes "This is the forth time you have talked to me, but I think I am getting amnesia, I have forgotten about you";
- if (.@var == 4) .@var = 0;
- close;
+ ++@var1;
+ mes("[Forgetfull Man]");
+ if (@var == 1)
+ mes("This is the first time you have talked to me");
+ if (@var == 2)
+ mes("This is the second time you have talked to me");
+ if (@var == 3)
+ mes("This is the third time you have talked to me");
+ if (@var == 4)
+ mes("This is the forth time you have talked to me, but I think I am getting amnesia, I have forgotten about you");
+ if (@var == 4)
+ @var = 0;
+ close();
Example 4:
- mes "[Quest Person]";
+ mes("[Quest Person]");
// The (AegisName) constant Apple comes from item_db, it is the item number 512.
if (countitem(Apple) >= 1) {
- mes "Oh an apple, I didn't want it, I just wanted to see one";
- close;
+ mes("Oh an apple, I didn't want it, I just wanted to see one");
+ close();
}
- mes "Can you please bring me an apple?";
- close;
+ mes("Can you please bring me an apple?");
+ close();
Example 5: Using complex conditions.
- mes "[Multi Checker]";
+ mes("[Multi Checker]");
if ((queststarted == 1) && (countitem(Apple) >= 5)) {
// Executed only if the quest has been started AND You have 5 apples
- mes "[Multi Checker]";
- mes "Well done you have started the quest of got me 5 apples";
- mes "Thank you";
+ mes("[Multi Checker]");
+ mes("Well done you have started the quest of got me 5 apples");
+ mes("Thank you");
queststarted = 0;
- delitem Apple, 5;
- close;
+ delitem(Apple, 5);
+ close();
}
- mes "Please get me 5 apples";
+ mes("Please get me 5 apples");
queststarted = 1;
- close;
+ close();
If the condition doesn't meet, it'll do the action following the else.
We can also group several actions depending on a condition, this way:
-if (<condition) {
- dothis1;
- dothis2;
- dothis3;
+if (<condition>) {
+ dothis1();
+ dothis2();
} else {
- dothat1;
- dothat2;
- dothat3;
- dothat4;
+ dothat1();
+ dothat2();
+ dothat3();
}
Example 6:
- mes "[Person Checker]";
+ mes("[Person Checker]");
if ($name$ == "") {
- mes "Please tell me someone's name";
- next;
- input $name$;
- $name2$ = strcharinfo(0);
- mes "[Person Checker]";
- mes "Thank you";
- close;
+ mes("Please tell me someone's name");
+ next();
+ input($name$);
+ $name2$ = strcharinfo(PC_NAME);
+ mes("[Person Checker]");
+ mes("Thank you");
+ close();
}
- if ($name$ == strcharinfo(0)) {
- mes "You are the person that " +$name2$+ " just mentioned";
- mes "nice to meet you";
+ if ($name$ == strcharinfo(PC_NAME)) {
+ mes("You are the person that " +$name2$+ " just mentioned");
+ mes("nice to meet you");
} else {
- mes "You are not the person that " +$name2$+ " mentioned";
+ mes("You are not the person that " +$name2$+ " mentioned");
}
$name$ = "";
$name2$ = "";
- close;
+ close();
-See 'strcharinfo' for explanation of what this function does.
+See strcharinfo() for explanation of what this function does.
Remember that if you plan to do several actions upon the condition being
false, and you forget to use the curly braces (the { } ), the second
action will be executed regardless the output of the condition, unless of
course, you stop the execution of the script if the condition is true
-(that is, in the first grouping using a return; , and end; or a close; ).
+(that is, in the first grouping using a return, and end or a close()).
Also, you can have multiple conditions nested or chained, and don't worry
about limits as to how many nested if you can have, there is no spoon ;).
...
-if (<condition 1>)
- dothis;
-else if (<condition 2>) {
- dotheother;
- do that;
+if (<condition 1>) {
+ dothis();
+} else if (<condition 2>) {
+ dotheother();
+ do_that();
end;
-} else
- do this;
+} else {
+ do_this();
+}
...
---------------------------------------
-*while (<condition>) <statement>;
+*while (<condition>) <statement or block>
This is probably the simplest and most frequently used loop structure. The
'while' statement can be interpreted as "while <condition> is true,
@@ -2105,34 +2127,34 @@ Multiple statements can be grouped with { }, curly braces, just like with
the 'if' statement.
Example 1:
- while (switch(select("Yes:No") == 2 ))
- mes "You picked no.";
+ while (switch(select("Yes", "No") == 2))
+ mes("You picked no.");
Example 2: multiple statements
- while (switch(select("Yes:No") == 2 )) {
- mes "Why did you pick no?";
- mes "You should pick yes instead!";
+ while (switch(select("Yes", "No") == 2 )) {
+ mes("Why did you pick no?");
+ mes("You should pick yes instead!");
}
Example 3: counter-controlled loop
.@i = 1;
while (.@i <= 5) {
- mes "This line will print 5 times.";
+ mes("This line will print 5 times.");
++.@i;
}
Example 4: sentinel-controlled loop
- mes "Input 0 to stop";
- input .@num;
+ mes("Input 0 to stop");
+ input(.@num);
while (.@num != 0) {
- mes "You entered " + .@num;
- input .@num;
+ mes("You entered " + .@num);
+ input(.@num);
}
- close;
+ close();
---------------------------------------
-*for (<variable initialization>; <condition>; <variable update>) <statement>;
+*for (<variable initialization>; <condition>; <variable update>) <statement or block>
Another pretest looping structure is the 'for' statement. It is considered
a specialized form of the 'while' statement, and is usually associated
@@ -2146,16 +2168,16 @@ reevaluated and the cycle continues.
Example 1:
for (.@i = 0; .@i < 5; ++.@i)
- mes "This line will print 5 times.";
+ mes("This line will print 5 times.");
Example 2:
- mes "This will print the numbers 1 - 5.";
+ mes("This will print the numbers 1 - 5.");
for (.@i = 1; .@i <= 5; ++.@i)
- mes .@i;
+ mes(.@i);
---------------------------------------
-*do { <statement>; } while (<condition>);
+*do { <statements>; } while (<condition>)
The 'do...while' is the only post-test loop structure available in this
script language. With a post-test, the statements are executed once before
@@ -2164,25 +2186,25 @@ repeated. When the condition is false, control is transferred to the
statement following the 'do...while' loop expression.
Example 1: sentinel-controlled loop
- mes "This menu will keep appearing until you pick Cancel";
+ mes("This menu will keep appearing until you pick Cancel");
do {
.@choice = select("One:Two:Three:Cancel");
} while (.@choice != 4);
Example 2: counter-controlled loop
- mes "This will countdown from 10 to 1.";
+ mes("This will countdown from 10 to 1.");
.@i = 10;
do {
- mes .@i--;
+ mes(.@i--);
} while (.@i > 0);
---------------------------------------
*freeloop(<toggle>)
-Toggling this to enabled (1) allows the script instance to bypass the
+Toggling this to enabled (true) allows the script instance to bypass the
infinite loop protection, allowing your script to loop as much as it may
-need. Disabling (0) may warn you if an infinite loop is detected if your
+need. Disabling (false) may warn you if an infinite loop is detected if your
script is looping too many times.
Please note, once again, that this isn't a solution to all problems, and by
@@ -2191,37 +2213,37 @@ unresponsive if the script it is used in is performing lenghty loop
operations.
Example:
- freeloop(1); // enable script to loop freely
+ freeloop(true); // enable script to loop freely
//Be aware with what you do here.
for (.@i = 0; .@i < .@bigloop; ++.@i) {
- dothis;
+ dothis();
// will sleep the script for 1ms when detect an infinity loop to
// let Hercules do what it need to do (socket, timer, process,
// etc.)
}
- freeloop(0); // disable
+ freeloop(false); // disable
for (.@i = 0; .@i < .@bigloop; ++.@i) {
- dothis;
+ dothis();
// throw an infinity loop error
}
---------------------------------------
-*setarray <array name>[<first value>],<value>{,<value>...<value>};
+*setarray(<array name>[<first value>], <value>{, <value>...<value>})
This command will allow you to quickly fill up an array in one go. Check
the Kafra scripts in the distribution to see this used a lot.
- setarray .@array[0], 100, 200, 300, 400, 500, 600;
+ setarray(.@array[0], 100, 200, 300, 400, 500, 600);
The index of the first element of the array to alter can be omitted if
zero. For example:
- setarray .@array, 200, 200, 200;
- setarray .@array[1], 300, 150;
+ setarray(.@array, 200, 200, 200);
+ setarray(.@array[1], 300, 150);
will produce:
@@ -2231,33 +2253,33 @@ will produce:
---------------------------------------
-*cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
+*cleararray(<array name>[<first value to alter>], <value>, <number of values to set>)
This command will change many array values at the same time to the same
value.
- setarray .@array, 100, 200, 300, 400, 500, 600;
+ setarray(.@array, 100, 200, 300, 400, 500, 600);
// This will make all 6 values 0
- cleararray .@array[0], 0, 6;
+ cleararray(.@array[0], 0, 6);
// This will make array element 0 change to 245
- cleararray .@array[0], 245, 1;
+ cleararray(.@array[0], 245, 1);
// This is equivalent to the above
- cleararray .@array, 245, 1;
+ cleararray(.@array, 245, 1);
// This will make elements 1 and 2 change to 345
- cleararray .@array[1], 345, 2;
+ cleararray(.@array[1], 345, 2);
See 'setarray'.
---------------------------------------
-*copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
+*copyarray(<destination array>[<first value>], <source array>[<first value>], <amount of data to copy>)
This command lets you quickly shuffle a lot of data between arrays, which
is in some cases invaluable.
- setarray .@array, 100, 200, 300, 400, 500, 600;
+ setarray(.@array, 100, 200, 300, 400, 500, 600);
// So we have made .@array[]
- copyarray .@array2[0],.@array[2],2;
+ copyarray(.@array2[0], .@array[2], 2);
// Now, .@array2[0] will be equal to .@array[2] (300) and
// .@array2[1] will be equal to .@array[3].
@@ -2269,7 +2291,7 @@ So using the examples above:
.@array[3] = 400
.@array[4] = 500
.@array[5] = 600
-
+
New Array:
.@array2[0] = 300
.@array2[1] = 400
@@ -2281,18 +2303,18 @@ and it will return a 0.
---------------------------------------
-*deletearray <array name>[<first value>],<how much to delete>;
+*deletearray(<array name>[<first value>], <how much to delete>)
This command will delete a specified number of array elements totally from
an array, shifting all the elements beyond this towards the beginning.
// This will delete array element 0, and move all the other array
// elements up one place.
- deletearray .@array[0],1
+ deletearray(.@array[0], 1);
// This would delete array elements numbered 1, 2 and 3, leave element 0
// in its place, and move the other elements ups, so there are no gaps.
- deletearray .@array[1],3
+ deletearray(.@array[1], 3);
If the amount of items to delete is not specified, all elements of the
array starting from the specified one to the end, are deleted. If no
@@ -2301,10 +2323,10 @@ deleted.
// This would delete all elements of the array starting from 2, leaving
// element 0 and 1
- deletearray .@array[2];
+ deletearray(.@array[2]);
// This would delete all elements of the array
- deletearray .@array;
+ deletearray(.@array);
---------------------------------------
//=====================================
@@ -2365,12 +2387,12 @@ counted towards this number.
For example:
- setarray .@array, 100, 200, 300, 400, 500, 600;
+ setarray(.@array, 100, 200, 300, 400, 500, 600);
.@arraysize = getarraysize(.@array);
This will make .@arraysize == 6. But if you try this:
- setarray .@array, 100, 200, 300, 400, 500, 600, 0;
+ setarray(.@array, 100, 200, 300, 400, 500, 600, 0);
.@arraysize = getarraysize(.@array);
.@arraysize will still equal 6, even though you've set 7 values.
@@ -2384,20 +2406,17 @@ If you do this:
---------------------------------------
-*getelementofarray(<array name>,<index>)
+*getelementofarray(<array name>, <index>)
This command retrieves the value of the element of given array at given
index. This is equivalent to using:
<array name>[<index>]
-The reason for this is, that this short form is internally converted into
-a call to getelementofarray, when the script is loaded.
-
Also useful when passing arrays to functions or accessing another npc's
arrays:
- getelementofarray(getarg(0),<index>)
- getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
+ getelementofarray(getarg(0), <index>)
+ getelementofarray(getvariableofnpc(.var, "testNPC"), <index>)
---------------------------------------
@@ -2419,28 +2438,28 @@ All of these also behave as variables, but don't expect to be able to just
Example 1:
// Returns how many status points you haven't spent yet.
- mes "Unused status points: "+readparam(9);
+ mes("Unused status points: "+readparam(9)); // [!]
Using this particular information as a function call is not required.
Typing this will return the same result:
- mes "Unused status points: "+StatusPoint;
+ mes("Unused status points: "+StatusPoint);
Example 2:
You can also use this command to get stat values.
if (readparam(bVit) > 77)
- mes "Only people with over 77 Vit are reading this!";
+ mes("Only people with over 77 Vit are reading this!");
Example 3:
// Display your current weight
- mes "Your current weight is "+( Weight/10 )+"/"+( MaxWeight/10 );
+ mes("Your current weight is "+ (Weight/10) + "/" + (MaxWeight/10));
---------------------------------------
-*getcharid(<type>{,"<character name>"})
+*getcharid(<type>{, "<character name>"})
This function will return a unique ID number of the invoking character,
or, if a character name is specified, of that player.
@@ -2463,13 +2482,14 @@ the character is not found, 0 is returned.
If getcharid(0) returns a zero, the script got called not by a character
and doesn't have an attached RID. Note that this will cause the map server
to print "player not attached!" error messages, so it is preferred to use
-"playerattached" to check for the character attached to the script.
+playerattached() to check for the character attached to the script.
-if( getcharid(2) == 0 ) mes "Only members of a guild are allowed here!";
+ if (getcharid(2) == 0)
+ mes("Only members of a guild are allowed here!");
---------------------------------------
-*getnpcid(<type>{,"<npc name>"});
+*getnpcid(<type>{, "<npc name>"})
Retrieves IDs of the currently invoked NPC. If a unique npc name is given,
IDs of that NPC are retrieved instead. Type specifies what ID to retrieve
@@ -2488,14 +2508,16 @@ If an invalid type is given or the NPC does not exist, 0 is returned.
These functions return the character ID of the attached player's child,
mother, mother, or father, respectively. It returns 0 if no ID is found.
- if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
+ if (getmotherid() != 0)
+ mes("Your mother's ID is: "+getmotherid());
---------------------------------------
*ispartneron()
-This function returns 1 if the invoking character's marriage partner is
-currently online and 0 if they are not or if the character has no partner.
+This function returns true if the invoking character's marriage partner
+is currently online and false if they are not or if the character has no
+partner.
---------------------------------------
@@ -2505,8 +2527,10 @@ This function returns the character ID of the invoking character's
marriage partner, if any. If the invoking character is not married, it
will return 0, which is a quick way to see if they are married:
- if (!getpartnerid()) mes "I'm not going to be your girlfriend!";
- if (getpartnerid()) mes "You're married already!";
+ if (getpartnerid() == 0)
+ mes("I'm not going to be your girlfriend!");
+ else
+ mes("You're married already!");
---------------------------------------
@@ -2519,11 +2543,11 @@ Lets say the ID of a party was saved as a global variable:
// This would return the name of the party from the ID stored in a
// variable
- mes "You're in the '"+getpartyname($@var)+"' party, I know!";
+ mes("You're in the '"+getpartyname($@var)+"' party, I know!");
---------------------------------------
-*getpartymember <party id>{,<type>};
+*getpartymember(<party id>{, <type>})
This command will find all members of a specified party and returns their
names (or character id or account id depending on the value of "type")
@@ -2564,7 +2588,7 @@ return 7 in this case.
Example 1: list party member names
// get the party member names
- getpartymember getcharid(1),0;
+ getpartymember(getcharid(1), 0);
// It's a good idea to copy the global temporary $@partymember*****
// variables to your own scope variables because if you have pauses in
@@ -2572,26 +2596,26 @@ Example 1: list party member names
// prompt), another player could click this NPC, trigger
// 'getpartymember', and overwrite the $@partymember***** variables.
.@count = $@partymembercount;
- copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
+ copyarray(.@name$[0], $@partymembername$[0], $@partymembercount);
// list the party member names
for (.@i = 0; .@i < .@count; ++.@i) {
- mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
+ mes((.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000");
}
- close;
+ close();
-Example 2: check party count (with a 'next' pause), before warping to event
+Example 2: check party count (with a next() pause), before warping to event
.register_num = 5; // How many party members are required?
// get the charID and accountID of character's party members
- getpartymember getcharid(1), 1;
- getpartymember getcharid(1), 2;
+ getpartymember(getcharid(1), 1);
+ getpartymember(getcharid(1), 2);
if ($@partymembercount != .register_num) {
- mes "Please form a party of "+ .register_num +" to continue";
- close;
+ mes("Please form a party of "+ .register_num +" to continue");
+ close();
}
// loop through both and use 'isloggedin' to count online party members
@@ -2605,40 +2629,40 @@ Example 2: check party count (with a 'next' pause), before warping to event
// their online char twice.
if (.@count_online != .register_num) {
- mes "All your party members must be online to continue";
- close;
+ mes("All your party members must be online to continue");
+ close();
}
// copy the array to prevent players cheating the system
- copyarray .@partymembercid, $@partymembercid, .register_num;
+ copyarray(.@partymembercid, $@partymembercid, .register_num);
- mes "Are you ready?";
- next; // careful here
- select "Yes";
+ mes("Are you ready?");
+ next(); // careful here
+ select("Yes");
// When a script hits a next, menu, sleep or input that pauses the
// script, players can invite or /leave and make changes in their
// party. To prevent this, we call getpartymember again and compare
// with the original values.
- getpartymember getcharid(1), 1;
+ getpartymember(getcharid(1), 1);
if ($@partymembercount != .register_num) {
- mes "You've made changes to your party !";
- close;
+ mes("You've made changes to your party !");
+ close();
}
for (.@i = 0; .@i < $@partymembercount; ++.@i) {
if (.@partymembercid[.@i] != $@partymembercid[.@i]) {
- mes "You've made changes to your party !";
- close;
+ mes("You've made changes to your party !");
+ close();
}
}
// Finally, it's safe to start the event!
- warpparty "event_map", 0,0, getcharid(1);
+ warpparty("event_map", 0, 0, getcharid(1));
---------------------------------------
-*getpartyleader(<party id>{,<type>})
+*getpartyleader(<party id>{, <type>})
This function returns some information about the given party-id's leader.
When type is omitted, the default information retrieved is the leader's
@@ -2688,11 +2712,11 @@ player is attached.
Examples:
// Outputs IP address of attached player.
- mes "Your IP: " + getcharip();
+ mes("Your IP: " + getcharip());
// Outputs IP address of character "Silver".
- mes "Silver's IP: " + getcharip("Silver");
-
+ mes("Silver's IP: " + getcharip("Silver"));
+
---------------------------------------
*sit({"<character name>"})
@@ -2706,7 +2730,7 @@ If no player is specified, the attached player will be used.
*issit({"<character name>"})
This function will return a number depending on the character's sitting state.
-If the character is sitting, it will return 1, otherwise (standing) it will return 0.
+If the character is sitting, it will return true, otherwise (standing) it will return false.
In case no player is specified, the function will return the state of the attached player.
---------------------------------------
@@ -2749,12 +2773,12 @@ for either slot.
Can be used to check if you have something equipped, or if you haven't got
something equipped:
- if(getequipid(EQI_HEAD_TOP) == Tiara) {
- mes "What a lovely Tiara you have on";
- close;
+ if (getequipid(EQI_HEAD_TOP) == Tiara) {
+ mes("What a lovely Tiara you have on");
+ close();
}
- mes "Come back when you have a Tiara on";
- close;
+ mes("Come back when you have a Tiara on");
+ close();
You can also use it to make sure people don't pass a point before removing
an item totally from them. Let's say you don't want people to wear Legion
@@ -2762,16 +2786,16 @@ Plate armor, but also don't want them to equip if after the check, you
would do this:
if (getequipid(EQI_ARMOR) == Full_Plate_Armor || getequipid(EQI_ARMOR) == Full_Plate_Armor_) {
- mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
- close;
+ mes("You are wearing some Legion Plate Armor, please drop that in your stash before continuing");
+ close();
}
if (countitem(Full_Plate_Armor) > 0 || countitem(Full_Plate_Armor_) > 0) {
- mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
- close;
+ mes("You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing");
+ close();
}
- mes "I will lets you pass";
- close2;
- warp "place",50,50;
+ mes("I will lets you pass");
+ close2();
+ warp("place", 50, 50);
end;
---------------------------------------
@@ -2783,12 +2807,12 @@ the invoking character, or an empty string if nothing is equipped in that
position.
Does the same thing as getitemname(getequipid()). Useful for an NPC to
state what your are wearing, or maybe saving as a string variable.
-See 'getequipid' for a full list of valid equipment slots.
+See getequipid() for a full list of valid equipment slots.
- if( getequipname(EQI_HEAD_TOP) != "" )
- mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
+ if (getequipid(EQI_HEAD_TOP) != 0)
+ mes("So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head");
else
- mes "You are not wearing a head gear";
+ mes("You are not wearing a head gear");
---------------------------------------
@@ -2810,10 +2834,10 @@ first one found, 2 will return the second one, etc. Will return 0 if no
such item is found.
// Let's see if they have anything broken:
- if (getbrokenid(1)==0)
- mes "You don't have anything broken, quit bothering me.";
+ if (getbrokenid(1) == 0)
+ mes("You don't have anything broken, quit bothering me.");
else // They do, so let's print the name of the first broken item:
- mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
+ mes("Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!");
---------------------------------------
@@ -2831,30 +2855,30 @@ specified equipment slot and 0 otherwise. For a list of equipment slots
see 'getequipid'. Function originally used by the refining NPCs:
if (getequipisequiped(EQI_HEAD_TOP)) {
- mes "[Refiner]";
- mes "That's a fine hat you are wearing there...";
- close;
+ mes("[Refiner]");
+ mes("That's a fine hat you are wearing there...");
+ close();
}
- mes "[Refiner]";
- mes "Do you want me to refine your dumb head?";
- close;
+ mes("[Refiner]");
+ mes("Do you want me to refine your dumb head?");
+ close();
---------------------------------------
*getequipisenableref(<equipment slot>)
-Will return 1 if the item equipped on the invoking character in the
-specified equipment slot is refinable, and 0 if it isn't. For a list of
-equipment slots see 'getequipid'.
+Will return true if the item equipped on the invoking character in the
+specified equipment slot is refinable, and false if it isn't. For a list
+of equipment slots see getequipid().
if (getequipisenableref(EQI_HEAD_TOP)) {
- mes "[Refiner]";
- mes "Ok I can refine this";
- close;
+ mes("[Refiner]");
+ mes("Ok I can refine this");
+ close();
}
- mes "[Refiner]";
- mes "I can't refine this hat!...";
- close;
+ mes("[Refiner]");
+ mes("I can't refine this hat!...");
+ close();
---------------------------------------
@@ -2866,11 +2890,10 @@ equipment slot. For a list of equipment slots see 'getequipid'.
Can be used to check if you have reached a maximum refine value, default
for this is +10:
- if(getequiprefinerycnt(EQI_HEAD_TOP) < 10)
- mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
+ if (getequiprefinerycnt(EQI_HEAD_TOP) < 10)
+ mes("I will now upgrade your "+getequipname(EQI_HEAD_TOP));
else
- mes "Sorry, it's not possible to refine hats better than +10";
- close;
+ mes("Sorry, it's not possible to refine hats better than +10");
---------------------------------------
@@ -2891,26 +2914,50 @@ Examples:
// Right hand can only contain a weapon.
switch (getequipweaponlv(EQI_HAND_R)) {
- case 1: mes "You are holding a lvl 1 weapon."; break;
- case 2: mes "You are holding a lvl 2 weapon."; break;
- case 3: mes "You are holding a lvl 3 weapon."; break;
- case 4: mes "You are holding a lvl 4 weapon."; break;
- case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
- default: mes "Seems you don't have a weapon on."; break;
+ case 1:
+ mes("You are holding a lvl 1 weapon.");
+ break;
+ case 2:
+ mes("You are holding a lvl 2 weapon.");
+ break;
+ case 3:
+ mes("You are holding a lvl 3 weapon.");
+ break;
+ case 4:
+ mes("You are holding a lvl 4 weapon.");
+ break;
+ case 5:
+ mes("You are holding a lvl 5 weapon, hm, must be a custom design...");
+ break;
+ default:
+ mes("Seems you don't have a weapon on.");
+ break;
}
// Left hand can hold either a weapon or shield.
if (getequipid(EQI_HAND_R) == 0) {
- mes "Seems you have nothing equipped here.";
- close;
+ mes("Seems you have nothing equipped here.");
+ close();
}
switch (getequipweaponlv(EQI_HAND_L)) {
- case 0: mes "You are holding a shield, so it doesn't have a level."; break;
- case 1: mes "You are holding a lvl 1 weapon."; break;
- case 2: mes "You are holding a lvl 2 weapon."; break;
- case 3: mes "You are holding a lvl 3 weapon."; break;
- case 4: mes "You are holding a lvl 4 weapon."; break;
- case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
+ case 0:
+ mes("You are holding a shield, so it doesn't have a level.");
+ break;
+ case 1:
+ mes("You are holding a lvl 1 weapon.");
+ break;
+ case 2:
+ mes("You are holding a lvl 2 weapon.");
+ break;
+ case 3:
+ mes("You are holding a lvl 3 weapon.");
+ break;
+ case 4:
+ mes("You are holding a lvl 4 weapon.");
+ break;
+ case 5:
+ mes("You are holding a lvl 5 weapon, hm, must be a custom design...");
+ break;
}
---------------------------------------
@@ -2921,7 +2968,7 @@ This function calculates and returns the percent value chance to
successfully refine the item found in the specified equipment slot of the
invoking character by +1. There is no actual formula, the success rate for
a given weapon level of a certain refine level is found in the
-db/refine_db.txt file. For a list of equipment slots see 'getequipid'.
+db/refine_db.txt file. For a list of equipment slots see getequipid().
These values can be displayed for the player to see, or used to calculate
the random change of a refine succeeding or failing and then going through
@@ -2930,11 +2977,11 @@ with it (which is what the official NPC refinery scripts use it for).
// This will find a random number from 0 - 99 and if that is equal to or
// more than the value recovered by this command it will show a message
if (getequippercentrefinery(EQI_HAND_L) <= rand(100))
- mes "Aww";
+ mes("Aww");
---------------------------------------
-*getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
+*getareadropitem("<map name>", <x1>, <y1>, <x2>, <y2>, <item>)
This function will count all the items with the specified ID number lying
on the ground on the specified map within the x1/y1-x2/y2 square on it and
@@ -2945,7 +2992,7 @@ or a number! If it's a number, it means that only the items with that item
ID number will be counted. If it is a string, it is assumed to mean the
'english name' field from the item database. If you give it an empty
string, or something that isn't found from the item database, it will
-count items number '512' (apples).
+count items number 512 (Apple).
---------------------------------------
@@ -2957,7 +3004,7 @@ for a list of possible equipment slots.
---------------------------------------
-*getinventorylist;
+*getinventorylist()
This command sets a bunch of arrays with a complete list of whatever the
invoking character has in its inventory, including all the data needed to
@@ -2989,12 +3036,12 @@ Notice that the variables this command generates are all temporary,
attached to the character, and integer.
Be sure to use @inventorylist_count to go through these arrays, and not
-'getarraysize', because the arrays are not automatically cleared between
-runs of 'getinventorylist'.
+getarraysize(), because the arrays are not automatically cleared between
+runs of getinventorylist().
---------------------------------------
-*getcartinventorylist;
+*getcartinventorylist()
This command sets a bunch of arrays with a complete list of whatever the
invoking character has in its cart_inventory, including all the data needed to
@@ -3009,10 +3056,10 @@ recreate these items perfectly if they are destroyed. Here's what you get:
@cartinventorylist_card2[] items. These data slots are also used to store
@cartinventorylist_card3[] names inscribed on the items, so you can
@cartinventorylist_card4[] explicitly check if the character owns an item
- made by a specific craftsman.
+ made by a specific craftsman.
@cartinventorylist_expire[] - expire time (Unix time stamp). 0 means never
- expires.
-@cartinventorylist_bound - whether it is an account bounded item or not.
+ expires.
+@cartinventorylist_bound - whether it is an account bound item or not.
@cartinventorylist_count - the number of items in these lists.
This could be handy to save/restore a character's cart_inventory, since no
@@ -3025,8 +3072,8 @@ Notice that the variables this command generates are all temporary,
attached to the character, and integer.
Be sure to use @cartinventorylist_count to go through these arrays, and not
-'getarraysize', because the arrays are not automatically cleared between
-runs of 'getcartinventorylist'.
+getarraysize(), because the arrays are not automatically cleared between
+runs of getcartinventorylist().
---------------------------------------
@@ -3036,7 +3083,8 @@ This function will return the number of cards inserted into the weapon
currently equipped on the invoking character.
While this function was meant for item scripts, it will work outside them:
- if (cardscnt()==4) mes "So you've stuck four cards into that weapon, think you're cool now?";
+ if (cardscnt() == 4)
+ mes("So you've stuck four cards into that weapon, think you're cool now?");
---------------------------------------
@@ -3045,7 +3093,8 @@ While this function was meant for item scripts, it will work outside them:
This function will return the refine count of the equipment from which
the function is called. This function is intended for use in item scripts.
- if (getrefine()==10) mes "Wow. That's a murder weapon.";
+ if (getrefine() == 10)
+ mes("Wow. That's a murder weapon.");
---------------------------------------
@@ -3064,7 +3113,7 @@ Example:
---------------------------------------
-*getiteminfo(<item ID>,<type>)
+*getiteminfo(<item ID>, <type>)
This function will look up the item with the specified ID number in the
database and return the info set by TYPE argument.
@@ -3084,11 +3133,11 @@ Check sample in doc/sample/getiteminfo.txt
---------------------------------------
-*getequipcardid(<equipment slot>,<card slot>)
+*getequipcardid(<equipment slot>, <card slot>)
Returns value for equipped item slot in the indicated slot (0, 1, 2, or 3).
-This function returns CARD ID, 255,254,-255 (for card 0, if the item is
+This function returns CARD ID, 255, 254, -255 (for card 0, if the item is
produced). It's useful for when you want to check whether an item contains
cards or if it's signed.
@@ -3098,7 +3147,7 @@ cards or if it's signed.
//=====================================
---------------------------------------
-*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search parameter>"})
+*getmapxy("<variable for map name>", <variable for x>, <variable for y>, <type>{, "<search parameter>"})
This function will locate a character object, NPC object or pet's
coordinates and place their coordinates into the variables specified when
@@ -3132,22 +3181,22 @@ is provided.
What a mess. Example, a working and tested one now:
prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
- mes "My name is Meh. I'm here so that Nyah can find me.";
- close;
+ mes("My name is Meh. I'm here so that Nyah can find me.");
+ close();
}
prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
- mes "My name is Nyah.";
- mes "I will now search for Meh all across the world!";
+ mes("My name is Nyah.");
+ mes("I will now search for Meh all across the world!");
if (getmapxy(.@mapname$, .@mapx, .@mapy, UNITTYPE_NPC, "Meh") != 0) {
- mes "I can't seem to find Meh anywhere!";
- close;
+ mes("I can't seem to find Meh anywhere!");
+ close();
}
- mes "And I found him on map "+.@mapname$+" at X:"+.@mapx+" Y:"+.@mapy+" !";
- close;
+ mes("And I found him on map "+.@mapname$+" at X:"+.@mapx+" Y:"+.@mapy+" !");
+ close();
}
-Notice that NPC objects disabled with 'disablenpc' will still be located.
+Notice that NPC objects disabled with disablenpc() will still be located.
---------------------------------------
@@ -3161,19 +3210,21 @@ account has no GM level.
This allows you to make NPC's only accessible for certain GM levels, or
behave specially when talked to by GMs.
- if (getgmlevel()) mes "What is your command, your godhood?";
- if (getgmlevel() < 99) end;
+ if (getgmlevel() > 0)
+ mes("What is your command, your godhood?");
+ if (getgmlevel() < 99)
+ end;
---------------------------------------
-*setgroupid(<new group id>{,"<character name>"|<account id>})
+*setgroupid(<new group id>{, "<character name>"|<account id>})
This function will temporary adjust the id of player group the account to which the
player specified if the new group id is available.
-Return 1 if success, otherwise it will return 0.
+Return true if successful, otherwise it will return false.
---------------------------------------
-
+
*getgroupid()
This function will return the id of player group the account to which the
@@ -3209,16 +3260,16 @@ Valid types:
It will only return numbers based on types.
Example :
if (gettime(GETTIME_WEEKDAY) == SATURDAY) {
- mes "It's a Saturday. I don't work on Saturdays.";
+ mes("It's a Saturday. I don't work on Saturdays.");
} else if (gettime(GETTIME_MONTH) == JANUARY) {
- mes "It's January. I don't work on January.";
+ mes("It's January. I don't work on January.");
} else if (gettime(GETTIME_MONTH) == OCTOBER && gettime(GETTIME_DAYOFMONTH) == 31) {
- mes "It's Halloween.";
+ mes("It's Halloween.");
}
---------------------------------------
-*gettimestr(<format string>,<max length>)
+*gettimestr(<format string>, <max length>)
This function will return a string containing time data as specified by
the format string.
@@ -3231,7 +3282,7 @@ Max length is the maximum length of a time string to generate.
The example given in Hercules sample scripts works like this:
- mes gettimestr("%Y-%m/%d %H:%M:%S",21);
+ mes(gettimestr("%Y-%m/%d %H:%M:%S", 21));
This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
@@ -3264,8 +3315,8 @@ Return -1 if the map name is invalid.
---------------------------------------
-*getareausers({"<map name>",}{<x1>,<y1>,<x2>,<y2>})
-*getareausers({"<map name>",}{<radius>})
+*getareausers({"<map name>", }{<x1>, <y1>, <x2>, <y2>})
+*getareausers({"<map name>", }{<radius>})
This function will return the count of connected characters which are
located within the specified area. Area can be x1/y1-x2/y2 square,
@@ -3282,11 +3333,11 @@ Examples:
---------------------------------------
-*getusersname;
+*getusersname();
This command will give the invoking character a list of names of the
connected characters (including themselves) into an NPC script message
-window (see 'mes') paging it by 10 names as if with the 'next' command.
+window (see 'mes') paging it by 10 names as if with the next() command.
You need to put a 'close' after that yourself.
@@ -3302,11 +3353,11 @@ This function returns a guild's name given an ID number. If there is no
such guild, "null" will be returned;
// Would print whatever guild 10007 name is.
- mes "The guild "+getguildname(10007)+" are all nice people.";
+ mes("The guild "+getguildname(10007)+" are all nice people.");
// This will do the same as above:
.@var = 10007;
- mes "We have some friends in "+getguildname(.@var)+", you know.";
+ mes("We have some friends in "+getguildname(.@var)+", you know.");
This is used all over the WoE controlling scripts. You could also use it
for a guild-based event.
@@ -3319,7 +3370,7 @@ This function return the name of the master of the guild which has the
specified ID number. If there is no such guild, "null" will be returned.
// Would return the guild master of guild 10007, whatever that might be.
- mes getguildmaster(10007)+" runs "+getguildname(10007);
+ mes(getguildmaster(10007)+" runs "+getguildname(10007));
Can be used to check if the character is the guild master of the specified
guild.
@@ -3328,15 +3379,15 @@ Maybe you want to make a room only guild masters can enter:
.@GID = getcharid(2);
if (.@GID == 0) {
- mes "Sorry you are not in a guild";
- close;
+ mes("Sorry you are not in a guild");
+ close();
}
- if (strcharinfo(0) == getguildmaster(.@GID)) {
- mes "Welcome guild master of "+GetGuildName(.@GID);
- close;
+ if (strcharinfo(PC_NAME) == getguildmaster(.@GID)) {
+ mes("Welcome guild master of "+getguildname(.@GID));
+ close();
}
- mes "Sorry you don't own the guild you are in";
- close;
+ mes("Sorry you don't own the guild you are in");
+ close();
---------------------------------------
@@ -3355,8 +3406,8 @@ that castle. The data is read from 'db/castle_db.txt'.
---------------------------------------
-*getcastledata("<map name>",<type of data>)
-*setcastledata "<map name>",<type of data>,<value>;
+*getcastledata("<map name>", <type of data>)
+*setcastledata("<map name>", <type of data>, <value>);
This function returns the castle ownership information for the castle
referred to by its map name. Castle information is stored in
@@ -3388,7 +3439,7 @@ scripts, with exception of:
- `defense` that is used in Guardians & Emperium HP calculations,
- `visibleG` that is always considered to hold guardian presence bits.
-The 'setcastledata' command will behave identically, but instead of
+The setcastledata() command will behave identically, but instead of
returning values for the specified types of accessible data, it will alter
them and cause them to be sent to the char-server for storage.
@@ -3397,8 +3448,8 @@ recalculating guardians' HP.
---------------------------------------
-*getgdskilllv(<guild id>,<skill id>)
-*getgdskilllv(<guild id>,"<skill name>")
+*getgdskilllv(<guild id>, <skill id>)
+*getgdskilllv(<guild id>, "<skill name>")
This function returns the level of the skill <skill id> of the guild
<guild id>.
@@ -3409,7 +3460,7 @@ GD_* are guild skills
---------------------------------------
-*requestguildinfo <guild id>{,"<event label>"};
+*requestguildinfo(<guild id>{, "<event label>"});
This command requests the guild data from the char server and merrily
continues with the execution. Whenever the guild information becomes
@@ -3419,17 +3470,17 @@ server to reply) it will run the specified event as in a 'doevent' call.
---------------------------------------
-*getmapguildusers(<mapname>,<guild id>)
+*getmapguildusers(<mapname>, <guild id>)
Returns the amount of characters from the specified guild on the given map.
Example:
-mes "You have "+getmapguildusers("prontera",getcharid(2))+" guild members in Prontera.";
+ mes("You have "+getmapguildusers("prontera", getcharid(2))+" guild members in Prontera.");
---------------------------------------
-*getguildmember <guild id>{,<type>};
+*getguildmember(<guild id>{, <type>});
This command will find all members of a specified guild and returns their names
(or character id or account id depending on the value of "type") into an array
@@ -3455,9 +3506,9 @@ The guild members will be found regardless of whether they are online or offline
Note that the names come in no particular order.
Be sure to use $@guildmembercount to go through this array, and not
-'getarraysize', because it is not cleared between runs of 'getguildmember'.
+getarraysize(), because it is not cleared between runs of getguildmember().
-For usage examples, see 'getpartymember'.
+For usage examples, see getpartymember().
---------------------------------------
//=====================================
@@ -3480,28 +3531,28 @@ Example 1:
if (getskilllv(TF_THROWSTONE)) {
// TF_THROWSTONE is defined in skill_db.txt and its value is 152
- mes "You have got the skill Throw Stone";
- close;
+ mes("You have got the skill Throw Stone");
+ close();
}
- mes "You don't have Throw Stone";
- close;
+ mes("You don't have Throw Stone");
+ close();
Example 2:
if (getskilllv(AL_HEAL) == 10) {
- mes "Your heal lvl has been maxed";
- close;
+ mes("Your heal lvl has been maxed");
+ close();
}
if (getskilllv(AL_HEAL) >= 5) {
- mes "Your heal lvl is 5 or more";
- close;
+ mes("Your heal lvl is 5 or more");
+ close();
}
- mes "You heal skill is below lvl 5";
- close;
+ mes("You heal skill is below lvl 5");
+ close();
---------------------------------------
-*getskilllist;
+*getskilllist();
This command sets a bunch of arrays with a complete list of skills the
invoking character has. Here's what you get:
@@ -3511,7 +3562,7 @@ invoking character has. Here's what you get:
@skilllist_flag[] - see 'skill' for the meaning of skill flags.
@skilllist_count - number of skills in the above arrays.
-While 'getskilllv' is probably more useful for most situations, this is the
+While getskilllv() is probably more useful for most situations, this is the
easiest way to store all the skills and make the character something else
for a while. Advanced job for a day? :) This could also be useful to see
how many skills a character has.
@@ -3555,7 +3606,7 @@ Example:
---------------------------------------
-*getmonsterinfo(<mob ID>,<type>)
+*getmonsterinfo(<mob ID>, <type>)
This function will look up the monster with the specified ID number in the
mob database and return the info set by TYPE argument.
@@ -3605,7 +3656,7 @@ was updated), and 0 otherwise (there were no free item drop slots).
Example:
// Add Poring Doll (741) to the Poring's (1002) drops, with 1% (100) rate
- addmonsterdrop(1002, 741, 100);
+ addmonsterdrop(PORING, Poring_Doll, 100);
---------------------------------------
@@ -3615,12 +3666,13 @@ This command will temporarily remove a drop from an existing monster.
Both the monster and the item must be valid.
-Return value will be 1 in case of success (the item was removed), and 0
-otherwise (the monster didn't have the specified item in its drop list).
+Return value will be true in case of success (the item was removed), and
+false otherwise (the monster didn't have the specified item in its drop
+list).
Example:
// Remove Jellopy (909) from the Poring's (1002) drops
- delmonsterdrop(1002, 909);
+ delmonsterdrop(PORING, Jellopy);
---------------------------------------
@@ -3628,7 +3680,8 @@ Example:
This command will find all drops of the specified mob and return the item
IDs and drop percentages into arrays of temporary global variables.
-'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
+getmobdrops() returns true if successful and false if the mob ID doesn't
+exist.
Upon executing this,
@@ -3649,57 +3702,57 @@ overwriting the values instead. So in addition to returning the 5 item
drops, the 6th and 7th elements from the last call remain, and you will
get 5+2 item drops, of which the last 2 don't belong to the new mob.
$@MobDrop_count will always contain the correct number (5), unlike
-'getarraysize()' which would return 7 in this case.
+getarraysize() which would return 7 in this case.
Example:
// get a Mob ID from the user
- input .@mob_id;
+ input(.@mob_id);
- if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
+ if (getmobdrops(.@mob_id)) { // getmobdrops() returns true on success
// immediately copy global temporary variables into scope
- // variables, since we don't know when 'getmobdrops' will get
+ // variables, since we don't know when getmobdrops() will get
// called again for another mob, overwriting your global temporary
// variables.
.@count = $@MobDrop_count;
- copyarray .@item[0],$@MobDrop_item[0],.@count;
- copyarray .@rate[0],$@MobDrop_rate[0],.@count;
+ copyarray(.@item[0], $@MobDrop_item[0], .@count);
+ copyarray(.@rate[0], $@MobDrop_rate[0], .@count);
- mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
+ mes(getmonsterinfo(.@mob_id, MOB_NAME) + " - " + .@count + " drops found:");
for (.@i = 0; .@i < .@count; ++.@i) {
- mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
+ mes(.@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%");
}
} else {
- mes "Unknown monster ID.";
+ mes("Unknown monster ID.");
}
- close;
+ close();
---------------------------------------
*skillpointcount()
Returns the total amount of skill points a character possesses
-(SkillPoint+SP's used in skills) This command can be used to check the
-currently attached characters total amount of skill points. This means the
-skill points used in skill are counted, and added to SkillPoints (number
-of skill points not used).
+(SkillPoint + skill points used in skills) This command can be used to
+check the currently attached characters total amount of skill points.
+This means the skill points used in skill are counted, and added to
+SkillPoints (number of skill points not used).
Example:
//This will set the temp character variable @skill_points to the amount of
//skill points, and then tell the player the value.
@skill_points = skillpointcount();
- mes "You have "+@skill_points+" skill points in total!";
+ mes("You have "+@skill_points+" skill points in total!");
//Self-explanatory... :P
if (skillpointcount() > 20)
- mes "Wow, you have more then 20 Skill Points in total!";
+ mes("Wow, you have more then 20 Skill Points in total!");
This command does not count skills which are set as flag 3 (permamently
granted) (e.g. ALL_BUYING_STORE/ALL_INCCARRY).
---------------------------------------
-*getscrate(<effect type>,<base rate>{,<GID>})
+*getscrate(<effect type>, <base rate>{, <GID>})
This function will return the chance of a status effect affecting the
invoking character, in percent, modified by the their current defense
@@ -3730,48 +3783,49 @@ is actually their account ID.
---------------------------------------
-*isloggedin(<account id>{,<char id>})
+*isloggedin(<account id>{, <char id>})
-This function returns 1 if the specified account is logged in and 0 if
-they aren't. You can also pass the char_id to check for both account and
-char id.
+This function returns true if the specified account is logged in and
+false if they aren't. You can also pass the char_id to check for both
+account and char id.
---------------------------------------
-*checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
-*checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
-*checkweight2(<id_array>,<amount_array>);
+*checkweight(<item id>, <amount>{, <item id>, <amount>, <item id>, <amount>, ...})
+*checkweight("<item name>", <amount>{, "<item name>", <amount>, "<item name>", <amount>, ...})
+*checkweight2(<id_array>, <amount_array>)
-These functions will compute and return 1 if the total weight of the
-specified number of specific items does not exceed the invoking
-character's carrying capacity, and 0 otherwise. It is important to see if
-a player can carry the items you expect to give them, failing to do that
-may open your script up to abuse or create some very unfair errors.
+These functions will compute and return true if the total weight of the
+specified number of specific items does not exceed the invoking
+character's carrying capacity, and false otherwise. It is important to
+see if a player can carry the items you expect to give them, failing to
+do that may open your script up to abuse or create some very unfair
+errors.
The second function will check an array of items and amounts, and also
-returns 1 on success and 0 on failure.
+returns true on success and false on failure.
The functions, in addition to checking to see if the player is capable of
holding a set amount of items, also ensure the player has room in their
inventory for the item(s) they will be receiving.
-Like 'getitem', this function will also accept an 'english name' from the
-database as an argument.
+Like getitem(), this function will also accept an 'english name' from
+the database as an argument.
Example 1:
- if (checkweight(512,10)) {
- getitem 512,10;
+ if (checkweight(Apple, 10)) {
+ getitem(Apple, 10);
} else {
- mes "Sorry, you cannot hold this amount of apples!";
+ mes("Sorry, you cannot hold this amount of apples!");
}
Example 2:
- setarray .@item[0],512,513,514;
- setarray .@amount[0],10,5,5;
- if (!checkweight(.@item,.@amount)) {
- mes "Sorry, you cannot hold this amount of fruit!";
+ setarray(.@item[0], 512, 513, 514);
+ setarray(.@amount[0], 10, 5, 5);
+ if (!checkweight(.@item, .@amount)) {
+ mes("Sorry, you cannot hold this amount of fruit!");
}
---------------------------------------
@@ -3779,49 +3833,50 @@ Example 2:
*basicskillcheck()
This function will return the state of the configuration option
-'basic_skill_check' in 'conf/map/battle.conf'. Returns 1 if the option is
-enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
-it is by default, characters must have a certain number of basic skill levels
-to sit, request a trade, use emotions, etc. Making your script behave
-differently depending on whether the characters must actually have the skill to
-do all these things might in some cases be required.
+'basic_skill_check' in 'conf/map/battle.conf'. Returns true if the
+option is enabled and false if it isn't. If the 'basic_skill_check'
+option is enabled, which it is by default, characters must have a
+certain number of basic skill levels to sit, request a trade, use
+emotions, etc. Making your script behave differently depending on
+whether the characters must actually have the skill to do all these
+things might in some cases be required.
---------------------------------------
*checkoption(<option number>)
*checkoption1(<option number>)
*checkoption2(<option number>)
-*setoption <option number>{,<flag>};
+*setoption(<option number>{, <flag>});
-The 'setoption' series of functions check for a so-called option that is
+The setoption() series of functions check for a so-called option that is
set on the invoking character. 'Options' are used to store status
conditions and a lot of other non-permanent character data of the yes-no
-kind. For most common cases, it is better to use 'checkcart',
-'checkfalcon', 'checkpeco' and other similar functions, but there are some
-options which you cannot get at this way. They return 1 if the option is
-set and 0 if the option is not set.
+kind. For most common cases, it is better to use checkcart(),
+checkfalcon(), checkmount() and other similar functions, but there are
+some options which you cannot get at this way.
Option numbers valid for the first (option) version of this command are:
-0x000001 - Sight in effect.
-0x000002 - Hide in effect.
-0x000004 - Cloaking in effect.
-0x000008 - Cart number 1 present.
-0x000010 - Falcon present.
-0x000020 - Peco Peco present.
-0x000040 - GM Perfect Hide in effect.
-0x000080 - Cart number 2 present.
-0x000100 - Cart number 3 present.
-0x000200 - Cart number 4 present.
-0x000400 - Cart number 5 present.
-0x000800 - Orc head present.
-0x001000 - The character is wearing a wedding sprite.
-0x002000 - Ruwach is in effect.
-0x004000 - Chasewalk in effect.
-0x008000 - Flying or Xmas suit.
-0x010000 - Sighttrasher.
-0x100000 - Warg present.
-0x200000 - The character is riding a warg.
+0x000000 Option_Nothing - No options
+0x000001 Option_Sight - Sight in effect.
+0x000002 Option_Hide - Hide in effect.
+0x000004 Option_Cloak - Cloaking in effect.
+0x000008 - Cart number 1 present.
+0x000010 Option_Falcon - Falcon present.
+0x000020 Option_Riding - Peco Peco present.
+0x000040 Option_Invisible - GM Perfect Hide in effect.
+0x000080 - Cart number 2 present.
+0x000100 - Cart number 3 present.
+0x000200 - Cart number 4 present.
+0x000400 - Cart number 5 present.
+0x000800 Option_Orcish - Orc head present.
+0x001000 Option_Wedding - The character is wearing a wedding sprite.
+0x002000 - Ruwach is in effect.
+0x004000 Option_Chasewalk - Chasewalk in effect.
+0x008000 Option_Flying - Flying or Xmas suit.
+0x010000 - Sighttrasher.
+0x100000 Option_Wug - Warg present.
+0x200000 Option_Wugrider - The character is riding a warg.
Option numbers valid for the second version (opt1) of this command are:
@@ -3845,7 +3900,7 @@ Option numbers (except for opt1) are bit-masks - you can add them up to
check for several states, but the functions will return true if at least
one of them is in effect.
-'setoption' will set options on the invoking character. There are no
+setoption() will set options on the invoking character. There are no
second and third versions of this command, so you can only change the
values in the first list (cloak, cart, ruwach, etc). If flag is 1 (default
when omitted), the option will be added to what the character currently
@@ -3857,7 +3912,7 @@ list.
---------------------------------------
-*setcart {<type>};
+*setcart({<type>})
*checkcart()
If <type> is 0 this command will remove the cart from the character.
@@ -3866,14 +3921,15 @@ cart number <type> and will work regardless of whether the character is a
merchant class or not.
Note: the character needs to have the skill MC_PUSHCART to gain a cart.
-The accompanying function will return 1 if the invoking character has a
-cart (any kind of cart) and 0 if they don't.
+The accompanying function will return true if the invoking character has a
+cart (any kind of cart) and false if they don't.
- if (checkcart()) mes "But you already have a cart!";
+ if (checkcart())
+ mes("But you already have a cart!");
---------------------------------------
-*setfalcon {<flag>};
+*setfalcon({<flag>})
*checkfalcon()
If <flag> is 0 this command will remove the falcon from the character.
@@ -3882,17 +3938,18 @@ there regardless of whether the character is a hunter or not. It will
(probably) not have any useful effects for non-hunters though.
Note: the character needs to have the skill HT_FALCON to gain a falcon.
-The accompanying function will return 1 if the invoking character has a
-falcon and 0 if they don't.
+The accompanying function will return true if the invoking character has a
+falcon and false if they don't.
- if (checkfalcon()) mes "But you already have a falcon!";
+ if (checkfalcon())
+ mes("But you already have a falcon!");
---------------------------------------
-*setmount {<flag>};
+*setmount({<flag>})
*checkmount()
-If <flag> is MOUNT_NONE (or 0) this command will remove the mount from the
+If <flag> is MOUNT_NONE this command will remove the mount from the
character.
Otherwise it gives the invoking character the desired combat mount, where
@@ -3925,36 +3982,37 @@ The following flag values are accepted:
Unlike 'setfalcon' and 'setcart' this will not work at all if they aren't of a
class which can ride a mount.
-The accompanying function will return 0 if the invoking character is not on a
-mount, and a non-zero value (according to the above constants) if they are.
+The accompanying function will return MOUNT_NONE if the invoking
+character is not on a mount, and a non-zero value (according to the
+above constants) if they are.
Note: in case of dragons, the returned value will always be MOUNT_DRAGON,
regardless of color.
if (checkmount())
- mes "Leave your mount outside! No riding mounts on the floor here!";
+ mes("Leave your mount outside! No riding mounts on the floor here!");
if (checkmount() == MOUNT_DRAGON)
- mes "Wow, your dragon is cool! Can I pet it?";
+ mes("Wow, your dragon is cool! Can I pet it?");
---------------------------------------
-*setcashmount;
+*setcashmount()
*hascashmount()
The 'setcashmount' function toggles cash mount for the invoking character.
-It will return 1 if successful, 0 otherwise.
+It will return true if successful, false otherwise.
Note: Character must not be mounting a non-cash mount (eg. dragon, peco,
wug, etc.)
-The accompanying function will return 1 if the invoking character has a
-cash mount and 0 if they don't.
+The accompanying function will return true if the invoking character has a
+cash mount and false if they don't.
---------------------------------------
*checkwug()
-This function will return 1 if the invoking character has a warg and 0 if
+This function will return true if the invoking character has a warg and false if
they don't.
---------------------------------------
@@ -3970,17 +4028,17 @@ Return values for 'checkvending' are
1 = normal vending
2 = vending using @autotrade
-'checkchatting' returns 1 if they are in a chat room, 0 if they are not.
+checkchatting() returns true if they are in a chat room, false if they are not.
Examples:
//This will check if Aaron is vending, and if so, put a message in
//front of the attached player saying Aaron is vending.
if (checkvending("Aaron"))
- mes "Aaron is currently vending!";
+ mes("Aaron is currently vending!");
//This will check if the attached player in a chat room or not.
if (checkchatting())
- mes "You are currently in a chat room!";
+ mes("You are currently in a chat room!");
---------------------------------------
@@ -3995,8 +4053,8 @@ Name is optional, and defaults to the attached player if omitted.
*agitcheck2()
These function will let you check whether the server is currently in WoE
-mode (or WoE SE mode if the second function is called) and will return 1
-if War of Emperium is on and 0 if it isn't.
+mode (or WoE SE mode if the second function is called) and will return true
+if War of Emperium is on and false if it isn't.
---------------------------------------
@@ -4005,7 +4063,8 @@ if War of Emperium is on and 0 if it isn't.
This functions will return true or false depending on whether the server is in
night mode or day mode:
- if (!isnight()) mes "I only prowl in the night.";
+ if (!isnight())
+ mes("I only prowl in the night.");
---------------------------------------
//=====================================
@@ -4013,41 +4072,46 @@ night mode or day mode:
//=====================================
---------------------------------------
-*isequipped(<item id>{,<item id>{,<item id>{,<item id>}}})
+*isequipped(<item id>{, <item id>{, <item id>{, <item id>}}})
-This function will return 1 if the invoking character has all of the item
+This function will return true if the invoking character has all of the item
IDs given equipped (if card IDs are passed, then it checks if the cards
are inserted into slots in the equipment they are currently wearing).
Theoretically there is no limit to the number of items that may be tested
for at the same time.
-If even one of the items given is not equipped, 0 will be returned.
+If even one of the items given is not equipped, false will be returned.
- // (Poring,Santa Poring,Poporing,Marin)
- if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
+ // (Poring, Santa Poring, Poporing, Marin)
+ if (isequipped(Poring_Card, Poring__Card, Poporing_Card, Marin_Card))
+ mes("Wow! You're wearing a full complement of possible poring cards!");
// (Poring)
- if (isequipped(4001)) mes "A poring card is useful, don't you think?";
+ if (isequipped(Poring_Card))
+ mes("A poring card is useful, don't you think?");
// (Earring)
- if (isequipped(2622)) mes "You got a pair of nice Earring.";
+ if (isequipped(Earring_))
+ mes("You got a pair of nice Earring.");
The function was meant for item scripts to support the cards released by
Gravity in February 2005, but it will work just fine in normal NPC scripts.
---------------------------------------
-*isequippedcnt(<item id>{,<item id>{,<item id>{,<item id>}}})
+*isequippedcnt(<item id>{, <item id>{, <item id>{, <item id>}}})
-This function is similar to 'isequipped', but instead of 1 or 0, it will
+This function is similar to isequipped(), but instead of true or false, it will
return the number of equipped items/cards in the list given that were found on the
invoking character.
- if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
- if (isequippedcnt(5353,2622) == 2) mes "You equipped both Helm of Sun and Earring.";
+ if (isequippedcnt(Poring_Card, Poring__Card, Poporing_Card, Marin_Card) == 4)
+ mes("Finally got all four poring cards?");
+ if (isequippedcnt(Helm_Of_Sun_, Earring_) == 2)
+ mes("You equipped both Helm of Sun and Earring.");
---------------------------------------
*checkequipedcard(<card id>)
-This function will return 1 if the card specified by it's item ID number
+This function will return true if the card specified by it's item ID number
is inserted into any equipment they have in their inventory, currently
equipped or not.
@@ -4055,12 +4119,12 @@ equipped or not.
*getequipisidentify(<equipment slot>)
-This function will return 1 if an item in the specified equipment slot is
-identified and 0 if it isn't. Since you can't even equip unidentified
+This function will return true if an item in the specified equipment slot is
+identified and false if it isn't. Since you can't even equip unidentified
equipment, there's a question of whether it can actually end up there, and
-it will normally return 1 all the time if there is an item in this
+it will normally return true all the time if there is an item in this
equipment slot, which makes this script command kinda pointless.
-For a list of equipment slots see 'getequipid'.
+For a list of equipment slots see getequipid().
---------------------------------------
//=====================================
@@ -4075,15 +4139,15 @@ For a list of equipment slots see 'getequipid'.
---------------------------------------
*attachrid(<account ID>)
-*detachrid;
+*detachrid()
These commands allow the manipulation of the script's currently attached
-player. While attachrid allows attaching of a different player by using
-its account id for the parameter rid, detachrid makes the following
+player. While attachrid() allows attaching of a different player by using
+its account id for the parameter rid, detachrid() makes the following
commands run as if the script was never invoked by a player.
In case, that the player cannot be attached, such as, when the player went
-offline in the mean time, attachrid returns 0, otherwise 1.
+offline in the mean time, attachrid() returns false, otherwise true.
---------------------------------------
@@ -4093,14 +4157,14 @@ Converts rid to name. Note: The player/monster/NPC must be online/enabled.
Good for PCKillEvent where you can convert 'killedrid' to the name of the
player.
-Note: rid2name may not produce correct character names since rid means
+Note: rid2name() may not produce correct character names since RID means
account id.
It will return the current online character of the account only.
---------------------------------------
-*message <account ID>,"<message>";
-*message "<character name>","<message>";
+*message(<account ID>, "<message>")
+*message("<character name>", "<message>")
That command will send a message to the chat window of the character
specified by account ID or name. The text will also appear above the head
@@ -4108,7 +4172,7 @@ of that character. It will not be seen by anyone else.
---------------------------------------
-*dispbottom "<message>"{,<color>};
+*dispbottom("<message>"{, <color>})
This command will send the given message into the invoking character's
chat window. The color format is in RGB (0xRRGGBB), and default to green
@@ -4116,25 +4180,25 @@ if <color> field is left out.
---------------------------------------
-*showscript "<message>"{,<GID>};
+*showscript("<message>"{, <GID>})
Makes attached player or GID says a message like shouting a skill name, the message
will be seen to everyone around but not in chat window.
---------------------------------------
-*warp "<map name>",<x>,<y>{,<flag>};
+*warp("<map name>", <x>, <y>{, <flag>})
This command will take the invoking character to the specified map, and if
wanted, specified coordinates too, but these can be random.
- warp "place",50,55;
+ warp("place", 50, 55);
This would take them to X 50 Y 55 on the map called "place". If your X and
Y coordinates land on an unwalkable map square, it will send the warped
character to a random place. Same will happen if they are both zero:
- warp "place",0,0;
+ warp("place", 0, 0);
Notice that while warping people to coordinates 0,0 will normally get them
into a random place, it's not certain to always be so. Darned if I know
@@ -4152,7 +4216,7 @@ Gravity client if warp to other maps.
---------------------------------------
-*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
+*areawarp("<from map name>", <x1>, <y1>, <x2>, <y2>, "<to map name>", <x3>, <y3>{, <x4>, <y4>})
This command is similar to 'warp', however, it will not refer to the
invoking character, but instead, all characters within a specified area,
@@ -4160,105 +4224,106 @@ defined by the x1/y1-x2/y2 square, will be warped. Nobody outside the area
will be affected, including the activating character, if they are outside
the area.
- areawarp "place",10,10,120,120,"place2",150,150;
+ areawarp("place", 10, 10, 120, 120, "place2", 150, 150);
Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a
square shape, on the map called "place", will be affected, and warped to
"place2" X 150 Y 150.
- areawarp "place",10,10,120,120,"place2",0,0;
+ areawarp("place", 10, 10, 120, 120, "place2", 0, 0);
-By using ,0,0; as the destination coordinates it will take all the
+By using 0,0; as the destination coordinates it will take all the
characters in the affected area to a random set of co-ordinates on the
"place2" map.
- areawarp "place",10,10,120,120,"place2",150,150,200,200;
+ areawarp("place", 10, 10, 120, 120, "place2", 150, 150, 200, 200);
By using the optional x4 and y4 parameters, the destination coordinates
will be a random place within the defined x3/y3-x4/y4 square.
-Like 'warp', areawarp will also explicitly warp characters randomly into
+Like warp(), areawarp() will also explicitly warp characters randomly into
the current map if you give the 'to map name' as "Random".
-See also 'warp'.
+See also warp().
---------------------------------------
-
-*warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"};
-
+
+*warpparty("<to_mapname>", <x>, <y>, <party_id>, {"<from_mapname>"})
+
Warps a party to specified map and coordinate given the party ID, which
you can get with getcharid(1). You can also request another party id given
-a member's name with getcharid(1,<player_name>).
+a member's name with getcharid(1, <player_name>).
You can use the following "map names" for special warping behavior:
-Random: All party members are randomly warped in their current map
- (as if they all used a fly wing).
-SavePointAll: All party members are warped to their respective save point.
-SavePoint: All party members are warped to the save point of the
- currently attached player (will fail if there's no player
- attached).
-Leader: All party members are warped to the leader's position. The
- leader must be online and in the current map-server for this
- to work.
-
-If you specify a from_mapname, warpparty will only affect those on that
-map.
+Random: All party members are randomly warped in their current map
+ (as if they all used a fly wing).
+SavePointAll: All party members are warped to their respective save point.
+SavePoint: All party members are warped to the save point of the
+ currently attached player (will fail if there's no player
+ attached).
+Leader: All party members are warped to the leader's position. The
+ leader must be online and in the current map-server for
+ this to work.
+
+If you specify a from_mapname, warpparty() will only affect those on
+that map.
Example:
- mes "[Party Warper]";
- mes "Here you go!";
- close2;
+ mes("[Party Warper]");
+ mes("Here you go!");
+ close2();
.@id = getcharid(1);
- warpparty "prontera",150,100,.@id;
- close;
+ warpparty("prontera", 150, 100, .@id);
+ close();
---------------------------------------
-*warpchar "<mapname>",<x>,<y>,<char_id>;
+*warpchar("<mapname>", <x>, <y>, <char_id>)
Warps another player to specified map and coordinate given the char id,
-which you can get with getcharid(0,<player_name>). Obviously this is
+which you can get with getcharid(0, <player_name>). Obviously this is
useless if you want to warp the same player that is executing this script,
unless it's some kind of "chosen" script.
Example:
-warpchar "prontera",150,100,150001;
+ warpchar("prontera", 150, 100, 150001);
---------------------------------------
-*warpguild "<mapname>",<x>,<y>,<guild_id>;
+*warpguild("<mapname>", <x>, <y>, <guild_id>)
Warps a guild to specified map and coordinate given the guild id, which
you can get with getcharid(2). You can also request another guild id given
-the member's name with getcharid(2,<player_name>).
+the member's name with getcharid(2, <player_name>).
You can use the following "map names" for special warping behavior:
-Random: All guild members are randomly warped in their current map
- (as if they all used a fly wing)
-SavePointAll: All guild members are warped to their respective save point.
-SavePoint: All guild members are warped to the save point of the
- currently attached player (will fail if there's no player
- attached).
+Random: All guild members are randomly warped in their current map
+ (as if they all used a fly wing)
+SavePointAll: All guild members are warped to their respective save point.
+SavePoint: All guild members are warped to the save point of the
+ currently attached player (will fail if there's no player
+ attached).
Example:
-warpguild "prontera",x,y,Guild_ID;
+ warpguild("prontera", x, y, Guild_ID);
---------------------------------------
-*warppartner("<map name>",<x>,<y>);
+*warppartner("<map name>", <x>, <y>)
This function will find the invoking character's marriage partner, if any,
and warp them to the map and coordinates given. Go kidnap that spouse. :)
-It will return 1 upon success and 0 if the partner is not online, the
-character is not married, or if there's no invoking character (no RID).
+It will return true upon success and false if the partner is not online,
+the character is not married, or if there's no invoking character (no
+RID).
0,0 will, as usual, normally translate to random coordinates.
---------------------------------------
-*savepoint "<map name>",<x>,<y>;
+*savepoint("<map name>", <x>, <y>)
This command saves where the invoking character will return to upon
'return to save point', if dead or in some other cases. The two versions
@@ -4266,25 +4331,25 @@ are equivalent. Map name, X coordinate and Y coordinate should be
perfectly obvious. This ignores any and all map flags, and can make a
character respawn where no teleportation is otherwise possible.
- savepoint "place",350,75;
+ savepoint("place", 350, 75);
---------------------------------------
-*heal <hp>,<sp>;
+*heal(<hp>, <sp>)
This command will heal a set amount of HP and/or SP on the invoking
character.
- heal 30000,0; // This will heal 30,000 HP
- heal 0,30000; // This will heal 30,000 SP
- heal 300,300; // This will heal 300 HP and 300 SP
+ heal(30000, 0) // This will heal 30,000 HP
+ heal(0, 30000) // This will heal 30,000 SP
+ heal(300, 300) // This will heal 300 HP and 300 SP
This command just alters the hit points and spell points of the invoking
character and produces no other output whatsoever.
---------------------------------------
-*itemheal <hp>,<sp>;
+*itemheal(<hp>, <sp>)
This command heals given relative amounts of HP and/or SP on the invoking
character. Unlike heal, this command is intended for use in item scripts.
@@ -4292,63 +4357,58 @@ It applies potion-related bonuses, such as alchemist ranking, cards,
status changes.
It also applies a sp/vit-related bonus that is calculated by:
heal = heal*[(100+STATUS*2)/100]
-So if a player has 99 vit and the script is 'itemheal 5,0':
+So if a player has 99 vit and the script is 'itemheal 5, 0':
heal(hp) = 5*[(100+99*2)/100]
- heal(hp) = 14,9
+ heal(hp) = 14.9
heal(hp) = 14
heal(sp) = 0
When used inside an NPC script, potion-related bonuses are omitted.
-There is also a nice example on using this with the 'rand' function, to
+There is also a nice example on using this with the rand() function, to
give you a random amount of healing.
// If the player has 50 vit and no bonuses this will heal
// anything from 200 to 300 HP and 5 SP
- itemheal rand(100,150),5;
+ itemheal(rand(100, 150), 5);
---------------------------------------
-*percentheal <hp>,<sp>;
+*percentheal(<hp>, <sp>)
This command will heal the invoking character. It heals the character, but
not by a set value - it adds percent of their maximum HP/SP.
- percentheal 100,0; // This will heal 100% HP
- percentheal 0,100; // This will heal 100% SP
- percentheal 50,50; // This will heal 50% HP and 50% SP
+ percentheal(100, 0); // This will heal 100% HP
+ percentheal(0, 100); // This will heal 100% SP
+ percentheal(50, 50); // This will heal 50% HP and 50% SP
So the amount that this will heal will depend on the total amount of HP or
-SP you have maximum. Like 'heal', this will not call up any animations or
+SP you have maximum. Like heal(), this will not call up any animations or
effects.
---------------------------------------
-*recovery;
+*recovery()
This command will revive and restore full HP and SP to all characters
currently connected to the server.
---------------------------------------
-*jobchange <job number>{,<upper flag>};
+*jobchange(<job number>{, <upper flag>})
This command will change the job class of the invoking character.
- jobchange 1; // This would change your player into a Swordman
- jobchange 4002; // This would change your player into a Swordman High
+ jobchange(Job_Swordman); // This would change your player into a Swordman
+ jobchange(Job_Swordman_High); // This would change your player into a Swordman High
This command does work with numbers, but you can also use job names. The
full list of job names and the numbers they correspond to can be found in
'db/constants.conf'.
- // This would change your player into a Swordman
- jobchange Job_Swordman;
- // This would change your player into a Swordman High
- jobchange Job_Swordman_High;
-
'upper flag' can alternatively be used to specify the type of job one
-changes to. For example, jobchange Job_Swordman,1; will change the
+changes to. For example, jobchange(Job_Swordman, 1); will change the
character to a high swordsman. The upper values are:
-1 (or when omitted): preserves the current job type.
0: Normal/standard classes
@@ -4361,18 +4421,18 @@ before changing jobs, which can be checked for later in scripts.
---------------------------------------
-*jobname (<job number>)
+*jobname(<job number>)
-This command retrieves the name of the given job using the messages.conf
-entries 550 to 650.
+This command retrieves the name of the given job using the names defined
+in messages.conf.
- mes "[Kid]";
- mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
- close;
+ mes("[Kid]");
+ mes("I never thought I'd met a "+jobname(Class)+" here of all places.");
+ close();
---------------------------------------
-*eaclass ({<job number>})
+*eaclass({<job number>})
This commands returns the "eA job-number" corresponding to the given
class, and uses the invoking player's class if none is given. The eA
@@ -4383,19 +4443,19 @@ equivalent.
.@eac = eaclass();
if ((.@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
- mes "Your base job is Swordman.";
+ mes("Your base job is Swordman.");
if (.@eac&EAJL_UPPER)
- mes "You are a rebirth job.";
+ mes("You are a rebirth job.");
if ((.@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
- mes "You must be a Swordman, Baby Swordman or High Swordman.";
+ mes("You must be a Swordman, Baby Swordman or High Swordman.");
For more information on the eA Job System, see the docs/ea_job_system.txt
file.
---------------------------------------
-*roclass <job number> {,<gender>}
+*roclass(<job number> {, <gender>})
-Does the opposite of eaclass. That is, given an eA job-number, it returns
+Does the opposite of eaclass(). That is, given an eA job-number, it returns
the corresponding RO class number. A gender is required because both Bard
and Dancers share the same eA job-number (EAJ_BARDDANCER), and uses the
invoking player's gender if none is given (if no player is attached,
@@ -4406,19 +4466,19 @@ the baby version of a Taekwon class).
.@eac = eaclass();
//Check if class is already rebirth
if (.@eac&EAJL_UPPER) {
- mes "You look strong.";
- close;
+ mes("You look strong.");
+ close();
}
.@eac = roclass(.@eac|EAJL_UPPER);
//Check if class has a rebirth version
if (.@eac != -1) {
- mes "Bet you can't wait to become a "+jobname(.@eac)+"!";
- close;
+ mes("Bet you can't wait to become a "+jobname(.@eac)+"!");
+ close();
}
---------------------------------------
-*changebase <job ID number>;
+*changebase(<job ID number>)
This command will change the appearance of the invoking character to that
of a specified job class. Nothing but appearance will change.
@@ -4436,18 +4496,18 @@ Examples:
Job: 0xFFFFFFFE
Loc: 16
Script: <"
- bonus bMdef,15;
- changebase Job_Wedding;
+ bonus(bMdef, 15);
+ changebase(Job_Wedding);
">
},
-changebase Job_Novice; // Changes player to Novice sprite.
+changebase(Job_Novice); // Changes player to Novice sprite.
-changebase Class; // Changes player back to default sprite.
+changebase(Class); // Changes player back to default sprite.
---------------------------------------
-*classchange <view id>,<type>;
+*classchange(<view id>, <type>)
This command is very ancient, it's origins are clouded in mystery.
It will send a 'display id change' packet to everyone in the immediate
@@ -4470,7 +4530,7 @@ supposed to do, but this will only happen in a later Git revision.
---------------------------------------
-*changesex;
+*changesex()
This command will change the gender for the attached character's account.
If it was male, it will become female, if it was female, it will become
@@ -4484,22 +4544,22 @@ they will also have their skills reset upon 'changesex'.
---------------------------------------
-*changecharsex;
+*changecharsex()
-This command is exactly same as changesex, with an exception that,
+This command is exactly same as changesex(), with an exception that,
character sex will be changed instead of account sex.
Requires client 2014-10-22 or greater.
---------------------------------------
-*getexp <base xp>,<job xp>;
+*getexp(<base xp>, <job xp>)
This command will give the invoking character a specified number of base
and job experience points. Should be used as a quest reward. Negative values
won't work.
Is subject to EXP bonuses and to the `quest_exp_rate` config option.
- getexp 10000,5000;
+ getexp(10000, 5000);
You can also assign directly to the parameters defined in
'db/constants.conf':
@@ -4515,8 +4575,8 @@ When setting the parameters directly no bonuses or config options are applied.
---------------------------------------
-*setlook <look type>,<look value>;
-*changelook <look type>,<look value>;
+*setlook(<look type>, <look value>)
+*changelook(<look type>, <look value>)
'setlook' will alter the look data for the invoking character. It is used
mainly for changing the palette used on hair and clothes: you specify
@@ -4528,13 +4588,13 @@ the look value).
// This will change your hair(6), so that it uses palette 8, what ever
// your palette 8 is, your hair will use that color.
- setlook LOOK_HAIR_COLOR, 8;
+ setlook(LOOK_HAIR_COLOR, 8);
// This will change your clothes(7), so they are using palette 1,
// whatever your palette 1 is, your clothes will then use that set of
// colors.
- setlook LOOK_CLOTHES_COLOR, 1;
+ setlook(LOOK_CLOTHES_COLOR, 1);
Here are the possible look types:
@@ -4575,7 +4635,7 @@ installation that you can look at: 'npc/custom/stylist.txt'
---------------------------------------
-*pushpc <direction>,<cells>;
+*pushpc(<direction>, <cells>)
This command will push the currently attached player to given direction by
given amount of square cells. Direction is the same as used when declaring
@@ -4588,29 +4648,18 @@ due to a wall), the character is pushed only up to the obstacle.
// pushes the character 5 cells in 3 o'clock direction from it's
// current position.
- pushpc DIR_EAST, 5;
+ pushpc(DIR_EAST, 5);
---------------------------------------
-*get_version()
-
-This command will return the SVN revision number or Git SHA-1 hash the
-server is currently running on (depends on whether you used a SVN or Git
-client for getting Hercules).
-
- if ( get_version() >= 15000 )
- mes "Welcome to Hercules!";
-
----------------------------------------
-
-*montransform <monster id>,<duration>{,<sc_type>{,<val1>{,<val2>{,<val3>{,<val4>}}}}};
-*montransform "<monster name>",<duration>{,<sc_type>{,<val1>{,<val2>{,<val3>{,<val4>}}}}};
+*montransform(<monster id>, <duration>{, <sc_type>{, <val1>{, <val2>{, <val3>{, <val4>}}}}})
+*montransform("<monster name>", <duration>{, <sc_type>{, <val1>{, <val2>{, <val3>{, <val4>}}}}})
This command can transform your character into monster and you can still
use all your skills like a normal character.
Can only be removed when your killed or if you die or if duration is over.
-for sc_type,val1,val2,val3,val4, see 'sc_start','sc_start2','sc_start4' commands.
+for sc_type, val1, val2, val3, val4, see sc_start(), sc_start2(), sc_start4() commands.
---------------------------------------
//=====================================
@@ -4618,8 +4667,8 @@ for sc_type,val1,val2,val3,val4, see 'sc_start','sc_start2','sc_start4' commands
//=====================================
---------------------------------------
-*getitem <item id>,<amount>{,<account ID>};
-*getitem "<item name>",<amount>{,<account ID>};
+*getitem(<item id>, <amount>{, <account ID>})
+*getitem("<item name>", <amount>{, <account ID>})
This command will give a specific amount of specified items to the target
character. If the character is not online, nothing will happen.
@@ -4629,8 +4678,8 @@ character inventory instead.
In the first and most commonly used version of this command, items are
referred to by their database ID number found in 'db/(pre-)re/item_db.txt'.
- getitem 502,10 // The person will receive 10 apples
- getitem 617,1 // The person will receive 1 Old Violet Box
+ getitem(Apple, 10); // The person will receive 10 apples
+ getitem(Old_Violet_Box, 1); // The person will receive 1 Old Violet Box
Giving an item ID of -1 will give a specified number of random items from
the list of those that fall out of Old Blue Box. Unlike in all other
@@ -4652,11 +4701,10 @@ is enabled.
You may also create an item by it's name in the 'english name' field in
the item database:
- getitem "RED_POTION",10;
+ getitem("Red_Potion", 10); // Not recommended, use Red_Potion instead of "Red_Potion"
Which will do what you'd expect. If it can't find that name in the
-database, apples will be created anyway. It is often a VERY GOOD IDEA to
-use it like this.
+database, apples will be created anyway.
This is used in pretty much all NPC scripts that have to do with items and
quite a few item scripts. For more examples check just about any official
@@ -4664,8 +4712,8 @@ script.
---------------------------------------
-*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
-*getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+*getitem2(<item id>, <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>{, <account ID>})
+*getitem2("<item name>", <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>{, <account ID>})
This command will give an amount of specified items to the invoking
character. If an optional account ID is specified, and the target
@@ -4674,7 +4722,7 @@ instead. If they are not online, nothing will happen. It works essentially
the same as 'getitem' (it even works for negative ID numbers the same way)
but is a lot more flexible.
-Those parameters that are different from 'getitem' are:
+Those parameters that are different from getitem() are:
identify - Whether you want the item to be identified (1) or not (0).
refine - For how many pluses will it be refined. It will not let you
@@ -4690,7 +4738,7 @@ piece of standard equipment, it is much easier to the 'getnameditem'
function instead.
You will need to keep these values if you want to destroy and then
-perfectly recreate a named item, for this see 'getinventorylist'.
+perfectly recreate a named item, for this see getinventorylist().
If you still want to try creating a named item with this command because
'getnameditem' won't do it for you cause it's too limited, you can do it
@@ -4700,7 +4748,7 @@ like this. Careful, minor magic ahead.
// item. Only an existing character's name may be there.
// Let's assume our character is 'Adam' and find his ID.
- .@charid = getcharid(0,"Adam");
+ .@charid = getcharid(0, "Adam");
// Now we split the character ID number into two portions with a
// binary shift operation. If you don't understand what this does,
@@ -4721,7 +4769,7 @@ like this. Careful, minor magic ahead.
// Now, let's give the character who invoked the script some
// Adam's Apples:
- getitem2 512,1,1,0,0,.@card1,.@card2,.@card3,.@card4;
+ getitem2(Apple, 1, 1, 0, 0, .@card1, .@card2, .@card3, .@card4);
This wasn't tested with all possible items, so I can't give any promises,
experiment first before relying on it.
@@ -4747,7 +4795,7 @@ To create equipment, continue this example it like this:
// That will make us an Adam's +2 VVS Ice Stiletto:
- getitem2 1216,1,1,2,0,.@card1,.@card2,.@card3,.@card4;
+ getitem2(Stiletto, 1, 1, 2, 0, .@card1, .@card2, .@card3, .@card4);
Experiment with the number of star crumbs - I'm not certain just how much
will work most and what it depends on. The valid element numbers are:
@@ -4760,10 +4808,10 @@ two eggs, and may hatch from either, although, I'm not sure what kind of a
mess will this really cause.
---------------------------------------
-*getitembound <item id>,<amount>,<bound type>{,<account ID>};
-*getitembound "<item name>",<amount>,<bound type>{,<account ID>};
+*getitembound(<item id>, <amount>, <bound type>{, <account ID>})
+*getitembound("<item name>", <amount>, <bound type>{, <account ID>})
-This command behaves identically to 'getitem', but the items created will be
+This command behaves identically to getitem(), but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.
@@ -4776,15 +4824,15 @@ Valid bound types are:
---------------------------------------
-*getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>;
-*getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>;
+*getitembound2(<item id>, <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>, <bound type>)
+*getitembound2("<item name>", <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>, <bound type>)
-This command behaves identically to 'getitem2', but the items created will be
+This command behaves identically to getitem2(), but the items created will be
bound to the target character as specified by the bound type. All items created
in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
some cases cannot be traded or stored.
-For a list of bound types see 'getitembound'.
+For a list of bound types see getitembound().
---------------------------------------
@@ -4797,16 +4845,16 @@ counted items. If a bound type is specified, only those items will be counted.
For a list of bound types see 'getitembound'.
Example:
- mes "You currently have "+countbound()+" bounded items.";
- next;
- mes "The list of bounded items include:";
+ mes("You currently have "+countbound()+" bound items.");
+ next();
+ mes("The list of bounded items include:");
for (.@i = 0; .@i < getarraysize(@bound_items); ++.@i)
- mes getitemname(@bound_items[.@i]);
- close;
+ mes(getitemname(@bound_items[.@i]));
+ close();
---------------------------------------
-*checkbound(<item_id>{,<bound_type>{,<refine>{,<attribute>{,<card_1>{,<card_2>{,<card_3>{,<card_4>}}}}}}});
+*checkbound(<item_id>{, <bound_type>{, <refine>{, <attribute>{, <card_1>{, <card_2>{, <card_3>{, <card_4>}}}}}}})
This command allows you to check whether or not the attached player has the specified bound item in their inventory.
If a bound type is not specified or a bound type of 0 is used, it will search the player's inventory for a bound item
@@ -4828,53 +4876,53 @@ Optional Parameters:
Example:
// This will check if you have a bound (any type) 1205 (Cutter).
- if (checkbound(1205)) {
- mes "You have a bound Cutter";
+ if (checkbound(Cutter)) {
+ mes("You have a bound Cutter");
} else {
- mes "You do not have a bound Cutter";
+ mes("You do not have a bound Cutter");
}
- close;
+ close();
// This will also check if you have a bound (any type) 1205 (Cutter).
- if (checkbound(1205,0)) {
- mes "You have a bound Cutter";
+ if (checkbound(Cutter, 0)) {
+ mes("You have a bound Cutter");
} else {
- mes "You do not have a bound Cutter";
+ mes("You do not have a bound Cutter");
}
- close;
+ close();
// This will check if the player doesn't have a bound 1205 (Cutter).
- if (!checkbound(1205)) {
- mes "You do not have a bound Cutter";
+ if (!checkbound(Cutter)) {
+ mes("You do not have a bound Cutter");
} else {
- mes "You do have a bound Cutter";
+ mes("You do have a bound Cutter");
}
- close;
+ close();
// This will check if the item found, has a bound type of 2 (guild_bound)
- if (checkbound(1205) == 2) {
- mes "You have a guild_bound Cutter";
+ if (checkbound(Cutter) == 2) {
+ mes("You have a guild_bound Cutter");
} else {
- mes "You do not have a guild_bound Cutter.";
+ mes("You do not have a guild_bound Cutter.");
}
- close;
+ close();
// This will check if you have a 'guild_bound' +7 1205 (Cutter).
- if (checkbound(1205, 2, 7)) {
- mes "You have a +7 guild_bound Cutter.";
+ if (checkbound(Cutter, 2, 7)) {
+ mes("You have a +7 guild_bound Cutter.");
} else {
- mes "You don't have the required item.";
+ mes("You don't have the required item.");
}
- close;
+ close();
---------------------------------------
-*getnameditem <item id>,<character name|character ID>;
-*getnameditem "<item name>",<character name|character ID>;
+*getnameditem(<item id>, <character name|character ID>)
+*getnameditem("<item name>", <character name|character ID>)
Create an item signed with the given character's name.
-The command returns 1 when the item is created successfully, or 0 if it
-fails. Failure occurs when:
+The command returns true when the item is created successfully, or false
+if it fails. Failure occurs when:
- There is no player attached.
- Item name or ID is not valid.
- The given character ID/name is offline.
@@ -4883,17 +4931,17 @@ Example:
//This will give the currently attached player a Aaron's Apple (if Aaron
//is online).
- getnameditem "Apple","Aaron";
+ getnameditem(Apple, "Aaron");
//Self-explanatory (I hope).
- if (getnameitem("Apple","Aaron")) {
- mes "You now have a Aaron's Apple!";
+ if (getnameditem(Apple, "Aaron")) {
+ mes("You now have a Aaron's Apple!");
}
---------------------------------------
-*rentitem <item id>,<time>;
-*rentitem "<item name>",<time>;
+*rentitem(<item id>, <time>)
+*rentitem("<item name>", <time>)
Creates a rental item in the attached character's inventory. The item will
expire in <time> seconds and be automatically deleted. When receiving a
@@ -4904,12 +4952,12 @@ before the item disappears.
This command can not be used to rent stackable items. Rental items cannot
be dropped, traded, sold to NPCs, or placed in guild storage (i.e. trade
mask 75).
-Note: 'delitem' in an NPC script can still remove rental items.
+Note: delitem() in an NPC script can still remove rental items.
---------------------------------------
-*makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
-*makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
+*makeitem(<item id>, <amount>, "<map name>", <X>, <Y>)
+*makeitem("<item name>", <amount>, "<map name>", <X>, <Y>)
This command will create an item lying around on a specified map in the
specified location.
@@ -4921,63 +4969,63 @@ specified location.
Y - The Y coordinate.
This item will still disappear just like any other dropped item. Like
-'getitem', it also accepts an 'english name' field from the database and
+getitem(), it also accepts an 'english name' field from the database and
creates apples if the name isn't found.
If the map name is given as "this", the map the invoking character is on
will be used.
---------------------------------------
-*cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
-*cleanmap "<map name>";
+*cleanarea("<map name>", <x1>, <y1>, <x2>, <y2>)
+*cleanmap("<map name>")
These commands will clear all items lying on the ground on the specified
map, either within the x1/y1-x2/y2 rectangle or across the entire map.
---------------------------------------
-*searchitem <array name>,"<item name>";
+*searchitem(<array name>, "<item name>")
This command will fill the given array with the ID of items whose name
matches the given one. It returns the number of items found. For
performance reasons, the results array is limited to 10 items.
- mes "What item are you looking for?";
- input .@name$;
- .@qty = searchitem(.@matches[0],.@name$);
- mes "I found "+.@qty+" items:";
+ mes("What item are you looking for?");
+ input(.@name$);
+ .@qty = searchitem(.@matches[0], .@name$);
+ mes("I found "+.@qty+" items:");
for (.@i = 0; .@i < .@qty; ++.@i)
//Display name (eg: "Apple[0]")
- mes getitemname(.@matches[.@i])+"["+getitemslots(.@matches[.@i])+"]";
+ mes(getitemname(.@matches[.@i])+"["+getitemslots(.@matches[.@i])+"]");
---------------------------------------
-*delitem <item id>,<amount>{,<account ID>};
-*delitem "<item name>",<amount>{,<account ID>};
+*delitem(<item id>, <amount>{, <account ID>})
+*delitem("<item name>", <amount>{, <account ID>})
This command will remove a specified amount of items from the invoking or
target character. Like all the item commands, it uses the item ID found
inside 'db/(pre-)re/item_db.txt'.
- delitem 502,10; // The person will lose 10 apples
- delitem 617,1; // The person will lose 1 Old Violet Box
+ delitem(Apple, 10); // The person will lose 10 apples
+ delitem(Old_Violet_Box, 1); // The person will lose 1 Old Violet Box
It is always a good idea to check if the player actually has the items
before you delete them. If you try to delete more items that the player
has, the player will lose the ones he/she has and the script will be
terminated with an error.
-Like 'getitem' this command will also accept an 'english name' field from
+Like getitem() this command will also accept an 'english name' field from
the database. If the name is not found, nothing will be deleted.
---------------------------------------
-*delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
-*delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
+*delitem2(<item id>, <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>{, <account ID>})
+*delitem2("<item name>", <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>{, <account ID>})
This command will remove a specified amount of items from the invoking or
target character.
-Check 'getitem2' to understand its expanded parameters.
+Check getitem2() to understand its expanded parameters.
---------------------------------------
@@ -4987,58 +5035,49 @@ Check 'getitem2' to understand its expanded parameters.
This function will return the number of items for the specified item ID
that the invoking character has in the inventory.
- mes "[Item Checker]";
- mes "Hmmm, it seems you have "+countitem(502)+" apples";
+ mes("[Item Checker]");
+ mes("Hmmm, it seems you have "+countitem(Apple)+" apples");
close;
-Like 'getitem', this function will also accept an 'english name' from the
+Like getitem(), this function will also accept an 'english name' from the
database as an argument.
-If you want to state the number at the end of a sentence, you can do it by
-adding up strings:
-
- mes "[Item Checker]";
- mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
- close;
-
---------------------------------------
-*countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
-*countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
+*countitem2(<item id>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>)
+*countitem2("<item name>", <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>)
-Expanded version of 'countitem' function, used for created/carded/forged
+Expanded version of countitem() function, used for created/carded/forged
items.
This function will return the number of items for the specified item ID
and other parameters that the invoking character has in the inventory.
-Check 'getitem2' to understand the arguments of the function.
-
+Check getitem2() to understand the arguments of the function.
+
---------------------------------------
-*groupranditem <item_id/constant>;
+*groupranditem(<item_id/constant>)
Returns the item_id of a random item picked from the item container specified. There
are different item containers and they are specified in 'db/(pre-)re/item_group.conf'.
Example:
- getitem groupranditem(603),1;
- getitem groupranditem(Old_Blue_Box),1;
+ getitem(groupranditem(Old_Blue_Box), 1);
---------------------------------------
-*getrandgroupitem <item_id/constant>,<quantity>;
+*getrandgroupitem(<item_id/constant>, <quantity>)
Similar to the above example, this command allows players to obtain the specified
quantity of a random item from the container. The different containers
are specified in 'db/(pre-)re/item_group.conf'.
Example:
- getrandgroupitem Old_Blue_Box,1;
- getrandgroupitem 603,1;
+ getrandgroupitem(Old_Blue_Box, 1);
---------------------------------------
-*packageitem
+*packageitem({item_id})
This command has only 1 param which is optional. If the package item_id is not provided, it
will try to use the item id from the item it is being used from (if called from an item script).
@@ -5058,25 +5097,26 @@ Example:
---------------------------------------
-*enable_items;
-*disable_items;
+*enable_items()
+*disable_items()
-These commands enable/disable changing of equipments while an NPC is
-running. When disable_items is run, equipments cannot be changed during
-scripts until enable_items is called or the script has terminated. To
-avoid possible exploits, when disable_items is invoked, it will only
-disable changing equips while running that script in particular. Note that
-if a different script also calls disable_items, it will override the last
-call (so you may want to call this command at the start of your script
-without assuming the effect is still in effect).
+These commands enable/disable changing of equipments while an NPC is
+running. When disable_items() is run, equipments cannot be changed
+during scripts until enable_items() is called or the script has
+terminated. To avoid possible exploits, when disable_items() is invoked,
+it will only disable changing equips while running that script in
+particular. Note that if a different script also calls disable_items(),
+it will override the last call (so you may want to call this command at
+the start of your script without assuming the effect is still in
+effect).
If 'item_enabled_npc' option is set to true in 'conf/map/battle/items.conf' all
NPC are allowing changing of equipment by default except for those have been
set with 'disable_items'.
---------------------------------------
-*itemskill <skill id>,<skill level>,{flag};
-*itemskill "<skill name>",<skill level>,{flag};
+*itemskill(<skill id>, <skill level>, {flag})
+*itemskill("<skill name>", <skill level>, {flag})
This command meant for item scripts to replicate single-use skills in
usable items. It will not work properly if there is a visible dialog
@@ -5086,14 +5126,14 @@ Otherwise, a target cursor is shown.
Flag is a optional param and, when present, the command will not check for
skill requirements.
-// When Anodyne is used, it will cast Endure (8), Level 1, as if the
-// actual skill has been used from skill tree.
-605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
+// When Anodyne is used, it will cast Endure, Level 1, as if the actual skill
+// has been used from skill tree.
+ itemskill(SM_ENDURE, 1);
---------------------------------------
-*itemeffect <item id>;
-*itemeffect "<item name>";
+*itemeffect(<item id>)
+*itemeffect("<item name>")
*consumeitem is an alias of itemeffect (added for compatibility)
This command will run the item script of the specified item on the
@@ -5103,7 +5143,7 @@ items, it will run for any item type.
---------------------------------------
-*produce <item level>;
+*produce(<item level>)
This command will open a crafting window on the client connected to the
invoking character. The 'item level' is a number which determines what
@@ -5129,7 +5169,7 @@ Valid item levels are:
---------------------------------------
-*cooking <dish level>;
+*cooking(<dish level>)
This command will open a produce window on the client connected to the
invoking character. The 'dish level' is the number which determines what
@@ -5158,7 +5198,7 @@ required ingredients to cook the dish the command works.
---------------------------------------
-*makerune <% success bonus>;
+*makerune(<% success bonus>)
This command will open a rune crafting window on the client connected to
the invoking character. Since this command is officially used in rune
@@ -5172,7 +5212,7 @@ materials in their inventory.
---------------------------------------
-*successremovecards <equipment slot>;
+*successremovecards(<equipment slot>)
This command will remove all cards from the item found in the specified
equipment slot of the invoking character, create new card items and give
@@ -5181,7 +5221,7 @@ also show a success effect.
---------------------------------------
-*failedremovecards <equipment slot>,<type>;
+*failedremovecards(<equipment slot>, <type>)
This command will remove all cards from the item found in the specified
equipment slot of the invoking character. 'type' determines what happens
@@ -5195,7 +5235,7 @@ Whatever the type is, it will also show a failure effect on screen.
---------------------------------------
-*repair <broken item number>;
+*repair(<broken item number>)
This command repairs a broken piece of equipment, using the same list of
broken items as available through 'getbrokenid'.
@@ -5206,7 +5246,7 @@ Valaris, who made it, can answer why is it so.
---------------------------------------
-*repairall;
+*repairall()
This command repairs all broken equipment in the attached player's
inventory. A repair effect will be shown if any items are repaired, else
@@ -5214,7 +5254,7 @@ the command will end silently.
---------------------------------------
-*successrefitem <equipment slot>{,<upgrade_count>};
+*successrefitem(<equipment slot>{, <upgrade_count>})
This command will refine an item in the specified equipment slot of the
invoking character by +1 (unless <upgrade_count> is specified).
@@ -5227,7 +5267,7 @@ will later forge a weapon.
---------------------------------------
-*failedrefitem <equipment slot>;
+*failedrefitem(<equipment slot>)
This command will fail to refine an item in the specified equipment slot
of the invoking character. The item will be destroyed. This will also
@@ -5236,18 +5276,17 @@ messages into their chat window.
---------------------------------------
-*downrefitem <equipment slot>{,<downgrade_count>};
+*downrefitem(<equipment slot>{, <downgrade_count>})
This command will downgrade an item by - 1 (unless optional <downgrade_count> is provided)
in the specified equipment slot of the invoking character.
-So the item will not be destroyed unlike in the
-failedrefitem script command. This will also display a 'refine failure'
-effect on the character and put appropriate messages into their chat
-window.
+So the item will not be destroyed unlike in the failedrefitem() script
+command. This will also display a 'refine failure' effect on the
+character and put appropriate messages into their chat window.
---------------------------------------
-*unequip <equipment slot>;
+*unequip(<equipment slot>)
This command will unequip whatever is currently equipped in the invoking
character's specified equipment slot. For a full list of possible
@@ -5258,7 +5297,7 @@ all of them.
---------------------------------------
-*clearitem;
+*clearitem()
This command will destroy all items the invoking character has in their
inventory (including equipped items). It will not affect anything else,
@@ -5266,9 +5305,9 @@ like storage or cart.
---------------------------------------
-*equip <item id>;
-*equip2 <item id>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
-*autoequip <item id>,<option>;
+*equip(<item id>)
+*equip2(<item id>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>)
+*autoequip(<item id>, <option>)
These commands are to equip a equipment on the attached character.
The equip function will equip the item ID given when the player has this
@@ -5280,22 +5319,22 @@ Examples:
//This will equip a 1104 (falchion) on the character if this is in the
//inventory.
- equip 1104;
+ equip(Falchion);
//This will equip a +10 1104 (falchion) on the character if this is in the
//inventory.
- equip2 1104,10,0,0,0,0,0;
+ equip2(Falchion, 10, 0, 0, 0, 0, 0);
//The invoked character will now automatically equip a falchion when it's
//looted.
- autoequip 1104,1;
+ autoequip(Falchion, 1);
//The invoked character will no longer automatically equip a falchion.
- autoequip 1104,0;
+ autoequip(Falchion, 0);
---------------------------------------
-*buyingstore <slots>;
+*buyingstore(<slots>)
Invokes buying store preparation window like the skill 'Open Buying
Store', without the item requirement. Amount of slots is limited by the
@@ -5304,11 +5343,11 @@ server to a maximum of 5 slots by default.
Example:
// Gives the player opportunity to buy 4 different kinds of items.
- buyingstore 4;
+ buyingstore(4);
---------------------------------------
-*searchstores <uses>,<effect>;
+*searchstores(<uses>, <effect>);
Invokes the store search window, which allows to search for both vending
and buying stores. Parameter uses indicates, how many searches can be
@@ -5324,24 +5363,24 @@ following:
Example:
// Item Universal_Catalog_Gold (10 uses, effect: open shop)
- searchstores 10,1;
+ searchstores(10, 1);
---------------------------------------
-*mergeitem;
+*mergeitem();
-mergeitem opens the item merge window,
+mergeitem() opens the item merge window,
The Item merge window shows all stackable item(same ItemID) with different
serial, that can be merged into one stack.
Check sample: npc/other/item_merge.txt
---------------------------------------
-*delequip <equipment slot>;
+*delequip(<equipment slot>)
This command will destroy whatever is currently equipped in the invoking
character's specified equipment slot. For a full list of possible equipment
-slots see 'getequipid'.
+slots see getequipid().
It is always a good idea to check if the player actually has the item you want
before you use this command. If you try to delete in a position that the player
@@ -5353,7 +5392,7 @@ has no gear, script will be terminated with an error.
//=====================================
---------------------------------------
-*openstorage;
+*openstorage()
This will open character's Kafra storage window on the client connected to
the invoking character. It can be used from any kind of NPC or item
@@ -5363,33 +5402,33 @@ The storage window opens regardless of whether there are open NPC dialogs
or not, but it is preferred to close the dialog before displaying the
storage window, to avoid any disruption when both windows overlap.
- mes "I will now open your stash for you";
- close2;
- openstorage;
+ mes("I will now open your stash for you");
+ close2();
+ openstorage();
end;
---------------------------------------
-*openmail;
+*openmail()
This will open a character's Mail window on the client connected to the
invoking character.
- mes "Close this window to open your mail inbox.";
- close2;
- openmail;
+ mes("Close this window to open your mail inbox.");
+ close2();
+ openmail();
end;
---------------------------------------
-*openauction;
+*openauction()
This will open the Auction window on the client connected to the invoking
character.
- mes "Close this window to open the Auction window.";
- close2;
- openauction;
+ mes("Close this window to open the Auction window.");
+ close2();
+ openauction();
end;
---------------------------------------
@@ -5400,7 +5439,7 @@ character.
*guildopenstorage()
-This function works the same as 'openstorage' but will open a guild
+This function works the same as openstorage() but will open a guild
storage window instead for the guild storage of the guild the invoking
character belongs to. This is a function because it returns a value - 0 if
the guild storage was opened successfully and 1 if it wasn't. (Notice,
@@ -5414,16 +5453,16 @@ to any guild.
---------------------------------------
-*guildchangegm(<guild id>,<new master's name>)
+*guildchangegm(<guild id>, <new master's name>)
This function will change the Guild Master of a guild. The ID is the
guild's id, and the new guild master's name must be passed.
-Returns 1 on success, 0 otherwise.
+Returns true on success, false otherwise.
---------------------------------------
-*guildgetexp <amount>;
+*guildgetexp(<amount>)
This will give the specified amount of guild experience points to the
guild the invoking character belongs to. It will silently fail if they do
@@ -5431,8 +5470,8 @@ not belong to any guild.
---------------------------------------
-*guildskill <skill id>,<level>
-*guildskill "<skill name>",<level>
+*guildskill(<skill id>, <level>)
+*guildskill("<skill name>", <level>)
This command will bump up the specified guild skill by the specified
number of levels. This refers to the invoking character and will only work
@@ -5447,7 +5486,7 @@ leveled to the maximum and not above.
// (GD_APPROVAL ID 10000). Notice that if you try to add two levels of
// Approval, or add Approval when the guild already has it, it will only
// have one level of Approval afterwards.
- guildskill 10000,1;
+ guildskill(GD_APPROVAL, 1);
You might want to make a quest for getting a certain guild skill, make it
hard enough that all the guild needs to help or something. Doing this for
@@ -5461,7 +5500,7 @@ annoying :D)
//=====================================
---------------------------------------
-*resetlvl <action type>;
+*resetlvl(<action type>)
This is a character reset command, meant mostly for rebirth script
supporting Advanced jobs, which will reset the invoking character's stats
@@ -5478,12 +5517,9 @@ and level depending on the action type given. Valid action types are:
In all cases everything the character has on will be unequipped.
-Even though it doesn't return a value, it is used as a function in the
-official rebirth scripts.
-
---------------------------------------
-*resetstatus;
+*resetstatus()
This is a character reset command, which will reset the stats on the
invoking character and give back all the stat points used to raise them
@@ -5493,7 +5529,7 @@ Used in reset NPC's (duh!).
---------------------------------------
-*resetskill;
+*resetskill()
This command takes off all the skill points on the invoking character, so
they only have Basic Skill blanked out (lvl 0) left, and returns the
@@ -5506,10 +5542,10 @@ Used in reset NPC's (duh!).
---------------------------------------
-*sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
-*sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
-*sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
-*sc_end <effect type>{,<GID>};
+*sc_start(<effect type>, <ticks>, <value 1>{, <rate>, <flag>{, <GID>}})
+*sc_start2(<effect type>, <ticks>, <value 1>, <value 2>{, <rate>, <flag>{, <GID>}})
+*sc_start4(<effect type>, <ticks>, <value 1>, <value 2>, <value 3>, <value 4>{, <rate>, <flag>{, <GID>}})
+*sc_end(<effect type>{, <GID>})
These commands will bestow a status effect on a character.
@@ -5540,27 +5576,22 @@ If a <GID> is given, the status change will be invoked on the specified characte
instead of the one attached to the script. This can only be defined after setting
a rate and flag.
-'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
+sc_start2() and sc_start4() allow extra parameters to be passed, and are used only
for effects that require them. The meaning of the extra values vary depending on the
effect type.
-'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
+sc_end() will remove a specified status effect. If SC_ALL (-1) is given, it will
perform a complete removal of all statuses (although permanent ones will re-apply).
Examples:
// This will poison the invoking character for 10 minutes at 50% chance.
- sc_start SC_POISON,600000,0,5000;
+ sc_start(SC_POISON, 600000, 0, 5000);
// This will bestow the effect of Level 10 Blessing.
- sc_start 10,240000,10;
-
- // Elemental armor defense takes the following four values:
- // val1 is the first element, val2 is the resistance to the element val1.
- // val3 is the second element, val4 is the resistance to the element val3.
- sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
+ sc_start(SC_BLESSING, 240000, 10);
// This will end the Freezing status for the invoking character.
- sc_end SC_FREEZE;
+ sc_end(SC_FREEZE);
Note: to use SC_NOCHAT you should alter Manner
Manner = -5; // Will mute a user for 5 minutes
@@ -5569,7 +5600,7 @@ Note: to use SC_NOCHAT you should alter Manner
---------------------------------------
-*getstatus <effect type>{,<type>};
+*getstatus(<effect type>{, <type>})
Retrieve information about a specific status effect when called. Depending
on <type> specified the function will return different information.
@@ -5589,8 +5620,8 @@ this script function will always return 0.
---------------------------------------
-*skilleffect <skill id>,<number>;
-*skilleffect "<skill name>",<number>;
+*skilleffect(<skill id>, <number>)
+*skilleffect("<skill name>", <number>)
This command displays visual and aural effects of given skill on currently
attached character. The number parameter is for skill whose visual effect
@@ -5599,33 +5630,33 @@ command will not actually use the skill: it is intended for scripts which
simulate skill usage by the NPC, such as buffs, by setting appropriate
status and displaying the skill's effect.
- mes "Be blessed!";
+ mes("Be blessed!");
// Heal of 2000 HP
- heal 2000,0;
- skilleffect 28,2000;
+ heal(2000, 0);
+ skilleffect(AL_HEAL, 2000);
// Blessing Level 10
- sc_start 10,240000,10;
- skilleffect 34,0;
+ sc_start(SC_BLESSING, 240000, 10);
+ skilleffect(AL_BLESSING, 0);
// Increase AGI Level 5
- sc_start 12,140000,5;
- skilleffect 29,0;
+ sc_start(SC_INC_AGI, 140000, 5);
+ skilleffect(AL_INCAGI, 0);
This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
Increase AGI Lv 5, and display appropriate effects.
---------------------------------------
-*npcskilleffect <skill id>,<number>,<x>,<y>;
-*npcskilleffect "<skill name>",<number>,<x>,<y>;
+*npcskilleffect(<skill id>, <number>, <x>, <y>)
+*npcskilleffect("<skill name>", <number>, <x>, <y>)
-This command behaves identically to 'skilleffect', however, the effect
+This command behaves identically to skilleffect(), however, the effect
will not be centered on the invoking character's sprite, nor on the NPC
sprite, if any, but will be centered at map coordinates given on the same
map as the invoking character.
---------------------------------------
-*specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
+*specialeffect(<effect number>{, <send_target>{, "<NPC Name>"}})
This command will display special effect with the given number, centered
on the specified NPCs coordinates, if any. For a full list of special
@@ -5641,26 +5672,26 @@ specifying AREA will retain the default behavior of the command.
// this will make the NPC "John Doe#1"
// show the effect "EF_HIT1" specified by
// Jane Doe. I wonder what John did...
- mes "[Jane Doe]";
- mes "Well, I never!";
- specialeffect EF_HIT1,AREA,"John Doe#1";
- close;
+ mes("[Jane Doe]");
+ mes("Well, I never!");
+ specialeffect(EF_HIT1, AREA, "John Doe#1");
+ close();
---------------------------------------
-*specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
+*specialeffect2(<effect number>{, <send_target>{, "<Player Name>"}})
-This command behaves identically to the 'specialeffect', but the effect
+This command behaves identically to the specialeffect(), but the effect
will be centered on the invoking character's sprite.
<Player name> parameter will display <effect number> on another Player
-than the one currently attached to the script. Like with specialeffect,
+than the one currently attached to the script. Like with specialeffect(),
when specifying a player, <send_target> must be supplied, specifying AREA
will retain the default behavior of the command.
---------------------------------------
-*statusup <stat>;
+*statusup(<stat>)
This command will bump a specified stat of the invoking character up by
one permanently using status points to do so, if there aren't enough to perform
@@ -5676,22 +5707,22 @@ bLuk - Luck
---------------------------------------
-*statusup2 <stat>,<amount>;
+*statusup2(<stat>, <amount>)
This command will bump a specified stat of the invoking character up by
the specified amount permanently without using status points.
-Amount can be negative. See 'statusup'.
+Amount can be negative. See statusup().
// This will decrease a character's Vit forever.
- statusup bVit,-1;
+ statusup(bVit, -1);
---------------------------------------
-*bonus <bonus type>,<val1>;
-*bonus2 <bonus type>,<val1>,<val2>;
-*bonus3 <bonus type>,<val1>,<val2>,<val3>;
-*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
-*bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
+*bonus(<bonus type>, <val1>)
+*bonus2(<bonus type>, <val1>, <val2>)
+*bonus3(<bonus type>, <val1>, <val2>, <val3>)
+*bonus4(<bonus type>, <val1>, <val2>, <val3>, <val4>)
+*bonus5(<bonus type>, <val1>, <val2>, <val3>, <val4>, <val5>)
These commands are meant to be used in item scripts. They will probably
work outside item scripts, but the bonus will not persist for long. They,
@@ -5702,17 +5733,17 @@ for each kind in 'doc/item_bonus.txt'.
---------------------------------------
-*autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
-*autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
-*autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
-*autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
+*autobonus(<bonus script>, <rate>, <duration>{, <flag>, {<other script>}})
+*autobonus2(<bonus script>, <rate>, <duration>{, <flag>, {<other script>}})
+*autobonus3(<bonus script>, <rate>, <duration>, <skill id>, {<other script>})
+*autobonus3(<bonus script>, <rate>, <duration>, "<skill name>", {<other script>})
These commands are meant to be used in item scripts. They will probably
work outside item scripts, but the bonus will not persist for long. They,
as expected, refer only to an invoking character.
What these commands do is 'attach' a script to the player which will get
-executed on attack (or when attacked in the case of autobonus2).
+executed on attack (or when attacked in the case of autobonus2()).
Rate is the trigger rate of the script (1000 = 100%).
@@ -5720,7 +5751,7 @@ Duration is the time that the bonus will last for since the script has
triggered.
Skill ID/skill name the skill which will be used as trigger to start the
-bonus (for autobonus3).
+bonus (for autobonus3()).
The optional argument 'flag' is used to classify the type of attack where
the script can trigger (it shares the same flags as the bAutoSpell bonus
@@ -5750,20 +5781,20 @@ command only. And we usually use 'other script' to show visual effects.
In all cases, when the script triggers, the attached player will be the
one who holds the bonus. There is currently no way of knowing within this
-script who was the other character (the attacker in autobonus2, or the
-target in autobonus and autobonus3).
+script who was the other character (the attacker in autobonus2(), or the
+target in autobonus() and autobonus3()).
//Grants a 1% chance of starting the state "all stats +10" for 10 seconds
//when using weapon or misc attacks (both melee and ranged skills) and
//shows a special effect when the bonus is active.
- autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
+ autobonus("{ bonus(bAllStats, 10); }", 10, 10000, BF_WEAPON|BF_MISC, "{ specialeffect2(EF_FIRESPLASHHIT); }");
---------------------------------------
-*skill <skill id>,<level>{,<flag>};
-*skill "<skill name>",<level>{,<flag>};
-*addtoskill <skill id>,<level>{,<flag>};
-*addtoskill "<skill name>",<level>{,<flag>};
+*skill(<skill id>, <level>{, <flag>})
+*skill("<skill name>", <level>{, <flag>})
+*addtoskill(<skill id>, <level>{, <flag>})
+*addtoskill("<skill name>", <level>{, <flag>})
These commands will give the invoking character a specified skill. This is
also used for item scripts.
@@ -5783,8 +5814,8 @@ additional bonus to the skill level. If the character did not have that
skill previously, they will now at 0+the level given.
// This will permanently give the character Stone Throw
-// (TF_THROWSTONE,152), at level 1.
- skill 152,1,0;
+// (TF_THROWSTONE, 152), at level 1.
+ skill(TF_THROWSTONE, 1, 0);
Flag 3 is the same as flag 0 in that it saves to the database. However,
these skills are ignored when any action is taken that adjusts the skill
@@ -5792,26 +5823,26 @@ tree (reset/job change).
---------------------------------------
-*nude;
+*nude()
This command will unequip anything equipped on the invoking character.
-It is not required to do this when changing jobs since 'jobchange' will
+It is not required to do this when changing jobs since jobchange() will
unequip everything not equippable by the new job class anyway.
---------------------------------------
-*disguise <Monster ID>;
-*undisguise;
+*disguise(<Monster ID>)
+*undisguise()
This command disguises the current player with a monster sprite.
-The disguise lasts until 'undisguise' is issued or the player logs out.
+The disguise lasts until undisguise() is issued or the player logs out.
Example:
-disguise 1002; // Disguise character as a Poring.
-next;
-undisguise; // Return to normal character sprite.
+disguise(PORING); // Disguise character as a Poring.
+next();
+undisguise(); // Return to normal character sprite.
---------------------------------------
//=====================================
@@ -5819,13 +5850,13 @@ undisguise; // Return to normal character sprite.
//=====================================
---------------------------------------
-*marriage("<spouse name>");
+*marriage("<spouse name>")
This function will marry two characters, the invoking character and the
one referred to by name given, together, setting them up as each other's
marriage partner. No second function call has to be issued (in current Git
at least) to make sure the marriage works both ways. The function returns
-1 upon success, or 0 if the marriage could not be completed, either
+true upon success, or false if the marriage could not be completed, either
because the other character wasn't found or because one of the two
characters is already married.
@@ -5835,7 +5866,7 @@ be shown.
---------------------------------------
-*wedding;
+*wedding()
This command will call up wedding effects - the music and confetti -
centered on the invoking character. Example can be found in the wedding
@@ -5848,8 +5879,8 @@ script.
This function will "un-marry" the invoking character from whoever they
were married to. Both will no longer be each other's marriage partner,
(at least in current Git, which prevents the cases of multi-spouse
-problems). It will return 1 upon success or 0 if the character was not
-married at all.
+problems). It will return true upon success or false if the character
+was not married at all.
This function will also destroy both wedding rings and send a message to
both players, telling them they are now divorced.
@@ -5860,8 +5891,8 @@ both players, telling them they are now divorced.
//=====================================
---------------------------------------
-*pcfollow <id>,<target id>;
-*pcstopfollow <id>;
+*pcfollow(<id>, <target id>)
+*pcstopfollow(<id>)
Makes a character follow or stop following someone. This command does the
same as the @follow command. The main difference is that @follow can use
@@ -5871,27 +5902,27 @@ Examples:
// This will make Aaron follow Bullah, when both of these characters are
// online.
- pcfollow getcharid(3,"Aaron"),getcharid(3,"Bullah");
+ pcfollow(getcharid(3, "Aaron"), getcharid(3, "Bullah"));
// Makes Aaron stop following whoever he is following.
- pcstopfollow getcharid(3,"Aaron");
+ pcstopfollow(getcharid(3, "Aaron"));
---------------------------------------
-*pcblockmove <id>,<option>;
+*pcblockmove(<id>, <option>)
-Prevents the given ID from moving when the option != 0, and 0 enables the
-ID to move again. The ID can either be the GID of a monster/NPC or account
-ID of a character, and will run for the attached player if zero is
-supplied.
+Prevents the given ID from moving when the optionis true , and false
+enables the ID to move again. The ID can either be the GID of a
+monster/NPC or account ID of a character, and will run for the attached
+player if zero is supplied.
Examples:
// Prevents the current char from moving away.
- pcblockmove getcharid(3),1;
+ pcblockmove(getcharid(3), true);
// Enables the current char to move again.
- pcblockmove getcharid(3),0;
+ pcblockmove(getcharid(3), false);
---------------------------------------
@@ -5906,8 +5937,8 @@ Examples:
//=====================================
---------------------------------------
-*monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"{,<size>{,<ai>}}};
-*areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>"{,<size>{,<ai>}}};
+*monster("<map name>", <x>, <y>, "<name to show>", <mob id>, <amount>{, "<event label>"{, <size>{, <ai>}}})
+*areamonster("<map name>", <x1>, <y1>, <x2>, <y2>, "<name to show>", <mob id>, <amount>{, "<event label>"{, <size>{, <ai>}}})
This command will spawn a monster on the specified coordinates on the
specified map. If the script is invoked by a character, a special map
@@ -5931,9 +5962,9 @@ the label given. The RID of the player attached at this execution will be
the RID of the killing character.
<size> can be:
- 0 = medium (default)
- 1 = small
- 2 = big
+ Size_Medium = medium (default)
+ Size_Small = small
+ Size_Large = big
<ai> can be:
0 = none (default)
@@ -5942,7 +5973,7 @@ the RID of the killing character.
3 = flora (Alchemist skill)
4 = zanzou (Kagerou/Oboro skill)
- monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
+ monster("place", 60, 100, "Poring", PORING, 1, "NPCNAME::OnLabel");
The coordinates of 0,0 will spawn the monster on a random place on the
map. Both 'monster' and 'areamonster' return the GID of the monster
@@ -5951,8 +5982,8 @@ controlling each of the spawned mobs with the unit* commands shown below.
For example:
// We'll make a poring which will automatically attack invoking player:
- .@mobGID = monster("prontera",150,150,"Poring",PORING,1); // PORING is defined in the mob db and its value is 1002
- unitattack .@mobGID, getcharid(3); // Attacker GID, attacked GID
+ .@mobGID = monster("prontera", 150, 150, "Poring", PORING, 1); // PORING is defined in the mob db and its value is 1002
+ unitattack(.@mobGID, getcharid(3)); // Attacker GID, attacked GID
The way you can get the GID of more than only one monster is looping
through all the summons to get their individual GIDs and do whatever you
@@ -5960,37 +5991,37 @@ want with them. For example:
// We want to summon .mobnumber porings which will give us a kiss
for (.@i = 0; .@i < .mobnumber; ++.@i) {
- .@mobGID = monster "map",.x,.y,"Kisser Poring",PORING,1;
- unitemote .@mobGID, e_kis;
+ .@mobGID = monster("map", .x, .y, "Kisser Poring", PORING, 1);
+ unitemote(.@mobGID, e_kis);
}
Refer to the unit* commands below.
-The 'areamonster' command works much like the 'monster' command and is not
+The areamonster() command works much like the monster() command and is not
significantly different, but spawns the monsters within a square defined
by x1/y1-x2/y2.
Simple monster killing script:
<NPC object definition. Let's assume you called him NPCNAME.>
- mes "[Summon Man]";
- mes "Want to start the kill?";
- next;
- if (select("Yes:No") != 1) {
- mes "[Summon Man]";
- mes "Come back later";
- close;
+ mes("[Summon Man]");
+ mes("Want to start the kill?");
+ next();
+ if (select("Yes", "No") != 1) {
+ mes("[Summon Man]");
+ mes("Come back later");
+ close();
}
- monster "prontera",0,0,"Quest Poring",PORING,10,"NPCNAME::OnPoringKilled";
+ monster("prontera", 0, 0, "Quest Poring", PORING, 10, "NPCNAME::OnPoringKilled");
// By using 0,0 it will spawn them in a random place.
- mes "[Summon Man]";
- mes "Now go and kill all the Poring I summoned";
+ mes("[Summon Man]");
+ mes("Now go and kill all the Poring I summoned");
// He summoned ten.
- close;
+ close();
OnPoringKilled:
++$poring_killed;
if ($poring_killed == 10) {
- announce "Summon Man: Well done all the poring are dead",bc_self;
+ announce("Summon Man: Well done all the poring are dead", bc_self);
$poring_killed = 0;
}
end;
@@ -5999,8 +6030,8 @@ For more examples see just about any official 2-1 or 2-2 job quest script.
---------------------------------------
-*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
-*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
+*areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, <skill id>, <skill level>, <cast time>, <cancelable>, <emotion>, <target type>)
+*areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, "<skill name>", <skill level>, <cast time>, <cancelable>, <emotion>, <target type>)
This command will make all monsters of the specified mob ID in the
specified area use the specified skill. Map name, x, and y define the
@@ -6018,16 +6049,16 @@ should be self-explanatory.
Example:
// spawn 1 Shining Plant in the 5x5 area centered on (155,188)
- areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
+ areamonster("prontera", 153, 186, 157, 190, "Shining Plant", SHINING_PLANT, 1);
// make the plant cast level 10 Cold Bolt on a random target
- areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
+ areamobuseskill("prontera", 155, 188, 2, SHINING_PLANT, MG_COLDBOLT, 10, 3000, 1, e_gg, 3)
---------------------------------------
-*killmonster "<map name>","<event label>"{,<type>};
+*killmonster("<map name>", "<event label>"{, <type>})
-This command will kill all monsters that were spawned with 'monster' or
-'addmonster' and have a specified event label attached to them. Commonly
+This command will kill all monsters that were spawned with monster() or
+areamonster() and have a specified event label attached to them. Commonly
used to get rid of remaining quest monsters once the quest is complete.
If the label is given as "All", all monsters which have their respawn
@@ -6036,13 +6067,13 @@ times set to -1 (like all the monsters summoned with 'monster' or
but no other ones - that is, all non-permanent monsters) on the specified
map will be killed regardless of the event label value.
-killmonster supports an optional argument type. Using 1 for type will make
+killmonster() supports an optional argument type. Using 1 for type will make
the command fire "OnMyMobDead" events from any monsters that do die as a
result of this command.
---------------------------------------
-*killmonsterall "<map name>"{,<type>};
+*killmonsterall("<map name>"{, <type>})
This command will kill all monsters on a specified map name, regardless of
how they were spawned or what they are without triggering any event label
@@ -6052,7 +6083,7 @@ other number for this parameter won't be recognized.
---------------------------------------
-*strmobinfo(<type>,<monster id>);
+*strmobinfo(<type>, <monster id>)
This function will return information about a monster record in the
database, as per 'db/(pre-)re/mob_db.txt'. Type is the kind of information
@@ -6069,7 +6100,7 @@ returned. Valid types are:
---------------------------------------
-*mobcount("<map name>","<event label>")
+*mobcount("<map name>", "<event label>")
This function will count all the monsters on the specified map that have a
given event label and return the number or 0 if it can't find any.
@@ -6092,7 +6123,7 @@ while the map is "this", it will return -1.
---------------------------------------
-*clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
+*clone("<map name>", <x>, <y>, "<event>", <char id>{, <master_id>{, <mode>{, <flag>, <duration>}}})
This command creates a monster which is a copy of another player. The
first four arguments serve the same purpose as in the monster script
@@ -6117,9 +6148,9 @@ returned value is zero.
---------------------------------------
-*summon "Monster name",<monster id>{,<Time Out>{,"event label"}};
+*summon("Monster name", <monster id>{, <Time Out>{, "event label"}})
-This command will summon a monster. (see also 'monster') Unlike monsters
+This command will summon a monster. (see also monster()) Unlike monsters
spawned with other commands, this one will set up the monster to fight to
protect the invoking character. Monster name and mob id obey the same
rules as the one given at the beginning of this document for permanent
@@ -6133,14 +6164,14 @@ Timeout is the time in milliseconds the summon lives, and is set default
to 60000 (1 minute). Note that also the value 0 will set the timer to
default, and it is not possible to create a spawn that lasts forever.
If an event label is given, upon the monster being killed, the event label
-will run as if by 'donpcevent'.
+will run as if by donpcevent().
// Will summon a poring to fight for the character.
- summon "--ja--", PORING;
+ summon("--ja--", PORING);
---------------------------------------
-*homevolution;
+*homevolution()
This command will try to evolve the current player's homunculus.
If it doesn't work, the /swt emotion is shown.
@@ -6167,7 +6198,7 @@ If the attached player doesn't own a homunculus, this command will return
---------------------------------------
-*morphembryo;
+*morphembryo()
This command will try to put the invoking player's Homunculus in an
uncallable state, required for mutation into a Homunculus S. The player
@@ -6181,21 +6212,22 @@ Returns 1 upon success and 0 for all failures.
---------------------------------------
-*hommutate {<ID>};
+*hommutate({<ID>})
-This command will try to mutate the invoking player's Homunculus into
-a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
+This command will try to mutate the invoking player's Homunculus into a
+Homunculus S. The Strange Embryo (Strange_Embryo, ID 6415) is deleted
+upon success.
The command will fail if the invoking player does not have an evolved
Homunculus at level 99 or above, if it is not in the embryo state
-(from the 'morphembryo' command), or if the invoking player does not
+(from the morphembryo() command), or if the invoking player does not
possess a Strange Embryo. The /swt emotion is shown upon failure.
If the optional parameter <ID> is set, the invoking player's Homunculus
will change into the specified Homunculus ID. Otherwise, a random Homunculus S
will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
-Returns 1 upon success and 0 for all failures.
+Returns true upon success and false for all failures.
---------------------------------------
@@ -6210,7 +6242,7 @@ and will return the following values:
---------------------------------------
-*getunittype <GID>;
+*getunittype(<GID>)
Returns the type of object from the given Game ID. Returns -1 if the given GID
does not exist. The return values are :-
@@ -6225,8 +6257,8 @@ does not exist. The return values are :-
---------------------------------------
-*unitwalk <GID>,<x>,<y>;
-*unitwalk <GID>,<target_GID>;
+*unitwalk(<GID>, <x>, <y>)
+*unitwalk(<GID>, <target_GID>)
This is one command, but can be used in two ways. If only the first
argument is given, the unit whose GID is given will start walking towards
@@ -6238,38 +6270,38 @@ coordinates on the map where the unit currently is.
Examples:
//Will move/walk the poring we made to the coordinates 150,150
- unitwalk .GID,150,150;
+ unitwalk(.GID, 150, 150);
//NPC will move towards the attached player.
- unitwalk .GID,getcharid(3);//a player's GID is their account ID
+ unitwalk(.GID, getcharid(3));//a player's GID is their account ID
---------------------------------------
-*unitkill <GID>;
-*unitwarp <GID>,<Mapname>,<x>,<y>;
-*unitattack <GID>,<Target ID>;
-*unitstop <GID>;
-*unittalk <GID>,<Text>;
-*unitemote <GID>,<Emote>;
+*unitkill(<GID>)
+*unitwarp(<GID>, <Mapname>, <x>, <y>)
+*unitattack(<GID>, <Target ID>)
+*unitstop(<GID>)
+*unittalk(<GID>, <Text>)
+*unitemote(<GID>, <Emote>)
Okay, these commands should be fairly self explaining.
For the emotions, you can look in db/constants.conf for prefixes with e_
-PS: unitwarp supports a <GID> of zero, which causes the executor of the
+PS: unitwarp() supports a <GID> of zero, which causes the executor of the
script to be affected. This can be used with OnTouchNPC to warp
monsters:
OnTouchNPC:
- unitwarp 0,"this",-1,-1;
+ unitwarp(0, "this", -1, -1);
---------------------------------------
-*disablenpc "<NPC object name>";
-*enablenpc "<NPC object name>";
+*disablenpc("<NPC object name>")
+*enablenpc("<NPC object name>")
These two commands will disable and enable, respectively, an NPC object
specified by name. The disabled NPC will disappear from sight and will no
longer be triggerable in the normal way. It is not clear whether it will
-still be accessible through 'donpcevent' and other triggering commands,
+still be accessible through donpcevent() and other triggering commands,
but it probably will be. You can disable even warp NPCs if you know their
object names, which is an easy way to make a map only accessible through
walking half the time. Then you 'enablenpc' them back.
@@ -6281,8 +6313,8 @@ name, make a few copies, and then disable all except one.
---------------------------------------
-*hideonnpc "<NPC object name>";
-*hideoffnpc "<NPC object name>";
+*hideonnpc("<NPC object name>")
+*hideoffnpc("<NPC object name>")
These commands will make the NPC object specified display as hidden or
visible, even though not actually disabled per se. Hidden as in thief Hide
@@ -6296,40 +6328,40 @@ NPCs talking while hidden then revealing... you can wonder around =P).
---------------------------------------
-*doevent "<NPC object name>::<event label>";
+*doevent("<NPC object name>::<event label>")
This command will start a new execution thread in a specified NPC object
at the specified label. The execution of the script running this command
-will not stop, and the event called by the 'doevent' command will not run
+will not stop, and the event called by the doevent() command will not run
until the invoking script has terminated. No parameters may be passed with
-a doevent call.
+a doevent() call.
The script of the NPC object invoked in this manner will run as if it's
been invoked by the RID that was active in the script that issued a
'doevent'. As such, the command will not work if an RID is not attached.
place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
- mes "This is what you will see when you click me";
- close;
+ mes("This is what you will see when you click me");
+ close();
OnLabel:
- mes "This is what you will see if the doevent is activated";
- close;
+ mes("This is what you will see if the doevent is activated");
+ close();
}
- ....
+ // ...
- doevent "NPC::OnLabel";
+ doevent("NPC::OnLabel");
---------------------------------------
-*donpcevent "<NPC object name>::<event label>";
+*donpcevent("<NPC object name>::<event label>")
This command invokes the event label code within an another NPC or NPCs.
It starts a separate instance of execution, and the invoking NPC will
resume execution its immediately.
If the supplied event label has the form "NpcName::OnLabel", then only
-given NPC's event label will be invoked (much like 'goto' into another
+given NPC's event label will be invoked (much like goto() into another
NPC). If the form is "::OnLabel" (NPC name omitted), the event code of all
NPCs with given label will be invoked, one after another. In both cases
the invoked script will run without an attached RID, whether or not the
@@ -6341,34 +6373,34 @@ responding to the invoking NPC's actions, such as using an emotion or
talking.
place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
- mes "Hey NPC2 copy what I do";
- close2;
- @emote = rand(1,30);
- donpcevent "NPC2::OnEmote";
+ mes("Hey NPC2 copy what I do");
+ close2();
+ @emote = rand(1, 30);
+ donpcevent("NPC2::OnEmote");
OnEmote:
- emotion @emote;
+ emotion(@emote);
end;
}
place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
- mes "Hey NPC copy what I do";
- close2;
- @emote = rand(1,30);
- donpcevent "NPC::OnEmote";
+ mes("Hey NPC copy what I do");
+ close2();
+ @emote = rand(1, 30);
+ donpcevent("NPC::OnEmote");
OnEmote:
- emotion @emote;
+ emotion(@emote);
end;
}
Whichever of the both NPCs is talked to, both will show a random emotion
at the same time.
-Command returns 1 or 0 on success and failure.
+Command returns true or false on success and failure.
A debug message also shows on the console when no events are triggered.
---------------------------------------
-*npctalk "<message>"{,"<npc name>"};
+*npctalk("<message>"{, "<npc name>"})
This command will display a message to the surrounding area as if the NPC
object running it was a player talking - that is, above their head and in
@@ -6377,8 +6409,8 @@ the message to complete the effect.
// This will make everyone in the area see the NPC greet the character
// who just invoked it.
- npctalk "Hello "+strcharinfo(0)+", how are you?";
- npctalk "Hello "+strcharinfo(0)+", how are you?","Another_NPC_Name";
+ npctalk("Hello "+strcharinfo(PC_NAME)+", how are you?");
+ npctalk("Hello "+strcharinfo(PC_NAME)+", how are you?", "Another_NPC_Name");
---------------------------------------
@@ -6397,12 +6429,12 @@ Size is 0 = normal 1 = small 2 = big.
//=====================================
---------------------------------------
-*addtimer <ticks>,"NPC::OnLabel";
-*deltimer "NPC::OnLabel";
-*addtimercount "NPC::OnLabel",<ticks>;
+*addtimer(<ticks>, "NPC::OnLabel")
+*deltimer("NPC::OnLabel")
+*addtimercount("NPC::OnLabel", <ticks>)
These commands will create, destroy, and delay a countdown timer -
-'addtimer' to create, 'deltimer' to destroy and 'addtimercount' to delay
+addtimer() to create, deltimer() to destroy and addtimercount() to delay
it by the specified number of ticks. For all three cases, the event label
given is the identifier of that timer. The timer runs on the character
object that is attached to the script, and can have multiple instances.
@@ -6417,38 +6449,38 @@ The ticks are given in 1/1000ths of a second.
One more thing. These timers are stored as part of player data. If the
player logs out, all of these get immediately deleted, without executing
the script. If this behavior is undesirable, use some other timer
-mechanism (like 'sleep').
+mechanism (like sleep()).
Example:
<NPC Header> {
- dispbottom "Starting a 5 second timer...";
- addtimer 5000, strnpcinfo(3)+"::On5secs";
+ dispbottom("Starting a 5 second timer...");
+ addtimer(5000, strnpcinfo(3)+"::On5secs");
end;
On5secs:
- dispbottom "5 seconds have passed!";
+ dispbottom("5 seconds have passed!");
end;
}
---------------------------------------
-*initnpctimer { "<NPC name>" {, <Attach Flag>} } |
- { "<NPC name>" | <Attach Flag> };
-*stopnpctimer { "<NPC name>" {, <Detach Flag>} } |
- { "<NPC name>" | <Detach Flag> };
-*startnpctimer { "<NPC name>" {, <Attach Flag>} } |
- { "<NPC name>" | <Attach Flag> };
-*setnpctimer <tick>{,"<NPC name>"};
-*getnpctimer (<type of information>{,"<NPC name>"})
-*attachnpctimer {"<character name>"};
-*detachnpctimer {"<NPC name>"};
+*initnpctimer({ "<NPC name>" {, <Attach Flag>} } |
+ { "<NPC name>" | <Attach Flag> })
+*stopnpctimer({ "<NPC name>" {, <Detach Flag>} } |
+ { "<NPC name>" | <Detach Flag> })
+*startnpctimer({ "<NPC name>" {, <Attach Flag>} } |
+ { "<NPC name>" | <Attach Flag> })
+*setnpctimer(<tick>{, "<NPC name>"})
+*getnpctimer(<type of information>{, "<NPC name>"})
+*attachnpctimer({"<character name>"})
+*detachnpctimer({"<NPC name>"})
This set of commands and functions will create and manage an NPC-based
timer. The NPC name may be omitted, in which case the calling NPC is used
as target.
-Contrary to addtimer/deltimer commands which let you have many different
+Contrary to addtimer()/deltimer() commands which let you have many different
timers referencing different labels in the same NPC, each with their own
-countdown, 'initnpctimer' can only have one per NPC object. But it can
+countdown, initnpctimer() can only have one per NPC object. But it can
trigger many labels and let you know how many were triggered already and
how many still remain.
@@ -6457,16 +6489,16 @@ Upon creating this timer, the execution will not stop, but will happily
continue onward. The timer will then invoke new execution threads at
labels "OnTimer<time>:" in the NPC object it is attached to.
-To create the timer, use the 'initnpctimer', which will start it running.
-'stopnpctimer' will pause the timer, without clearing the current tick,
-while 'startnpctimer' will let the paused timer continue.
+To create the timer, use the initnpctimer(), which will start it running.
+stopnpctimer() will pause the timer, without clearing the current tick,
+while startnpctimer() will let the paused timer continue.
By default timers do not have a RID attached, which lets them continue
even if the player that started them logs off. To attach a RID to a timer,
you can either use the optional "attach flag" when using
-'initnpctimer/startnpctimer', or do it manually by using 'attachnpctimer'.
-Likewise, the optional flag of stopnpctimer lets you detach any RID after
-stopping the timer, and by using 'detachnpctimer' you can detach a RID at
+initnpctimer()/startnpctimer(), or do it manually by using attachnpctimer().
+Likewise, the optional flag of stopnpctimer() lets you detach any RID after
+stopping the timer, and by using detachnpctimer() you can detach a RID at
any time.
Normally there is only a single timer per NPC, but as an exception, as
@@ -6481,8 +6513,8 @@ If the player that is attached to the npctimer logs out, the
the appropriate cleanup (the player is still attached when this event is
triggered).
-The 'setnpctimer' command will explicitly set the timer to a given tick.
-'getnpctimer' provides timer information. Its parameter defines what type:
+The setnpctimer() command will explicitly set the timer to a given tick.
+getnpctimer() provides timer information. Its parameter defines what type:
0 - Will return the current tick count of the timer.
1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
@@ -6493,46 +6525,46 @@ The 'setnpctimer' command will explicitly set the timer to a given tick.
Example 1:
<NPC Header> {
- // We need to use attachnpctimer because the mes command below
+ // We need to use attachnpctimer() because the mes command below
// needs RID attach
- attachnpctimer;
- initnpctimer;
- npctalk "I cant talk right now, give me 10 seconds";
+ attachnpctimer();
+ initnpctimer();
+ npctalk("I cant talk right now, give me 10 seconds");
end;
OnTimer5000:
- npctalk "Ok 5 seconds more";
+ npctalk("Ok 5 seconds more");
end;
OnTimer6000:
- npctalk "4";
+ npctalk("4");
end;
OnTimer7000:
- npctalk "3";
+ npctalk("3");
end;
OnTimer8000:
- npctalk "2";
+ npctalk("2");
end;
OnTimer9000:
- npctalk "1";
+ npctalk("1");
end;
OnTimer10000:
- stopnpctimer;
- mes "[Man]";
- mes "Ok we can talk now";
- detachnpctimer;
- // and remember attachnpctimer and detachnpctimer can only be used
+ stopnpctimer();
+ mes("[Man]");
+ mes("Ok we can talk now");
+ detachnpctimer();
+ // and remember attachnpctimer() and detachnpctimer() can only be used
// while the NPC timer is not running!
}
Example 2:
OnTimer15000:
- npctalk "Another 15 seconds have passed.";
+ npctalk("Another 15 seconds have passed.");
- // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
- // This is equal to 'setnpctimer 0' + 'startnpctimer'.
- // Alternatively, you can also insert another 'OnTimer15001' label
+ // You have to use initnpctimer() instead of setnpctimer(0).
+ // This is equal to setnpctimer(0); startnpctimer();.
+ // Alternatively, you can also insert another 'OnTimer15001:' label
// so that the timer won't stop.
- initnpctimer;
+ initnpctimer();
end;
// This OnInit label will run when the script is loaded, so that the
@@ -6540,55 +6572,55 @@ Example 2:
// dropped back to 0 every time the NPC says something, so it will
// cycle continuously.
OnInit:
- initnpctimer;
+ initnpctimer();
end;
Example 3:
- mes "[Man]";
- mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
+ mes("[Man]");
+ mes("I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.");
// We divide the timer returned by 1000 to convert milliseconds to
// seconds.
- close;
+ close();
Example 4:
- mes "[Man]";
- mes "Ok, I will let you have 30 more seconds...";
- close2;
- setnpctimer (getnpctimer(0)-30000);
- // Notice the 'close2'. If there were a 'next' there the timer would
- // be changed only after the player pressed the 'next' button.
+ mes("[Man]");
+ mes("Ok, I will let you have 30 more seconds...");
+ close2();
+ setnpctimer(getnpctimer(0)-30000);
+ // Notice the close2(). If there were a next() there the timer would
+ // be changed only after the player pressed the next() button.
end;
---------------------------------------
-*sleep <milliseconds>;
-*sleep2 <milliseconds>;
-*awake "<NPC name>";
+*sleep(<milliseconds>)
+*sleep2(<milliseconds>)
+*awake("<NPC name>")
These commands are used to control the pause of a NPC.
-sleep and sleep2 will pause the script for the given amount of
+sleep() and sleep2() will pause the script for the given amount of
milliseconds.
-Awake is used to cancel a sleep. When awake is called on a NPC it will run
-as if the sleep timer ran out, and thus making the script continue. Sleep
-and sleep2 basically do the same, but the main difference is that sleep
-will not keep the rid, while sleep2 does.
+awake() is used to cancel a sleep(). When awake() is called on a NPC it will run
+as if the sleep timer ran out, and thus making the script continue. sleep()
+and sleep2() basically do the same, but the main difference is that sleep()
+will not keep the rid, while sleep2() does.
Examples:
// This will pause the script for 10 seconds and ditch the RID
// (so no player is attached anymore)
- sleep 10000;
+ sleep(10000);
// Pauses the script for 5 seconds, and continue with the RID attached.
- sleep2 5000;
+ sleep2(5000);
//Cancels any running sleep timers on the NPC 'NPC'.
- awake "NPC";
+ awake("NPC");
---------------------------------------
-*progressbar "<color>",<seconds>;
+*progressbar("<color>", <seconds>)
-This command works almost like sleep2, but displays a progress bar above
+This command works almost like sleep2(), but displays a progress bar above
the head of the currently attached character (like cast bar). Once the
given amount of seconds passes, the script resumes. If the character moves
while the progress bar progresses, it is aborted and the script ends. The
@@ -6601,12 +6633,12 @@ client and appears always green.
//=====================================
---------------------------------------
-*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
+*announce("<text>", <flag>{, <fontColor>{, <fontType>{, <fontSize>{, <fontAlign>{, <fontY>}}}}})
This command will broadcast a message to all or most players, similar to
@kami/@kamib GM commands.
- announce "This will be shown to everyone at all in yellow.", bc_all;
+ announce("This will be shown to everyone at all in yellow.", bc_all);
The region the broadcast is heard in (target), source of the broadcast and
the color the message will come up as is determined by the flags.
@@ -6647,12 +6679,12 @@ notation. C_ constant can also be used for color effects, see the full list
of the available ones in 'db/constants.conf' under 'C_'.
For example:
- announce "This announcement will be shown to everyone in green.",bc_all,0x00FF00;
+ announce("This announcement will be shown to everyone in green.", bc_all, 0x00FF00);
Will display a global announce in green. The color format is in RGB
(0xRRGGBB).
Another example:
- announce "This announcement will shown to everyone in purple.",bc_all,C_PURPLE;
+ announce("This announcement will shown to everyone in purple.", bc_all, C_PURPLE);
In official scripts only two font-weights (types) are used:
- normal (FW_NORMAL = 400, default),
@@ -6665,64 +6697,64 @@ idea, but it can be used instead in NPCs to "preview" an announce.
// This will be a private message to the player using the NPC that
// made the announcement
- announce "This is my message just for you",bc_blue|bc_self;
+ announce("This is my message just for you", bc_blue|bc_self);
// This will be shown on everyones screen that is in sight of the NPC.
- announce "This is my message just for you people here",bc_npc|bc_area;
+ announce("This is my message just for you people here", bc_npc|bc_area);
---------------------------------------
-*mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
+*mapannounce("<map name>", "<text>", <flag>{, <fontColor>{, <fontType>{, <fontSize>{, <fontAlign>{, <fontY>}}}}}})
-This command will work like 'announce' but will only broadcast to
+This command will work like announce() but will only broadcast to
characters currently residing on the specified map. The flag and optional
-parameters parameters are the same as in 'announce', but target and source
+parameters parameters are the same as in announce(), but target and source
flags are ignored.
---------------------------------------
-*areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
+*areaannounce("<map name>", <x1>, <y1>, <x2>, <y2>, "<text>", <flag>{, <fontColor>{, <fontType>{, <fontSize>{, <fontAlign>{, <fontY>}}}}}})
This command works like 'announce' but will only broadcast to characters
residing in the specified x1/y1-x2/y2 rectangle on the map given. The
-flags and optional parameters are the same as in 'announce', but target
+flags and optional parameters are the same as in announce(), but target
and source flags are ignored.
- areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
+ areaannounce("prt_church", 0, 0, 350, 350, "God's in his heaven, all right with the world", 0);
---------------------------------------
-*callshop "<name>",<option>;
+*callshop("<name>", <option>)
These are a series of commands used to create dynamic shops.
-The callshop function calls an invisible shop (FAKE_NPC) as if the player
+The callshop() function calls an invisible shop (FAKE_NPC) as if the player
clicked on it.
For the options on callShop:
0 = The normal window (buy, sell and cancel)
1 = The buy window
2 = The sell window
-
+
Example:
//Will call the shop named DaShop and opens the buy menu.
-callshop "DaShop",1;
+callshop("DaShop", 1);
-The shop which is called by callshop (as long as an npcshop* command is
+The shop which is called by callshop() (as long as an npcshop* command is
executed from that NPC (see note 1)) will trigger the labels OnBuyItem and
OnSellitem. These labels can take over handling for relatively the buying
of items from the shop and selling the items to a shop. Via these labels
you can customize the way an item is bought or sold by a player.
-In the OnBuyItem, two arrays are set (@bought_nameid and
-@bought_quantity), which hold information about the name id (item id) sold
+In the OnBuyItem, two arrays are filled (@bought_nameid and
+@bought_quantity) with information about the name id (item id) sold
and the amount sold of it. Same goes for the OnSellItem label, only the
variables are named different (@sold_nameid, @sold_quantity, @sold_refine,
@sold_attribute, @sold_identify, @sold_card1, @sold_card2, @sold_card3,
@sold_card4). An example on a shop comes with Hercules, and can be found
in the doc/sample/npc_dynamic_shop.txt file.
-
+
This example shows how to use the labels and their set variables to create
a dynamic shop.
@@ -6734,42 +6766,42 @@ given in the shop.
---------------------------------------
-*npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
+*npcshopitem("<name>", <item id>, <price>{, <item id>, <price>{, <item id>, <price>{, ...}}})
This command lets you override the contents of an existing NPC shop or
cashshop. The current sell list will be wiped, and only the items
specified with the price specified will be for sale.
-The function returns 1 if shop was updated successfully, or 0 if not found.
+The function returns true if shop was updated successfully, or false if not found.
Note that you cannot use -1 to specify default selling price!
---------------------------------------
-*npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
+*npcshopadditem("<name>", <item id>, <price>{, <item id>, <price>{, <item id>, <price>{, ...}}})
This command will add more items at the end of the selling list for the
specified NPC shop or cashshop. If you specify an item already for sell,
that item will appear twice on the sell list.
-The function returns 1 if shop was updated successfully, or 0 if not found.
+The function returns true if shop was updated successfully, or false if not found.
Note that you cannot use -1 to specify default selling price!
---------------------------------------
-*npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}}
+*npcshopdelitem("<name>", <item id>{, <item id>{, <item id>{, ...}}})
This command will remove items from the specified NPC shop or cashshop.
If the item to remove exists more than once on the shop, all instances
will be removed.
-Note that the function returns 1 even if no items were removed. The return
+Note that the function returns true even if no items were removed. The return
value is only to confirm that the shop was indeed found.
---------------------------------------
-*npcshopattach "<name>"{,<flag>}
+*npcshopattach("<name>"{, <flag>})
This command will attach the current script to the given NPC shop.
When a script is attached to a shop, the events "OnBuyItem" and
@@ -6778,16 +6810,16 @@ from the shop. Additionally, the arrays @bought_nameid[],
@bought_quantity[] or @sold_nameid[] and @sold_quantity[] will be filled
up with the items and quantities bought/sold.
-The optional parameter specifies whether to attach ("1") or detach ("0")
+The optional parameter specifies whether to attach (true) or detach (false)
from the shop (the default is to attach). Note that detaching will detach
any NPC attached to the shop, even if it's from another script, while
attaching will override any other script that may be already attached.
-The function returns 0 if the shop was not found, 1 otherwise.
+The function returns false if the shop was not found, true otherwise.
---------------------------------------
-*waitingroom "<chatroom name>",<limit>{,<event label>,<trigger>,<required zeny>,<min lvl>,<max lvl>};
+*waitingroom("<chatroom name>", <limit>{, <event label>, <trigger>, <required zeny>, <min lvl>, <max lvl>})
This command will create a chat room, owned by the NPC object running this
script and displayed above the NPC sprite.
@@ -6796,13 +6828,13 @@ The maximum length of a chat room name is 60 letters.
The limit is the maximum number of people allowed to enter the chat room.
The attached NPC is included in this count. If the optional event and
trigger parameters are given, the event label
-("<NPC object name>::<label name>") will be invoked as if with a 'doevent'
+("<NPC object name>::<label name>") will be invoked as if with a doevent()
upon the number of people in the chat room reaching the given triggering
amount.
// The NPC will just show a box above its head that says "Hello World",
// clicking it will do nothing, since the limit is zero.
- waitingroom "Hello World",0;
+ waitingroom("Hello World", 0);
// The NPC will have a box above its head, with "Disco - Waiting Room"
// written on it, and will have 8 waiting slots. Clicking this will enter
@@ -6810,7 +6842,7 @@ amount.
// accumulate. Once this happens, it will cause the NPC "Bouncer" run the
// label "OnStart".
- waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
+ waitingroom("Disco - Waiting Room", 8, "Bouncer::OnStart", 7);
// The NPC will have a box above its head, with "Party - Waiting Room"
// written on it, and will have 8 waiting slots. Clicking this will allow
@@ -6818,7 +6850,7 @@ amount.
// the player will be able to wait until 7 players accumulate. Once this
// happens, it will cause the NPC "Bouncer" run the label "OnStart".
- waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
+ waitingroom("Party - Waiting Room", 8, "Bouncer::OnStart", 7, 5000, 50, 99);
Creating a waiting room does not stop the execution of the script and it
will continue to the next line.
@@ -6828,7 +6860,7 @@ extensive use of waiting rooms.
---------------------------------------
-*delwaitingroom {"<NPC object name"};
+*delwaitingroom({"<NPC object name"})
This command will delete a waiting room. If no parameter is given, it will
delete a waiting room attached to the NPC object running this command, if
@@ -6837,15 +6869,15 @@ the only way to get rid of a waiting room, nothing else will cause it to
disappear.
It's not clear what happens to a waiting room if the NPC is disabled with
-'disablenpc', by the way.
+disablenpc(), by the way.
---------------------------------------
-*enablewaitingroomevent {"<NPC object name>"};
-*disablewaitingroomevent {"<NPC object name>"};
+*enablewaitingroomevent({"<NPC object name>"})
+*disablewaitingroomevent({"<NPC object name>"})
This will enable and disable triggering the waiting room event (see
-'waitingroom') respectively. Optionally giving an NPC object name will do
+waitingroom()) respectively. Optionally giving an NPC object name will do
that for a specified NPC object. The chat room will not disappear when
triggering is disabled and enabled in this manner and players will not be
kicked out of it. Enabling a chat room event will also cause it to
@@ -6858,7 +6890,7 @@ characters are present in the room to mess up the script.
---------------------------------------
-*getwaitingroomstate(<information type>{,"<NPC object name>"})
+*getwaitingroomstate(<information type>{, "<NPC object name>"})
This function will return information about the waiting room state for the
attached waiting room or for a waiting room attached to the specified NPC
@@ -6883,11 +6915,10 @@ The valid information types are:
34 - Minimum Base Level to enter waiting room.
35 - Maximum Base Level to enter waiting room.
36 - Minimum Zeny to enter waiting room.
-
---------------------------------------
-*warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
+*warpwaitingpc("<map name>", <x>, <y>{, <number of people>})
This command will warp the amount of characters equal to the trigger
number of the waiting room chat attached to the NPC object running this
@@ -6916,61 +6947,61 @@ one-on-one duel, for example.
---------------------------------------
-*kickwaitingroomall {"<NPC object name>"};
+*kickwaitingroomall({"<NPC object name>"})
This command kicks everybody out of a specified waiting room chat.
---------------------------------------
-*setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
+*setmapflagnosave("<map name>", "<alternate map name>", <x>, <y>)
This command sets the 'nosave' flag for the specified map and also gives
an alternate respawn-upon-relogin point.
It does not make a map impossible to make a save point on as you would
-normally think, 'savepoint' will still work. It will, however, make the
+normally think, savepoint() will still work. It will, however, make the
specified map kick the reconnecting players off to the alternate map given
to the coordinates specified.
---------------------------------------
-*setmapflag "<map name>",<flag>{,<val>};
+*setmapflag("<map name>", <flag>{, <val>})
This command marks a specified map with a map flag given. Map flags alter
the behavior of the map, you can see the list of the available ones in
'db/constants.conf' under 'mf_'.
-The map flags alter the behavior of the map regarding teleporting
-(mf_nomemo, mf_noteleport, mf_nowarp, mf_nogo), storing location when
-disconnected (mf_nosave), dead branch usage (mf_nobranch), penalties upon
-death (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp,
-mf_pvp_noparty, mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty),
-ability to use skills or open up trade deals (mf_notrade, mf_novending,
-mf_noskill, mf_noicewall), current weather effects (mf_snow, mf_fog,
-mf_sakura, mf_leaves, mf_rain, mf_clouds, mf_fireworks) and whether night
-will be in effect on this map (mf_nightenabled).
+The map flags alter the behavior of the map regarding teleporting
+(mf_nomemo, mf_noteleport, mf_nowarp), storing location when
+disconnected (mf_nosave), dead branch usage (mf_nobranch), penalties
+upon death (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp,
+mf_pvp_noparty, mf_pvp_noguild), WoE behavior (mf_gvg, mf_gvg_noparty),
+ability to use skills or open up trade deals (mf_notrade, mf_novending,
+mf_noskill, mf_noicewall), current weather effects (mf_snow, mf_fog,
+mf_sakura, mf_leaves, mf_clouds, mf_clouds2, mf_fireworks), whether
+night will be in effect on this map (mf_nightenabled) and so on.
The val optional parameter is as the mapflags variable when one exists, it
may be a number or a string depending on the mapflag in question.
---------------------------------------
-*removemapflag "<map name>",<flag>;
+*removemapflag("<map name>", <flag>)
This command removes a mapflag from a specified map.
-See 'setmapflag' for a list of mapflags.
+See setmapflag() for examples of mapflags.
---------------------------------------
-*getmapflag("<map name>",<flag>)
+*getmapflag("<map name>", <flag>)
This command checks the status of a given mapflag and returns the
mapflag's state.
-0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
+false means OFF, and true means ON. See setmapflag() for examples of mapflags.
---------------------------------------
-*setbattleflag "<battle flag>",<value>;
+*setbattleflag("<battle flag>", <value>)
*getbattleflag("<battle flag>")
Sets or gets the value of the given battle flag.
@@ -6980,15 +7011,15 @@ also used in Lupus' variable rates script.
Examples:
// Will set the base experience rate to 20x (2000%)
- setbattleflag "base_exp_rate",2000;
+ setbattleflag("base_exp_rate", 2000);
// Will return the value of the base experience rate (when used after the
// above example, it would print 2000).
- mes getbattleflag("base_exp_rate");
+ mes(getbattleflag("base_exp_rate"));
---------------------------------------
-*warpportal <x>,<y>,"<mapname>",<x>,<y>;
+*warpportal(<x>, <y>, "<mapname>", <x>, <y>)
Creates a warp Portal as if a acolyte class character did it.
The first x and y is the place of the warp portal on the map where the NPC
@@ -6998,11 +7029,11 @@ Examples:
// Will create a warp portal on the NPC's map at 150,150
// leading to prontera, coords 150,180.
- warpportal 150,150,"prontera",150,180;
+ warpportal(150, 150, "prontera", 150, 180);
---------------------------------------
-*mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
+*mapwarp("<from map>", "<to map>", <x>, <y>{, <type>, <ID>})
This command will collect all characters located on the From map and warp
them wholesale to the same point on the To map, or randomly distribute
@@ -7019,7 +7050,7 @@ Optionally, a type and ID can be specified. Available types are:
Example:
// Will warp all members of guild with ID 63 on map prontera to alberta.
- mapwarp "prontera","alberta",150,150,1,63;
+ mapwarp("prontera", "alberta", 150, 150, 1, 63);
---------------------------------------
//=====================================
@@ -7027,7 +7058,7 @@ Example:
//=====================================
---------------------------------------
-*maprespawnguildid "<map name>",<guild id>,<flag>;
+*maprespawnguildid("<map name>", <guild id>, <flag>)
This command goes through the specified map and for each player and
monster found there does stuff.
@@ -7049,10 +7080,10 @@ For examples, check the WoE scripts in the distribution.
---------------------------------------
-*agitstart;
-*agitend;
-*agitstart2;
-*agitend2;
+*agitstart()
+*agitend()
+*agitstart2()
+*agitend2()
These four commands will start/end War of Emperium or War of Emperium SE.
@@ -7066,8 +7097,8 @@ time-triggering label.
---------------------------------------
-*gvgon "<map name>";
-*gvgoff "<map name>";
+*gvgon("<map name>")
+*gvgoff("<map name>")
These commands will turn GVG mode for the specified maps on and off,
setting up appropriate map flags. In GVG mode, maps behave as if during
@@ -7076,14 +7107,14 @@ effect.
---------------------------------------
-*flagemblem <guild id>;
+*flagemblem(<guild id>)
-This command only works when run by the NPC objects which have sprite id
-722, which is a 3D guild flag sprite. If it isn't, the data will change,
-but nothing will be seen by anyone. If it is invoked in that manner, the
-emblem of the specified guild will appear on the flag, though, if any
-players are watching it at this moment, they will not see the emblem
-change until they move out of sight of the flag and return.
+This command only works when run by the NPC objects which have sprite id
+GUILD_FLAG (722), which is a 3D guild flag sprite. If it isn't, the data
+will change, but nothing will be seen by anyone. If it is invoked in
+that manner, the emblem of the specified guild will appear on the flag,
+though, if any players are watching it at this moment, they will not see
+the emblem change until they move out of sight of the flag and return.
This is commonly used in official guildwar scripts with a function call
which returns a guild id:
@@ -7091,13 +7122,13 @@ which returns a guild id:
// This will change the emblem on the flag to that of the guild that owns
// "guildcastle"
- flagemblem getcastledata("guildcastle",1);
+ flagemblem(getcastledata("guildcastle", 1));
---------------------------------------
-*guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
+*guardian("<map name>", <x>, <y>, "<name to show>", <mob id>{, "<event label>"{, <guardian index>}})
-This command is roughly equivalent to 'monster', but is meant to be used
+This command is roughly equivalent to monster(), but is meant to be used
with castle guardian monsters and will only work with them. It will set
the guardian characteristics up according to the castle's investment
values and otherwise set the things up that only castle guardians need.
@@ -7109,7 +7140,7 @@ guardianinfo.
---------------------------------------
-*guardianinfo("<map name>", <guardian number>, <type>);
+*guardianinfo("<map name>", <guardian number>, <type>)
This function will return various info about the specified guardian, or -1
if it fails for some reason. It is primarily used in the castle manager
@@ -7127,22 +7158,22 @@ Type indicates what information to return:
//=====================================
---------------------------------------
-*npcspeed <speed value>;
-*npcwalkto <x>,<y>;
-*npcstop;
+*npcspeed(<speed value>)
+*npcwalkto(<x>, <y>)
+*npcstop()
These commands will make the NPC object in question move around the map.
As they currently are, they are a bit buggy and are not useful for much
more than making an NPC move randomly around the map.
-'npcspeed' will set the NPCs walking speed to a specified value. As in the
+npcspeed() will set the NPCs walking speed to a specified value. As in the
@speed GM command, 200 is the slowest possible speed while 0 is the
fastest possible (instant motion). 100 is the default character walking
speed.
-'npcwalkto' will start the NPC sprite moving towards the specified
+npcwalkto() will start the NPC sprite moving towards the specified
coordinates on the same map as it is currently on. The script proceeds
immediately after the NPC begins moving.
-'npcstop' will stop the motion.
+npcstop() will stop the motion.
While in transit, the NPC will be clickable, but invoking it will cause it
to stop moving, which will make it's coordinates different from what the
@@ -7156,9 +7187,9 @@ by defining a job-sprite based sprite id in 'db/mob_avail.txt' with this.
---------------------------------------
-*movenpc "<NPC name>",<x>,<y>{,<dir>};
+*movenpc("<NPC name>", <x>, <y>{, <dir>})
-This command looks like the npcwalktoxy function,but is a little different.
+This command looks like the npcwalktoxy function, but is a little different.
While npcwalktoxy just makes the NPC 'walk' to the coordinates given
(which sometimes gives problems if the path isn't a straight line without
@@ -7170,7 +7201,7 @@ Example:
// This will move Bugga from to the coordinates 100,20 (if those
// coordinates are legit).
- movenpc "Bugga",100,20;
+ movenpc("Bugga", 100, 20);
---------------------------------------
//=====================================
@@ -7178,18 +7209,18 @@ Example:
//=====================================
---------------------------------------
-*debugmes "<message>";
+*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!";
+ debugmes(strcharinfo(PC_NAME)+" has clicked me!");
- // debugmes "\033[38D\033[K ==Message== \n"; // enable colour code.
+ debugmes("\033[38D\033[K ==Message== \n"); // enable colour code.
---------------------------------------
-*logmes "<message>";
+*logmes("<message>")
This command will write the message given to the map server NPC log file,
as specified in 'conf/map/logs.conf'. If SQL logging is enabled, the message
@@ -7199,7 +7230,7 @@ If logs are not enabled for NPCs, nothing will happen.
---------------------------------------
-*globalmes "<message>"{,"<NPC name>"};
+*globalmes("<message>"{, "<NPC name>"})
This command will send a message to the chat window of all currently
connected characters.
@@ -7209,7 +7240,7 @@ be the NPC with the said name.
---------------------------------------
-*channelmes("<#channel>", "<message>");
+*channelmes("<#channel>", "<message>")
This command will send a message to the specified chat channel.
@@ -7223,7 +7254,7 @@ no RID is attached), false will be returned. In case of success, true is
returned.
---------------------------------------
-*rand(<number>{,<number>});
+*rand(<number>{, <number>})
This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you
@@ -7231,18 +7262,18 @@ This function returns a number ...
(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
+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>;
+*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
+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
@@ -7255,26 +7286,26 @@ 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;
+ 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;
+ 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;
+ 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>;
+*cutin("<filename>", <position>)
This command will display a picture, usually an NPC illustration, also
called cutin, for the currently attached client. The position parameter
@@ -7301,18 +7332,18 @@ 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;
+ 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;
+ mes("See you.");
+ close2();
+ cutin("", 255);
end;
---------------------------------------
-*pet <pet id>;
+*pet(<pet id>)
This command is used in all the item scripts for taming items. Running
this command will make the pet catching cursor appear on the client
@@ -7323,7 +7354,7 @@ A full list of pet IDs can be found inside 'db/pet_db.txt'
---------------------------------------
-*emotion <emotion number>{,<target>{,"<target name>"}};
+*emotion(<emotion number>{, <target>{, "<target name>"}})
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
@@ -7331,15 +7362,15 @@ if they were doing that emotion. For a full list of emotion numbers, see
question mark) and 'e_gasp' (the exclamation mark).
The optional target parameter specifies who will get the emotion on top of
-their head. If 0 (default if omitted), the NPC in current use will show
-the emotion, if 1, the player that is running the script will display it.
+their head. If false (default if omitted), the NPC in current use will show
+the emotion, if true, the player that is running the script will display it.
Target name parameter allows to display emotion on top of other NPC/PC
without event labels. If specified name is not found, command does nothing.
---------------------------------------
-*misceffect <effect number>;
+*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
@@ -7354,11 +7385,11 @@ 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>};
+*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').
+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.
@@ -7375,18 +7406,18 @@ 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; // will play the soundeffect
-soundeffect "12345678901234567890.wav", 0; // throws gravity error
+soundeffect("1234567890123456789.wav", 0); // will play the soundeffect
+soundeffect("12345678901234567890.wav", 0); // throws gravity error
You can add your own effects this way, naturally.
---------------------------------------
-*playbgm "<BGM filename>";
-*playbgmall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
+*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').
+character only (playbgm()) or multiple characters (playbgmall()).
BGM filename is the filename in /BGM/ folder. It has to be in .mp3
extension, but it's not required to specify the extension in the script.
@@ -7398,16 +7429,16 @@ You can add your own BGMs this way, naturally.
---------------------------------------
-*pvpon "<map name>";
-*pvpoff "<map name>";
+*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
+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>";
+*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
@@ -7415,15 +7446,16 @@ 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$;
+ input(.@player$);
+ atcommand("@nuke "+.@player$);
-This command has a lot of good uses, I am sure you can have some fun with
-this one.
+Use of this command is not recommended unless you know what you're
+doing, since not all atcommands are intended to be used by the script
+engine.
---------------------------------------
-*charcommand "<command>";
+*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
@@ -7433,11 +7465,15 @@ 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";
+ charcommand("#option 0 0 0 Roy");
+
+Use of this command is not recommended unless you know what you're
+doing, since not all atcommands are intended to be used by the script
+engine.
---------------------------------------
-*bindatcmd "command","<NPC object name>::<event label>"{,<group level>,<group level char>,<log>};
+*bindatcmd("command", "<NPC object name>::<event label>"{, <group level>, <group level char>, <log>})
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
@@ -7449,7 +7485,7 @@ be able to access the command.
used on others like a char command would, e.g. "#command "target" params",
when not provided, "group level char" defaults to 99.
"log" whether to log the usages of this command with the atcommand log
-(1 = log, 0 = no log), default is to not log.
+(true = log, false = no log), default is to not log.
The following variables are set upon execution:
.@atcmd_command$ = The name of the @command used.
@@ -7467,10 +7503,10 @@ When a user types the command "@test", an angel effect will be shown.
- script atcmd_example FAKE_NPC,{
OnInit:
- bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
+ bindatcmd("test", strnpcinfo(3)+"::OnAtcommand");
end;
OnAtcommand:
- specialeffect2 338;
+ specialeffect2(EF_ANGEL2);
end;
}
@@ -7505,7 +7541,7 @@ case it expects spaces. For example:
- script atcmd_example FAKE_NPC,{
OnInit:
- bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
+ bindatcmd("test", strnpcinfo(3)+"::OnAtcommand");
end;
OnAtcommand:
// This command expects a character name (that may contain spaces) as
@@ -7520,13 +7556,13 @@ OnAtcommand:
---------------------------------------
-*unbindatcmd "command";
+*unbindatcmd("command")
This command will unbind a NPC event label from an atcommand.
---------------------------------------
-*useatcmd "command";
+*useatcmd("command")
This command will execute an atcommand binding on the attached RID from a
script. The three .@atcmd_***** variables will NOT be set when invoking
@@ -7534,10 +7570,10 @@ scripts-atcommands this way.
---------------------------------------
-*unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>};
-*unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>};
-*unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;
-*unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>;
+*unitskilluseid(<GID>, <skill id>, <skill lvl>{, <target id>})
+*unitskilluseid(<GID>, "<skill name>", <skill lvl>{, <target id>})
+*unitskillusepos(<GID>, <skill id>, <skill lvl>, <x>, <y>)
+*unitskillusepos(<GID>, "<skill name>", <skill lvl>, <x>, <y>)
This is the replacement of the older commands, these use the same values
for GID as the other unit* commands (See 'GID').
@@ -7547,8 +7583,8 @@ For the position, the x and y are given in the unitskillusepos.
---------------------------------------
-*npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
-*npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
+*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
@@ -7561,22 +7597,22 @@ config, and will not work properly if the NPC has a mob sprite.
// Casts Level 10 Heal on the attached player, calculated with
// all stats 99 and base level 60.
- npcskill "AL_HEAL",10,99,60;
+ npcskill(AL_HEAL, 10, 99, 60);
---------------------------------------
-*setnpcdistance <distance>
+*setnpcdistance(<distance>)
This command can reduce distance from where npc can be clicked.
Usefull to use from OnInit event.
// Set distance to one tile on server load
OnInit:
- setnpcdistance 1;
+ setnpcdistance(1);
---------------------------------------
-*getnpcdir {<name>};
+*getnpcdir({<name>})
Return current npc direction for parameter "name" or for attached npc
if it missing. If name missing and not attached npc, return -1.
@@ -7586,16 +7622,16 @@ Example:
---------------------------------------
-*setnpcdir {<name>,} <direction>;
+*setnpcdir({<name>, }<direction>)
Set npc direction. If npc name missing, will be used attached npc.
Example:
- setnpcdir 2;
+ setnpcdir(DIR_WEST);
---------------------------------------
-*getnpcclass {<name>};
+*getnpcclass({<name>})
Return npc class/sprite id for npc with given name or for attached npc.
If name missing and no attached npc, return -1.
@@ -7605,8 +7641,8 @@ Example:
---------------------------------------
-*day;
-*night;
+*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
@@ -7616,13 +7652,14 @@ Example:
- script DayNight FAKE_NPC,{
OnClock0600:
- day;
+ day();
end;
OnInit:
// setting correct mode upon server start-up
- if (gettime(GETTIME_HOUR) >= 6 && gettime(GETTIME_HOUR) < 18) end;
+ if (gettime(GETTIME_HOUR) >= 6 && gettime(GETTIME_HOUR) < 18)
+ end;
OnClock1800:
- night;
+ night();
end;
}
@@ -7634,21 +7671,21 @@ script is used.
---------------------------------------
-*pcre_match("<string>","<regex>");
-
-This command is only available if the server is compiled with regular
-expressions library enabled.
+*pcre_match("<string>", "<regex>")
The string <string> will be searched for a match to the regular expression
<regex>, and the number of matches will be returned.
An alternative way to invoke this command is to use the operators '~=' or '~!'.
The operator '~=' is exactly the same as pcre_match, while the operator '~!'
-will return 1 if no matches were found, or 0 if at least a match was found.
+will return true if no matches were found, or false if at least a match was found.
- if (pcre_match("string", "regex")) mes "There was a match.";
- if ("string" ~= "regex") mes "There was a match.";
- if ("string" ~! "regex") mes "There were no matches.";
+ if (pcre_match("string", "regex"))
+ mes("There was a match.");
+ if ("string" ~= "regex")
+ mes("There was a match.");
+ if ("string" ~! "regex")
+ mes("There were no matches.");
You can find more usage examples in the test script npc/custom/test.txt.
@@ -7675,13 +7712,10 @@ a regex tutorial.
---------------------------------------
-*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.
+*defpattern(<set number>, "<regular expression pattern>", "<event label>")
+*activatepset(<set number>)
+*deactivatepset(<set number>)
+*deletepset(<set number>)
They will make the NPC object listen for text spoken publicly by players
and match it against regular expression patterns, then trigger labels
@@ -7691,18 +7725,18 @@ 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
+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
+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
+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
+deletepset() will delete a pattern set from memory, so you can create a
new pattern set in its place.
For an example of this in use, see doc/sample/npc_test_pcre.txt
@@ -7713,12 +7747,12 @@ instead if they want it so much.
---------------------------------------
-*pow(<number>,<power>)
+*pow(<number>, <power>)
Returns the result of the calculation.
Example:
- .@i = pow(2,3); // .@i will be 8
+ .@i = pow(2, 3); // .@i will be 8
---------------------------------------
@@ -7744,7 +7778,7 @@ Example:
---------------------------------------
-*distance(<x0>,<y0>,<x1>,<y1>)
+*distance(<x0>, <y0>, <x1>, <y1>)
Returns distance between 2 points.
@@ -7753,12 +7787,12 @@ is returned, otherwise the Chebyshev distance. The value is truncated to
integer.
Example:
- .@i = distance(100,200,101,202);
+ .@i = distance(100, 200, 101, 202);
---------------------------------------
-*min(<number>{,<number>...<number>})
-*max(<number>{,<number>...<number>})
+*min(<number>{, <number>...<number>})
+*max(<number>{, <number>...<number>})
Returns the smallest (or biggest) from the set of given numbers.
@@ -7780,36 +7814,36 @@ Example:
---------------------------------------
-*swap <variable>,<variable>;
+*swap(<variable>, <variable>)
Swap the value of 2 variables. Both sides must be same integer or string type.
Example:
.@var1 = 111;
.@var2 = 222;
- swap .@var1, .@var2;
- mes "var1 = "+ .@var1; // return 222
- mes "var2 = "+ .@var2; // return 111
+ swap(.@var1, .@var2);
+ mes("var1 = "+ .@var1); // return 222
+ mes("var2 = "+ .@var2); // return 111
---------------------------------------
-*query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
-*query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
+*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 128 rows of values, and will return the number of rows (the array size).
-Note that 'query_sql' runs on the main database while 'query_logsql' runs
+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]+")"; // Will return a person with the biggest 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]+")";
+ .@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]+")"); // Will return a person with the biggest 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]+")");
---------------------------------------
@@ -7824,7 +7858,7 @@ Example:
---------------------------------------
-*setiteminfo(<item id>,<type>,<value>)
+*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
@@ -7844,7 +7878,7 @@ setiteminfo Stone, 6, 9990; // Stone now weighs 999.0
---------------------------------------
-*setitemscript(<item id>,<"{ new item script }">{,<type>});
+*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
@@ -7857,8 +7891,8 @@ Type can optionally be used indicates which script to set (default is 0):
Example:
-setitemscript Silver_Ring_, "{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
-setitemscript Silver_Ring_, "";
+setitemscript(Silver_Ring_, "{ if (isequipped(Santa's_Hat) == 0) end; if (getskilllv(AL_TELEPORT)) { skill(MC_IDENTIFY, 1); } else { skill(AL_TELEPORT, 1+isequipped(Santa's_Hat)); } }");
+setitemscript(Silver_Ring_, "");
---------------------------------------
@@ -7866,21 +7900,21 @@ setitemscript Silver_Ring_, "";
*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
+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
+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)
Example:
.@var = atoi("11"); // Sets .@var to 11
.@var = axtoi("FF"); // Sets .@var to 255
-mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
+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)
@@ -7890,23 +7924,23 @@ mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
---------------------------------------
-*compare("<string>","<substring>")
+*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.
+This command returns true when the substring is in the main string or
+false otherwise. 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;
+//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>")
+*strcmp("<string>", "<string>")
This command compares two strings and is similar to strcmp in C.
@@ -7916,11 +7950,11 @@ Return Values:
<0 : String 1 < String 2
Examples:
- .@a = strcmp("abcdef","ABCDEF");
+ .@a = strcmp("abcdef", "ABCDEF");
if (.@a > 0){
- mes ".@a is greater than 0."; //Output is this.
- }else{
- mes ".@a is less or equal to 0";
+ mes(".@a is greater than 0."); //Output is this.
+ } else {
+ mes(".@a is less or equal to 0");
}
---------------------------------------
@@ -7934,15 +7968,15 @@ else.
---------------------------------------
-*charisalpha("<string>",<position>)
+*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.
+This function will return true if the character number Position in the given
+string is a letter, false if it isn't a letter but a digit or a space.
The first letter is position 0.
---------------------------------------
-*charat(<string>,<index>)
+*charat(<string>, <index>)
Returns char at specified index. If index is out of range, returns an
empty string.
@@ -7953,19 +7987,19 @@ Example:
---------------------------------------
-*setchar(<string>,<char>,<index>)
+*setchar(<string>, <char>, <index>)
Returns the original string with the char at the specified index set to
the specified char. If index is 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>)
+*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
@@ -7978,7 +8012,7 @@ Example:
---------------------------------------
-*delchar(<string>,<index>)
+*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.
@@ -8001,12 +8035,12 @@ Example:
---------------------------------------
-*charisupper(<string>,<index>)
-*charislower(<string>,<index>)
+*charisupper(<string>, <index>)
+*charislower(<string>, <index>)
-Returns 1 if character at specified index of specified string is
-uppercase for 'charisupper' or lowercase for 'charislower'. Otherwise, 0.
-Characters not of the alphabelt will return 0.
+Returns true if character at specified index of specified string is
+uppercase for charisupper() or lowercase for charislower(). Otherwise, false.
+Characters not of the alphabelt will return false.
Example:
@@ -8014,7 +8048,7 @@ Example:
---------------------------------------
-*substr(<string>,<start_index>,<end_index>)
+*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
@@ -8026,7 +8060,7 @@ Example:
---------------------------------------
-*explode(<dest_array>,<string>,<delimiter>)
+*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
@@ -8048,19 +8082,19 @@ Example:
---------------------------------------
-*implode(<string_array>{,<glue>})
+*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";
+ setarray(.@my_array$[0], "This", "is", "a", "test");
implode(.@my_array$, " "); //returns "This is a test"
---------------------------------------
-*sprintf(<format>{,param{,param{,...}}})
+*sprintf(<format>{, param{, param{, ...}}})
C style sprintf. The resulting string is returned.
@@ -8142,7 +8176,7 @@ Example:
---------------------------------------
-*sscanf(<string>,<format>{,param{,param{,...}}})
+*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
@@ -8154,7 +8188,7 @@ Example:
---------------------------------------
-*strpos(<haystack>,<needle>{,<offset>})
+*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.
@@ -8172,28 +8206,28 @@ Example:
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
+to false. 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"
+ replacestr("Donkey", "don", "mon", false); //returns "monkey"
+ replacestr("test test test test test", "test", "yay", false, 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.
+sensitive unless <usecase> is set to false.
Example:
countstr("test test test Test", "test"); //returns 3
- countstr("cake Cake", "Cake", 0); //returns 2
+ countstr("cake Cake", "Cake", false); //returns 2
---------------------------------------
-*setfont <font>;
+*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
@@ -8212,7 +8246,7 @@ currently used font is used, default interface font is used again.
---------------------------------------
-*showdigit <value>{,<type>};
+*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
@@ -8232,10 +8266,10 @@ 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;
+ showdigit(86399);
// counter that starts at 60 and runs for 60 seconds
- showdigit 60,3;
+ showdigit(60, 3);
---------------------------------------
@@ -8246,30 +8280,30 @@ meant to be executed from pet scripts. They will modify the pet AI
decision-making for the current pet of the invoking character, and will
NOT have any independent effect by themselves, which is why only one of
them each may be in effect at any time for a specific pet. A pet may
-have 'petloot', 'petskillbonus', 'petskillattack' and 'petskillsupport' at the
+have petloot(), petskillbonus(), petskillattack() and petskillsupport() at the
same time.
-*petskillbonus <bonus type>,<value>,<duration>,<delay>;
+*petskillbonus(<bonus type>, <value>, <duration>, <delay>)
This command will make the pet give a bonus to the owner's stat (bonus
-type - bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the
+type - bInt, bVit, bDex, bAgi, bLuk, bStr, bSpeedRate - for a full list, see the
values starting with 'b' in 'db/constants.conf').
-*petrecovery <status type>,<delay>;
+*petrecovery(<status type>, <delay>)
This command will make the pet cure a specified status condition. The
curing actions will occur once every <delay> seconds. For a full list of
status conditions that can be cured, see the list of 'SC_' status
condition constants in 'db/constants.conf'
-*petloot <max items>;
+*petloot(<max items>)
This command will turn on pet looting, with a maximum number of items to
loot specified. Pet will store items and return them when the maximum is
reached or when pet performance is activated.
-*petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
-*petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
+*petskillsupport(<skill id>, <skill level>, <delay>, <percent hp>, <percent sp>)
+*petskillsupport("<skill name>", <skill level>, <delay>, <percent hp>, <percent sp>)
This will make the pet use a specified support skill on the owner whenever
the HP and SP are below the given percent values, with a specified delay
@@ -8278,11 +8312,11 @@ time between activations. The skill numbers are as per
It's not quite certain who's stats will be used for the skills cast, the
character's or the pets. Probably, Skotlex can answer that question.
-*petskillattack <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
-*petskillattack "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
+*petskillattack(<skill id>, <damage>, <number of attacks>, <rate>, <bonusrate>)
+*petskillattack("<skill name>", <damage>, <number of attacks>, <rate>, <bonusrate>)
This command will make the pet cast an attack skill on the enemy the pet's
-owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
+owner is currently fighting. Skill IDs and levels are as per petskillsupport().
If <number of attacks> is specified different than 0, it will make the pet cast
the skill with a fixed amount of damage inflicted and the specified number of
attacks. A value of zero uses the skill's defaults.
@@ -8298,7 +8332,7 @@ exhibited if the pet is loyal and appropriate configuration options are
set in 'conf/map/battle.conf'.
Pet scripts in the database normally run whenever a pet of that type
-hatches from the egg. Other commands usable in item scripts (see 'bonus')
+hatches from the egg. Other commands usable in item scripts (see bonus())
will also happily run from pet scripts. Apparently, the pet-specific
commands will also work in NPC scripts and modify the behavior of the
current pet up until the pet is hatched again. (Which will also occur when
@@ -8311,7 +8345,7 @@ Nobody tried this before, so you're essentially on your own here.
---------------------------------------
-*bpet;
+*bpet()
This command opens up a pet hatching window on the client connected to the
invoking character. It is used in item script for the pet incubators and
@@ -8321,7 +8355,7 @@ This is still usable outside item scripts.
---------------------------------------
-*makepet <pet id>;
+*makepet(<pet id>)
This command will create a pet egg and put it in the invoking character's
inventory. The kind of pet is specified by pet ID numbers listed in
@@ -8329,22 +8363,22 @@ inventory. The kind of pet is specified by pet ID numbers listed in
successfully caught a pet in the normal way.
// This will make you a poring:
- makepet 1002;
+ makepet(PORING);
Notice that you absolutely have to create pet eggs with this command. If
-you try to give a pet egg with 'getitem', pet data will not be created by
+you try to give a pet egg with getitem(), pet data will not be created by
the char server and the egg will disappear when anyone tries to hatch it.
---------------------------------------
-*homshuffle;
+*homshuffle()
This will recalculate the homunculus stats according to its level, of the
current invoking character.
---------------------------------------
-*setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
+*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
@@ -8356,14 +8390,14 @@ This command lets you alter these flags for all map cells in the specified
(x1,y1)-(x2,y2) rectangle.
'type' defines which flag to modify. Possible options include cell_walkable,
cell_shootable, cell_basilica. For a full list, see constants.conf.
-'flag' can be 0 or 1 (0:clear flag, 1:set flag).
+'flag' can be false (clear flat) or true (set flag).
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;
+ setcell("arena", 0, 0, 300, 300, cell_basilica, true);
+ setcell("arena", 140, 140, 160, 160, cell_basilica, false);
+ setcell("arena", 135, 135, 165, 165, cell_walkable, false);
+ setcell("arena", 140, 140, 160, 160, cell_walkable, true);
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,
@@ -8375,10 +8409,10 @@ problems.
Another example:
OnBarricadeDeploy:
- setcell "schg_cas05",114,51,125,51,cell_walkable,0;
+ setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, false);
end;
OnBarricadeBreak:
- setcell "schg_cas05",114,51,125,51,cell_walkable,1;
+ setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, true);
end;
This could be a part of the WoE:SE script, where attackers are not allowed
@@ -8387,9 +8421,9 @@ remove a nonwalkable row of cells after the barricade mobs.
---------------------------------------
-*checkcell ("<map name>",<x>,<y>,<type>);
+*checkcell("<map name>", <x>, <y>, <type>)
-This command will return 1 or 0, depending on whether the specified cell
+This command will return true or false, 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
db/constants.conf.
@@ -8406,38 +8440,34 @@ overview:
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;
+ 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;
}
---------------------------------------
-*setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
-*delwall "<name>";
+*setwall("<map name>", <x>, <y>, <size>, <dir>, <shootable>, "<name>")
+*delwall("<name>")
-Creates an invisible wall, an array of "setcell" starting from x,y and
+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.
+Directions are the same as NPC sprite facing directions: (DIR_ constants).
---------------------------------------
-*readbook <book id>,<page>;
+*readbook(<book id>, <page>)
This will open a book item at the specified page.
@@ -8447,7 +8477,7 @@ This will open a book item at the specified page.
//=====================================
---------------------------------------
-*instance_create("<instance name>",<owner id>{,<optional owner_type>});
+*instance_create("<instance name>", <owner id>{, <optional owner_type>})
Create an instance using the name "<instance name>" for the <owner_id> of
owner_type (when not provided, defaults to IOT_PARTY). Most instance_*
@@ -8461,20 +8491,20 @@ Example:
// Attempt to create an instance using that party ID.
.@id = instance_create("Endless Tower", .@party_id);
if (.@id == -1) { // Invalid type - not used anymore
- ...
+ // ...
} else if (.@id == -2) { // Invalid Party ID
- ...
+ // ...
} else if (.@id == -3) { // No free instances (MAX_INSTANCE exceeded)
- ...
+ // ...
} else if (.@id == -4) { // Already exists
- ...
+ // ...
} else (.@id < 0) { // Unspecified error while queuing instance.
- ...
+ // ...
}
---------------------------------------
-*instance_destroy {<instance id>};
+*instance_destroy({<instance id>})
Destroys instance with the ID <instance id>. If no ID is specified, the
instance the script is attached to is used. If in the end no instance_id,
@@ -8482,23 +8512,23 @@ is found the command halts the script execution.
---------------------------------------
-*instance_attachmap("<map name>",<instance id>{,<use base name>{,"<new map name>"}});
+*instance_attachmap("<map name>", <instance id>{, <use base name>{, "<new map name>"}})
Attaches the map "<map name>" to the instance specified with
<instance id>. The optional parameter specifies, whether a map requires
-emulation for instancing (1) or not (0 = default). if use base name is specified,
+emulation for instancing (true) or not (false = default). if use base name is specified,
and "<new map name>" too the server will instance the map under the "<new map name>",
name.
Returns the resulting map name on success or an empty string on failure.
Example:
- instance_attachmap("prontera", .@instance_id,1,"via");
+ instance_attachmap("prontera", .@instance_id, true, "via");
^ the above creates a instance (or clone) of prontera, on a map called "via"
---------------------------------------
-*instance_detachmap "<map name>"{,<instance id>};
+*instance_detachmap("<map name>"{, <instance id>})
Detach the map "<map name>" to the instance with the <instance id>. If no
ID is specified, the instance the script is attached to is used. If in the
@@ -8506,14 +8536,14 @@ end no instance_id is found the command halts the script execution.
---------------------------------------
-*instance_init <instance id>;
+*instance_init(<instance id>)
Initializes the instance given by <instance id>. This copies all NPCs from
the source maps to the instanced maps.
---------------------------------------
-*instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
+*instance_announce(<instance id>, "<text>", <flag>{, <fontColor>{, <fontType>{, <fontSize>{, <fontAlign>{, <fontY>}}}}})
Works like announce, but has the <instance id> parameter. If instance id
is -1, the instance the script is attached to is used. If in the
@@ -8521,13 +8551,13 @@ end no instance_id is found the command halts the script execution.
---------------------------------------
-*instance_attach <instance id>;
+*instance_attach(<instance id>)
Attaches the current script to the instance given by <instance id>.
---------------------------------------
-*instance_npcname("<npc name>"{,<instance id>});
+*instance_npcname("<npc name>"{, <instance id>})
Retrieves the unique name given to a copy of an NPC given by "<npc name>"
in an instance specified <instance id>. If no ID is specified, the
@@ -8536,7 +8566,7 @@ is found the command halts the script execution.
---------------------------------------
-*has_instance("<map name>"{,<instance id>});
+*has_instance("<map name>"{, <instance id>})
Checks whether or not the given map belongs to specified instance. If no
ID is specified, the instance the script is attached to is used. If the
@@ -8549,7 +8579,7 @@ Returns name of the instanced map on success, otherwise an empty string.
---------------------------------------
-*has_instance2("<map name>");
+*has_instance2("<map name>")
Same as has_instance, with exception it returns the instance id of the map,
as long as the user is assigned to a instance containing that map.
@@ -8557,13 +8587,13 @@ It will return -1 upon failure, valid instance ids are >= 0.
---------------------------------------
-*instance_id();
+*instance_id()
Retrieves the instance id of the script it is being run on.
---------------------------------------
-*instance_warpall "<map name>",<x>,<y>{,<instance id>};
+*instance_warpall("<map name>", <x>, <y>{, <instance id>})
Warps all players in the instance <instance id> to <map name> at given
coordinates. If no ID is specified, the instance the script is attached to
@@ -8572,7 +8602,7 @@ script execution.
---------------------------------------
-*instance_set_timeout <alive timeout>,<idle timeout>{,<instance id>};
+*instance_set_timeout(<alive timeout>, <idle timeout>{, <instance id>})
Sets the timeout values for an instance given by <instance id>. If no ID
is specified, the instance the script is attached to is used. If in the end,
@@ -8586,10 +8616,10 @@ Both timeout values are in seconds.
---------------------------------------
-*instance_check_party(<party id>{,<amount>{,<min>{,<max>}}});
+*instance_check_party(<party id>{, <amount>{, <min>{, <max>}}})
-This function checks if a party meets certain requirements, returning 1 if
-all conditions are met and 0 otherwise. It will only check online
+This function checks if a party meets certain requirements, returning true if
+all conditions are met and false otherwise. It will only check online
characters.
amount - number of online party members (default is 1).
@@ -8599,21 +8629,21 @@ max - maximum level of all characters in the party (default is max
Example:
-if (instance_check_party(getcharid(1),2,2,149)) {
- mes "Your party meets the Memorial Dungeon requirements.",
- mes "All online members are between levels 1-150 and at least two are online.";
- close;
+if (instance_check_party(getcharid(1), 2, 2, 149)) {
+ mes("Your party meets the Memorial Dungeon requirements.");
+ mes("All online members are between levels 1-150 and at least two are online.");
+ close();
} else {
- mes "Sorry, your party does not meet the requirements.";
- close;
+ mes("Sorry, your party does not meet the requirements.");
+ close();
}
---------------------------------------
-*instance_check_guild(<guild_id>{,<amount>{,<min>{,<max>}}});
+*instance_check_guild(<guild_id>{, <amount>{, <min>{, <max>}}})
-This function checks if a guild meets certain requirements, returning 1 if
-all conditions are met and 0 otherwise. it will only check online characters.
+This function checks if a guild meets certain requirements, returning true if
+all conditions are met and false otherwise. it will only check online characters.
amount - number of online guild members (default is 1).
min - minimum level of all characters in the guild (default is 1).
@@ -8621,16 +8651,16 @@ max - maximum level of all characters in the guild (default is max level in conf
Example:
if (instance_check_guild(getcharid(2), 2, 1, 150)) {
- mes "Your guild meets the Memorial Dungeon requirements.",
- mes "All online members are between levels 1-150 and at least two are online.";
- close;
+ mes("Your guild meets the Memorial Dungeon requirements.");
+ mes("All online members are between levels 1-150 and at least two are online.");
+ close();
} else {
- mes "Sorry, your guild does not meet the requirements.";
- close;
+ mes("Sorry, your guild does not meet the requirements.");
+ close();
}
---------------------------------------
-*instance_set_respawn(<map_name>,<x>,<y>{,<instance_id>});
+*instance_set_respawn(<map_name>, <x>, <y>{, <instance_id>})
Updates the 'reload spawn' position of a instance,
that is where players in the instance are sent to upon @reloadscript,
@@ -8644,7 +8674,7 @@ it will use the player's warp destination as the initial respawn point,
it can of course be modified by using this script command at any point.
---------------------------------------
-*instance_mapname("<map name>"{,<instance id>})
+*instance_mapname("<map name>"{, <instance id>})
Returns the unique name of the instanced map. If no instance ID is specified,
the instance the script is attached to is used. If the script is not attached to
@@ -8665,9 +8695,9 @@ that fails, the command returns an empty string instead.
//=====================================
---------------------------------------
-*questinfo <Quest ID>, <Icon> {, <Map Mark Color>{, <Job Class>}};
+*questinfo(<Quest ID>, <Icon> {, <Map Mark Color>{, <Job Class>}})
-This is esentially a combination of questprogress and showevent. Use this only
+This is esentially a combination of questprogress() and showevent(). Use this only
in an OnInit label. For the Quest ID, specify the quest ID that you want
checked if it has been started yet.
@@ -8697,27 +8727,27 @@ If questinfo is present, it will check if the quest has been started, if it has
Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
Example
-izlude,100,100,4 script Test 844,{
- mes "[Test]";
- mes "Hello World.";
- close;
+ izlude,100,100,4 script Test 844,{
+ mes("[Test]");
+ mes("Hello World.");
+ close();
OnInit:
- questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
+ questinfo(1001, QTYPE_QUEST, 0, Job_Novice);
end;
-}
+ }
---------------------------------------
-*setquest <ID>;
+*setquest(<ID>)
Place quest of <ID> in the users quest log, the state of which is "active".
-If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
+If questinfo() is set, and the same ID is specified here, the icon will be cleared when the quest is set.
---------------------------------------
-*completequest <ID>{,<ID2>};
+*completequest(<ID>{, <ID2>})
Change the state for the given quest <ID> to "complete" and remove from
the users quest log.
@@ -8727,7 +8757,7 @@ will be completed.
---------------------------------------
-*erasequest <ID>{,<ID2>};
+*erasequest(<ID>{, <ID2>})
Remove the quest of the given <ID> from the user's quest log.
@@ -8736,26 +8766,26 @@ will be erased.
---------------------------------------
-*changequest <ID>,<ID2>;
+*changequest(<ID>, <ID2>)
Remove quest of the given <ID> from the user's quest log.
Add quest of the <ID2> to the the quest log, and the state is "active".
---------------------------------------
-*questprogress(<ID>{,PLAYTIME|HUNTING})
+*questprogress(<ID>{, PLAYTIME|HUNTING})
If no additional argument supplied, return the state of the quest:
0 = Quest not started (not in quest log)
1 = Quest has been given
2 = Quest completed
-If parameter 'PLAYTIME' is supplied:
+If parameter PLAYTIME is supplied:
0 = Quest not started (not in quest log)
1 = The time limit has not yet been reached
2 = The time limit has been reached
-If parameter 'HUNTING' is supplied:
+If parameter HUNTING is supplied:
0 = Quest not started (not in quest log)
1 = Player hasn't killed all of the target monsters
2 = Player has killed all of the target monsters
@@ -8771,10 +8801,10 @@ inactive or completed)
---------------------------------------
-*showevent <icon>{,<mark color>}
+*showevent(<icon>{, <mark color>})
Show an emotion on top of a NPC, and optionally,
-a colored mark in the mini-map like "viewpoint".
+a colored mark in the mini-map like viewpoint().
This is used to indicate that a NPC has a quest or an event to
a certain player.
@@ -8809,7 +8839,7 @@ Mark Color:
//=====================================
---------------------------------------
-*waitingroom2bg_single(<battle group>,"<mapname>",<x>,<y>,"<npc name>");
+*waitingroom2bg_single(<battle group>, "<mapname>", <x>, <y>, "<npc name>")
Adds the first waiting player from the chat room of given NPC to an
existing battleground group and warps it to specified coordinates on given
@@ -8817,7 +8847,7 @@ map.
---------------------------------------
-*waitingroom2bg("<mapname>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<npc name>"});
+*waitingroom2bg("<mapname>", <x>, <y>, "<On Quit Event>", "<On Death Event>"{, "<npc name>"})
<Mapname> and X Y coordinates refer to where the "respawn" base is, where
the player group will respawn when they die.
@@ -8836,38 +8866,38 @@ is used.
Example:
// Battle Group will be referred to as $@KvM01BG_id1, and when they
// die, respawn at bat_c01,52,129.
- $@KvM01BG_id1 = waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
+ $@KvM01BG_id1 = waitingroom2bg("bat_c01", 52, 129, "KvM01_BG::OnGuillaumeQuit", "KvM01_BG::OnGuillaumeDie");
end;
----------------------------------------
-*bg_team_setxy <Battle Group ID>,<x>,<y>;
+*bg_team_setxy(<Battle Group ID>, <x>, <y>)
Update the respawn point of the given battle group to x, y on the same
map. The <Battle Group ID> can be retrieved using getcharid(4).
Example:
- bg_team_setxy getcharid(4),56,212;
- mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,0xFFCE00;
+ bg_team_setxy(getcharid(4), 56, 212);
+ mapannounce("bat_a01", "Group [1] has taken the work shop, and will now respawn there.", bc_map, 0xFFCE00);
end;
----------------------------------------
-*bg_warp <Battle Group>,"<Mapname>",<x>,<y>;
+*bg_warp(<Battle Group>, "<Mapname>", <x>, <y>)
Similar to warp command.
Place all members of <Battle Group> at <mapname> at x y.
Example:
//place the battle group one for Tierra Gorge at starting position.
- bg_warp $@TierraBG1_id1,"bat_a01",352,342;
+ bg_warp($@TierraBG1_id1, "bat_a01", 352, 342);
end;
----------------------------------------
-*bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
+*bg_monster(<Battle Group>, "<map name>", <x>, <y>, "<name to show>", <mob id>, "<event label>")
-Similar to monster script command.
+Similar to monster() script command.
Spawn a monster with allegiance to the given battle group.
Does not allow for the summoning of multiple monsters.
Monsters are similar to that in War of Emperium, in that the specified
@@ -8875,63 +8905,61 @@ Battle group is considered friendly.
Example:
// It can be used in two different ways.
- bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",OBJ_B,"Feed Depot#1::OnMyMobDead";
+ bg_monster($@TierraBG1_id2, "bat_a01", 167, 50, "Food Depot", OBJ_B, "Feed Depot#1::OnMyMobDead");
end;
// Alternatively, you can set an ID for the monster using "set".
// This becomes useful when used with the command below.
- $@Guardian_3 = bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",B_S_GUARDIAN,"NPCNAME::OnMyMobDead");
+ $@Guardian_3 = bg_monster($@TierraBG1_id2, "bat_a01", 268, 204, "Guardian", B_S_GUARDIAN, "NPCNAME::OnMyMobDead");
end;
----------------------------------------
-*bg_monster_set_team <GID>,<Battle Group>;
+*bg_monster_set_team(<GID>, <Battle Group>)
This command will change the allegiance if a monster in a battle ground.
-GID can be set when spawning the monster via the bg_monster command.
+GID can be set when spawning the monster via the bg_monster() command.
Example:
- end;
-
OnEnable:
- mapannounce "bat_b01", "A guardian has been summoned for Battle Group 2!", bc_map, 0xFFCE00;
- set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",B_S_GUARDIAN,"NPCNAME::OnMyMobDead");
- initnpctimer;
+ mapannounce("bat_b01", "A guardian has been summoned for Battle Group 2!", bc_map, 0xFFCE00);
+ $@Guardian = bg_monster($@BG_2, "bat_a01", 268, 204, "Guardian", B_S_GUARDIAN, "NPCNAME::OnMyMobDead");
+ initnpctimer();
end;
OnTimer1000:
- stopnpctimer;
- mapannounce "bat_b01", "Erm, sorry about that! This monster was meant for Battle Group 1.", bc_map, 0xFFCE00;
- bg_monster_set_team $@Guardian, $@BG_1;
+ stopnpctimer();
+ mapannounce("bat_b01", "Erm, sorry about that! This monster was meant for Battle Group 1.", bc_map, 0xFFCE00);
+ bg_monster_set_team($@Guardian, $@BG_1);
end;
----------------------------------------
-*bg_leave;
+*bg_leave()
Removes attached player from their Battle Group.
----------------------------------------
-*bg_destroy <Batte Group>;
+*bg_destroy(<Batte Group>)
As the name says, destroys the battle group created for that battle ground.
----------------------------------------
-*areapercentheal "<mapname>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
+*areapercentheal("<mapname>", <x1>, <y1>, <x2>, <y2>, <hp>, <sp>)
Not exactly limited to battleground use, this will restore HP/SP in a
defined area at a percentage.
Example:
- areapercentheal "bat_a01",52,208,61,217,100,100;
+ areapercentheal("bat_a01", 52, 208, 61, 217, 100, 100);
end;
----------------------------------------
-*bg_get_data(<Battle Group>,<type>);
+*bg_get_data(<Battle Group>, <type>)
Retrieves data related to given battle group. Type can be one of the
following:
@@ -8940,14 +8968,14 @@ following:
----------------------------------------
-*bg_getareausers(<battle group>,"<map_name>",<x0>,<y0>,<x1>,<y1>);
+*bg_getareausers(<battle group>, "<map_name>", <x0>, <y0>, <x1>, <y1>)
Retrieves amount of players belonging to given battle group on given map
within an specified rectangular area.
----------------------------------------
-*bg_updatescore "<map_name>",<Guillaume Score>,<Croix Score>;
+*bg_updatescore("<map_name>", <Guillaume Score>, <Croix Score>)
This command will force the update of the displayed scoreboard.
It is only usable when the map is defined as a Type 2 Battleground:
@@ -8955,7 +8983,7 @@ mapflag%TAB%<map_name>%TAB%battleground%TAB%2
----------------------------------------
-*bg_create_team "<map_name>",<Respawn X>,<Respawn Y>;
+*bg_create_team("<map_name>", <Respawn X>, <Respawn Y>)
This command will create a new BG Team.
When player dies, they will be respawned map_name,X,Y as mentioned.
@@ -8965,7 +8993,7 @@ else it will return the BG ID(Also known as TeamID).
----------------------------------------
-*bg_join_team <Team_ID>{,<account_id>};
+*bg_join_team(<Team_ID>{, <account_id>})
This command will make the attached player join to Team with ID as mentioned.
If account_id is provided, command will look for that player, instead of the attached player.
@@ -8974,7 +9002,7 @@ Command will return -1 if Player is not found, 0 if join is failed, 1 upon succe
----------------------------------------
-*bg_match_over "<Arena Name>"{,<Cancelled>};
+*bg_match_over("<Arena Name>"{, <Cancelled>})
This command will end the battleground Arena
(Arena Name as referred to, in conf/battlegrounds.conf)
@@ -8996,29 +9024,29 @@ Command will return 0 when successful, else it will return 1.
//=====================================
---------------------------------------
-*mercenary_create <class>,<contract time>;
+*mercenary_create(<class>, <contract time>)
This command summons a mercenary of given class, for given amount of time
in milliseconds. Typically used in item scripts of mercenary scrolls.
----------------------------------------
-*mercenary_heal <hp>,<sp>;
+*mercenary_heal(<hp>, <sp>)
-This command works like 'heal', but affects the mercenary of the currently
+This command works like heal(), but affects the mercenary of the currently
attached character.
----------------------------------------
-*mercenary_sc_start <type>,<tick>,<val1>;
+*mercenary_sc_start(<type>, <tick>, <val1>)
-This command works like 'sc_start', but affects the mercenary of the
+This command works like sc_start(), but affects the mercenary of the
currently attached character.
----------------------------------------
-*mercenary_get_calls(<guild>);
-*mercenary_set_calls <guild>,<value>;
+*mercenary_get_calls(<guild>)
+*mercenary_set_calls(<guild>, <value>)
Sets or gets the mercenary calls value for given guild for currently
attached character. Guild can be one or the following constants:
@@ -9029,8 +9057,8 @@ attached character. Guild can be one or the following constants:
----------------------------------------
-*mercenary_get_faith(<guild>);
-*mercenary_set_faith <guild>,<value>;
+*mercenary_get_faith(<guild>)
+*mercenary_set_faith(<guild>, <value>)
Sets or gets the mercenary faith value for given guild for currently
attached character. Guild can be one or the following constants:
@@ -9041,7 +9069,7 @@ attached character. Guild can be one or the following constants:
---------------------------------------
-*getmercinfo(<type>{,<char id>});
+*getmercinfo(<type>{, <char id>})
Retrieves information about mercenary of the currently attached character.
If char id is given, the information of that character is retrieved
@@ -9073,19 +9101,19 @@ for name and 0 for all other types.
//=====================================
---------------------------------------
-*queue();
+*queue()
Creates a new queue instance and returns the created queue id.
---------------------------------------
-*queuesize(<queue_id>);
+*queuesize(<queue_id>)
Returns the amount of entries in the queue instance of <queue_id>.
---------------------------------------
-*queueadd(<queue_id>, <var_id>);
+*queueadd(<queue_id>, <var_id>)
Adds <var_id> to queue of <queue_id>.
@@ -9094,7 +9122,7 @@ true otherwise.
---------------------------------------
-*queueremove(<queue_id>, <var_id>);
+*queueremove(<queue_id>, <var_id>)
Removes <var_id> from queue of <queue_id>.
@@ -9103,7 +9131,7 @@ true otherwise.
---------------------------------------
-*queueopt(<queue_id>,<optionType>,{Optional <option val>});
+*queueopt(<queue_id>, <optionType>, {Optional <option val>})
Modifies <queue_id>'s <optionType>. When <option val> is not present
<optionType> is removed from <queue_id>. When present it modifies
@@ -9124,7 +9152,7 @@ Example:
---------------------------------------
-*queuedel(<queue_id>);
+*queuedel(<queue_id>)
Deletes the queue <queue_id>.
@@ -9132,7 +9160,7 @@ Returns false if the queue wasn't found, true otherwise.
---------------------------------------
-*queueiterator(<queue_id>);
+*queueiterator(<queue_id>)
Creates a new queue iterator instance.
A queue iterator is not a reference to a queue's actual members, it copies
@@ -9141,15 +9169,15 @@ even if you remove them from the queue.
---------------------------------------
-*qicheck(<queue_iterator_id>);
+*qicheck(<queue_iterator_id>)
Checks whether the current member in the iterator's queue exists.
-Returns 1 when it does, 0 otherwise.
+Returns true when it does, false otherwise.
---------------------------------------
-*qiget(<queue_iterator_id>);
+*qiget(<queue_iterator_id>)
obtains the next member in the iterator's queue, returns the next member's
id or 0 when it doesnt exist.
@@ -9161,11 +9189,11 @@ Example:
---------------------------------------
-*qiclear(<queue_iterator_id>);
+*qiclear(<queue_iterator_id>)
Deletes a queue iterator from memory.
-Returns false when it fails, otherwise 1 is returned.
+Returns false when it fails, otherwise true is returned.
---------------------------------------
//=====================================
@@ -9181,14 +9209,14 @@ Commands that control NPC Trader Shops
See /doc/sample/npc_trader_sample.txt
---------------------------------------
-*openshop({NPC_Name});
+*openshop({NPC_Name})
opens the trader shop from the currently-attached npc unless,
when the optional NPC_Name param is used.
---------------------------------------
-*sellitem <Item_ID>{,<price>{,<qty>}};
+*sellitem(<Item_ID>{, <price>{, <qty>}})
adds (or modifies) <Item_ID> data to the shop,
when <price> is not provided (or when it is -1) itemdb default is used.
@@ -9199,13 +9227,13 @@ the previous data (price/qty), is overwritten with the new.
---------------------------------------
-*stopselling <Item_ID>;
+*stopselling(<Item_ID>)
attempts to remove <Item_ID> from the current shop list.
---------------------------------------
-*setcurrency <Val1>{,<Val2>};
+*setcurrency(<Val1>{, <Val2>})
updates the currently attached player shop funds,
to be used within a "OnCountFunds" event of a NST_CUSTOM trader type.
@@ -9215,7 +9243,7 @@ to be used within a "OnCountFunds" event of a NST_CUSTOM trader type.
---------------------------------------
-*tradertype(<Type>);
+*tradertype(<Type>)
Modifies the npc trader type, item list is cleared upon modifiying the value.
By default, all npcs staart with tradertype(NST_ZENY);
@@ -9227,14 +9255,14 @@ By default, all npcs staart with tradertype(NST_ZENY);
---------------------------------------
-*purchaseok();
+*purchaseok()
Signs that the transaction (on a NST_CUSTOM trader) has been successful,
to be used within a "OnPayFunds" event of a NST_CUSTOM trader.
---------------------------------------
-*shopcount(<Item_ID>);
+*shopcount(<Item_ID>)
Returns the amount of still-available <Item_ID> in the shop (on a NST_MARKET trader).