diff options
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r-- | doc/script_commands.txt | 153 |
1 files changed, 127 insertions, 26 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 10b4e5653..90d4d77cc 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -714,6 +714,8 @@ MAX_BANK_ZENY - Maximum Zeny in the bank MAX_BG_MEMBERS - Maximum BattleGround members MAX_CHAT_USERS - Maximum Chat users MAX_REFINE - Maximum Refine level +MAX_MENU_OPTIONS - Maximum NPC menu options +MAX_MENU_LENGTH - Maximum NPC menu string length Send targets and status options are also hard-coded and can be found in 'doc/constants.md'. @@ -1600,21 +1602,24 @@ perfectly equivalent. --------------------------------------- *select("<option>"{, "<option>", ...}) -*prompt("<option>"{, "<option>", ...}) This function is a handy replacement for 'menu' that doesn't use a complex -label structure. It will return the number of menu option picked, -starting with 1. Like 'menu', it will also set the variable @menu to -contain the option the user picked. +label structure. It will return the number of the menu option picked, +starting with 1. If the player presses cancel, the script is terminated. - if (select("Yes:No") == 1) + if (select("Yes", "No") == 1) mes("You said yes, I know."); And like 'menu', the selected option is consistent with grouped options and empty options. -'prompt' works almost the same as select, except that when a character -clicks the Cancel button, this function will return 255 instead. +--------------------------------------- + +*prompt("<option>"{, "<option>", ...}) + +This function behaves exactly like select(), but when a player presses cancel +it returns MAX_MENU_OPTIONS and the script is not terminated. You almost always +want to use select() rather than prompt(). --------------------------------------- @@ -1976,18 +1981,35 @@ prontera,150,150,0 script TestNPC 123,{ *is_function("<function name>") -This command checks whether a function exists. -It returns 1 if function is found, or 0 if it isn't. +This command checks whether or not a function exists and returns its type. +Returns false if it cannot be found. + +return values: + + FUNCTION_IS_COMMAND - built-in script command (eg: mes, select, ...) + FUNCTION_IS_GLOBAL - user-defined global function (callable with callfunc) + FUNCTION_IS_LOCAL - user-defined local function + FUNCTION_IS_LABEL - user-defined label function (callable with callsub) Example: - function script try { + function script func1 { dothat(); } - script test FAKE_NPC,{ - .@try = is_function("try"); // 1 - .@not = is_function("notafunction"); // 0 + function func2 { + do_something(); + } + + func3: + end; + + is_function("func1"); // FUNCTION_IS_GLOBAL + is_function("func2"); // FUNCTION_IS_LOCAL + is_function("func3"); // FUNCTION_IS_LABEL + is_function("select"); // FUNCTION_IS_COMMAND + is_function("invalid"); // false } --------------------------------------- @@ -2557,15 +2579,12 @@ playerattached() to check for the character attached to the script. --------------------------------------- -*getnpcid(<type>{, "<npc name>"}) +*getnpcid({"<npc name>"}) Retrieves IDs of the currently invoked NPC. If a unique npc name is given, -IDs of that NPC are retrieved instead. Type specifies what ID to retrieve -and can be one of the following: - - 0 - Unit ID (GID) +IDs of that NPC are retrieved instead. -If an invalid type is given or the NPC does not exist, 0 is returned. +If the NPC does not exist, 0 is returned. --------------------------------------- @@ -3222,6 +3241,7 @@ Valid types are: ITEMINFO_VIEWID - View ID ("Sprite" field in the Item DB) ITEMINFO_MATK - MATK (only relevant if RENEWAL is set) ITEMINFO_VIEWSPRITE - View Sprite ("ViewSprite" field in the Item DB) + ITEMINFO_TRADE - Trade Restriction (see "doc/constant.md": item trade restriction) Check sample in doc/sample/getiteminfo.txt @@ -5975,6 +5995,17 @@ Example usage: --------------------------------------- +*removespecialeffect(<effect number>{, <send_target>{, <unit id>{, <account id>}}}) +*removespecialeffect(<effect number>{, <send_target>{, "<NPC Name>"{, <account id>}}}) + +Works for: + main client from version 2018-10-02 + re client from version 2018-10-02 +This command will remove special effect. All parameters same with specialeffect. +Examples and detailed explanation about parameters see in specialeffect. + +--------------------------------------- + *specialeffect2(<effect number>{, <send_target>{, "<Player Name>"}}) @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -7662,15 +7693,19 @@ solution rather than sending the map and the monster_id. //===================================== --------------------------------------- -*debugmes("<message>") +*debugmes("<format string>"{, <param>{, ...}}) + +This command will print a message in the server console (map-server window), +after applying the same format-string replacements as sprintf(). It will not be +displayed anywhere else. Returns true on success. + +Example: -This command will send the message to the server console (map-server -window). It will not be displayed anywhere else. -// // Displays "NAME has clicked me!" in the map-server window. - debugmes(strcharinfo(PC_NAME)+" has clicked me!"); + debugmes("%s has clicked me!", strcharinfo(PC_NAME)); + + debugmes("\033[0;32mHello World"); // supports ANSI escape sequences - debugmes("\033[38D\033[K ==Message== \n"); // enable colour code. --------------------------------------- *logmes("<message>"{, <log type>}) @@ -8093,7 +8128,7 @@ built-in atcommands and custom atcommands. *has_permission("<permission>"{, <account id>}) Check if the attached or specified player has the specified permission -and returns true or false accordingly. See doc/permissions.txt for +and returns true or false accordingly. See doc/permissions.md for details about permissions. Valid <permission> are: @@ -8566,6 +8601,18 @@ Example: --------------------------------------- +*data_to_string(<data>) + +Returns a string representation of the given data, similar to the .toString() +method in JavaScript. + +Example: + + data_to_string(DATATYPE_VAR) // "DATATYPE_VAR" + data_to_string(.@foo) // ".@foo" + +--------------------------------------- + *charisalpha("<string>", <position>) This function will return true if the character number Position in the given @@ -9393,10 +9440,11 @@ supported types: values QINFO_SEX: sex QINFO_BASE_LEVEL: min, max QINFO_JOB_LEVEL: min, max - QINFO_ITEM: item_id, amount // append to the items list on each use + QINFO_ITEM: item_id, min amount, max amount // append to the items list on each use QINFO_HOMUN_LEVEL: min QINFO_HOMUN_TYPE: homunculus_type (0 - regular, 1 - evolved, 2 - S) QINFO_QUEST: quest_id, state // append to the quests list on each use + QINFO_MERCENARY_CLASS: mercenary_class --------------------------------------- @@ -10136,3 +10184,56 @@ the available flags are: Opens the styling shop on client --------------------------------------- + +*msgtable(<message_id>{, <color>}) + +Show in client message by <message_id> from msg string table +with optional <color>. + +--------------------------------------- + +*msgtable2(<message_id>, <param>{, <color>}) + +Show in client message by <message_id> from msg string table. +<param> is parameter for this message. Can be string or int. +Optional <color> can be used for set color for whole message. + +--------------------------------------- + +*camerainfo() + +Show or hide camera info window. +Works for 20160525 clients or newer. + +--------------------------------------- + +*changecamera(<range>, <rotation>, <latitude>{, <target>}) + +Change camera range, rotation, latitude. +The optional target parameter specifies who will get changed +camera. +Works for 20160525 clients or newer. + +--------------------------------------- + +*achievement_progress(<ach_id>, <obj_idx>, <progress>, <incremental>{, <account_id>}); + +Make the player progress in the specified achievement. +aid - achievement ID +obj_idx - achievement objective index. +progress - objective progress towards goal. +incremental - (boolean) true to add the progress towards the goal, + false to use the progress only as a comparand. +account_id - (optional) AID to perform on (default to attached player). + +returns progress on success and false on failure + +--------------------------------------- + +*itempreview(<index>) + +Update already opened preview window with item from + inventory with given index. +Works for 20181017 RE and main clients or newer. + +--------------------------------------- |