From 49eff7fc35ceefb13e5247b7f8bc66a32c0a5871 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Jun 2016 01:22:40 +0300 Subject: Update to latest hercules. --- server/sample/npc_dynamic_shop.txt | 2 +- server/sample/npc_test_duplicate.txt | 2 +- server/scripts/constants.md | 2 +- server/scripts/script_commands.txt | 102 ++++++++++++++++++++++++++++++----- 4 files changed, 91 insertions(+), 17 deletions(-) diff --git a/server/sample/npc_dynamic_shop.txt b/server/sample/npc_dynamic_shop.txt index 1e4ac77..9b1315b 100644 --- a/server/sample/npc_dynamic_shop.txt +++ b/server/sample/npc_dynamic_shop.txt @@ -9,7 +9,7 @@ //============================================================ // Dummy shop to insert items into: -- shop dyn_shop1 -1,501:50. +- shop dyn_shop1 FAKE_NPC,501:50. prontera,181,200,4 script Dynamic Shop 2_F_MAGICMASTER,{ callshop "dyn_shop1",0; diff --git a/server/sample/npc_test_duplicate.txt b/server/sample/npc_test_duplicate.txt index 55d64bc..4e07e38 100644 --- a/server/sample/npc_test_duplicate.txt +++ b/server/sample/npc_test_duplicate.txt @@ -12,7 +12,7 @@ //= 'OnInit' loads the main npc last, for some reason. (check with debugmes) //============================================================ -- script Test Script -1,1,1,{ +- script Test Script FAKE_NPC,1,1,{ mes "Hi."; mes "My coords are "+ .map$ +", "+ .x +"/" +.y ; close; diff --git a/server/scripts/constants.md b/server/scripts/constants.md index 138808d..65e2650 100644 --- a/server/scripts/constants.md +++ b/server/scripts/constants.md @@ -3651,7 +3651,7 @@ - `MAX_GUILD_STORAGE`: 600 - `MAX_CART`: 100 - `MAX_INVENTORY`: 100 -- `MAX_ZENY`: 1000000000 +- `MAX_ZENY`: 2147483647 - `MAX_BG_MEMBERS`: 30 - `MAX_CHAT_USERS`: 20 - `MAX_REFINE`: 20 diff --git a/server/scripts/script_commands.txt b/server/scripts/script_commands.txt index c45b4e6..f0758de 100644 --- a/server/scripts/script_commands.txt +++ b/server/scripts/script_commands.txt @@ -1188,7 +1188,7 @@ From here on, we will have the commands sorted as followed: //===================================== --------------------------------------- -*mes ""{,""...""}; +*mes ""; This command will displays a box on the screen for the invoking character, if no such box is displayed already, and will print the string specified @@ -1220,14 +1220,6 @@ non-English characters, the color codes might get screwed if they stick to letters with no intervening space. Separating them with spaces from the letters on either side solves the problem. -To display multiple lines of message while only using a single mes; -command, use the script command in the following format: - - mes "Line 1", "Line 2", "Line 3"; - -This will display 3 different lines while only consuming a single line in -the relevant script file. - If you're using a client from 2011-10-10aRagexe.exe onwards, you can also use automatic navigation and open URLs in browser by using some HTML-like labels. For example: @@ -1243,6 +1235,23 @@ Clicking Google will open the browser and point to Google website. --------------------------------------- +*mesf(""{,{, {, ...}}}) + +This command will display a box on the screen for the invoking character, +if no such box is displayed already, and will print the string specified +into that box, after applying the same format-string replacements as sprintf(). + +Example: + + mesf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class)); + // is equivalent to: + mes(sprintf("Hello, I'm %s, a level %d %s", strcharinfo(PC_NAME), BaseLevel, jobname(Class))); + +This command is a combination of mes() and sprintf(). See their documentation +for more details. + +--------------------------------------- + *next; This command will display a 'next' button in the message window for the @@ -3516,7 +3525,7 @@ invoking character has. Here's what you get: @skilllist_flag[] - see 'skill' for the meaning of skill flags. @skilllist_count - number of skills in the above arrays. -While 'getskillv' is probably more useful for most situations, this is the +While 'getskilllv' is probably more useful for most situations, this is the easiest way to store all the skills and make the character something else for a while. Advanced job for a day? :) This could also be useful to see how many skills a character has. @@ -8067,10 +8076,75 @@ Example: *sprintf({,param{,param{,...}}}) -C style sprintf. The resulting string is returned same as in PHP. All C -format specifiers are supported except %n. For more info check sprintf -function at www.cplusplus.com -Number of params is only limited by Hercules' script engine. +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"; -- cgit v1.2.3-70-g09d2