diff options
-rw-r--r-- | doc/script_commands.txt | 122 | ||||
-rw-r--r-- | src/map/map.h | 32 |
2 files changed, 100 insertions, 54 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 5fbf652a4..af3d90262 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -7610,10 +7610,9 @@ This will open a book item at the specified page. ======================== --------------------------------------- -*instance_create("<instance name>",<party id>); +*instance_create("<instance name>",<owner id>{,<optional owner_type>}); -Create an instance using the name "<instance name>" for the Party of -<party id>. +Create an instance using the name "<instance name>" for the <owner_id> of owner_type (when not provided, defaults to IOT_PARTY) Most instance_* commands are used in conjunction with this command and depend on the ID this command returns. @@ -7644,30 +7643,32 @@ Example: *instance_destroy {<instance id>}; Destroys instance with the ID <instance id>. If no ID is specified, the -instance the script is attached to is used. If the script is not attached -to an instance, the instance of the currently attached player's party is -used. If no player is currently attached, the command fails and causes the -script to halt. +instance the script is attached to is used. If in the end no instance_id, +is found the command halts the script execution. --------------------------------------- -*instance_attachmap("<map name>",<instance id>{,<use base name>}); +*instance_attachmap("<map name>",<instance id>{,<use base name>{,"<new map name>"}}); Attaches the map "<map name>" to the instance specified with <instance id>. The optional parameter specifies, whether a map requires -emulation for instancing (1) or not (0 = default). +emulation for instancing (1) or not (0 = default). if use base name is specified, +and "<new map name>" too the server will instance the map under the "<new map name>", +name. Returns the resulting map name on success or an empty string on failure. +Example: + instance_attachmap("prontera", .@instance_id,1,"via"); +^ the above creates a instance (or clone) of prontera, on a map called "via" + --------------------------------------- *instance_detachmap "<map name>"{,<instance id>}; Detach the map "<map name>" to the instance with the <instance id>. If no -ID is specified, the instance the script is attached to is used. If the -script is not attached to an instance, the instance of the currently -attached player's party is used. If no player is currently attached, the -command fails and causes the script to halt. +ID is specified, the instance the script is attached to is used. If in the +end no instance_id is found the command halts the script execution. --------------------------------------- @@ -7681,10 +7682,8 @@ the source maps to the instanced maps. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}; Works like announce, but has the <instance id> parameter. If instance id -is 0, the instance the script is attached to is used. If the script is not -attached to an instance, the instance of the currently attached player's -party is used. If no player is currently attached, the command fails and -causes the script to halt. +is -1, the instance the script is attached to is used. If in the +end no instance_id is found the command halts the script execution. --------------------------------------- @@ -7698,10 +7697,8 @@ Attaches the current script to the instance given by <instance id>. Retrieves the unique name given to a copy of an NPC given by "<npc name>" in an instance specified <instance id>. If no ID is specified, the -instance the script is attached to is used. If the script is not attached -to an instance, the instance of the currently attached player's party is -used. If no player is currently attached, the command fails and causes the -script to halt. +instance the script is attached to is used. If in the end no instance_id, +is found the command halts the script execution. --------------------------------------- @@ -7709,22 +7706,18 @@ script to halt. Checks whether or not the given map belongs to specified instance. If no ID is specified, the instance the script is attached to is used. If the -script is not attached to an instance, the instance of the currently -attached player's party is used. If no player is currently attached, the -command fails and causes the script to halt. +script is not attached to an instance, it'll try to check whether the, +player attached to the script possesses an instance with a map matching +"<map name>". If in the end no instance_id is found the command halts the, +script execution. Returns name of the instanced map on success, otherwise an empty string. --------------------------------------- -*instance_id({<type>}); +*instance_id(); -Retrieves the instance id, depending on <type>. If type is not given, it -defaults to 0. - -Type: - 0 - Instance ID the script is attached to. - 1 - Instance ID of the currently attached player's party. +Retrieves the instance id of the script it is being run on. --------------------------------------- @@ -7732,19 +7725,16 @@ Type: Warps all players in the instance <instance id> to <map name> at given coordinates. If no ID is specified, the instance the script is attached to -is used. If the script is not attached to an instance, the instance of the -currently attached player's party is used. If no player is currently -attached, the command fails and causes the script to halt. +is used. If in the end no instance_id is found the command halts the, +script execution. --------------------------------------- *instance_set_timeout <alive timeout>,<idle timeout>{,<instance id>}; Sets the timeout values for an instance given by <instance id>. If no ID -is specified, the instance the script is attached to is used. If the -script is not attached to an instance, the instance of the currently -attached player's party is used. If no player is currently attached, the -command fails and causes the script to halt. +is specified, the instance the script is attached to is used. If in the end, +no instance_id is found the command halts the script execution. Parameter <alive timeout> specifies the total amount of time the instance will exist. Parameter <idle timeout> specifies how long players have, when @@ -8080,3 +8070,59 @@ If the character does not have a mercenary, the command returns "" for name and 0 for all other types. ---------------------------------------- + +========================== +|11.- Queue Commands .| +========================== +--------------------------------------- +Queue Author's note: the following sucks, probably breaks formatting, please fix if you're willing to (you may remove this note) +--------------------------------------- +*queue() +creates a new queue instance, returns created queue id + +--------------------------------------- +*queuesize(<queue_id>) +returns the amount of entries in queue instance of <queue_id>. + +--------------------------------------- +*queueadd(<queue_id>,<var_id>) +adds <var_id> to queue of <queue_id>, returns 1 if <var_id> is already present in the queue, 0 otherwise. + +--------------------------------------- +*queueremove(<queue_id>,<var_id>) +removes <var_id> from queue of <queue_id>, returns 1 if <var_id> is not present in the queue, 0 otherwise. + +--------------------------------------- +*queueopt(<queue_id>,<optionType>,{Optional <option val>}) +modifies <queue_id>'s <optionType>, when <option val> is not present, <optionType> is removed from <queue_id>, when present it modifies <queue_id>'s <optionType> with the new <option val> value. +Currently 3 options are available, HQO_OnDeath (0), HQO_OnLogout (1), HQO_OnMapChange (2) (the constant names are not final). + +Example: + queueopt(.@queue_id,0,"MyNPC::MyOnQueueMemberDeathEventName"); + +--------------------------------------- +*queuedel(<queue_id>) +deletes <queue_id> returns 1 when <queue_id> is not found, 0 otherwise. + +--------------------------------------- +*queueiterator(<queue_id>) +creates a new queue iterator instance, a queue iterator is not a reference to a queue's actual members, it copies the queues members when initialized, this way you can loop through them even if you remove them from the queue + +--------------------------------------- +*qicheck(<queue_iterator_id>) +checks whether there is a next member in the iterator's queue, 1 when it does, 0 otherwise. + +--------------------------------------- +*qiget(<queue_iterator_id>) +obtains the next member in the iterator's queue, returns the next member's id or 0 when it doesnt exist. + +Example: + for( set .@elem,qiget(.@queue_iterator_id); qicheck(.@queue_iterator_id); set .@elem,qiget(.@queue_iterator_id) ) { + //Do something + } + +--------------------------------------- +*qiclear(<queue_iterator_id>) +deletes a queue iterator from memory, returns 1 when it fails, 0 otherwise. + +---------------------------------------
\ No newline at end of file diff --git a/src/map/map.h b/src/map/map.h index 850913474..c8c1aae12 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -31,7 +31,7 @@ enum E_MAPSERVER_ST { #define AREA_SIZE battle_config.area_size #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 -#define MAX_MOBSKILL 50 //Max 128, see mob skill_idx type if need this higher +#define MAX_MOBSKILL 50 #define MAX_MOB_LIST_PER_MAP 100 #define MAX_EVENTQUEUE 2 #define MAX_EVENTTIMER 32 @@ -61,10 +61,10 @@ enum MOBID { MOBID_MAGICDECOY_WIND = 2046, }; -//The following system marks a different job ID system used by the map server, -//which makes a lot more sense than the normal one. [Skotlex] +// The following system marks a different job ID system used by the map server, +// which makes a lot more sense than the normal one. [Skotlex] // -//These marks the "level" of the job. +// These marks the "level" of the job. #define JOBL_2_1 0x100 //256 #define JOBL_2_2 0x200 //512 #define JOBL_2 0x300 @@ -73,13 +73,13 @@ enum MOBID { #define JOBL_BABY 0x2000 //8192 #define JOBL_THIRD 0x4000 //16384 -//for filtering and quick checking. +// For filtering and quick checking. #define MAPID_BASEMASK 0x00ff #define MAPID_UPPERMASK 0x0fff #define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK) //First Jobs //Note the oddity of the novice: -//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type, too... +//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type. enum { //Novice And 1-1 Jobs MAPID_NOVICE = 0x0, @@ -207,31 +207,31 @@ enum { MAPID_BABY_CHASER, }; -//Max size for inputs to Graffiti, Talkie Box and Vending text prompts +// Max size for inputs to Graffiti, Talkie Box and Vending text prompts #define MESSAGE_SIZE (79 + 1) -//String length you can write in the 'talking box' +// String length you can write in the 'talking box' #define CHATBOX_SIZE (70 + 1) -//Chatroom-related string sizes +// Chatroom-related string sizes #define CHATROOM_TITLE_SIZE (36 + 1) #define CHATROOM_PASS_SIZE (8 + 1) -//Max allowed chat text length +// Max allowed chat text length #define CHAT_SIZE_MAX (255 + 1) -//24 for npc name + 24 for label + 2 for a "::" and 1 for EOS +// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS #define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 ) #define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000 -//Specifies maps where players may hit each other +// Specifies maps where players may hit each other #define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground) -//Specifies maps that have special GvG/WoE restrictions +// Specifies maps that have special GvG/WoE restrictions #define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle)) -//Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status) +// Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status) #define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle) // No Kill Steal Protection #define map_flag_ks(m) (map[m].flag.town || map[m].flag.pvp || map[m].flag.gvg || map[m].flag.battleground) //This stackable implementation does not means a BL can be more than one type at a time, but it's -//meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] +// meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] enum bl_type { BL_NUL = 0x000, BL_PC = 0x001, @@ -248,7 +248,7 @@ enum bl_type { BL_ALL = 0xFFF, }; -//For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. +// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet. #define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB }; |