From dfec4146ad7989702a29bfd186cd086276863704 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 31 May 2018 22:23:29 -0300 Subject: Move stuff around --- server/scripts/script_commands.txt | 1813 ++++++++++++++++++------------------ 1 file changed, 908 insertions(+), 905 deletions(-) (limited to 'server/scripts/script_commands.txt') diff --git a/server/scripts/script_commands.txt b/server/scripts/script_commands.txt index 1744a7e..bfb6c95 100644 --- a/server/scripts/script_commands.txt +++ b/server/scripts/script_commands.txt @@ -3304,668 +3304,396 @@ enable (true) or disable (false) the effect on the player. //===================================== --------------------------------------- -*getmapxy("", , , {, ""}) -This function will locate a character object, NPC object or pet's -coordinates and place their coordinates into the variables specified when -calling it. It will return 0 if the search was successful, and -1 if the -parameters given were not variables or the search was not successful. +--------------------------------------- +//===================================== +2.2 - Guild-Related Commands +//===================================== +--------------------------------------- -Type is the type of object to search for: +*getguildname() - UNITTYPE_PC - Character object - UNITTYPE_NPC - NPC object - UNITTYPE_PET - Pet object - UNITTYPE_MOB - Monster object - UNITTYPE_HOM - Homunculus object - UNITTYPE_MER - Mercenary object - UNITTYPE_ELEM - Elemental object +This function returns a guild's name given an ID number. If there is no +such guild, "null" will be returned; -To look for a monster object, monster GID is required. The function will -always return -1 when search using string. + // Would print whatever guild 10007 name is. + mes("The guild "+getguildname(10007)+" are all nice people."); -The search parameter is optional. If it is not specified, the location of the -invoking character will always be returned for UNITTYPE_PC, the location of the -NPC running this function for UNITTYPE_NPC. If a search parameter is specified, -for UNITTYPE_PC and UNITTYPE_NPC, the character or NPC with the specified name -or GID will be located. + // This will do the same as above: + .@var = 10007; + mes("We have some friends in "+getguildname(.@var)+", you know."); -If type is UNITTYPE_PET, UNITTYPE_HOM, UNITTYPE_MER or UNITTYPE_ELEM the search -will locate the owner's pet/homun/mercenary/elementals if the search parameter -is not provided. It will NOT locate these object by name, but can be done if GID -is provided. +This is used all over the WoE controlling scripts. You could also use it +for a guild-based event. -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."); +*getguildmaster() + +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)); + +Can be used to check if the character is the guild master of the specified +guild. + +Maybe you want to make a room only guild masters can enter: + + .@GID = getcharid(CHAR_ID_GUILD); + if (.@GID == 0) { + mes("Sorry you are not in a guild"); 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!"); - if (getmapxy(.@mapname$, .@mapx, .@mapy, UNITTYPE_NPC, "Meh") != 0) { - mes("I can't seem to find Meh anywhere!"); - close(); - } - mes("And I found him on map "+.@mapname$+" at X:"+.@mapx+" Y:"+.@mapy+" !"); + if (strcharinfo(PC_NAME) == getguildmaster(.@GID)) { + mes("Welcome guild master of "+getguildname(.@GID)); close(); } - -Notice that NPC objects disabled with disablenpc() will still be located. + mes("Sorry you don't own the guild you are in"); + close(); --------------------------------------- -*getmapinfo({, ""}) -*getmapinfo({, }) +*getguildmasterid() -This command returns various information about a specific map. If the second -argument is omitted, it will try to use the map of the attached NPC, or the -map of the attached player if the NPC can't be found. +This function will return the character ID number of the guild master of +the guild specified by the ID. 0 if the character is not a guild master of +any guild. -Valid are: - MAPINFO_NAME name of the map - MAPINFO_ID numeric ID of the map - MAPINFO_ZONE name of the zone used by the map - MAPINFO_SIZE_X width of the map (cells on the x axis) - MAPINFO_SIZE_Y height of the map (cells on the y axis) +--------------------------------------- -Examples: - getmapinfo(MAPINFO_ID, "map name"); // ID from name - getmapinfo(MAPINFO_NAME, 3); // name from ID - getmapinfo(MAPINFO_ZONE); // zone, ie Normal, PvP, Jail, ... +*getcastlename("") ---------------------------------------- +This function returns the name of the castle when given the map name for +that castle. The data is read from 'db/castle_db.txt'. -*getunits(, , , ""{, , , , }) +--------------------------------------- -This function searches a whole map or area for units and adds their GID to -the provided array. It filters units by and stops searching -after units have been found. Set to false (0) if you wish to -disable the limit altogether. +*getcastledata("", ) +*setcastledata("", , ); -Type is the type of unit to search for: +This function returns the castle ownership information for the castle +referred to by its map name. Castle information is stored in +`guild_castle` SQL table. - BL_PC - Character object - BL_MOB - Monster object - BL_PET - Pet object - BL_HOM - Homunculus object - BL_MER - Mercenary object - BL_ITEM - Item object (item drops) - BL_SKILL - Skill object (skill fx & sfx) - BL_NPC - NPC object - BL_CHAT - Chat object - BL_ELEM - Elemental object - BL_CHAR - Shorthand for (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) - BL_ALL - Any kind of object +Types of data correspond to `guild_castle` table columns: -** Do NOT use UNITTYPE_ constants here, they have different values. + 1 - `guild_id` - Guild ID. + 2 - `economy` - Castle Economy score. + 3 - `defense` - Castle Defense score. + 4 - `triggerE` - Number of times the economy was invested in today. + 5 - `triggerD` - Number of times the defense was invested in today. + 6 - `nextTime` - unused + 7 - `payTime` - unused + 8 - `createTime` - unused + 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise. +10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian) +11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian) +12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian) +13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian) +14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian) +15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian) +16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian) +17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian) -Example: +All types of data have their meaning determined by War of Emperium +scripts, with exception of: + - `guild_id` that is always the ID of the guild that owns the castle, + - `defense` that is used in Guardians & Emperium HP calculations, + - `visibleG` that is always considered to hold guardian presence bits. - .@count = getunits((BL_PC | BL_NPC), .@units, false, "prontera"); +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. -The above example would search the map "prontera" for all PC and NPC units and -add them to the .@units array, while setting .@count to the amount of units -added to the array (useful in for() loops). +Changing Guild ID or Castle Defense will trigger additional actions, like +recalculating guardians' HP. --------------------------------------- -*getgmlevel() +*getgdskilllv(, ) +*getgdskilllv(, "") -This function will return the (GM) level of player group the account to -which the invoking character belongs. If this is somehow executed from a -console command, 99 will be returned, and 0 will be returned if the -account has no GM level. +This function returns the level of the skill of the guild +. +If the guild does not have that skill, 0 is returned. +If the guild does not exist, -1 is returned. +Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. +GD_* are guild skills -This allows you to make NPC's only accessible for certain GM levels, or -behave specially when talked to by GMs. +--------------------------------------- - if (getgmlevel() > 0) - mes("What is your command, your godhood?"); - if (getgmlevel() < 99) - end; +*requestguildinfo({, ""}); + +This command requests the guild data from the char server and merrily +continues with the execution. Whenever the guild information becomes +available (which happens instantly if the guild information is already in +memory, or later, if it isn't and the map server has to wait for the char +server to reply) it will run the specified event as in a 'doevent' call. --------------------------------------- -*setgroupid({, ""|}) +*getmapguildusers(, ) -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 true if successful, otherwise it will return false. +Returns the amount of characters from the specified guild on the given map. + +Example: + + mes("You have "+getmapguildusers("prontera", getcharid(CHAR_ID_GUILD))+" guild members in Prontera."); --------------------------------------- -*getgroupid({}) +*getguildmember({, }); -This command returns the id of the group of the attached or specified player. -If the player is not found, returns -1. +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 +of temporary global variables. ---------------------------------------- +Upon executing this, -*gettimetick() +$@guildmembername$[] is a global temporary string array which contains all the + names of these guild members. + (only set when type is 0 or not specified) -Valid types are : - 0 - server's tick (milleseconds), unsigned int, loops every ~50 days - 1 - time since the start of the current day in seconds - 2 - UNIX epoch time (number of seconds elapsed since 1st of January 1970) +$@guildmembercid[] is a global temporary number array which contains the + character id of these guild members. + (only set when type is 1) ---------------------------------------- +$@guildmemberaid[] is a global temporary number array which contains the + account id of these guild members. + (only set when type is 2) -*gettime() +$@guildmembercount is the number of guild members that were found. -This function returns specified information about the current system time. +The guild members will be found regardless of whether they are online or offline. +Note that the names come in no particular order. -Valid types: - 1 - GETTIME_SECOND - Seconds (of a minute) - 2 - GETTIME_MINUTE - Minutes (of an hour) - 3 - GETTIME_HOUR - Hour (of a day) - 4 - GETTIME_WEEKDAY - Week day (0 for Sunday, 6 is Saturday) - - Additional: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY - 5 - GETTIME_DAYOFMONTH - Day of the month. - 6 - GETTIME_MONTH - Number of the month. - - Additional: JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER - 7 - GETTIME_YEAR - Year - 8 - GETTIME_DAYOFYEAR - Day of the year. +Be sure to use $@guildmembercount to go through this array, and not +getarraysize(), because it is not cleared between runs of getguildmember(). -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."); - } else if (gettime(GETTIME_MONTH) == 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."); - } +For usage examples, see getpartymember(). +--------------------------------------- +//===================================== +2.2 - End of Guild-Related Commands +//===================================== --------------------------------------- -*getcalendartime(, {, {, }}) +*getskilllv() +*getskilllv("") -This function returns the timestamp of the next ocurrence of given time. +This function returns the level of the specified skill that the invoking +character has. If they don't have the skill, 0 will be returned. The full +list of character skills is available in 'db/(pre-)re/skill_db.txt'. -Day of Month specifies a day between 1 and 31 in the future, by default its value is -1 (don't use). -Day of Week specifies a day in the week and its valid values are: - 0 - SUNDAY - 1 - MONDAY - 2 - TUESDAY - 3 - WEDNESDAY - 4 - THURSDAY - 5 - FRIDAY - 6 - SATURDAY +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. -In order to use Day of Week, you must use Day of Month as -1. -If for some reason the command fails, it'll return -1. +Example 1: -Examples : - getcalendartime(19, 00); // Next 7 pm - getcalendartime(19, 00, 6); // Next day 6 of the month, at 7pm - getcalendartime(19, 10, -1, 1); // Next Monday, at 7:10pm + 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 don't have Throw Stone"); + close(); ---------------------------------------- +Example 2: -*gettimestr(, ) + if (getskilllv(AL_HEAL) == 10) { + mes("Your heal lvl has been maxed"); + close(); + } + if (getskilllv(AL_HEAL) >= 5) { + mes("Your heal lvl is 5 or more"); + close(); + } + mes("You heal skill is below lvl 5"); + close(); -This function will return a string containing time data as specified by -the format string. +--------------------------------------- -This uses the C function 'strfmtime', which obeys special format -characters. For a full description see, for example, the description of -'strfmtime' at http://www.delorie.com/gnu/docs/glibc/libc_437.html -All the format characters given in there should properly work. -Max length is the maximum length of a time string to generate. +*getskilllist(); -The example given in Hercules sample scripts works like this: +This command sets a bunch of arrays with a complete list of skills the +invoking character has. Here's what you get: - mes(gettimestr("%Y-%m/%d %H:%M:%S", 21)); +@skilllist_id[] - skill ids. +@skilllist_lv[] - skill levels. +@skilllist_flag[] - see 'skill' for the meaning of skill flags. +@skilllist_count - number of skills in the above arrays. -This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'. +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. --------------------------------------- -*getusers() +*getpetinfo() -This function will return a number of users on a map or the whole server. -What it returns is specified by Type. +This function will return pet information for the pet the invoking +character currently has active. Valid types are: -Type can be one of the following values, which control what is returned: + 0 - Unique pet ID number as stored by the char server and distinguishing + it from all other pets the characters actually have. This value is + currently useless, at most you can use it to tell pets apart reliably. + 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of + a pet it is. + 2 - Pet name. Will return "null" if there's no pet. + 3 - Pet friendly level (intimacy score). 1000 is full loyalty. + 4 - Pet hungry level. 100 is completely full. + 5 - Pet rename flag. 0 means this pet has not been named yet. - 0 - Count of all characters on the map of the invoking character. - 1 - Count of all characters in the entire server. - 8 - Count of all characters on the map of the NPC the script is - running in. +If the invoking player doesn't own a pet, this command will return +"null" for type 2, and return 0 for other types. --------------------------------------- -*getmapusers("") +*petstat() -This function will return the number of users currently located on the -specified map. +Returns current pet status, all are integers except name. +Returns 0 or "" if the player doesn't have pets. -Currently being used in the PVP scripts to check if a PVP room is full of -not, if the number returned it equal to the maximum allowed it will not -let you enter. +Flags usable: +PET_CLASS +PET_NAME +PET_LEVEL +PET_HUNGRY +PET_INTIMATE -Return -1 if the map name is invalid. +Example: + .@i = petstat(PET_CLASS); --------------------------------------- -*getareausers({"", }{, , , }) -*getareausers({"", }{}) +*getmonsterinfo(, ) -This function will return the count of connected characters which are -located within the specified area. Area can be x1/y1-x2/y2 square, -or radius from npc position. If map name missing, used attached player map. +This function will look up the monster with the specified ID number in the +mob database and return the info set by TYPE argument. +It will return -1 if there is no such monster (or the type value is +invalid), or "null" if you requested the monster's name. -This is useful for maps that are split into many buildings, such as all -the "*_in" maps, due to all the shops and houses. +Valid types are listed in constants.conf: + MOB_NAME 0 + MOB_LV 1 + MOB_MAXHP 2 + MOB_BASEEXP 3 + MOB_JOBEXP 4 + MOB_ATK1 5 + MOB_ATK2 6 + MOB_DEF 7 + MOB_MDEF 8 + MOB_STR 9 + MOB_AGI 10 + MOB_VIT 11 + MOB_INT 12 + MOB_DEX 13 + MOB_LUK 14 + MOB_RANGE 15 + MOB_RANGE2 16 + MOB_RANGE3 17 + MOB_SIZE 18 + MOB_RACE 19 + MOB_ELEMENT 20 + MOB_MODE 21 + MOB_MVPEXP 22 -Examples: - // return players in area npc area on current map. - .@num = getareausers(); - // return players in square (1, 1) - (10, 10) - .@num = "players: " + getareausers(1, 1, 10, 10); +Check sample in doc/sample/getmonsterinfo.txt --------------------------------------- -*getusersname(); +*addmonsterdrop(, , ) -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. +This command will temporarily add a drop to an existing monster. If the +monster already drops the specified item, its drop rate will be updated to the +given value. -You need to put a 'close' after that yourself. +Both the monster and the item must be valid. Acceptable values for the drop +rate are in the range [1:10000]. + +Return value will be 1 in case of success (the item was added or its drop rate +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(PORING, Poring_Doll, 100); ---------------------------------------- -//===================================== -2.2 - Guild-Related Commands -//===================================== --------------------------------------- -*getguildname() +*delmonsterdrop(, ) -This function returns a guild's name given an ID number. If there is no -such guild, "null" will be returned; +This command will temporarily remove a drop from an existing monster. - // Would print whatever guild 10007 name is. - mes("The guild "+getguildname(10007)+" are all nice people."); +Both the monster and the item must be valid. - // This will do the same as above: - .@var = 10007; - mes("We have some friends in "+getguildname(.@var)+", you know."); +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). -This is used all over the WoE controlling scripts. You could also use it -for a guild-based event. +Example: + // Remove Jellopy (909) from the Poring's (1002) drops + delmonsterdrop(PORING, Jellopy); --------------------------------------- -*getguildmaster() - -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. +*getmobdrops() -// Would return the guild master of guild 10007, whatever that might be. - mes(getguildmaster(10007)+" runs "+getguildname(10007)); +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 true if successful and false if the mob ID doesn't +exist. -Can be used to check if the character is the guild master of the specified -guild. +Upon executing this, -Maybe you want to make a room only guild masters can enter: +$@MobDrop_item[] is a global temporary number array which contains the + item IDs of the monster's drops. - .@GID = getcharid(CHAR_ID_GUILD); - if (.@GID == 0) { - mes("Sorry you are not in a guild"); - 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(); +$@MobDrop_rate[] is a global temporary number array which contains the + drop percentages of each item. (1 = .01%) ---------------------------------------- +$@MobDrop_count is the number of item drops found. -*getguildmasterid() +Be sure to use $@MobDrop_count to go through the arrays, and not +'getarraysize', because the temporary global arrays are not cleared +between runs of 'getmobdrops'. If a mob with 7 item drops is looked up, +the arrays would have 7 elements. But if another mob is looked up and it +only has 5 item drops, the server will not clear the arrays for you, +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. -This function will return the character ID number of the guild master of -the guild specified by the ID. 0 if the character is not a guild master of -any guild. +Example: ---------------------------------------- + // get a Mob ID from the user + input(.@mob_id); -*getcastlename("") + 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 + // 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); -This function returns the name of the castle when given the map name for -that castle. The data is read from 'db/castle_db.txt'. + 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 + "%"); + } + } else { + mes("Unknown monster ID."); + } + close(); --------------------------------------- -*getcastledata("", ) -*setcastledata("", , ); - -This function returns the castle ownership information for the castle -referred to by its map name. Castle information is stored in -`guild_castle` SQL table. - -Types of data correspond to `guild_castle` table columns: - - 1 - `guild_id` - Guild ID. - 2 - `economy` - Castle Economy score. - 3 - `defense` - Castle Defense score. - 4 - `triggerE` - Number of times the economy was invested in today. - 5 - `triggerD` - Number of times the defense was invested in today. - 6 - `nextTime` - unused - 7 - `payTime` - unused - 8 - `createTime` - unused - 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise. -10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian) -11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian) -12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian) -13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian) -14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian) -15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian) -16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian) -17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian) - -All types of data have their meaning determined by War of Emperium -scripts, with exception of: - - `guild_id` that is always the ID of the guild that owns the castle, - - `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 -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. - -Changing Guild ID or Castle Defense will trigger additional actions, like -recalculating guardians' HP. - ---------------------------------------- - -*getgdskilllv(, ) -*getgdskilllv(, "") - -This function returns the level of the skill of the guild -. -If the guild does not have that skill, 0 is returned. -If the guild does not exist, -1 is returned. -Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. -GD_* are guild skills - ---------------------------------------- - -*requestguildinfo({, ""}); - -This command requests the guild data from the char server and merrily -continues with the execution. Whenever the guild information becomes -available (which happens instantly if the guild information is already in -memory, or later, if it isn't and the map server has to wait for the char -server to reply) it will run the specified event as in a 'doevent' call. - ---------------------------------------- - -*getmapguildusers(, ) - -Returns the amount of characters from the specified guild on the given map. - -Example: - - mes("You have "+getmapguildusers("prontera", getcharid(CHAR_ID_GUILD))+" guild members in Prontera."); - ---------------------------------------- - -*getguildmember({, }); - -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 -of temporary global variables. - -Upon executing this, - -$@guildmembername$[] is a global temporary string array which contains all the - names of these guild members. - (only set when type is 0 or not specified) - -$@guildmembercid[] is a global temporary number array which contains the - character id of these guild members. - (only set when type is 1) - -$@guildmemberaid[] is a global temporary number array which contains the - account id of these guild members. - (only set when type is 2) - -$@guildmembercount is the number of guild members that were found. - -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(). - -For usage examples, see getpartymember(). - ---------------------------------------- -//===================================== -2.2 - End of Guild-Related Commands -//===================================== ---------------------------------------- - -*getskilllv() -*getskilllv("") - -This function returns the level of the specified skill that the invoking -character has. If they don't have the skill, 0 will be returned. The full -list of character skills is available in 'db/(pre-)re/skill_db.txt'. - -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. - -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 don't have Throw Stone"); - close(); - -Example 2: - - if (getskilllv(AL_HEAL) == 10) { - mes("Your heal lvl has been maxed"); - close(); - } - if (getskilllv(AL_HEAL) >= 5) { - mes("Your heal lvl is 5 or more"); - close(); - } - mes("You heal skill is below lvl 5"); - close(); - ---------------------------------------- - -*getskilllist(); - -This command sets a bunch of arrays with a complete list of skills the -invoking character has. Here's what you get: - -@skilllist_id[] - skill ids. -@skilllist_lv[] - skill levels. -@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 -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. - ---------------------------------------- - -*getpetinfo() - -This function will return pet information for the pet the invoking -character currently has active. Valid types are: - - 0 - Unique pet ID number as stored by the char server and distinguishing - it from all other pets the characters actually have. This value is - currently useless, at most you can use it to tell pets apart reliably. - 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of - a pet it is. - 2 - Pet name. Will return "null" if there's no pet. - 3 - Pet friendly level (intimacy score). 1000 is full loyalty. - 4 - Pet hungry level. 100 is completely full. - 5 - Pet rename flag. 0 means this pet has not been named yet. - -If the invoking player doesn't own a pet, this command will return -"null" for type 2, and return 0 for other types. - ---------------------------------------- - -*petstat() - -Returns current pet status, all are integers except name. -Returns 0 or "" if the player doesn't have pets. - -Flags usable: -PET_CLASS -PET_NAME -PET_LEVEL -PET_HUNGRY -PET_INTIMATE - -Example: - .@i = petstat(PET_CLASS); - ---------------------------------------- - -*getmonsterinfo(, ) - -This function will look up the monster with the specified ID number in the -mob database and return the info set by TYPE argument. -It will return -1 if there is no such monster (or the type value is -invalid), or "null" if you requested the monster's name. - -Valid types are listed in constants.conf: - MOB_NAME 0 - MOB_LV 1 - MOB_MAXHP 2 - MOB_BASEEXP 3 - MOB_JOBEXP 4 - MOB_ATK1 5 - MOB_ATK2 6 - MOB_DEF 7 - MOB_MDEF 8 - MOB_STR 9 - MOB_AGI 10 - MOB_VIT 11 - MOB_INT 12 - MOB_DEX 13 - MOB_LUK 14 - MOB_RANGE 15 - MOB_RANGE2 16 - MOB_RANGE3 17 - MOB_SIZE 18 - MOB_RACE 19 - MOB_ELEMENT 20 - MOB_MODE 21 - MOB_MVPEXP 22 - -Check sample in doc/sample/getmonsterinfo.txt - ---------------------------------------- - -*addmonsterdrop(, , ) - -This command will temporarily add a drop to an existing monster. If the -monster already drops the specified item, its drop rate will be updated to the -given value. - -Both the monster and the item must be valid. Acceptable values for the drop -rate are in the range [1:10000]. - -Return value will be 1 in case of success (the item was added or its drop rate -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(PORING, Poring_Doll, 100); - ---------------------------------------- - -*delmonsterdrop(, ) - -This command will temporarily remove a drop from an existing monster. - -Both the monster and the item must be valid. - -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(PORING, Jellopy); - ---------------------------------------- - -*getmobdrops() - -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 true if successful and false if the mob ID doesn't -exist. - -Upon executing this, - -$@MobDrop_item[] is a global temporary number array which contains the - item IDs of the monster's drops. - -$@MobDrop_rate[] is a global temporary number array which contains the - drop percentages of each item. (1 = .01%) - -$@MobDrop_count is the number of item drops found. - -Be sure to use $@MobDrop_count to go through the arrays, and not -'getarraysize', because the temporary global arrays are not cleared -between runs of 'getmobdrops'. If a mob with 7 item drops is looked up, -the arrays would have 7 elements. But if another mob is looked up and it -only has 5 item drops, the server will not clear the arrays for you, -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. - -Example: - - // get a Mob ID from the user - input(.@mob_id); - - 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 - // 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); - - 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 + "%"); - } - } else { - mes("Unknown monster ID."); - } - close(); - ---------------------------------------- - -*skillpointcount() +*skillpointcount() Returns the total amount of skill points a character possesses (SkillPoint + skill points used in skills) This command can be used to @@ -8501,522 +8229,797 @@ Example: --------------------------------------- -*ord() +*ord() + +Returns the ASCII value of char . + +Example: + + ord("c"); //returns 99 + +--------------------------------------- + +*setchar(, , ) + +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 parameter will be used. + +Example: + + setchar("Cat", "B", 0); //returns "Bat" + +--------------------------------------- + +*insertchar(, , ) + +Returns the original string with the specified char inserted at the +specified index. If index is out of range, the char will be inserted on +the end of the string that it is closest. Only the 1st char in the +parameter will be used. + +Example: + + insertchar("laughter", "s", 0); //returns "slaughter" + +--------------------------------------- + +*delchar(, ) + +Returns the original string with the char at the specified index removed. +If index is out of range, original string will be returned. + +Example: + + delchar("Diet", 3); //returns "Die" + +--------------------------------------- + +*strtoupper() +*strtolower() + +Returns the specified string in it's uppercase/lowercase form. +All non-alpha characters will be preserved. + +Example: + + strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!" + +--------------------------------------- + +*charisupper(, ) +*charislower(, ) + +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: + + charisupper("Hercules", 0); //returns 1 + +--------------------------------------- + +*substr(, , ) + +Returns the sub-string of the specified string inclusively between the set +indexes. If indexes are out of range, or the start index is after the end +index, an empty string will be returned. + +Example: + + substr("foobar", 3, 5); //returns "bar" + +--------------------------------------- + +*explode(, , ) + +Breaks a string up into substrings based on the specified delimiter. +Substrings will be stored within the specified string array. Only the 1st +char of the delimiter parameter will be used. If an empty string is passed +as a delimiter, the string will be placed in the array in its original +form, without any changes. Return the number of elements written to +. + +Example: + + .@num_elements = explode(.@my_array$, "Explode:Test:1965:red:PIE", ":"); + //.@my_array$ contents will be... + //.@my_array$[0]: "Explode" + //.@my_array$[1]: "Test" + //.@my_array$[2]: "1965" + //.@my_array$[3]: "red" + //.@my_array$[4]: "PIE" + //.@num_elements: 5 + +--------------------------------------- + +*implode({, }) + +Combines all substrings within the specified string array into a single +string. If the glue parameter is specified, it will be inserted inbetween +each substring. + +Example: + setarray(.@my_array$[0], "This", "is", "a", "test"); + implode(.@my_array$, " "); //returns "This is a test" + +--------------------------------------- + +*sprintf({, param{, param{, ...}}}) + +C style sprintf. The resulting string is returned. + +The format string can contain placeholders (format specifiers) using the +following structure: + + %[parameter][flags][width]type + +The following format specifier types are supported: + +%%: Prints a literal '%' (special case, doesn't support parameter, flag, width) +%d, %i: Formats the specified value as a decimal signed number +%u: Formats the specified value as a decimal unsigned number +%x: Formats the specified value as a hexadecimal (lowercase) unsigned number +%X: Formats the specified value as a hexadecimal (uppercase) unsigned number +%o: Formats the specified value as an octal unsigned number +%s: Formats the specified value as a string +%c: Formats the specified value as a character (only uses the first character + of strings) + +The following format specifier types are not supported: + +%n (not implemented due to safety concerns) +%f, %F, %e, %E, %g, %G (the script engine doesn't use floating point values) +%p (the script engine doesn't use pointers) +%a, %A (not supported, use 0x%x and 0x%X respectively instead) + +An ordinal parameter can be specified in the form 'x$' (where x is a number), +to reorder the output (this may be useful in translated strings, where the +sentence order may be different from the original order). Example: + + // Name, level, job name + mes(sprintf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +When translating the sentence to other languages (for example Italian), +swapping some arguments may be appropriate, and it may be desirable to keep the +actual arguments in the same order (i.e. when translating through the HULD): + + // Job name is printed before the level, although they're specified in the opposite order. + // Name, job name, level + mes(sprintf("Ciao, io sono %1$s, un %3$s di livello %2$d", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +The supported format specifier flags are: + +- (minus): Left-align the output of this format specifier. (the default is to + right-align the output). ++ (plus): Prepends a plus for positive signed-numeric types. positive = '+', + negative = '-'. +(space): Prepends a space for positive signed-numeric types. positive = ' ', + negative = '-'. This flag is ignored if the '+' flag exists. +0 (zero): When a field width option is specified, prepends zeros for numeric + types. (the default prepends spaces). +A field width can be specified. + + mes(sprintf("The temperature is %+d degrees Celsius", .@temperature)); // Keeps the '+' sign in front of positive values + .@map_name$ = sprintf("quiz_%02d", .@i); // Keeps the leading 0 in "quiz_00", etc + +A field width may be specified, to ensure that 'at least' that many characters +are printed. If a star ('*') is specified as width, then the width is read as +argument to the sprintf() function. This also supports positional arguments. + + sprintf("%04d", 10) // Returns "0010" + sprintf("%0*d", 5, 10) // Returns "00010" + sprintf("%5d", 10) // Returns " 10" + sprintf("%-5d", 10) // Returns "10 " + sprintf("%10s", "Hello") // Returns " Hello"; + sprintf("%-10s", "Hello") // Returns "Hello "; + +Precision ('.X') and length ('hh', 'h', 'l', 'll', 'L', 'z', 'j', 't') +specifiers are not implemented (not necessary for the script engine purposes) + +Example: + .@format$ = "The %s contains %d monkeys"; + dispbottom(sprintf(.@format$, "zoo", 5)); + //prints "The zoo contains 5 monkeys" + + dispbottom(sprintf(.@format$, "barrel", 82)); + //prints "The barrel contains 82 monkeys" + +--------------------------------------- + +*sscanf(, {, param{, param{, ...}}}) + +C style sscanf. All C format specifiers are supported. +More info: sscanf @ www.cplusplus.com. The number of params is only +limited by Hercules' script engine. + +Example: + sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$); + dispbottom(.@num + " " + .@str$); //prints "42 foobar" + +--------------------------------------- + +*strpos(, {, }) -Returns the ASCII value of char . +PHP style strpos. Finds a substring (needle) within a string (haystack). +The offset parameter indicates the index of the string to start searching. +Returns index of substring on successful search, else -1. +Comparison is case sensitive. Example: - - ord("c"); //returns 99 + strpos("foobar", "bar", 0); //returns 3 + strpos("foobarfoo", "foo", 0); //returns 0 + strpos("foobarfoo", "foo", 1); //returns 6 --------------------------------------- -*setchar(, , ) +*replacestr(, , {, {, }}) -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 parameter will be used. +Replaces all instances of a search string in the input with the specified +replacement string. By default is case sensitive unless is set +to false. If specified it will only replace as many instances as specified +in the count parameter. Example: - - setchar("Cat", "B", 0); //returns "Bat" + replacestr("testing tester", "test", "dash"); //returns "dashing dasher" + replacestr("Donkey", "don", "mon", false); //returns "monkey" + replacestr("test test test test test", "test", "yay", false, 3); //returns "yay yay yay test test" --------------------------------------- -*insertchar(, , ) +*countstr(, {, }) -Returns the original string with the specified char inserted at the -specified index. If index is out of range, the char will be inserted on -the end of the string that it is closest. Only the 1st char in the -parameter will be used. +Counts all instances of a search string in the input. By default is case +sensitive unless is set to false. Example: - - insertchar("laughter", "s", 0); //returns "slaughter" + countstr("test test test Test", "test"); //returns 3 + countstr("cake Cake", "Cake", false); //returns 2 --------------------------------------- -*delchar(, ) - -Returns the original string with the char at the specified index removed. -If index is out of range, original string will be returned. +*setfont() -Example: +This command sets the current RO client interface font to one of the fonts +stored in data\*.eot by using an ID of the font. When the ID of the +currently used font is used, default interface font is used again. - delchar("Diet", 3); //returns "Die" + 0 - Default + 1 - RixLoveangel + 2 - RixSquirrel + 3 - NHCgogo + 4 - RixDiary + 5 - RixMiniHeart + 6 - RixFreshman + 7 - RixKid + 8 - RixMagic + 9 - RixJJangu --------------------------------------- -*strtoupper() -*strtolower() +*showdigit({, }) -Returns the specified string in it's uppercase/lowercase form. -All non-alpha characters will be preserved. +Displays given numeric 'value' in large digital clock font on top of the +screen. The optional parameter 'type' specifies visual aspects of the +"clock" and can be one of the following values: -Example: + 0 - Displays the value for 5 seconds (default). + 1 - Incremental counter (1 tick/second). + 2 - Decremental counter (1 tick/second). Does not stop at zero, but + overflows. + 3 - Decremental counter (1 tick/second). Two digits only, stops at + zero. - strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!" +For type 1 and 2 the start value is set by using negative number of the +one intended to set (ex. -10 starts the counter at 10 seconds). Except for +type 3 the value is interpreted as seconds and formatted as time in days, +hours, minutes and seconds. Note, that the official script command does +not have the optional parameter. + + // displays 23:59:59 for 5 seconds + showdigit(86399); + + // counter that starts at 60 and runs for 60 seconds + showdigit(60, 3); --------------------------------------- -*charisupper(, ) -*charislower(, ) +* The Pet AI commands -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. +These commands will only work if the invoking character has a pet, and are +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 +same time. -Example: +*petskillbonus(, , , ) - charisupper("Hercules", 0); //returns 1 +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 +values starting with 'b' in 'db/constants.conf'). ---------------------------------------- +*petrecovery(, ) -*substr(, , ) +This command will make the pet cure a specified status condition. The +curing actions will occur once every seconds. For a full list of +status conditions that can be cured, see the list of 'SC_' status +condition constants in 'db/constants.conf' -Returns the sub-string of the specified string inclusively between the set -indexes. If indexes are out of range, or the start index is after the end -index, an empty string will be returned. +*petloot() -Example: +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. - substr("foobar", 3, 5); //returns "bar" +*petskillsupport(, , , , ) +*petskillsupport("", , , , ) ---------------------------------------- +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 +time between activations. The skill numbers are as per +'db/(pre-)re/skill_db.txt'. +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. -*explode(, , ) +*petskillattack(, , , , ) +*petskillattack("", , , , ) -Breaks a string up into substrings based on the specified delimiter. -Substrings will be stored within the specified string array. Only the 1st -char of the delimiter parameter will be used. If an empty string is passed -as a delimiter, the string will be placed in the array in its original -form, without any changes. Return the number of elements written to -. +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(). +If 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. -Example: +All commands with delays and durations will only make the behavior active +for the specified duration of seconds, with a delay of the specified +number of seconds between activations. Rates are a chance of the effect +occurring and are given in percent. 'bonusrate' is added to the normal +rate if the pet intimacy is at the maximum possible. - .@num_elements = explode(.@my_array$, "Explode:Test:1965:red:PIE", ":"); - //.@my_array$ contents will be... - //.@my_array$[0]: "Explode" - //.@my_array$[1]: "Test" - //.@my_array$[2]: "1965" - //.@my_array$[3]: "red" - //.@my_array$[4]: "PIE" - //.@num_elements: 5 +The behavior modified with the above mentioned commands will only be +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()) +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 +the character is logged in again with the pet still out of the egg.) It is +not certain for how long the effect of such command running from an NPC +script will eventually persist, but apparently, it is possible to usefully +employ them in usable item scripts to create pet buffing items. -*implode({, }) +Nobody tried this before, so you're essentially on your own here. -Combines all substrings within the specified string array into a single -string. If the glue parameter is specified, it will be inserted inbetween -each substring. +--------------------------------------- -Example: - setarray(.@my_array$[0], "This", "is", "a", "test"); - implode(.@my_array$, " "); //returns "This is a test" +*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 +will let the player hatch an owned egg. If the character has no eggs, it +will just open up an empty incubator window. +This is still usable outside item scripts. --------------------------------------- -*sprintf({, param{, param{, ...}}}) +*makepet() -C style sprintf. The resulting string is returned. +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 +'db/pet_db.txt'. The egg is created exactly as if the character just +successfully caught a pet in the normal way. -The format string can contain placeholders (format specifiers) using the -following structure: + // This will make you a poring: + makepet(PORING); - %[parameter][flags][width]type +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 +the char server and the egg will disappear when anyone tries to hatch it. -The following format specifier types are supported: +--------------------------------------- -%%: Prints a literal '%' (special case, doesn't support parameter, flag, width) -%d, %i: Formats the specified value as a decimal signed number -%u: Formats the specified value as a decimal unsigned number -%x: Formats the specified value as a hexadecimal (lowercase) unsigned number -%X: Formats the specified value as a hexadecimal (uppercase) unsigned number -%o: Formats the specified value as an octal unsigned number -%s: Formats the specified value as a string -%c: Formats the specified value as a character (only uses the first character - of strings) +*homshuffle() -The following format specifier types are not supported: +This will recalculate the homunculus stats according to its level, of the +current invoking character. -%n (not implemented due to safety concerns) -%f, %F, %e, %E, %g, %G (the script engine doesn't use floating point values) -%p (the script engine doesn't use pointers) -%a, %A (not supported, use 0x%x and 0x%X respectively instead) +--------------------------------------- -An ordinal parameter can be specified in the form 'x$' (where x is a number), -to reorder the output (this may be useful in translated strings, where the -sentence order may be different from the original order). Example: +*setcell("", , , , , , ) - // Name, level, job name - mes(sprintf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); +Each map cell has several 'flags' that specify the properties of that cell. +These include terrain properties (walkability, shootability, presence of +water), skills (basilica, land protector, ...) and other (NPC nearby, no +vending, ...). +Each of these can be 'on' or 'off'. Together they define a cell's behavior. -When translating the sentence to other languages (for example Italian), -swapping some arguments may be appropriate, and it may be desirable to keep the -actual arguments in the same order (i.e. when translating through the HULD): +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 false (clear flat) or true (set flag). - // Job name is printed before the level, although they're specified in the opposite order. - // Name, job name, level - mes(sprintf("Ciao, io sono %1$s, un %3$s di livello %2$d", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); +Example: + + 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, +and the rest of the map will be marked as 'basilica', preventing observers +from casting any offensive skills or fighting among themselves. Note that +the wall will not be shown nor known client-side, which may cause movement +problems. -The supported format specifier flags are: +Another example: -- (minus): Left-align the output of this format specifier. (the default is to - right-align the output). -+ (plus): Prepends a plus for positive signed-numeric types. positive = '+', - negative = '-'. -(space): Prepends a space for positive signed-numeric types. positive = ' ', - negative = '-'. This flag is ignored if the '+' flag exists. -0 (zero): When a field width option is specified, prepends zeros for numeric - types. (the default prepends spaces). -A field width can be specified. +OnBarricadeDeploy: + setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, false); + end; +OnBarricadeBreak: + setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, true); + end; - mes(sprintf("The temperature is %+d degrees Celsius", .@temperature)); // Keeps the '+' sign in front of positive values - .@map_name$ = sprintf("quiz_%02d", .@i); // Keeps the leading 0 in "quiz_00", etc +This could be a part of the WoE:SE script, where attackers are not allowed +to proceed until all barricades are destroyed. This script would place and +remove a nonwalkable row of cells after the barricade mobs. -A field width may be specified, to ensure that 'at least' that many characters -are printed. If a star ('*') is specified as width, then the width is read as -argument to the sprintf() function. This also supports positional arguments. +--------------------------------------- - sprintf("%04d", 10) // Returns "0010" - sprintf("%0*d", 5, 10) // Returns "00010" - sprintf("%5d", 10) // Returns " 10" - sprintf("%-5d", 10) // Returns "10 " - sprintf("%10s", "Hello") // Returns " Hello"; - sprintf("%-10s", "Hello") // Returns "Hello "; +*checkcell("", , , ) -Precision ('.X') and length ('hh', 'h', 'l', 'll', 'L', 'z', 'j', 't') -specifiers are not implemented (not necessary for the script engine purposes) +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. + +The meaning of the individual types can be confusing, so here's an +overview: + - cell_chkwall/water/cliff + these check directly for the 'terrain component' of the specified cell + - cell_chkpass/reach/nopass/noreach + passable = not wall & not cliff, reachable = passable + wrt. no-stacking mod + - cell_chknpc/basilica/landprotector/novending/nochat + these check for specific dynamic flags (name indicates what they do) Example: - .@format$ = "The %s contains %d monkeys"; - dispbottom(sprintf(.@format$, "zoo", 5)); - //prints "The zoo contains 5 monkeys" - dispbottom(sprintf(.@format$, "barrel", 82)); - //prints "The barrel contains 82 monkeys" + 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; + } --------------------------------------- -*sscanf(, {, param{, param{, ...}}}) - -C style sscanf. All C format specifiers are supported. -More info: sscanf @ www.cplusplus.com. The number of params is only -limited by Hercules' script engine. +*setwall("", , , , , , "") +*delwall("") -Example: - sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$); - dispbottom(.@num + " " + .@str$); //prints "42 foobar" +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: (DIR_ constants). --------------------------------------- -*strpos(, {, }) - -PHP style strpos. Finds a substring (needle) within a string (haystack). -The offset parameter indicates the index of the string to start searching. -Returns index of substring on successful search, else -1. -Comparison is case sensitive. +*readbook(, ) -Example: - strpos("foobar", "bar", 0); //returns 3 - strpos("foobarfoo", "foo", 0); //returns 0 - strpos("foobarfoo", "foo", 1); //returns 6 +This will open a book item at the specified page. --------------------------------------- -*replacestr(, , {, {, }}) +*rodex_sendmail(, "", "", "<body>"{, <zeny>{, <item1>, <amount1>{, <item2>, <amount2>{, <item3>, <amount3>{, <item4>, <amount4>{, <item5>, <amount5>}}}}}}) +*rodex_sendmail_acc(<account id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>{, <item2>, <amount2>{, <item3>, <amount3>{, <item4>, <amount4>{, <item5>, <amount5>}}}}}}) -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 false. If specified it will only replace as many instances as specified -in the count parameter. +This will send a mail using the RoDEX mail system, in newer clients the message will be marked as a NPC mail (that you can't reply). +If items and zeny are specified, they will be added as attachments to the message. -Example: - replacestr("testing tester", "test", "dash"); //returns "dashing dasher" - replacestr("Donkey", "don", "mon", false); //returns "monkey" - replacestr("test test test test test", "test", "yay", false, 3); //returns "yay yay yay test test" +For examples of usage, see /doc/sample/npc_rodex.txt --------------------------------------- -*countstr(<input>, <search>{, <usecase>}) +*rodex_sendmail2(<char id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>, <refine1>, <attribute1>, <card0_1>, <card1_1>, <card2_1>, <card3_1>{,<item2>, <amount2>, <refine2>, <attribute2>, <card0_2>, <card1_2>, <card2_2>, <card3_2>{,<item3>, <amount3>, <refine3>, <attribute3>, <card0_3>, <card1_3>, <card2_3>, <card3_3>{,<item4>, <amount4>, <refine4>, <attribute4>, <card0_4>, <card1_4>, <card2_4>, <card3_4>{,<item5>, <amount5>, <refine5>, <attribute5>, <card0_5>, <card1_5>, <card2_5>, <card3_5>}}}}}}) +*rodex_sendmail_acc2(<account id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>, <refine1>, <attribute1>, <card0_1>, <card1_1>, <card2_1>, <card3_1>{,<item2>, <amount2>, <refine2>, <attribute2>, <card0_2>, <card1_2>, <card2_2>, <card3_2>{,<item3>, <amount3>, <refine3>, <attribute3>, <card0_3>, <card1_3>, <card2_3>, <card3_3>{,<item4>, <amount4>, <refine4>, <attribute4>, <card0_4>, <card1_4>, <card2_4>, <card3_4>{,<item5>, <amount5>, <refine5>, <attribute5>, <card0_5>, <card1_5>, <card2_5>, <card3_5>}}}}}}) -Counts all instances of a search string in the input. By default is case -sensitive unless <usecase> is set to false. +These are more flexible versions of rodex_sendmail and rodex_sendmail_acc. -Example: - countstr("test test test Test", "test"); //returns 3 - countstr("cake Cake", "Cake", false); //returns 2 +This will send a mail using the RoDEX mail system, in newer clients the message will be marked as a NPC mail (that you can't reply). +If items and zeny are specified, they will be added as attachments to the message. +Check getitem2 command for more information of the extra parameters. + +For examples of usage, see /doc/sample/npc_rodex.txt --------------------------------------- -*setfont(<font>) +*getmapxy("<variable for map name>", <variable for x>, <variable for y>, <type>{, "<search parameter>"}) -This command sets the current RO client interface font to one of the fonts -stored in data\*.eot by using an ID of the font. When the ID of the -currently used font is used, default interface font is used again. +This function will locate a character object, NPC object or pet's +coordinates and place their coordinates into the variables specified when +calling it. It will return 0 if the search was successful, and -1 if the +parameters given were not variables or the search was not successful. - 0 - Default - 1 - RixLoveangel - 2 - RixSquirrel - 3 - NHCgogo - 4 - RixDiary - 5 - RixMiniHeart - 6 - RixFreshman - 7 - RixKid - 8 - RixMagic - 9 - RixJJangu +Type is the type of object to search for: ---------------------------------------- + UNITTYPE_PC - Character object + UNITTYPE_NPC - NPC object + UNITTYPE_PET - Pet object + UNITTYPE_MOB - Monster object + UNITTYPE_HOM - Homunculus object + UNITTYPE_MER - Mercenary object + UNITTYPE_ELEM - Elemental object -*showdigit(<value>{, <type>}) +To look for a monster object, monster GID is required. The function will +always return -1 when search using string. -Displays given numeric 'value' in large digital clock font on top of the -screen. The optional parameter 'type' specifies visual aspects of the -"clock" and can be one of the following values: +The search parameter is optional. If it is not specified, the location of the +invoking character will always be returned for UNITTYPE_PC, the location of the +NPC running this function for UNITTYPE_NPC. If a search parameter is specified, +for UNITTYPE_PC and UNITTYPE_NPC, the character or NPC with the specified name +or GID will be located. - 0 - Displays the value for 5 seconds (default). - 1 - Incremental counter (1 tick/second). - 2 - Decremental counter (1 tick/second). Does not stop at zero, but - overflows. - 3 - Decremental counter (1 tick/second). Two digits only, stops at - zero. +If type is UNITTYPE_PET, UNITTYPE_HOM, UNITTYPE_MER or UNITTYPE_ELEM the search +will locate the owner's pet/homun/mercenary/elementals if the search parameter +is not provided. It will NOT locate these object by name, but can be done if GID +is provided. -For type 1 and 2 the start value is set by using negative number of the -one intended to set (ex. -10 starts the counter at 10 seconds). Except for -type 3 the value is interpreted as seconds and formatted as time in days, -hours, minutes and seconds. Note, that the official script command does -not have the optional parameter. +What a mess. Example, a working and tested one now: - // displays 23:59:59 for 5 seconds - showdigit(86399); + 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(); + } - // counter that starts at 60 and runs for 60 seconds - showdigit(60, 3); + 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!"); + if (getmapxy(.@mapname$, .@mapx, .@mapy, UNITTYPE_NPC, "Meh") != 0) { + mes("I can't seem to find Meh anywhere!"); + 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. --------------------------------------- -* The Pet AI commands +*getmapinfo(<info>{, "<map name>"}) +*getmapinfo(<info>{, <map id>}) -These commands will only work if the invoking character has a pet, and are -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 -same time. +This command returns various information about a specific map. If the second +argument is omitted, it will try to use the map of the attached NPC, or the +map of the attached player if the NPC can't be found. -*petskillbonus(<bonus type>, <value>, <duration>, <delay>) +Valid <info> are: + MAPINFO_NAME name of the map + MAPINFO_ID numeric ID of the map + MAPINFO_ZONE name of the zone used by the map + MAPINFO_SIZE_X width of the map (cells on the x axis) + MAPINFO_SIZE_Y height of the map (cells on the y axis) -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 -values starting with 'b' in 'db/constants.conf'). +Examples: + getmapinfo(MAPINFO_ID, "map name"); // ID from name + getmapinfo(MAPINFO_NAME, 3); // name from ID + getmapinfo(MAPINFO_ZONE); // zone, ie Normal, PvP, Jail, ... -*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' +*getunits(<type>, <variable>, <limit>, "<map>"{, <x1>, <y1>, <x2>, <y2>}) -*petloot(<max items>) +This function searches a whole map or area for units and adds their GID to +the provided <variable> array. It filters units by <type> and stops searching +after <limit> units have been found. Set <limit> to false (0) if you wish to +disable the limit altogether. -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. +Type is the type of unit to search for: + + BL_PC - Character object + BL_MOB - Monster object + BL_PET - Pet object + BL_HOM - Homunculus object + BL_MER - Mercenary object + BL_ITEM - Item object (item drops) + BL_SKILL - Skill object (skill fx & sfx) + BL_NPC - NPC object + BL_CHAT - Chat object + BL_ELEM - Elemental object + BL_CHAR - Shorthand for (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) + BL_ALL - Any kind of object + +** Do NOT use UNITTYPE_ constants here, they have different values. -*petskillsupport(<skill id>, <skill level>, <delay>, <percent hp>, <percent sp>) -*petskillsupport("<skill name>", <skill level>, <delay>, <percent hp>, <percent sp>) +Example: -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 -time between activations. The skill numbers are as per -'db/(pre-)re/skill_db.txt'. -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. + .@count = getunits((BL_PC | BL_NPC), .@units, false, "prontera"); -*petskillattack(<skill id>, <damage>, <number of attacks>, <rate>, <bonusrate>) -*petskillattack("<skill name>", <damage>, <number of attacks>, <rate>, <bonusrate>) +The above example would search the map "prontera" for all PC and NPC units and +add them to the .@units array, while setting .@count to the amount of units +added to the array (useful in for() loops). -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(). -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. +--------------------------------------- -All commands with delays and durations will only make the behavior active -for the specified duration of seconds, with a delay of the specified -number of seconds between activations. Rates are a chance of the effect -occurring and are given in percent. 'bonusrate' is added to the normal -rate if the pet intimacy is at the maximum possible. +*getgmlevel() -The behavior modified with the above mentioned commands will only be -exhibited if the pet is loyal and appropriate configuration options are -set in 'conf/map/battle.conf'. +This function will return the (GM) level of player group the account to +which the invoking character belongs. If this is somehow executed from a +console command, 99 will be returned, and 0 will be returned if the +account has no GM level. -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()) -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 -the character is logged in again with the pet still out of the egg.) It is -not certain for how long the effect of such command running from an NPC -script will eventually persist, but apparently, it is possible to usefully -employ them in usable item scripts to create pet buffing items. +This allows you to make NPC's only accessible for certain GM levels, or +behave specially when talked to by GMs. -Nobody tried this before, so you're essentially on your own here. + if (getgmlevel() > 0) + mes("What is your command, your godhood?"); + if (getgmlevel() < 99) + end; --------------------------------------- -*bpet() +*setgroupid(<new group id>{, "<character name>"|<account id>}) -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 -will let the player hatch an owned egg. If the character has no eggs, it -will just open up an empty incubator window. -This is still usable outside item scripts. +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 true if successful, otherwise it will return false. --------------------------------------- -*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 -'db/pet_db.txt'. The egg is created exactly as if the character just -successfully caught a pet in the normal way. - - // This will make you a poring: - makepet(PORING); +*getgroupid({<account id>}) -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 -the char server and the egg will disappear when anyone tries to hatch it. +This command returns the id of the group of the attached or specified player. +If the player is not found, returns -1. --------------------------------------- -*homshuffle() +*gettimetick(<type>) -This will recalculate the homunculus stats according to its level, of the -current invoking character. +Valid types are : + 0 - server's tick (milleseconds), unsigned int, loops every ~50 days + 1 - time since the start of the current day in seconds + 2 - UNIX epoch time (number of seconds elapsed since 1st of January 1970) --------------------------------------- -*setcell("<map name>", <x1>, <y1>, <x2>, <y2>, <type>, <flag>) +*gettime(<type>) -Each map cell has several 'flags' that specify the properties of that cell. -These include terrain properties (walkability, shootability, presence of -water), skills (basilica, land protector, ...) and other (NPC nearby, no -vending, ...). -Each of these can be 'on' or 'off'. Together they define a cell's behavior. +This function returns specified information about the current system time. -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 false (clear flat) or true (set flag). +Valid types: + 1 - GETTIME_SECOND - Seconds (of a minute) + 2 - GETTIME_MINUTE - Minutes (of an hour) + 3 - GETTIME_HOUR - Hour (of a day) + 4 - GETTIME_WEEKDAY - Week day (0 for Sunday, 6 is Saturday) + - Additional: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY + 5 - GETTIME_DAYOFMONTH - Day of the month. + 6 - GETTIME_MONTH - Number of the month. + - Additional: JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER + 7 - GETTIME_YEAR - Year + 8 - GETTIME_DAYOFYEAR - Day of the year. -Example: +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."); + } else if (gettime(GETTIME_MONTH) == 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."); + } - 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, -and the rest of the map will be marked as 'basilica', preventing observers -from casting any offensive skills or fighting among themselves. Note that -the wall will not be shown nor known client-side, which may cause movement -problems. +*getcalendartime(<hour>, <minute>{, <day of month>{, <day of week>}}) -Another example: +This function returns the timestamp of the next ocurrence of given time. -OnBarricadeDeploy: - setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, false); - end; -OnBarricadeBreak: - setcell("schg_cas05", 114, 51, 125, 51, cell_walkable, true); - end; +Day of Month specifies a day between 1 and 31 in the future, by default its value is -1 (don't use). +Day of Week specifies a day in the week and its valid values are: + 0 - SUNDAY + 1 - MONDAY + 2 - TUESDAY + 3 - WEDNESDAY + 4 - THURSDAY + 5 - FRIDAY + 6 - SATURDAY -This could be a part of the WoE:SE script, where attackers are not allowed -to proceed until all barricades are destroyed. This script would place and -remove a nonwalkable row of cells after the barricade mobs. +In order to use Day of Week, you must use Day of Month as -1. +If for some reason the command fails, it'll return -1. + +Examples : + getcalendartime(19, 00); // Next 7 pm + getcalendartime(19, 00, 6); // Next day 6 of the month, at 7pm + getcalendartime(19, 10, -1, 1); // Next Monday, at 7:10pm --------------------------------------- -*checkcell("<map name>", <x>, <y>, <type>) +*gettimestr(<format string>, <max length>) -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. +This function will return a string containing time data as specified by +the format string. -The meaning of the individual types can be confusing, so here's an -overview: - - cell_chkwall/water/cliff - these check directly for the 'terrain component' of the specified cell - - cell_chkpass/reach/nopass/noreach - passable = not wall & not cliff, reachable = passable - wrt. no-stacking mod - - cell_chknpc/basilica/landprotector/novending/nochat - these check for specific dynamic flags (name indicates what they do) +This uses the C function 'strfmtime', which obeys special format +characters. For a full description see, for example, the description of +'strfmtime' at http://www.delorie.com/gnu/docs/glibc/libc_437.html +All the format characters given in there should properly work. +Max length is the maximum length of a time string to generate. -Example: +The example given in Hercules sample scripts works like this: - 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; - } + mes(gettimestr("%Y-%m/%d %H:%M:%S", 21)); + +This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'. --------------------------------------- -*setwall("<map name>", <x>, <y>, <size>, <dir>, <shootable>, "<name>") -*delwall("<name>") +*getusers(<type>) -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: (DIR_ constants). +This function will return a number of users on a map or the whole server. +What it returns is specified by Type. + +Type can be one of the following values, which control what is returned: + + 0 - Count of all characters on the map of the invoking character. + 1 - Count of all characters in the entire server. + 8 - Count of all characters on the map of the NPC the script is + running in. --------------------------------------- -*readbook(<book id>, <page>) +*getmapusers("<map name>") -This will open a book item at the specified page. +This function will return the number of users currently located on the +specified map. + +Currently being used in the PVP scripts to check if a PVP room is full of +not, if the number returned it equal to the maximum allowed it will not +let you enter. + +Return -1 if the map name is invalid. --------------------------------------- -*rodex_sendmail(<char id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>{, <item2>, <amount2>{, <item3>, <amount3>{, <item4>, <amount4>{, <item5>, <amount5>}}}}}}) -*rodex_sendmail_acc(<account id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>{, <item2>, <amount2>{, <item3>, <amount3>{, <item4>, <amount4>{, <item5>, <amount5>}}}}}}) +*getareausers({"<map name>", }{<x1>, <y1>, <x2>, <y2>}) +*getareausers({"<map name>", }{<radius>}) -This will send a mail using the RoDEX mail system, in newer clients the message will be marked as a NPC mail (that you can't reply). -If items and zeny are specified, they will be added as attachments to the message. +This function will return the count of connected characters which are +located within the specified area. Area can be x1/y1-x2/y2 square, +or radius from npc position. If map name missing, used attached player map. -For examples of usage, see /doc/sample/npc_rodex.txt +This is useful for maps that are split into many buildings, such as all +the "*_in" maps, due to all the shops and houses. ---------------------------------------- +Examples: + // return players in area npc area on current map. + .@num = getareausers(); + // return players in square (1, 1) - (10, 10) + .@num = "players: " + getareausers(1, 1, 10, 10); -*rodex_sendmail2(<char id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>, <refine1>, <attribute1>, <card0_1>, <card1_1>, <card2_1>, <card3_1>{,<item2>, <amount2>, <refine2>, <attribute2>, <card0_2>, <card1_2>, <card2_2>, <card3_2>{,<item3>, <amount3>, <refine3>, <attribute3>, <card0_3>, <card1_3>, <card2_3>, <card3_3>{,<item4>, <amount4>, <refine4>, <attribute4>, <card0_4>, <card1_4>, <card2_4>, <card3_4>{,<item5>, <amount5>, <refine5>, <attribute5>, <card0_5>, <card1_5>, <card2_5>, <card3_5>}}}}}}) -*rodex_sendmail_acc2(<account id>, "<sender name>", "<title>", "<body>"{, <zeny>{, <item1>, <amount1>, <refine1>, <attribute1>, <card0_1>, <card1_1>, <card2_1>, <card3_1>{,<item2>, <amount2>, <refine2>, <attribute2>, <card0_2>, <card1_2>, <card2_2>, <card3_2>{,<item3>, <amount3>, <refine3>, <attribute3>, <card0_3>, <card1_3>, <card2_3>, <card3_3>{,<item4>, <amount4>, <refine4>, <attribute4>, <card0_4>, <card1_4>, <card2_4>, <card3_4>{,<item5>, <amount5>, <refine5>, <attribute5>, <card0_5>, <card1_5>, <card2_5>, <card3_5>}}}}}}) +--------------------------------------- -These are more flexible versions of rodex_sendmail and rodex_sendmail_acc. +*getusersname(); -This will send a mail using the RoDEX mail system, in newer clients the message will be marked as a NPC mail (that you can't reply). -If items and zeny are specified, they will be added as attachments to the message. -Check getitem2 command for more information of the extra parameters. +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. -For examples of usage, see /doc/sample/npc_rodex.txt +You need to put a 'close' after that yourself. --------------------------------------- //===================================== @@ -10009,4 +10012,4 @@ Enables the Emblem of the given Clan to the current NPC //===================================== 13 - End of Clan System Related Commands //===================================== ---------------------------------------- \ No newline at end of file +--------------------------------------- -- cgit v1.2.3-70-g09d2