Removed extra tabs/spaces in script_commands.txt
This commit is contained in:
parent
045f4be573
commit
4b8720b44c
@ -1,13 +1,13 @@
|
|||||||
//===== rAthena Documentation ================================
|
//===== rAthena Documentation================================
|
||||||
//= rAthena Script Commands
|
//= rAthena Script Commands
|
||||||
//===== By: ==================================================
|
//===== By:==================================================
|
||||||
//= rAthena Dev Team
|
//= rAthena Dev Team
|
||||||
//===== Last Updated: ========================================
|
//===== Last Updated:========================================
|
||||||
//= 20161206
|
//= 20161206
|
||||||
//===== Description: =========================================
|
//===== Description:=========================================
|
||||||
//= A reference manual for the rAthena scripting language.
|
//= A reference manual for the rAthena scripting language.
|
||||||
//= Commands are sorted depending on their functionality.
|
//= Commands are sorted depending on their functionality.
|
||||||
//============================================================
|
//===========================================================
|
||||||
|
|
||||||
This document is a reference manual for all the scripting commands and functions
|
This document is a reference manual for all the scripting commands and functions
|
||||||
available in rAthena. It is not a simple tutorial. When people tell you to
|
available in rAthena. It is not a simple tutorial. When people tell you to
|
||||||
@ -696,23 +696,23 @@ you can not compare numbers to strings.
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
1==1 is True.
|
1 == 1 is True.
|
||||||
1<2 is True while 1>2 is False.
|
1<2 is True while 1>2 is False.
|
||||||
@x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
|
@x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
|
||||||
|
|
||||||
Only '==' and '!=' have been tested for comparing strings. Since there's no way
|
Only ' == ' and '!=' have been tested for comparing strings. Since there's no way
|
||||||
to code a seriously complex data structure in this language, trying to sort
|
to code a seriously complex data structure in this language, trying to sort
|
||||||
strings by alphabet would be pointless anyway.
|
strings by alphabet would be pointless anyway.
|
||||||
|
|
||||||
Comparisons can be stacked in the same condition:
|
Comparisons can be stacked in the same condition:
|
||||||
|
|
||||||
&& - Is True if and only if BOTH sides are true.
|
&& - Is True if and only if BOTH sides are true.
|
||||||
('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
|
('1 == 1 && 2 == 2' is true. '2 == 1 && 1 == 1' is false.)
|
||||||
|| - Is True if either side of this expression is True.
|
|| - Is True if either side of this expression is True.
|
||||||
|
|
||||||
1==1 && 2==2 is True.
|
1 == 1 && 2 == 2 is True.
|
||||||
1==1 && 2==1 is False.
|
1 == 1 && 2 == 1 is False.
|
||||||
1==1 || 2==1 is True.
|
1 == 1 || 2 == 1 is True.
|
||||||
|
|
||||||
Logical bitwise operators work only on numbers, and they are the following:
|
Logical bitwise operators work only on numbers, and they are the following:
|
||||||
|
|
||||||
@ -775,14 +775,14 @@ Logical bitwise operators work only on numbers, and they are the following:
|
|||||||
- First let's set the quests that are currently in progress:
|
- First let's set the quests that are currently in progress:
|
||||||
set inProgress,1|8|16; // quest 1,8 and 16 are in progress
|
set inProgress,1|8|16; // quest 1,8 and 16 are in progress
|
||||||
- After playing for a bit, the player starts another quest:
|
- 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)
|
// this will set the bit for quest 2 (inProgress has that bit set to 0)
|
||||||
set inProgress,inProgress^2;
|
set inProgress,inProgress^2;
|
||||||
mes "Quest 2: find a newbie and be helpful to him for an hour.";
|
mes "Quest 2: find a newbie and be helpful to him for an hour.";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
- After spending some time reading info on Xor's, the player finally completes quest 1:
|
- 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)
|
// this will unset the bit for quest 1 (inProgress has that bit set to 1)
|
||||||
set inProgress,inProgress^1;
|
set inProgress,inProgress^1;
|
||||||
mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
|
mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
|
||||||
@ -798,14 +798,14 @@ are following:
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
set .@myvar,10;
|
set .@myvar,10;
|
||||||
mes "Negative 10 is "+(-.@myvar);
|
mes "Negative 10 is " + (-.@myvar);
|
||||||
|
|
||||||
! - Logical Not.
|
! - Logical Not.
|
||||||
Reverses the boolean result of an expression. True will become false and
|
Reverses the boolean result of an expression. True will become false and
|
||||||
false will become true.
|
false will become true.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
if(!callfunc("F_dosomething"))
|
if (!callfunc("F_dosomething"))
|
||||||
{
|
{
|
||||||
mes "Doing something failed.";
|
mes "Doing something failed.";
|
||||||
close;
|
close;
|
||||||
@ -825,7 +825,7 @@ following:
|
|||||||
?: - Conditional operator
|
?: - Conditional operator
|
||||||
Very useful e.g. to replace
|
Very useful e.g. to replace
|
||||||
|
|
||||||
if(Sex) mes "..."; else mes "...";
|
if (Sex) mes "..."; else mes "...";
|
||||||
|
|
||||||
clauses with simple
|
clauses with simple
|
||||||
|
|
||||||
@ -989,7 +989,7 @@ amatsu,13,152,4 script Master 767,{
|
|||||||
close;
|
close;
|
||||||
|
|
||||||
OnThisMobDeath:
|
OnThisMobDeath:
|
||||||
announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
|
announce "Hey, " + strcharinfo(0) + " just killed a Poringz0rd!",bc_blue|bc_all;
|
||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1189,23 +1189,13 @@ This command will stop the execution for this particular script. The two
|
|||||||
versions are perfectly equivalent. It is the normal way to end a script which
|
versions are perfectly equivalent. It is the normal way to end a script which
|
||||||
does not use 'mes'.
|
does not use 'mes'.
|
||||||
|
|
||||||
if (BaseLevel<=10) goto L_Lvl10;
|
if (BaseLevel <= 10)
|
||||||
if (BaseLevel<=20) goto L_Lvl20;
|
|
||||||
if (BaseLevel<=30) goto L_Lvl30;
|
|
||||||
if (BaseLevel<=40) goto L_Lvl40;
|
|
||||||
if (BaseLevel<=50) goto L_Lvl50;
|
|
||||||
if (BaseLevel<=60) goto L_Lvl60;
|
|
||||||
if (BaseLevel<=70) goto L_Lvl70;
|
|
||||||
L_Lvl10:
|
|
||||||
npctalk "Look at that you are still a n00b";
|
npctalk "Look at that you are still a n00b";
|
||||||
end;
|
else if (BaseLevel <= 20)
|
||||||
L_Lvl20:
|
|
||||||
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;
|
else if (BaseLevel <= 30)
|
||||||
L_Lvl30:
|
|
||||||
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;
|
else if (BaseLevel <= 40)
|
||||||
L_Lvl40:
|
|
||||||
npctalk "Look at that you are almost 2nd profession";
|
npctalk "Look at that you are almost 2nd profession";
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1311,9 +1301,12 @@ with other command, such as "if", but often used on its own.
|
|||||||
|
|
||||||
...
|
...
|
||||||
goto Label;
|
goto Label;
|
||||||
|
|
||||||
mes "This will not be seen";
|
mes "This will not be seen";
|
||||||
|
end;
|
||||||
Label:
|
Label:
|
||||||
mes "This will be seen";
|
mes "This will be seen";
|
||||||
|
end;
|
||||||
|
|
||||||
This command should be avoided and only used if there is no other option.
|
This command should be avoided and only used if there is no other option.
|
||||||
|
|
||||||
@ -1337,6 +1330,7 @@ number of option the player picked. (Numbering of options starts at 1.)
|
|||||||
This number is consistent with empty options and grouped options.
|
This number is consistent with empty options and grouped options.
|
||||||
|
|
||||||
menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
|
menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
|
||||||
|
|
||||||
L_Wrong:
|
L_Wrong:
|
||||||
// If they click "A" or "B" they will end up here
|
// If they click "A" or "B" they will end up here
|
||||||
// @menu == 1 if "A"
|
// @menu == 1 if "A"
|
||||||
@ -1430,7 +1424,7 @@ But how do you figure out which option the user picked? Enter the @menu.
|
|||||||
starting with 1 for the first option. You know now which option the user picked
|
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:
|
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 is the number of option the user picked.
|
||||||
@menu-1 is the array index for the list of actually used menu items that we
|
@menu-1 is the array index for the list of actually used menu items that we
|
||||||
@ -1441,7 +1435,7 @@ items that we've saved just for this purpose.
|
|||||||
And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
|
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.)
|
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' statements to
|
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
|
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
|
menu every time, which is handy when you want to, for example, make users select
|
||||||
items in any specific order before proceeding, or make a randomly shuffled menu.
|
items in any specific order before proceeding, or make a randomly shuffled menu.
|
||||||
@ -1469,7 +1463,8 @@ no questions. It will return the number of menu option picked, starting with 1.
|
|||||||
Like 'menu', it will also set the variable @menu to contain the option the user
|
Like 'menu', it will also set the variable @menu to contain the option the user
|
||||||
picked.
|
picked.
|
||||||
|
|
||||||
if (select("Yes:No")==1) mes "You said yes, I know.";
|
if (select("Yes:No" ) == 1)
|
||||||
|
mes "You said yes, I know.";
|
||||||
|
|
||||||
And like 'menu', the selected option is consistent with grouped options
|
And like 'menu', the selected option is consistent with grouped options
|
||||||
and empty options.
|
and empty options.
|
||||||
@ -1550,7 +1545,8 @@ the place that called it.
|
|||||||
}
|
}
|
||||||
function%TAB%script%TAB%funcNPC%TAB%{
|
function%TAB%script%TAB%funcNPC%TAB%{
|
||||||
.@win = rand(2);
|
.@win = rand(2);
|
||||||
if (.@win == 0) return;
|
if (.@win == 0)
|
||||||
|
return;
|
||||||
mes "Sorry, you lost.";
|
mes "Sorry, you lost.";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
@ -1572,7 +1568,8 @@ generally cleaner:
|
|||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
function%TAB%script%TAB%OddFunc%TAB%{
|
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
|
return 1;// it's odd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1780,7 +1777,7 @@ prontera,154,189,4 script Item Seller 767,{
|
|||||||
function SF_Selling {
|
function SF_Selling {
|
||||||
mes "Would you like to buy a phracon for 50z?";
|
mes "Would you like to buy a phracon for 50z?";
|
||||||
next;
|
next;
|
||||||
if(select("Yes","No, thanks") == 1) {
|
if (select("Yes","No, thanks") == 1) {
|
||||||
Zeny -= Zeny;
|
Zeny -= Zeny;
|
||||||
getitem 1010,1;
|
getitem 1010,1;
|
||||||
mes "Thank you!";
|
mes "Thank you!";
|
||||||
@ -1800,7 +1797,7 @@ prontera,150,150,0 script TestNPC 123,{
|
|||||||
input .@a;
|
input .@a;
|
||||||
input .@b;
|
input .@b;
|
||||||
/* Function call */
|
/* Function call */
|
||||||
mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
|
mes .@a + " + " + .@b + " = " + MyAdd(.@a,.@b);
|
||||||
close;
|
close;
|
||||||
|
|
||||||
/* Function definition */
|
/* Function definition */
|
||||||
@ -1851,7 +1848,7 @@ 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
|
Anything that is returned by a function can be used in a condition check without
|
||||||
bothering to store it in a specific variable:
|
bothering to store it in a specific variable:
|
||||||
|
|
||||||
if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
|
if (strcharinfo(0) == "Daniel Jackson") mes "It is true, you are Daniel!";
|
||||||
|
|
||||||
More examples of using the 'if' command in the real world:
|
More examples of using the 'if' command in the real world:
|
||||||
|
|
||||||
@ -1912,7 +1909,7 @@ Example 5:
|
|||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
if ($@name$ == strcharinfo(0)) { // player name matches $@name$
|
if ($@name$ == strcharinfo(0)) { // player name matches $@name$
|
||||||
mes "You are the person that " +$@name2$+ " just mentioned.";
|
mes "You are the person that " + $@name2$ + " just mentioned.";
|
||||||
mes "Nice to meet you!";
|
mes "Nice to meet you!";
|
||||||
|
|
||||||
// reset the global variables
|
// reset the global variables
|
||||||
@ -1921,7 +1918,7 @@ Example 5:
|
|||||||
|
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
mes "You are not the person that " +$name2$+ " mentioned.";
|
mes "You are not the person that " + $name2$ + " mentioned.";
|
||||||
close;
|
close;
|
||||||
|
|
||||||
See 'strcharinfo' for an explanation of what this function does.
|
See 'strcharinfo' for an explanation of what this function does.
|
||||||
@ -1929,7 +1926,7 @@ See 'strcharinfo' for an explanation of what this function does.
|
|||||||
Example 6: Using complex conditions.
|
Example 6: Using complex conditions.
|
||||||
|
|
||||||
mes "[Multiple Checks]";
|
mes "[Multiple Checks]";
|
||||||
if ( (@queststarted == 1) && (countitem(512) >= 5) ) {
|
if (@queststarted == 1 && countitem(512) >= 5) {
|
||||||
mes "Well done, you have started the quest and brought me 5 Apples.";
|
mes "Well done, you have started the quest and brought me 5 Apples.";
|
||||||
@queststarted = 0;
|
@queststarted = 0;
|
||||||
delitem 512,5;
|
delitem 512,5;
|
||||||
@ -2335,12 +2332,12 @@ them - some will not work for various internal reasons.
|
|||||||
Example 1:
|
Example 1:
|
||||||
|
|
||||||
// Returns how many status points you haven't spent yet.
|
// 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
|
Using this particular information as a function call is not required. Typing this
|
||||||
will return the same result:
|
will return the same result:
|
||||||
|
|
||||||
mes "Unused status points: "+StatusPoint;
|
mes "Unused status points: " + StatusPoint;
|
||||||
|
|
||||||
Example 2:
|
Example 2:
|
||||||
|
|
||||||
@ -2401,7 +2398,7 @@ 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,
|
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.
|
mother, mother, or father, respectively. It returns 0 if no ID is found.
|
||||||
|
|
||||||
if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
|
if (getmotherid()) mes "Your mother's ID is: " + getmotherid();
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2553,31 +2550,31 @@ wearing such an item, 'getequipid' will return its ID number for either slot.
|
|||||||
Can be used to check if you have something equipped, or if you haven't got
|
Can be used to check if you have something equipped, or if you haven't got
|
||||||
something equipped:
|
something equipped:
|
||||||
|
|
||||||
if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
|
if (getequipid(EQI_HEAD_TOP) == 2234)
|
||||||
mes "Come back when you have a Tiara on";
|
|
||||||
close;
|
|
||||||
L_WearingTiara:
|
|
||||||
mes "What a lovely Tiara you have on";
|
mes "What a lovely Tiara you have on";
|
||||||
|
else
|
||||||
|
mes "Come back when you have a Tiara on";
|
||||||
close;
|
close;
|
||||||
|
|
||||||
You can also use it to make sure people don't pass a point before removing an
|
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 Plate
|
item totally from them. Let's say you don't want people to wear Legion Plate
|
||||||
armor, but also don't want them to equip if after the check, you would do this:
|
armor, but also don't want them to equip if after the check, you would do this:
|
||||||
|
|
||||||
if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
|
if (getequipid(EQI_ARMOR) == 2341 || getequipid(EQI_ARMOR) == 2342) {
|
||||||
|
mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
|
||||||
|
close;
|
||||||
|
}
|
||||||
// the || is used as an or argument, there is 2341 and 2342 cause there are
|
// the || is used as an or argument, there is 2341 and 2342 cause there are
|
||||||
// two different legion plate armors, one with a slot one without.
|
// two different legion plate armors, one with a slot one without.
|
||||||
if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
|
|
||||||
mes "I will lets you pass";
|
if (countitem(2341) > 0 || countitem(2432) > 0) {
|
||||||
|
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;
|
close2;
|
||||||
warp "place",50,50;
|
warp "place",50,50;
|
||||||
end;
|
end;
|
||||||
L_EquipedLegionPlate:
|
|
||||||
mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
|
|
||||||
close;
|
|
||||||
L_InventoryLegionPlate:
|
|
||||||
mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
|
|
||||||
close;
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2597,8 +2594,8 @@ Does the same thing as getitemname(getequipid()). Useful for an NPC to state
|
|||||||
what your are wearing, or maybe saving as a string variable.
|
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) != "" )
|
if ( getequipname(EQI_HEAD_TOP) != "" )
|
||||||
mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
|
mes "So you are wearing a " + getequipname(EQI_HEAD_TOP) + " on your head";
|
||||||
else
|
else
|
||||||
mes "You are not wearing any head gear";
|
mes "You are not wearing any head gear";
|
||||||
|
|
||||||
@ -2620,11 +2617,12 @@ several broken items, 1 given as an argument will return the first one found, 2
|
|||||||
will return the second one, etc. Will return 0 if no such item is found.
|
will return the second one, etc. Will return 0 if no such item is found.
|
||||||
|
|
||||||
// Let's see if they have anything broken:
|
// Let's see if they have anything broken:
|
||||||
if (getbrokenid(1)==0) goto Skip;
|
if (getbrokenid(1) == 0)
|
||||||
// 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!";
|
|
||||||
Skip:
|
|
||||||
mes "You don't have anything broken, quit bothering me.";
|
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!";
|
||||||
|
end;
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2634,14 +2632,15 @@ This functions will return 1 if there is an equipment placed on the specified
|
|||||||
equipment slot and 0 otherwise. For a list of equipment slots
|
equipment slot and 0 otherwise. For a list of equipment slots
|
||||||
see 'getequipid'. Function originally used by the refining NPCs:
|
see 'getequipid'. Function originally used by the refining NPCs:
|
||||||
|
|
||||||
if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
|
if (getequipisequiped(EQI_HEAD_TOP)) {
|
||||||
mes "[Refiner]";
|
|
||||||
mes "Do you want me to refine your dumb head?";
|
|
||||||
close;
|
|
||||||
L_equipped:
|
|
||||||
mes "[Refiner]";
|
mes "[Refiner]";
|
||||||
mes "That's a fine hat you are wearing there...";
|
mes "That's a fine hat you are wearing there...";
|
||||||
close;
|
close;
|
||||||
|
} else {
|
||||||
|
mes "[Refiner]";
|
||||||
|
mes "Do you want me to refine your dumb head?";
|
||||||
|
close;
|
||||||
|
}
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2651,14 +2650,15 @@ 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
|
equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
|
||||||
see 'getequipid'.
|
see 'getequipid'.
|
||||||
|
|
||||||
if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
|
if (getequipisenableref(EQI_HEAD_TOP)) {
|
||||||
mes "[Refiner]";
|
|
||||||
mes "I can't refine this hat!...";
|
|
||||||
close;
|
|
||||||
L_Refine:
|
|
||||||
mes "[Refiner]";
|
mes "[Refiner]";
|
||||||
mes "Ok I can refine this";
|
mes "Ok I can refine this";
|
||||||
close;
|
close;
|
||||||
|
} else {
|
||||||
|
mes "[Refiner]";
|
||||||
|
mes "I can't refine this hat!...";
|
||||||
|
close;
|
||||||
|
}
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2670,11 +2670,11 @@ slot. For a list of equipment slots see 'getequipid'.
|
|||||||
Can be used to check if you have reached a maximum refine value, default for
|
Can be used to check if you have reached a maximum refine value, default for
|
||||||
this is +10:
|
this is +10:
|
||||||
|
|
||||||
if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
|
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";
|
mes "Sorry, it's not possible to refine hats better than +10";
|
||||||
close;
|
close;
|
||||||
L_Refine_HeadGear:
|
|
||||||
mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
|
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -2704,7 +2704,7 @@ Examples:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Left hand can hold either a weapon or shield.
|
// Left hand can hold either a weapon or shield.
|
||||||
if (!getequipisequiped(EQI_HAND_R)) {
|
if (getequipid(EQI_HAND_R) == 0) {
|
||||||
mes "Seems you have nothing equipped here.";
|
mes "Seems you have nothing equipped here.";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
@ -2950,11 +2950,11 @@ Example:
|
|||||||
prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
|
prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
|
||||||
mes "My name is Nyah.";
|
mes "My name is Nyah.";
|
||||||
mes "I will now search for Meh all across the world!";
|
mes "I will now search for Meh all across the world!";
|
||||||
if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "Meh") !=0) {
|
if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "Meh") != 0) {
|
||||||
mes "I can't seem to find Meh anywhere!";
|
mes "I can't seem to find Meh anywhere!";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
|
mes "And I found him on map " + @mapname$ + " at X:" + @mapx + " Y:" + @mapy + " !";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3014,7 +3014,7 @@ DT_DAYOFYEAR - Day of the year
|
|||||||
|
|
||||||
It will only return numbers. If another type is supplied -1 will be returned.
|
It will only return numbers. If another type is supplied -1 will be returned.
|
||||||
|
|
||||||
if (gettime(DT_DAYOFWEEK)==SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
|
if (gettime(DT_DAYOFWEEK) == SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -3080,7 +3080,7 @@ This function returns a guild's name given an ID number. If there is no such
|
|||||||
guild, "null" will be returned.
|
guild, "null" will be returned.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
mes "The guild "+getguildname(10007)+" are all nice people.";
|
mes "The guild " + getguildname(10007) + " are all nice people.";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -3126,7 +3126,7 @@ ID number. If there is no such guild, "null" will be returned.
|
|||||||
|
|
||||||
Example 1:
|
Example 1:
|
||||||
// Prints the guild master of guild 10007, whoever that might be.
|
// Prints the guild master of guild 10007, whoever that might be.
|
||||||
mes getguildmaster(10007)+" runs "+getguildname(10007);
|
mes getguildmaster(10007) + " runs " + getguildname(10007);
|
||||||
|
|
||||||
Example 2:
|
Example 2:
|
||||||
// Checks if the character is the guild master of the specified guild.
|
// Checks if the character is the guild master of the specified guild.
|
||||||
@ -3139,7 +3139,7 @@ Example 2:
|
|||||||
mes "Sorry, you don't own the guild you are in.";
|
mes "Sorry, you don't own the guild you are in.";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
mes "Welcome, guild master of "+getguildname(.@GID);
|
mes "Welcome, guild master of " + getguildname(.@GID);
|
||||||
close;
|
close;
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -3225,7 +3225,7 @@ Returns the amount of characters from the specified guild on the given map.
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
|
mes "You have " + getMapGuildUsers("prontera",getcharid(2)) + " guild members in Prontera.";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
//
|
//
|
||||||
@ -3244,25 +3244,19 @@ There are two main uses for this function, it can check whether the character
|
|||||||
has a skill or not, and it can tell you if the level is high enough.
|
has a skill or not, and it can tell you if the level is high enough.
|
||||||
|
|
||||||
Example 1:
|
Example 1:
|
||||||
|
if (getskilllv(152))
|
||||||
if (getskilllv(152)) goto L_HasSkillThrowStone;
|
|
||||||
mes "You don't have Throw Stone";
|
|
||||||
close;
|
|
||||||
L_HasSkillThrowStone:
|
|
||||||
mes "You have got the skill Throw Stone";
|
mes "You have got the skill Throw Stone";
|
||||||
|
else
|
||||||
|
mes "You don't have Throw Stone";
|
||||||
close;
|
close;
|
||||||
|
|
||||||
Example 2:
|
Example 2:
|
||||||
|
if (getskilllv(28) >= 5)
|
||||||
if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
|
|
||||||
if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
|
|
||||||
mes "You heal skill is below lvl 5";
|
|
||||||
close;
|
|
||||||
L_HasSkillHeallvl6orMore:
|
|
||||||
mes "Your heal lvl is 5 or more";
|
mes "Your heal lvl is 5 or more";
|
||||||
close;
|
else if (getskilllv(28) == 10)
|
||||||
L_HasSkillHealMaxed:
|
|
||||||
mes "Your heal lvl has been maxed";
|
mes "Your heal lvl has been maxed";
|
||||||
|
else
|
||||||
|
mes "You heal skill is below lvl 5";
|
||||||
close;
|
close;
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -3712,7 +3706,7 @@ more:
|
|||||||
|
|
||||||
// These two are equivalent:
|
// These two are equivalent:
|
||||||
if (isday()) mes "I only prowl in the night.";
|
if (isday()) mes "I only prowl in the night.";
|
||||||
if (isnight()!=1) mes "I only prowl in the night.";
|
if (isnight() != 1) mes "I only prowl in the night.";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -4110,7 +4104,7 @@ changing jobs, which can be checked for later in scripts.
|
|||||||
This command retrieves the name of the given job using the map_msg entries 550->655.
|
This command retrieves the name of the given job using the map_msg entries 550->655.
|
||||||
|
|
||||||
mes "[Kid]";
|
mes "[Kid]";
|
||||||
mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
|
mes "I never thought I'd met a " + jobname(Class) + " here of all places.";
|
||||||
close;
|
close;
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -4153,7 +4147,7 @@ job (for example, if you try to get the baby version of a Taekwon class).
|
|||||||
@eac = roclass(@eac|EAJL_UPPER);
|
@eac = roclass(@eac|EAJL_UPPER);
|
||||||
//Check if class has a rebirth version
|
//Check if class has a rebirth version
|
||||||
if (@eac != -1) {
|
if (@eac != -1) {
|
||||||
mes "Bet you can't wait to become a "+jobname(@eac)+"!";
|
mes "Bet you can't wait to become a " + jobname(@eac) + "!";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4352,7 +4346,7 @@ See also db/[pre-]re/job_noenter_map.txt
|
|||||||
This command will return the SVN revision number that the server is currently
|
This command will return the SVN revision number that the server is currently
|
||||||
running on.
|
running on.
|
||||||
|
|
||||||
if ( get_revision() >= 15000 )
|
if (get_revision() >= 15000)
|
||||||
mes "Welcome to rAthena!";
|
mes "Welcome to rAthena!";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -4749,7 +4743,7 @@ This function will return the number of items for the specified item ID that the
|
|||||||
invoking character has in the inventory.
|
invoking character has in the inventory.
|
||||||
|
|
||||||
mes "[Item Checker]";
|
mes "[Item Checker]";
|
||||||
mes "Hmmm, it seems you have "+countitem(502)+" apples";
|
mes "Hmmm, it seems you have " + countitem(502) + " apples";
|
||||||
close;
|
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
|
||||||
@ -4759,7 +4753,7 @@ If you want to state the number at the end of a sentence, you can do it by
|
|||||||
adding up strings:
|
adding up strings:
|
||||||
|
|
||||||
mes "[Item Checker]";
|
mes "[Item Checker]";
|
||||||
mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
|
mes "Hmmm, the total number of apples you are holding is " + countitem("APPLE");
|
||||||
close;
|
close;
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -4821,7 +4815,7 @@ counted items. If a bound type is specified, only those items will be counted.
|
|||||||
For a list of bound types see 'getitembound'.
|
For a list of bound types see 'getitembound'.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
mes "You currently have "+countbound()+" bounded items.";
|
mes "You currently have " + countbound() + " bounded items.";
|
||||||
next;
|
next;
|
||||||
mes "The list of bounded items include:";
|
mes "The list of bounded items include:";
|
||||||
for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
|
for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
|
||||||
@ -5880,7 +5874,7 @@ Simple monster killing script:
|
|||||||
mes "[Summon Man]";
|
mes "[Summon Man]";
|
||||||
mes "Want to start the Poring hunt?";
|
mes "Want to start the Poring hunt?";
|
||||||
next;
|
next;
|
||||||
if(select("Yes.:No.") == 2) {
|
if (select("Yes.:No.") == 2) {
|
||||||
mes "[Summon Man]";
|
mes "[Summon Man]";
|
||||||
mes "Come back later.";
|
mes "Come back later.";
|
||||||
close;
|
close;
|
||||||
@ -5896,12 +5890,10 @@ Simple monster killing script:
|
|||||||
|
|
||||||
OnPoringKilled:
|
OnPoringKilled:
|
||||||
$PoringKilled++;
|
$PoringKilled++;
|
||||||
if ($PoringKilled >= 10) goto L_AllDead;
|
if ($PoringKilled >= 10) {
|
||||||
end;
|
|
||||||
|
|
||||||
L_AllDead:
|
|
||||||
announce "Summon Man: Well done. All the Porings are dead!",3;
|
announce "Summon Man: Well done. All the Porings are dead!",3;
|
||||||
$PoringKilled = 0;
|
$PoringKilled = 0;
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
For more good examples see just about any official 2-1 or 2-2 job quest script.
|
For more good examples see just about any official 2-1 or 2-2 job quest script.
|
||||||
@ -6154,6 +6146,7 @@ the invoking NPC's actions, such as using an emotion or talking.
|
|||||||
mes "NPC2 copies my actions!";
|
mes "NPC2 copies my actions!";
|
||||||
close2;
|
close2;
|
||||||
donpcevent "NPC2::OnEmote";
|
donpcevent "NPC2::OnEmote";
|
||||||
|
end;
|
||||||
OnEmote:
|
OnEmote:
|
||||||
emotion rand(1,30);
|
emotion rand(1,30);
|
||||||
end;
|
end;
|
||||||
@ -6163,6 +6156,7 @@ the invoking NPC's actions, such as using an emotion or talking.
|
|||||||
mes "NPC1 copies my actions!";
|
mes "NPC1 copies my actions!";
|
||||||
close2;
|
close2;
|
||||||
donpcevent "NPC1::OnEmote";
|
donpcevent "NPC1::OnEmote";
|
||||||
|
end;
|
||||||
OnEmote:
|
OnEmote:
|
||||||
emotion rand(1,30);
|
emotion rand(1,30);
|
||||||
end;
|
end;
|
||||||
@ -6201,7 +6195,7 @@ Target for <flag>:
|
|||||||
|
|
||||||
// This will make everyone in the area see the NPC greet the character
|
// This will make everyone in the area see the NPC greet the character
|
||||||
// who just invoked it.
|
// who just invoked it.
|
||||||
npctalk "Hello "+strcharinfo(0)+", how are you?";
|
npctalk "Hello " + strcharinfo(0) + ", how are you?";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -6255,7 +6249,7 @@ If this behavior is undesirable, use some other timer mechanism (like 'sleep').
|
|||||||
Example:
|
Example:
|
||||||
<NPC Header> {
|
<NPC Header> {
|
||||||
dispbottom "Starting a 5 second timer...";
|
dispbottom "Starting a 5 second timer...";
|
||||||
addtimer 5000, strnpcinfo(3)+"::On5secs";
|
addtimer 5000, strnpcinfo(3) + "::On5secs";
|
||||||
end;
|
end;
|
||||||
On5secs:
|
On5secs:
|
||||||
dispbottom "5 seconds have passed!";
|
dispbottom "5 seconds have passed!";
|
||||||
@ -6370,7 +6364,7 @@ Example 2:
|
|||||||
Example 3:
|
Example 3:
|
||||||
|
|
||||||
mes "[Man]";
|
mes "[Man]";
|
||||||
mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
|
mes "I have been waiting " + (getnpctimer(0)/1000) + " seconds for you.";
|
||||||
// We divide the timer returned by 1000 to convert milliseconds to seconds.
|
// We divide the timer returned by 1000 to convert milliseconds to seconds.
|
||||||
close;
|
close;
|
||||||
|
|
||||||
@ -7049,7 +7043,7 @@ This command will send the message to the server console (map-server window). It
|
|||||||
will not be displayed anywhere else.
|
will not be displayed anywhere else.
|
||||||
|
|
||||||
// Displays "NAME has clicked me!" in the map-server window.
|
// Displays "NAME has clicked me!" in the map-server window.
|
||||||
debugmes strcharinfo(0)+" has clicked me!";
|
debugmes strcharinfo(0) + " has clicked me!";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -7251,8 +7245,8 @@ character belonged to an account which had GM level 99.
|
|||||||
|
|
||||||
// This will ask the invoker for a character name and then use the '@nuke'
|
// This will ask the invoker for a character name and then use the '@nuke'
|
||||||
// GM command on them, killing them mercilessly.
|
// GM command on them, killing them mercilessly.
|
||||||
input @player$;
|
input .@player$;
|
||||||
atcommand "@nuke "+@player$;
|
atcommand "@nuke " + .@player$;
|
||||||
|
|
||||||
Note that for atcommands bound using 'bindatcmd', this command will execute the
|
Note that for atcommands bound using 'bindatcmd', this command will execute the
|
||||||
original atcommand, not the script-bound atcommand.
|
original atcommand, not the script-bound atcommand.
|
||||||
@ -7285,16 +7279,16 @@ The following variables are set upon execution:
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
When a user types the command "@test", an angel effect will be shown.
|
When a user types the command "@test", an angel effect will be shown.
|
||||||
|
|
||||||
- script atcmd_example -1,{
|
- script atcmd_example -1,{
|
||||||
OnInit:
|
OnInit:
|
||||||
bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
|
bindatcmd "test",strnpcinfo(3) + "::OnAtcommand";
|
||||||
end;
|
end;
|
||||||
OnAtcommand:
|
OnAtcommand:
|
||||||
specialeffect2 338;
|
specialeffect2 338;
|
||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -7343,7 +7337,7 @@ Examples:
|
|||||||
unitwalk getcharid(3),150,150;
|
unitwalk getcharid(3),150,150;
|
||||||
|
|
||||||
// Performs a conditional check with the command and reports success or failure to the player.
|
// Performs a conditional check with the command and reports success or failure to the player.
|
||||||
if(unitwalk(getcharid(3),150,150))
|
if (unitwalk(getcharid(3),150,150))
|
||||||
dispbottom "Walking you there...";
|
dispbottom "Walking you there...";
|
||||||
else
|
else
|
||||||
dispbottom "That's too far away, man.";
|
dispbottom "That's too far away, man.";
|
||||||
@ -7826,7 +7820,7 @@ OnClock0600:
|
|||||||
end;
|
end;
|
||||||
OnInit:
|
OnInit:
|
||||||
// setting correct mode upon server start-up
|
// setting correct mode upon server start-up
|
||||||
if(gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
|
if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
|
||||||
OnClock1800:
|
OnClock1800:
|
||||||
night;
|
night;
|
||||||
end;
|
end;
|
||||||
@ -7956,11 +7950,11 @@ Note that 'query_sql' runs on the main database while 'query_logsql' runs on the
|
|||||||
Example:
|
Example:
|
||||||
.@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
|
.@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
|
||||||
mes "Hall Of Fame: TOP5";
|
mes "Hall Of Fame: TOP5";
|
||||||
mes "1."+.@name$[0]+"("+.@fame[0]+")"; // largest fame value.
|
mes "1." + .@name$[0] + "(" + .@fame[0] + ")"; // largest fame value.
|
||||||
mes "2."+.@name$[1]+"("+.@fame[1]+")";
|
mes "2." + .@name$[1] + "(" + .@fame[1] + ")";
|
||||||
mes "3."+.@name$[2]+"("+.@fame[2]+")";
|
mes "3." + .@name$[2] + "(" + .@fame[2] + ")";
|
||||||
mes "4."+.@name$[3]+"("+.@fame[3]+")";
|
mes "4." + .@name$[3] + "(" + .@fame[3] + ")";
|
||||||
mes "5."+.@name$[4]+"("+.@fame[4]+")";
|
mes "5." + .@name$[4] + "(" + .@fame[4] + ")";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -8004,7 +7998,7 @@ Type can optionally be used indicates which script to set (default is 0):
|
|||||||
2 - OnUnequip_Script
|
2 - OnUnequip_Script
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
|
setitemscript 2637,"{ if (isequipped(2236) == 0)end; if (getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
|
||||||
setitemscript 2637,"";
|
setitemscript 2637,"";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
@ -8360,7 +8354,7 @@ Example:
|
|||||||
mes "Alright, now give me the coordinates.";
|
mes "Alright, now give me the coordinates.";
|
||||||
input .@x;
|
input .@x;
|
||||||
input .@y;
|
input .@y;
|
||||||
if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
|
if ( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
|
||||||
mes "Can't warp you there, sorry!";
|
mes "Can't warp you there, sorry!";
|
||||||
close;
|
close;
|
||||||
} else {
|
} else {
|
||||||
@ -9245,7 +9239,7 @@ If there is no such party ID, "null" will be returned.
|
|||||||
Lets say the ID of a party was saved as a global variable:
|
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
|
// 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!";
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
@ -9317,7 +9311,7 @@ Example 2: check party count (with a 'next' pause), before warping to event
|
|||||||
getpartymember getcharid(1), 2;
|
getpartymember getcharid(1), 2;
|
||||||
|
|
||||||
if ( $@partymembercount != .register_num ) {
|
if ( $@partymembercount != .register_num ) {
|
||||||
mes "Please form a party of "+ .register_num +" to continue";
|
mes "Please form a party of " + .register_num + " to continue";
|
||||||
close;
|
close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user