viewing paste jabote doc | Diff

Posted on the
  1.  doc/script_commands.txt | 1620 ++++++++++++++++++++++++-----------------------
  2.  1 file changed, 825 insertions(+), 795 deletions(-)
  3.  
  4. diff --git a/doc/script_commands.txt b/doc/script_commands.txt
  5. index 767aa54..7eaaa71 100644
  6. --- a/doc/script_commands.txt
  7. +++ b/doc/script_commands.txt
  8. @@ -28,30 +28,57 @@ help.
  9.  
  10.  A little learning never caused anyone's head to explode.
  11.  
  12. -Structure
  13. ----------
  14. -
  15. -The commands and functions are listed in no particular order:
  16. -
  17. -*Name of the command and how to call it.
  18. -
  19. -Descriptive text
  20. -
  21. -    Small example if possible. Will usually be incomplete, it's there just 
  22. -    to give you an idea of how it works in practice.
  23.  
  24. -To find a specific command, use Ctrl+F, (or whatever keys call up a search 
  25. -function in whatever you're reading this with) put an * followed by the 
  26. -command name, and it should find the command description for you.
  27. +Structure and Table of Contents
  28. +-------------------------------
  29. +(*TableContents)
  30. +
  31. +The structure of the document is below. Also, a unique code has been put 
  32. +in each section so that you can easily find it with Ctrl+F (or whatever 
  33. +keys call up a search function in whatever you're reading this with). 
  34. +There will be only 2 coincidences when using these codes: this very Table 
  35. +of Contents and that section in particular, so the search function should 
  36. +find whatever you want right away. Only section without search code is the 
  37. +headers and introduction above.
  38. +
  39. +Search codes are preceded by an asterisk (*).
  40. +
  41. +If you find anything omitted througout all the document, please tell us.
  42. +
  43. +Table of Contents:
  44. +
  45. +1.  Headers and introduction                    ( - )
  46. +2.  Structure and Table of Contents             (*TableContents)
  47. +3.  Understanding this document                 (*UnderstandThis)
  48. +4.  Script loading structure                    (*LoadingScripts)
  49. +5.  Top level commands                          (*TopLevel)
  50. +	1.  Warning about NPC names                 (*NPCNameWarning)
  51. +	2.  Setting map flags                       (*TopMapflag)
  52. +	3.  Creating a permanent monster spawn      (*TopMonster)
  53. +	                                            (*TopBossMonster)
  54. +	4.  Defining a warp point                   (*TopWarp)
  55. +	5.  Defining NPC objects (scripts)          (*TopScript)
  56. +	6.  Placing shops or cashshops              (*TopShop)
  57. +	                                            (*TopCashShop)
  58. +	7.  Adding duplicates                       (*TopDuplicate)
  59. +		1.  Adding warp duplicates              (*TopDuplicateWarp)
  60. +		2.  Adding script duplicates            (*TopDuplicateScript)
  61. +		3.  Adding shop or cashshop duplicates  (*TopDuplicateShop)
  62. +		                                        (*TopDuplicateCashShop)
  63. +	8.  Defining function objects               (*TopFunction)
  64.  
  65. -If you find anything omitted, please tell us. :)
  66. +	
  67. +	
  68. +	
  69.  
  70. -Syntax
  71. -------
  72. +	
  73. +Understanding this document
  74. +---------------------------
  75. +(*UnderstandThis)
  76.  
  77.  Throughout this document, wherever a command wants an argument, it is 
  78.  given in <angle brackets>. This doesn't mean you should type the angle 
  79. -brackets. :) If an argument of a command is optional, it is given in 
  80. +brackets. If an argument of a command is optional, it is given in 
  81.  {curly brackets}. You've doubtlessly seen this convention somewhere, if 
  82.  you didn't, get used to it, that's how big boys do it. If a command can 
  83.  optionally take an unspecified number of arguments, you'll see a list like 
  84. @@ -67,24 +94,41 @@ expression, like a bunch of functions or operators returning a value, in
  85.  (round brackets) instead of most numbers. Round brackets will not always 
  86.  be required, but they're often a good idea.
  87.  
  88. -Wherever you refer to a map, use 'mapname' instead of 'mapname.gat'.
  89. +The top level commands need the use of tabulation spaces so, for 
  90. +preventing problems and confusion, the tab symbols are written as '%TAB%' 
  91. +or '<TAB>' throughout this document, even though this makes the text a bit 
  92. +less readable. Using an invisible symbol to denote arguments is one of the 
  93. +bad things about this language, but we're stuck with it for now.
  94.  
  95. +Wherever you refer to a map, use 'mapname' instead of 'mapname.gat'. 
  96. +However, old scripts that keep the .gat will still work.
  97.  
  98.  Script loading structure
  99.  ------------------------
  100. +(*LoadingScripts)
  101. +
  102. +As an exception to the just above section, the only parameter these 
  103. +instructions take is a string that shouldn't be enclosed between quotes.
  104. +
  105. +Map server automatically loads any available scripts that are referenced 
  106. +in the 'npc/re/scripts_main.conf' file for Renewal enabled servers or in 
  107. +the 'npc/pre-re/scripts_main.conf' file for Pre-Renewal servers. This file 
  108. +itself contains references to other files, just like this:
  109.  
  110. -Scripts are loaded by the map server as referenced in the 
  111. -'conf/map-server.conf' configuration file, but in the default 
  112. -configuration, it doesn't load any script files itself. Instead, it loads 
  113. -the file 'npc/scripts_main.conf' which itself contains references to other 
  114. -files. The actual scripts are loaded from txt files, which are linked up 
  115. -like this:
  116. +import: <path to a filename>
  117. +
  118. +This will make the map server look on the specified filename for more file 
  119. +references or npc loading sentences, which are covered next. Nothing nice  
  120. +happens when you try to import the same file recursively or in a loop.
  121. +
  122. +The actual scripts are loaded from text files, which are linked up like 
  123. +this:
  124.  
  125.  npc: <path to a filename>
  126.  
  127. -Any line like this, invoked, ultimately, by 'map-server.conf' will load up 
  128. -the script contained in this file, which will make the script available. 
  129. -No file will get loaded twice, to prevent possible errors.
  130. +Any line like this will load up the script contained in this file, which 
  131. +will make the script available. No file will get loaded twice, to prevent 
  132. +possible errors.
  133.  
  134.  Another configuration file option of relevance is:
  135.  
  136. @@ -93,241 +137,569 @@ delnpc: <path to a filename>
  137.  This will unload a specified script filename from memory, which, while 
  138.  seemingly useless, may sometimes be required.
  139.  
  140. -Whenever '//' is encountered in a line upon reading, everything beyond 
  141. -this on that line is considered to be a comment and is ignored. This works 
  142. -wherever you place it.
  143. -
  144. -// This line will be ignored when processing the script.
  145. +File extensions don't matter when messing with these ones as long as you 
  146. +provide the correct file extension the files have themselves. This means 
  147. +you can save your scripts in .c extension if you want, so that you'll have 
  148. +some C syntax highlighting (which is quite similar to the scripts we have 
  149. +here) if you use some adequate text editors. Saving them in .txt is just 
  150. +a convention we follow.
  151.  
  152. -Block comments can also be used, where you can place /* and */ between any 
  153. -text you wish Hercules to ignore.
  154. -
  155. -Example:
  156. -/* This text,
  157. - * no matter which new line you start
  158. - * is ignored, until the following 
  159. - * symbol is encountered: */
  160. - 
  161. -The asterisks (*) in front of each line is a personal preference, and is 
  162. -not required.
  163. +Top Level Commands
  164. +------------------
  165. +(*TopLevel)
  166.  
  167.  Upon loading all the files, the server will execute all the top-level 
  168.  commands in them. No variables exist yet at this point, no commands can be 
  169.  called other than those given in this section. These commands set up the 
  170.  basic server script structure - create NPC objects, spawn monster objects, 
  171.  set map flags, etc. No code is actually executed at this point except 
  172. -them. The top-level commands the scripting are pretty confusing, since 
  173. +them.
  174. +
  175. +The top-level commands the scripting are pretty confusing, since 
  176.  they aren't structured like you would expect commands, command name first, 
  177.  but rather, normally start with a map name.
  178.  
  179.  What's more confusing about the top-level commands is that most of them 
  180. -use a tab symbol to divide their arguments.
  181. -
  182. -To prevent problems and confusion, the tab symbols are written as '%TAB%' 
  183. -or '<TAB>' throughout this document, even though this makes the text a bit 
  184. -less readable. Using an invisible symbol to denote arguments is one of the 
  185. -bad things about this language, but we're stuck with it for now. :)
  186. +use a tab symbol to divide their arguments. Remember that the tab symbols 
  187. +are written as '%TAB%' or '<TAB>' throughout this document.
  188.  
  189.  Here is a list of valid top-level commands:
  190. +*   mapflag
  191. +*   monster
  192. +*   boss_monster
  193. +*   warp
  194. +*   script
  195. +*   shop
  196. +*   cashshop
  197. +*   duplicate
  198. +*   function
  199.  
  200. -** Set a map flag:
  201. -
  202. -<map name>%TAB%mapflag%TAB%<flag>
  203. +They'll be explained like this:
  204.  
  205. -This will, upon loading, set a specified map flag on a map you like. These 
  206. -are normally in files inside 'npc/mapflag' and are loaded first, so by the 
  207. -time the server's up, all the maps have the flags they should have. Map 
  208. -flags determine the behavior of the map regarding various common problems, 
  209. -for a better explanation, see 'setmapflag'.
  210. +Top level command and how to call it, with full list of parameters.
  211.  
  212. -** Create a permanent monster spawn:
  213. +->  Description: 
  214. +	Short descriptive text about what it does.
  215. +->  Parameters: 
  216. +	Any required or optional parameters it needs for working. Some 
  217. +	parameters will be explained together since it'll make for a better
  218. +	explanation like this.
  219. +->  Notes:
  220. +	Notes about it. It'll be only present if needed. 
  221. +->  Examples:
  222. +	Small example(s) so that you can get familiar with it.
  223.  
  224. -<map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}
  225.  
  226. -Map name is the name of the map the monsters will spawn on. X,Y are the 
  227. -coordinates where the mob should spawn. If X's and Y's are non-zero, they 
  228. -specify the 'radius' of a spawn-rectangle area centered at x,y. Putting 
  229. -zeros instead of these coordinates will spawn the monsters randomly. Note 
  230. -this is only the initial spawn zone, as mobs random-walk, they are free to 
  231. -move away from their specified spawn region.
  232. +But let's start with a warning about NPC names first:
  233.  
  234. -Monster name is the name the monsters will have on screen, and has no 
  235. -relation whatsoever to their names anywhere else. It's the mob id that 
  236. -counts, which identifies monster record in 'mob_db.txt' database of 
  237. -monsters. If the mob name is given as "--ja--", the 'japanese name' field 
  238. -from the monster database is used, (which, in Hercules, actually contains 
  239. -an English name) if it's "--en--", it's the 'english name' from the 
  240. -monster database (which contains an uppercase name used to summon the 
  241. -monster with a GM command).
  242. +### Warning about NPC names ###
  243. +(*NPCNameWarning)
  244.  
  245. -Amount is the amount of monsters that will be spawned when this command is 
  246. -executed, it is affected by spawn rates in 'battle.conf'.
  247. -
  248. -Delay1 and delay2 control monster respawn delays - the first one is the 
  249. -fixed base respawn time, and the second is random variance on top of the 
  250. -base time. Both values are given in milliseconds (1000 = 1 second). Note 
  251. -that the server also enforces a minimum respawn delay of 5 seconds.
  252. -
  253. -You can specify a custom level to use for the mob different from the one 
  254. -of the database by adjoining the level after the name with a comma. eg: 
  255. -"Poring,50" for a name will spawn a monster with name Poring and level 50.
  256. -
  257. -Event is a script event to be executed when the mob is killed. The event 
  258. -must be in the form "NPCName::OnEventName" to execute, and the event name 
  259. -label should start with "On". As with all events, if the NPC is an 
  260. -on-touch NPC, the player who triggers the script must be within 'trigger' 
  261. -range for the event to work.
  262. -
  263. -There are two optional fields for monster size and AI. Size can be 0 
  264. -(medium), 1 (small), or 2 (big). AI can be 0 (default), 1 
  265. -(attack/friendly), 2 (sphere), 3 (flora), or 4 (zanzou).
  266. -
  267. -Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able to be 
  268. -detected on the map with the SC_CASH_BOSS_ALARM status (used by Convex Mirror, item ID# 12214).
  269. -
  270. -** NPC names
  271. -
  272. -/!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  273. -
  274. -NPC names are kinda special and are formatted this way:
  275. +This applies to warps, NPCs, duplicates and shops, since they are the only 
  276. +scripts with a name. Their names are kinda special and are formatted this 
  277. +way:
  278.  
  279.  <Display name>{::<Unique name>}
  280.  
  281. -All NPCs need to have a unique name that is used for identification 
  282. -purposes. When you have to identify a NPC by it's name, you should use 
  283. -<Unique name>. If <Unique name> is not provided, use <Display name> 
  284. -instead.
  285. -
  286. -The client has a special feature when displaying names: if the display 
  287. -name contains a '#' character, it hides that part of the name.
  288. -Ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  289. +All of them need to have a name that should be unique for identification 
  290. +purposes. The NPC name used for identification is its <Unique name> or, if 
  291. +it isn't provided, they are identified by their <Display name> instead.
  292.  
  293. +Remember:
  294.  <Display name> must be at most 24 characters in length.
  295.  <Unique name> must be at most 24 characters in length.
  296.  
  297. -** Define a warp point
  298. +Any name too long for a NPC will just be truncated.
  299. +
  300. +Also, the client has a special feature when displaying names: if the 
  301. +display name contains a '#' character, it hides the rest of the name, 
  302. +starting from that '#'. Keep in mind that character also counts 
  303. +towards the limit.
  304. +
  305. +Examples with NPC names:
  306. +
  307. +Original NPC name        | Displayed name          | NPC identification name
  308. +----------------------------------------------------------------------------
  309. +MyNPCName                | MyNPCName               | MyNPCname
  310. +----------------------------------------------------------------------------
  311. +Hunter#hunter1           | Hunter                  | Hunter#hunter1
  312. +----------------------------------------------------------------------------
  313. +ThisNameIsTooLongForANPC | ThisNameisTooLongForANP | ThisNameisTooLongForANP
  314. +----------------------------------------------------------------------------
  315. +#hiddenName              | (no displayed name)     | #hiddenName
  316. +----------------------------------------------------------------------------
  317. +NPCName#91::MyUniqueName | NPCName                 | MyUniqueName
  318. +----------------------------------------------------------------------------
  319. +
  320. +And one last thing about it: avoid putting the same identification names 
  321. +to NPCs (and truncated NPC names if applicable). Map server will warn you 
  322. +and automatically set or change their unique name in this fashion:
  323. +
  324. +<number of duplicate names>_<NPC's mapID in map server>_<x pos>_<y pos>
  325. +
  326. +For more details about this, please refer to the particular sections of 
  327. +the respective top level commands.
  328. +
  329. +### Setting map flags ###
  330. +(*TopMapflag)
  331. +
  332. +<map name>%TAB%mapflag%TAB%<flag>{%TAB<optional parameter>}
  333. +
  334. +->  Description:
  335. +	When loaded, this will set the specified map flag on the selected map, 
  336. +	which will change the behavior of the map depending on the mapflag you 
  337. +	set. They're normally in files inside 'npc/mapflag', but you can also 
  338. +	see them on the same file as other scripts too.
  339. +->  Parameters:
  340. +	*   map name: The name of the map you'll use to load the mapflag;
  341. +	*   mapflag: Keep it as is, this is the top level command;
  342. +	*   flag: the mapflag you'll load on the specified map. You can see a 
  343. +	    list of the available map flags in 'db/const.txt' with the 'mf_'
  344. +	    prefix. You must __NOT__ copy the 'mf_' prefix as it's required 
  345. +	    on the 'setmapflag' script command.
  346. +	*   optional parameter: For most map flags you can send them 'off' to 
  347. +	    disable them. Some others may require this parameter (or even 
  348. +	    more than one parameter separated with commas as it's the case of 
  349. +	    the mf_nightmaredrop map flag). The type of optional parameter 
  350. +	    also depends on the nature of the map flag you're setting.
  351. +->  Notes: Not all map flags can be deactivated with the 'off' optional 
  352. +    parameter. Also some mapflags may not work if you don't provide them 
  353. +	the mapflag they require. You can also set map flags inside a script 
  354. +	by using the 'setmapflag' script command.
  355. +->  Examples:
  356. +    *   Setting Prontera as PvP map:
  357. +		prontera%TAB%mapflag%TAB%pvp
  358. +	*   Removing the GvG mapflag from guild_vs2:
  359. +		guild_vs2%TAB%mapflag%TAB%gvg%TAB%off
  360. +	*   Changing the base exp you get on pay_fild04 to 2.50x (250):
  361. +		pay_fild02%TAB%mapflag%TAB%bexp%TAB%250
  362. +	*   Making aldeg_cas01 castle have a random nightmare drop of 
  363. +	    equipment of 70%:
  364. +		aldeg_cas01%TAB%mapflag%TAB%nightmaredrop%TAB%random,equip,7000
  365. +
  366. +
  367. +### Creating a permanent monster spawn ###
  368. +(*TopMonster)
  369. +(*TopBossMonster)
  370. +
  371. +<map name>,<x>,<y>{,<xs>{,<ys>}}%TAB%monster%TAB%<monster name>{,<mob level>}%TAB%<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>,{<mob ai>}}}}}
  372. +<map name>,<x>,<y>{,<xs>{,<ys>}}%TAB%boss_monster%TAB%<monster name>{,<mob level>}%TAB%<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>{,<mob ai>}}}}}
  373. +
  374. +->  Description:
  375. +	When parsed, this will make a permanent mob spawn (until server reboot 
  376. +	or script reload) with the specified characteristics.
  377. +->  Parameters:
  378. +	*   map name: The map name in which the monster(s) will be spawned.
  379. +	*   x,y: They are the x and y coordinates on the specified map, in 
  380. +	    which the monsters will be spawned or the center of the spawn 
  381. +	    rectangle if xs or ys are greater than 0. If both x and y are 0, 
  382. +	    the monsters will be spawned on a random position of the map. Be 
  383. +	    warned that mobs walk around randomly, so that they may eventually 
  384. +	    walk over the entire map as long as there's a walkable path!
  385. +	*   xs,ys: They are the horizontal and vertical span (ie, width and 
  386. +	    height) of a spawn rectangle centered in x,y. Think of this as the 
  387. +	    amount of squares you'd like to have your monster(s) spawned from 
  388. +	    the center to both sides. For example, if xs is 6 and ys is 1, the 
  389. +	    result would be a 6+1+6 width by 1+1+1 height spawn rectangle:
  390. +	    -------------
  391. +	    |     C     |
  392. +	    -------------
  393. +	    where that C is the center of that spawn rectangle. Even if both 
  394. +	    of them are optional, you'd better set them together
  395. +	*   monster: __Mutually excluyent with boss_monster__. Specifies the 
  396. +	    parser to spawn regular monsters with no special treatment.
  397. +	*   boss_monster: __Mutually excluyent with monster__. Specifies the 
  398. +	    parser to spawn special monsters (usually MvPs) which can be 
  399. +	    detected by the SC_CASH_BOSS_ALARM status (Convex Mirror). Please 
  400. +	    note this will __not__ mark the mob as boss-type.
  401. +	*   monster name: The name the monsters will use, at your choice, 
  402. +	    with a max of 24 characters by default. You could use some special 
  403. +	    names as "--ja--", which will use the 'japanese name' of its 
  404. +	    record in the monster database (that is, in fact, an English name) 
  405. +	    or "--en--", which will use its 'english name' (that is that same 
  406. +	    name in uppercase).
  407. +	*   mob level: If specified, spawned monsters will forcely be this 
  408. +	    level, but they won't get any status changed other than this one.
  409. +	*   mob id: The actual mob id of the monsters you'll be spawning from 
  410. +	    the mob db.
  411. +	*   amount: The amount of monsters you want to spawn. It's affected by 
  412. +	    the mob_count_rate configuration in conf/battle/monster.conf
  413. +	*   delay 1: Minimum time, in milliseconds (1000 = 1 second) that, 
  414. +	    after killing a monster from this respawn, the server will take to 
  415. +	    spawn that monster again. This is known as base respawn time.
  416. +	*   delay 2: Random time, from 0 to this value (in milliseconds), that 
  417. +	    will be added on top of the base respawn time to respawn a dead 
  418. +	    monster from this respawn. Server always enforces a minimum of a 
  419. +	    total 5000 milliseconds before respawning a mob.
  420. +	*   event: An NPC name and event to be executed on every death of any 
  421. +	    of the spawned monsters (and, if an user has killed that mob, the 
  422. +	    event will be executed attached to that user). The event must be 
  423. +	    in the form "NPCName::OnEventName" for being executed, and the 
  424. +	    event name label should start with "On". If you don't want to 
  425. +	    execute any event, just set this value to 0 or 1. For more 
  426. +	    information about labels, please see the 'Labels' section.
  427. +	*   mob size: This optional parameter will determine the size of the 
  428. +	    summoned monsters on the spawn. Set it to 0 if you don't want to 
  429. +	    alter the monster's size, 1 if you want them to be small and 2 if 
  430. +	    you want to make the monsters big. Formerly, a summoned monster 
  431. +	    with altered size had its stats, drop rates and experience doubled 
  432. +	    on size = 2, or halved if size = 1, but now it's disabled by 
  433. +	    default. You can enable this feature if you want by changing the 
  434. +	    mob_size_influence configuration in conf/battle/monster.conf
  435. +	*   mob ai: The special AI the mob will have. It's not like the one 
  436. +	    you set in the mob db, but a special extra behavior you may want 
  437. +	    to set. 0 means no special behavior; 1 means the spawned monsters 
  438. +	    will attack other monsters; 2 makes their behavior as if summoned 
  439. +	    by Alchemist's Marine Sphere skill; 3 makes them behave as if 
  440. +	    summoned by Alchemist's Summon Flora and 4 makes them behave as if 
  441. +	    summoned as from Kagerou/Oboro's Zanzou skill.
  442. +-> Notes:
  443. +    Please note that by using this you'll make a __permanent__ monster 
  444. +	spawn, there's no way of unloading them from the server unless you 
  445. +	reboot or issue @reloadscript. If you want to make a mob spawn for 
  446. +	once or limited times, please refer to the 'monster' and 'areamonster' 
  447. +	script commands. Also note that if you want to put an optional 
  448. +	parameter and there are some others before, you'll have to fill the 
  449. +	ones before (mostly with zeros).
  450. +-> Examples:
  451. +	*   Spawn a shining plant (ID# 1083) with its default name on prontera, 
  452. +	    x=150, y=170 that will respawn every 5s (minimum default):
  453. +		prontera,150,170%TAB%monster%TAB%--ja--%TAB%1083,1
  454. +	*   Spawn 10 boss level 99 porings (ID# 1002) named Satan Morroc at a 
  455. +	    random place on prontera, which will respawn around 1~1:30 hours 
  456. +	    after being killed (from 3600000 to 5400000 ms):
  457. +		prontera,0,0%TAB%monster%TAB%Satan Morroc,99%TAB%1002,10,3600000,1800000
  458. +	*   Spawn 4 big Poporing on a 3x4 square around prontera,150,170, 
  459. +	    which will attack other mobs and trigger the 'OnMyPopoDie' label 
  460. +	    from 'MyNPCName' when killed (default respawn time):
  461. +		prontera,150,170,3,4%TAB%monster%TAB%Poporing%TAB%1031,4,0,0,"MyNPCName::OnMyPopoDie",2,1
  462. +
  463. +
  464. +### Defining a warp point ###
  465. +(*TopWarp)
  466.  
  467.  <from map name>,<fromX>,<fromY>{,<facing>}%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
  468.  
  469. -This will define a warp NPC that will warp a player between maps, and 
  470. -while most arguments of that are obvious, some deserve special mention.
  471. -
  472. -SpanX and SpanY will make the warp sensitive to a character who didn't 
  473. -step directly on it, but walked into a zone which is centered on the warp 
  474. -from coordinates and is SpanX in each direction across the X axis and 
  475. -SpanY in each direction across the Y axis.
  476. -
  477. -Warp NPC objects also have a name, because you can use it to refer to them 
  478. -later with 'enablenpc'/'disablenpc'.
  479. -
  480. -Facing of a warp object is irrelevant, it is not used in the code and all 
  481. -current scripts have a zero in there.
  482. -
  483. -** Define an NPC object.
  484. -
  485. +->  Description:
  486. +	When parsed, this will make a warp NPC with its respective sprite, 
  487. +	that will warp users when they enter on their area of effect. They're 
  488. +	mostly used to connect all of the maps throughout Hercules.
  489. +->  Parameters:
  490. +	*   from map name: The map name the warp npc will appear in.
  491. +	*   fromX,fromY: The x,y coordinates in which the warp NPC will be 
  492. +	    placed.
  493. +	*   facing: Just an optional and useless parameter. All current warps 
  494. +	    have a 0 in there, since warp NPCs have no orientations.
  495. +	*   warp: This tells the parser to parse a warp. Mandatory.
  496. +	*   warp name: The name of the warp so that you can manipulate it via 
  497. +	    scripting for example with 'enablenpc', 'disablenpc' or 'movenpc' 
  498. +	    script commands.
  499. +	*   spanx, spany: They are, respectively, the horizontal and vertical 
  500. +	    span of the area of effect the warp will have. Their typical 
  501. +	    values are 1, so that the warp area of effect will span througout 
  502. +	    all of the NPC sprite (9 squares total).
  503. +	*   to map name: The destination map name the warp will send users to.
  504. +	*   toX, toY: The map coordinates the users will be sent to.
  505. +->  Notes:
  506. +	You can unload these warps by kicking them using the GM context menu 
  507. +	ingame (right clicking them while having a GM sprite set by the 
  508. +	clientinfo file).
  509. +->  Examples:
  510. +	*   Current Hercules warp, from the south of Prontera to the fields:
  511. +		prontera,156,22,0%TAB%warp%TAB%prt001%TAB%3,2,prt_fild08,170,375
  512. +	*   Same version of that warp without the deprecated facing parameter:
  513. +		prontera,156,22%TAB%warp%TAB%prt001%TAB%3,2,prt_fild08,170,375
  514. +
  515. +
  516. +### Defining NPC objects (scripts) ###
  517. +(*TopScript)
  518. +
  519. +Three different ways:
  520.  <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  521.  <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  522. -
  523. -This will place an NPC object on a specified map at the specified 
  524. -location, and is a top-level command you will use the most in your custom 
  525. -scripting. The NPCs are triggered by clicking on them, and/or by walking 
  526. -in their trigger area, if defined. See that below.
  527. -
  528. -Facing is a direction the NPC sprite will face in. Not all NPC sprites 
  529. -have different images depending on the direction you look from, so for 
  530. -some facing will be meaningless. Facings are counted counterclockwise in 
  531. -increments of 45 degrees, where 0 means facing towards the top of the map. 
  532. -(So to turn the sprite towards the bottom of the map, you use facing 4, 
  533. -and to make it look southeast it's facing 5.)
  534. -
  535. -Sprite id is the sprite number used to display this particular NPC. For a 
  536. -full list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml
  537. -You may also use a monster's ID number instead to display a monster sprite 
  538. -for this NPC. It is possible to use a job sprite as well, but you must 
  539. -first define it as a monster sprite in 'mob_avail.txt', a full description 
  540. -on how to do this is not in the scope of this manual.
  541. -A '-1' sprite id will make the NPC invisible (and unclickable). 
  542. -A '111' sprite id will make an NPC which does not have a sprite, but is 
  543. -still clickable, which is useful if you want to make a clickable object of 
  544. -the 3D terrain.
  545. -
  546. -TriggerX and triggerY, if given, will define an area, centered on NPC and 
  547. -spanning triggerX cells in every direction across X and triggerY in every 
  548. -direction across Y. Walking into that area will trigger the NPC. If no 
  549. -'OnTouch:' special label is present in the NPC code, the execution will 
  550. -start from the beginning of the script, otherwise, it will start from the 
  551. -'OnTouch:' label. Monsters can also trigger the NPC, though the label 
  552. -'OnTouchNPC:' is used in this case.
  553. -
  554. -The code part is the script code that will execute whenever the NPC is 
  555. -triggered. It may contain commands and function calls, descriptions of 
  556. -which compose most of this document. It has to be in curly brackets, 
  557. -unlike elsewhere where we use curly brackets, these do NOT signify an 
  558. -optional parameter.
  559. -
  560. -** Define a 'floating' NPC object.
  561. -
  562.  -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  563.  
  564. -This will define an NPC object not triggerable by normal means. This would 
  565. -normally mean it's pointless since it can't do anything, but there are 
  566. -exceptions, mostly related to running scripts at specified time, which is 
  567. -what these floating NPC objects are for. More on that below.
  568. +IMPORTANT NOTE: We have decided to put all possibilities here instead of 
  569. +just showing that triggerX and triggerY are optional parameters since, as 
  570. +an exception to general notation rule on this document, __curly brackets 
  571. +around the code are required for your NPC to work__.
  572. +
  573. +->	Description: 
  574. +	This will place a NPC object on the specified place (except the last 
  575. +	one, that will make a 'floating' NPC that won't be on any specific 
  576. +	map), which are usually triggered by being clicked, but you can make 
  577. +	them get triggered some other ways such as being whispered or at 
  578. +	certain times of a day. Once triggered, they'll run part or all of the 
  579. +	code that has been written on it, depending on how you triggered it.
  580. +->  Parameters:
  581. +	*   map name: The map name the NPC will be put in. Must be valid.
  582. +	*   x,y: The x and y coordinates to place the NPC at. You can safely 
  583. +	    put the NPC on a non walkable cell if you want, as long as it's 
  584. +	    inside of the map.
  585. +	*   facing: The direction the NPC will be facing in. Not all sprites 
  586. +	    have an image for each of the directions, so this value can be 
  587. +	    useless if you use sprites without different images for the 
  588. +	    directions. Its range is between 0 and 7. 0 means the NPC is 
  589. +	    looking north, then sum in incrementes of 45 degrees for each 
  590. +	    number. For example: 2 means the NPC is facing west, 4 means it's 
  591. +	    facing south and 5 means he's facing southeast.
  592. +	*   script: Required for this to be parsed as a script.
  593. +	*   NPC name: The name the NPC will have. Please take a look at the 
  594. +	    previous name warning to prevent problems with them.
  595. +	*   sprite id: The sprite number used to display the NPC. You can also 
  596. +	    use a monster ID as sprite ID to display a monster's sprite, or 
  597. +	    even use a job sprite if you previously define it in the 
  598. +	    'db/mob_avail.txt' file. Interesting sprite IDs could be 45 (a 
  599. +	    warp NPC sprite, for making warps via NPC scripts); 111, which is 
  600. +	    an invisible yet clickable NPC sprite (you can use it to make 
  601. +	    clickable objects on the map 3D land); and -1, which is an 
  602. +	    invisible and unclickable NPC sprite, mostly to be used with 
  603. +	    floating NPCs (they'll be further explained on the notes).
  604. +	    For an full and updated NPC list with IDs, please check this URL: 
  605. +	    http://nn.nachtwolke.com/dev/npclist/
  606. +	    Note that you can actually set other sprite than 1 for floating 
  607. +	    NPCs, but that'll be an useless assignment since nobody will be 
  608. +	    ever able to see them.
  609. +	*   triggerX,triggerY: They are the trigger span area of the NPC. If 
  610. +	    set (they're optional), this defines the horizontal and vertical 
  611. +	    squares (from both sides) in which you can 'touch' this NPC. This 
  612. +	    will also trigger the 'OnTouch:' or 'OnTouch_:' labels from 
  613. +	    the NPC if present (if the NPC doesn't have it, the script will 
  614. +	    run from the start). You could also make part of the NPC to run 
  615. +	    when 'touched' by monsters if you make use of the 'OnTouchNPC:' 
  616. +	    label. Please refer to the 'Labels' section for more information.
  617. +	*   code: The script code which the NPC will actually run when 
  618. +	    triggered. Most of this document is composed of these script 
  619. +	    commands descriptions. Please remember that the curly brackets are 
  620. +	    mandatory here.
  621. +->  Notes:
  622. +	In case the NPC is 'touchable' and its code has both an 'OnTouch:' and 
  623. +	an 'OnTouch_:' label, only the 'OnTouch_:' label will be triggered;
  624. +	You can make the NPC a 'floating' NPC if you put only a - (dash) as 
  625. +	the four first parameters. These NPCs can't be triggered by being 
  626. +	clicked or touched, but you may make them react to whispers or some 
  627. +	other events as if a player actually clicked it. Or you can even make 
  628. +	them work as an automated script, without the need of being activated 
  629. +	by someone. This will be explained later on, in more detail.
  630. +->  Examples (without any code, since you don't know yet):
  631. +	*   A NPC in prontera, 156,200 with the sprite from the priest inside 
  632. +	    Prontera church (60), named 'Pater Nostrum', looking southeast:
  633. +		prontera,156,200,5%TAB%script%TAB%Pater Nostrum%TAB%60,{<code>}
  634. +	*   Same NPC, but this time looking east (to the right) and can be 
  635. +	    triggered on touch on a rectangle up to 2 cells from left or right 
  636. +	    and up to 3 cells from up or down:
  637. +		prontera,156,200,6%TAB%script%TAB%Pater Nostrum%TAB%60,2,3,{<code>}
  638. +	*   A floating NPC named MyHiddenNPC:
  639. +		-%TAB%script%TAB%MyHiddenNPC%TAB%-1,{<code>}
  640. +
  641. +
  642. +### Placing shops or cashshops ###
  643. +*TopShop
  644. +*TopCashShop
  645.  
  646.  ** Define a shop/cashshop NPC.
  647.  
  648. --%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  649. +Two different ways:
  650.  <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  651. -
  652. -This will define a shop NPC, which, when triggered (which can only be done 
  653. -by clicking) will cause a shop window to come up. No code whatsoever runs 
  654. -in shop NPCs and you can't change the prices otherwise than by editing the 
  655. -script itself (no variables even exist at this point of scripting, so 
  656. -don't even bother trying to use them).
  657. -
  658. -The item id is the number of item in the 'item_db.txt' database. If Price 
  659. -is set to -1, the 'buy price' given in the item database will be used. 
  660. -Otherwise, the price you gave will be used for this item, which is how you 
  661. -create differing prices for items in different shops.
  662. -
  663. -You can alternatively use "cashshop" in place of "shop" to use the Cash 
  664. -Shop interface, allowing you to buy items with special points (Currently 
  665. -stored as account vars in global_reg #CASHPOINTS and #KAFRAPOINTS). This 
  666. -type of shop will not allow you to sell items at it, you may only purchase 
  667. -items here. The layout used to define sale items still count, and 
  668. -"<price>" refers to how many points will be spent purchasing the them.
  669. -
  670. -** Define an warp/shop/cashshop/NPC duplicate.
  671. -
  672. -warp: <map name>,<x>,<y>{,<facing>}%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  673. -shop/cashshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  674. -shop/cashshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  675. -npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  676. -npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  677. -
  678. -This will duplicate an warp/shop/cashshop/NPC referred to by 'label'.
  679. -Warp duplicates inherit the target location.
  680. -Shop/cashshop duplicates inherit the item list.
  681. -NPC duplicates inherit the script code.
  682. -The rest (name, location, facing, sprite ID, span/trigger area) is 
  683. -obtained from the definition of the duplicate (not inherited).
  684. -
  685. -** Define a function object
  686. +<map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  687. +-%TAB%shop%TAB%<NPC Name>%TAB%-1,<itemid>:<price>{,<itemid>:<price>...}
  688. +-%TAB%cashshop%TAB%<NPC Name>%TAB%-1,<itemid>:<price>{,<itemid>:<price>...}
  689. +
  690. +->  Description:
  691. +	This will place a shop or cash shop NPC where specified, with a 
  692. +	special code that will run upon trigger which lets you buy from it the 
  693. +	stated items, at the stated price.
  694. +->  Parameters:
  695. +	*   map name,x,y,facing: The same as in script NPCs. Please see the 
  696. +	    script top level command (just above) for more details. As you can 
  697. +	    see, you can also put a dash (-) instead of them to make it a 
  698. +	    "floating" shop, only triggerable for players by script NPCs via 
  699. +	    the callshop script command.
  700. +	*   shop: __Mutually excluyent with cashshop__. Sets a regular shop 
  701. +	    that will trade items (buy the stated items or sell any of your 
  702. +	    own that you're allowed to sell) for zeny, and whose prices can 
  703. +	    be influenced by skills such as Merchant's Discount and Overcharge.
  704. +	*   cashshop: __Mutually excluyent with shop__. Sets a cash shop, 
  705. +	    which will use special points as currency. These points are stored 
  706. +	    in the account variables #CASHPOINTS and #KAFRAPOINTS, and their 
  707. +	    amounts will be reduced when buying something from them. You 
  708. +	    usually can't sell items to cash shops. Also, Merchant's Discount 
  709. +	    and similar skills will have no use here. Please see the Variables 
  710. +	    section for more information about variables.
  711. +	*   sprite id: Just the same as in regular script NPCs. Please see the 
  712. +	    above section for more information.
  713. +	*   itemid,price: The item ID (from the item db) of the item this shop 
  714. +	    is selling and its respective price. Invalid item IDs will be 
  715. +	    skipped when parsing a shop. The maximum amount of items a shop 
  716. +	    can currently sell is 100 possibly due to client-side limitations, 
  717. +	    so server-side limit is also 100. You can sell items for free (and 
  718. +	    receive a warning in the map-server console) if you set the price 
  719. +	    to 0, or sell them for the default buying price in the item db if 
  720. +	    you specify a negative number (typically -1) for the price. Cash 
  721. +	    shop items have no default buying price, so be warned that if you 
  722. +	    put a negative number as the price, it will be sold for free. You 
  723. +	    will also get a warning if there's an item in your shop that can 
  724. +	    be sold (with overcharge) at a greater price than its discounted 
  725. +	    amount. Please note that they both are in a special format (pairs 
  726. +	    itemID:price) so that there won't be any confusions with prices.
  727. +	    You can sell the same item multiple times if you want, even at the 
  728. +	    same price
  729. +->  Notes:
  730. +	Map server will ignore empty shops because they haven't any reasons 
  731. +	for existence. For a blank NPC, please use a script instead. Shops can 
  732. +	also be controlled by the script commands that start by npcshop.
  733. +->  Examples: 
  734. +	*   Actual Vendor from Milk Ranch shop NPC in Prontera:
  735. +		prontera,73,134,0%TAB%shop%TAB%Vendor from Milk Ranch#p%TAB%90,519:-1
  736. +	*   Same shop but selling milk bottles for 500 Zeny:
  737. +		prontera,73,134,0%TAB%shop%TAB%Vendor from Milk Ranch#p%TAB%90,519:500
  738. +	*   Same shop but selling milk for 10 cash points:
  739. +		prontera,73,134,0%TAB%cashshop%TAB%Vendor from Milk Ranch#p%TAB%90,519:10
  740. +	*   Sample of actual Gonryun's tool shop (with many items):
  741. +		gonryun,147,84,5%TAB%shop%TAB%Tool Dealer#gon%TAB%777,1750:-1,1770:-1,611:-1,501:-1,502:-1,503:-1,504:-1,506:-1,645:-1,656:-1,601:-1,602:-1,1065:-1
  742. +	*   Floating apple shop, default price (usually taken as dummy shop 
  743. +	    for being controlled by script NPCs:
  744. +		-%TAB%shop%TAB%Apple shop%TAB%-1,512:-1
  745. +
  746. +
  747. +### Adding duplicates ###
  748. +(*TopDuplicate)
  749. +
  750. +<map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<extra>
  751. +-%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  752. +
  753. +->  Description:
  754. +	This is a special top level command, since its syntax varies on 
  755. +	whatever you want to duplicate. Keep in mind that you can only 
  756. +	duplicate NPCs with a name, so if you want to duplicate a mob spawn or 
  757. +	a mapflag, you should make a new declaration. Also, functions (seen 
  758. +	right after this section) can't be duplicated because it'd be nonsense 
  759. +	given its functionality. All duplicated NPC inherit some of the 
  760. +	features of the original NPC, which will be explained in each case.
  761. +->  Parameters:
  762. +	*   map name,x,y,facing: Much like their respective counterparts, 
  763. +	    these are the coordinates and facing your duplicate will be in. 
  764. +	    And also changing them all to a dash (not valid for warp NPCs) 
  765. +	    still retains the same meaning for floating shops or scripts.
  766. +	*   duplicate: Required for duplicating a NPC.
  767. +	*   label: The name of the _original_ NPC you wish to duplicate.
  768. +	*   NPC name: The name of the _new_ duplicated NPC. Beware of 
  769. +	    duplicated NPC names since that rule still applies here. A good 
  770. +	    idea for having same NPC names without fearing of duplicates is 
  771. +	    using the hidden part of the display name.
  772. +	*   extra: Varies depending of the kind of NPC you wish to duplicate, 
  773. +	    but also works the same way as the original ones.
  774. +
  775. +#### Adding warp duplicates ####
  776. +(*TopDuplicateWarp)
  777. +
  778. +<map name>,<x>,<y>{,<facing>}%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  779. +
  780. +->  Description:
  781. +	Duplicates the warp called the same as the label. The duplicate will 
  782. +	inherit original NPC's target location. 
  783. +->  Notes: 
  784. +	You can't make a floating warp with duplicates, just the same that 
  785. +	happened with regular warps.
  786. +->  Example:
  787. +	*   Generating a copy of the example warp of before, right next to the 
  788. +	    original warp NPC (just the duplicate):
  789. +		prontera,159,22%TAB%duplicate(prt001)%TAB%prt001#2%TAB%,3,2
  790. +
  791. +#### Adding script duplicates ####
  792. +(*TopDuplicateScript)
  793. +
  794. +<map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>{,<triggerX>,<triggerY>}
  795. +-%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%-1
  796. +
  797. +->  Description:
  798. +	Duplicates the script referenced on the label parameter. Duplicates 
  799. +	will inherit the script code and will also share the same NPC 
  800. +	variables (.variables) and their values from one NPC to the other. 
  801. +	This doesn't happen with any other kind of variables, just this one. 
  802. +	For more information, please refer to the 'variables' section.
  803. +->  Example:
  804. +    *   An actual duplicate of the Maroll Battle Recruiter script:
  805. +	prontera,123,83,3%TAB%duplicate(BatRecruit)%TAB%Maroll Battle Recruiter::BatRecruit1%TAB%728
  806. +
  807. +#### Adding shop or cashshop duplicates ####
  808. +(*TopDuplicateShop)
  809. +(*TopDuplicateCashShop)
  810. +
  811. +<map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  812. +-%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%-1
  813. +
  814. +->  Description:
  815. +	Duplicates the shop referenced on the label parameter. Duplicated 
  816. +	shops will inherit the item list sold by the original NPC, along with 
  817. +	their respective prices.
  818. +->  Example:
  819. +	*   Duplicating the actual Vendor from Milk Ranch shop NPC in 
  820. +	    Prontera, right next to the original with a different name:
  821. +		prontera,74,134,0%TAB%duplicate(Vendor from Milk Ranch#p)%TAB%Milk Vendor%TAB%90
  822. +
  823. +
  824. +### Defining function objects ###
  825. +(*TopFunction)
  826.  
  827.  function%TAB%script%TAB%<function name>%TAB%{<code>}
  828.  
  829. -This will define a function object, callable with the 'callfunc' command 
  830. -(see below). This object will load on every map server separately, so you 
  831. -can get at it from anywhere. It's not possible to call the code in this 
  832. -object by anything other than the 'callfunc' script command.
  833. +IMPORTANT NOTE: As an exception to general notation rule on this document, 
  834. +__curly brackets around the code are required for your function to work__.
  835. +
  836. +->  Description:
  837. +	Upon parsing, this will define a function you can only call by using 
  838. +	the 'callfunc' script command, which will be available to every script 
  839. +	on the map server. The assigned code will be run once the function has 
  840. +	been called. Functions can have their own NPC variables (.variables), 
  841. +	however, they __can't__ be accessed by the script command 
  842. +	'getvariableofnpc'. Also, you can pass some variables to the functions 
  843. +	when calling them. For more documentation about variables, please see 
  844. +	the 'variables' section.
  845. +->  Parameters:
  846. +	*   function: Specifies this is a function. Think of this as another 
  847. +	    kind of floating NPC, but with special properties that are only 
  848. +	    enabled if you tell the server this is a function, not a regular
  849. +	    floating script. Required for being parsed as a function.
  850. +	*   script: Required for being parsed as a function.
  851. +	*   function name: The name you will be setting to the function so 
  852. +	    that you can call it with 'callfunc'. Please note that if you try 
  853. +	    to parse a new function with the name of an existing one, you'll
  854. +		overload it (server will use the new one and 'forget' the old one 
  855. +		existed) along with a map server warning about it.
  856. +	*   code: The actual script commands the function will run when the 
  857. +	    function is called. Most of this document is dedicated to describe 
  858. +	    what these script commands do. Please remember that the curly 
  859. +	    brackets are mandatory here.
  860. +->  Example (without any code, since you don't know yet):
  861. +	*   Making a new function, called dec2bin:
  862. +		function%TAB%script%TAB%dec2bin%TAB%{<code>}
  863. +
  864. +
  865.  
  866. -The code part is the script code that will execute whenever the function 
  867. -is called with 'callfunc'. It has to be in curly brackets, unlike 
  868. -elsewhere where we use curly brackets, these do NOT signify an optional 
  869. -parameter.
  870. +Syntax
  871. +------
  872. +
  873. +Whenever '//' is encountered in a line upon reading, everything beyond 
  874. +this on that line is considered to be a comment and is ignored. This works 
  875. +wherever you place it.
  876. +
  877. +// This line will be ignored when processing the script.
  878. +
  879. +Block comments can also be used, where you can place /* and */ between any 
  880. +text you wish Hercules to ignore.
  881. +
  882. +Example:
  883. +/* This text,
  884. + * no matter which new line you start
  885. + * is ignored, until the following 
  886. + * symbol is encountered: */
  887. + 
  888. +The asterisks (*) in front of each line is a personal preference, and is 
  889. +not required.
  890.  
  891. -Once an object is defined which has a 'code' field to it's definition, it 
  892. -contains script commands which can actually be triggered and executed.
  893. +You can place comments wherever you want in a script, even outside a 
  894. +script. Just make sure to use them wisely and avoid doing weird things.
  895.  
  896.  ~ RID? GID? ~
  897.  
  898. @@ -406,7 +778,7 @@ Also notice that if you try to 'mes 0x10' it will print '16'.
  899.  
  900.  Number values can't exceed the limits of an integer variable: Any number
  901.  greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  902. -be capped to those values and will cause a warning to be reported.
  903. +be capped to those values and will cause a warning to be reported. 
  904.  
  905.  Variables
  906.  ---------
  907. @@ -414,10 +786,7 @@ Variables
  908.  The meat of every programming language is variables - places where you 
  909.  store data.
  910.  
  911. -In Hercules scripting language, variable names are case sensitive. Even though
  912. -at the current time the script engine accepts them even with the incorrect
  913. -case, it is not advised to rely on this behavior, as it may change at any
  914. -time.
  915. +In Hercules scripting language, variable names are not case sensitive.
  916.  
  917.  Variables are divided into and uniquely identified by the combination of:
  918.  prefix  - determines the scope and extent (or lifetime) of the variable
  919. @@ -445,7 +814,7 @@ nothing  - A permanent variable attached to the character, the default
  920.  "$"      - A global permanent variable. 
  921.             They are stored in database table `mapreg`.
  922.  "$@"     - A global temporary variable.
  923. -           They are important for scripts which are called with no RID
  924. +           Thhey are important for scripts which are called with no RID
  925.             attached, that is, not triggered by a specific character object.
  926.  "."      - A NPC variable.
  927.             They exist in the NPC and disappear when the server restarts or 
  928. @@ -522,9 +891,7 @@ JobExp      - Amount of job experience points.
  929.  NextBaseExp - Amount of base experience points needed to reach next level.
  930.  NextJobExp  - Amount of job experience points needed to reach next level.
  931.  Weight      - Amount of weight the character currently carries.
  932. -              Display as in Weight/10.
  933.  MaxWeight   - Maximum weight the character can carry.
  934. -              Display as in MaxWeight/10.
  935.  Sex         - 0 if female, 1 if male.
  936.  Class       - Character's job.
  937.  Upper       - 0 if the character is normal class, 1 if advanced, 2 if baby.
  938. @@ -639,8 +1006,8 @@ even a value from an another array) to get at an array value:
  939.  
  940.  This will make @arrayofnumbers[100] equal to 10.
  941.  
  942. -Notice that index numbering always starts with 0. Arrays can hold over
  943. -2 billion variables.
  944. +Notice that index numbering always starts with 0. Arrays cannot hold more 
  945. +than 128 variables (so the last one can't have a number higher than 127).
  946.  
  947.  And array indexes probably can't be negative. Nobody tested what happens 
  948.  when you try to get a negatively numbered variable from an array, but it's 
  949. @@ -727,12 +1094,6 @@ other, but you can not compare numbers to strings.
  950.   >   - True if the first value greater than the second value.
  951.   <   - True if the first value is less than the second value.
  952.   !=  - True if the first value IS NOT equal to the second one.
  953. - ~=  - True if the second value (as regular expression) matches the first
  954. -       value. Both values must be strings. See the script function pcre_match
  955. -       for more details and advanced features.
  956. - ~!  - True if the second value (as regular expression) DOES NOT match the
  957. -       first value. Both values must be strings. See script function pcre_match
  958. -       for more details and advanced features.
  959.  
  960.  Examples:
  961.  
  962. @@ -740,9 +1101,9 @@ Examples:
  963.   1<2 is True while 1>2 is False.
  964.   @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  965.  
  966. -Only '==', '!=', '~=' and '~!' have been tested for comparing strings. Since
  967. -there's no way to code a seriously complex data structure in this language,
  968. -trying to sort strings by alphabet would be pointless anyway.
  969. +Only '==' and '!=' have been tested for comparing strings. Since there's 
  970. +no way to code a seriously complex data structure in this language, trying 
  971. +to sort strings by alphabet would be pointless anyway.
  972.  
  973.  Comparisons can be stacked in the same condition:
  974.  
  975. @@ -890,9 +1251,9 @@ Operator Precedence and Associativity
  976.  Operator precedence and associativity work more or less like they do in
  977.  mathematics. The rules can be summarized with the following table:
  978.  
  979. -Precedence  |  Description                                  | Associativity
  980. +Precedence  |  Operator (Description)                       | Associativity
  981.  ---------------------------------------------------------------------------
  982. -1 (highest) | []  Array subscripting                        | None
  983. +1 (highest) | []  (Array subscripting)                      | None
  984.  ---------------------------------------------------------------------------
  985.  2           | ++  Increment                                 | None
  986.              | --  Decrement                                 |
  987. @@ -918,8 +1279,6 @@ Precedence  |  Description                                  | Associativity
  988.  ---------------------------------------------------------------------------
  989.  7           | ==  Equal to                                  | Left to right
  990.              | !=  Not equal to                              |
  991. -            | ~=  Regexp match                              |
  992. -            | ~!  Regexp non-match                          |
  993.  ---------------------------------------------------------------------------
  994.  8           |  &  Bitwise AND                               | Left to right
  995.  ---------------------------------------------------------------------------
  996. @@ -1110,41 +1469,46 @@ multiple commands on one line if you properly terminate them with a ';',
  997.  but it's better if you don't, since it is not certain just whether the 
  998.  scripting engine will behave nicely if you do.
  999.  
  1000. -Please note that command and function names are case sensitive. Even though at
  1001. -the current time the script engine accepts them with the incorrect case, it is
  1002. -not advised to rely on this behavior as it may change at any time.
  1003. -
  1004.  -------------------------
  1005.  
  1006.  
  1007. -From here on, we will have the commands sorted as followed:
  1008. +From here on, we will have the commands sorted as follow:
  1009.  
  1010. -1 - Basic Commands
  1011. -2 - Information-Retrieving Commands
  1012. -    -- 2.1: Information Item-Related Commands
  1013. -    -- 2.2: Information Guild-Related Commands
  1014. -3 - Checking Commands
  1015. -    -- 3.1: Checking Item-Related Commands
  1016. -4 - Player-Related Commands
  1017. -    -- 4.1: Player Item-Related Commands
  1018. -    -- 4.2: Guild-Related Commands
  1019. -    -- 4.3: Marriage-Related Commands
  1020. -5 - Mob / NPC Related commands
  1021. -    -- 5.1: Time-Related Commands
  1022. -    -- 5.2: Guild-Related Commands
  1023. -6 - Other Commands
  1024. -7 - Instance Commands
  1025. -8 - Quest Log Commands
  1026. -9 - Battleground Commands
  1027. -10 - Mercenary Commands
  1028. -11 - Queue Commands
  1029. -12 - NPC Trader Commands
  1030. +1.- Basic commands.
  1031. +2.- Information-retrieving commands.
  1032. +3.- Checking commands.
  1033. +4.- Player-related commands.
  1034. +5.- Mob / NPC -related commands.
  1035. +6.- Other commands.
  1036. +7.- Instance commands.
  1037. +8.- Quest Log commands.
  1038. +9.- Battleground commands.
  1039. +10.- Mercenary commands.
  1040. +11.- Queue commands.
  1041.  
  1042. +The commands and functions are listed in no particular order inside their 
  1043. +own categories. They're structured just like this:
  1044.  
  1045. ----------------------------------------
  1046. -//=====================================
  1047. -1 - Basic Commands
  1048. -//=====================================
  1049. +*Name of the command and how to call it, with a full list of parameters.
  1050. +
  1051. +->	Short description: 
  1052. +	Short descriptive text about what the command does.
  1053. +->	Parameters: 
  1054. +	Any required or optional parameters the command needs for working.
  1055. +->	Returns: 
  1056. +	What the command usually returns. Expect sometimes a list in case one 
  1057. +	of the parameters specifies a type of return.
  1058. +->	Notes:
  1059. +	Notes about the script command. It'll be only present if needed. 
  1060. +->	Examples:
  1061. +    Small example if possible/needed. Will usually be incomplete, it's 
  1062. +	there just to give you an idea of how it works in practice. Some 
  1063. +	commands will have more than one example.
  1064. +
  1065. +
  1066. +=====================
  1067. +|1.- Basic commands.|
  1068. +=====================
  1069.  ---------------------------------------
  1070.  
  1071.  *mes "<string>"{,"<string>"..."<string>"};
  1072. @@ -2269,16 +2633,10 @@ an array, shifting all the elements beyond this towards the beginning.
  1073.  	deletearray @array[1],3
  1074.  
  1075.  ---------------------------------------
  1076. -//=====================================
  1077. -1 - End of Basic-Related Commands
  1078. -//=====================================
  1079. ----------------------------------------
  1080.  
  1081. -
  1082. ----------------------------------------
  1083. -//=====================================
  1084. -2 - Information-retrieving Related Commands
  1085. -//=====================================
  1086. +======================================
  1087. +|2.- Information-retrieving commands.|
  1088. +======================================
  1089.  ---------------------------------------
  1090.  
  1091.  *strcharinfo(<type>)
  1092. @@ -2378,11 +2736,6 @@ You can also use this command to get stat values.
  1093.  	if (readparam(bVit) > 77)
  1094.  		mes "Only people with over 77 Vit are reading this!";
  1095.  
  1096. -Example 3:
  1097. -
  1098. -	// Display your current weight
  1099. -	mes "Your current weight is "+( Weight/10 )+"/"+( MaxWeight/10 );
  1100. -
  1101.  ---------------------------------------
  1102.  
  1103.  *getcharid(<type>{,"<character name>"})
  1104. @@ -2655,9 +3008,9 @@ If the character is sitting, it will return 1, otherwise (standing) it will retu
  1105.  In case no player is specified, the function will return the state of the attached player.
  1106.  
  1107.  ---------------------------------------
  1108. -//=====================================
  1109. -2.1 - Item-Related Commands
  1110. -//=====================================
  1111. +\\
  1112. +2,2 Item-related commands
  1113. +\\
  1114.  ---------------------------------------
  1115.  
  1116.  *getequipid(<equipment slot>)
  1117. @@ -2679,13 +3032,6 @@ EQI_HEAD_LOW (10)         - Lower Headgear (beards, some masks)
  1118.  EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
  1119.  EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
  1120.  EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
  1121. -EQI_COSTUME_GARMENT (14)  - Costume Garment
  1122. -EQI_SHADOW_ARMOR (15)     - Shadow Armor
  1123. -EQI_SHADOW_WEAPON (16)    - Shadow Weapon
  1124. -EQI_SHADOW_SHIELD (17)    - Shadow Shield
  1125. -EQI_SHADOW_SHOES (18)     - Shadow Shoes
  1126. -EQI_SHADOW_ACC_R (19)     - Shadow Accessory 2
  1127. -EQI_SHADOW_ACC_L (20)     - Shadow Accessory 1
  1128.  
  1129.  Notice that a few items occupy several equipment slots, and if the 
  1130.  character is wearing such an item, 'getequipid' will return it's ID number 
  1131. @@ -2707,8 +3053,9 @@ Plate armor, but also don't want them to equip if after the check, you
  1132.  would do this:
  1133.  
  1134.  		if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
  1135. -	// the || is used as an or argument, there is 2341 and 2342 'cause there
  1136. -	// are two different legion plate armors; one with a slot and one without.
  1137. +	// the || is used as an or argument, there is 2341 and 2342 cause 
  1138. +	// there are two different legion plate armors, one with a slot one 
  1139. +	// without.
  1140.  		if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1141.  		mes "I will lets you pass";
  1142.  		close2;
  1143. @@ -2723,7 +3070,7 @@ would do this:
  1144.  
  1145.  ---------------------------------------
  1146.  
  1147. -*getequipname(<equipment slot>)
  1148. +*getequipname(<equpment slot>)
  1149.  
  1150.  Returns the jname of the item equipped in the specified equipment slot on 
  1151.  the invoking character, or an empty string if nothing is equipped in that 
  1152. @@ -2735,7 +3082,7 @@ See 'getequipid' for a full list of valid equipment slots.
  1153.  		if( getequipname(EQI_HEAD_TOP) != "" )
  1154.  			mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
  1155.  	else
  1156. -			mes "You are not wearing a head gear";
  1157. +			mes "You are not wearing any head gear";
  1158.  
  1159.  ---------------------------------------
  1160.  
  1161. @@ -2916,7 +3263,6 @@ recreate these items perfectly if they are destroyed. Here's what you get:
  1162.  @inventorylist_expire[]    - expire time (Unix time stamp). 0 means never 
  1163.                               expires.
  1164.  @inventorylist_count       - the number of items in these lists.
  1165. -@inventorylist_bound       - whether it is an account bounded item or not.
  1166.  
  1167.  This could be handy to save/restore a character's inventory, since no 
  1168.  other command returns such a complete set of data, and could also be the
  1169. @@ -3015,9 +3361,9 @@ produced). It's useful for when you want to check whether an item contains
  1170.  cards or if it's signed.
  1171.  
  1172.  ---------------------------------------
  1173. -//=====================================
  1174. -2.1 - End of Item-Related Commands
  1175. -//=====================================
  1176. +//
  1177. +2,1.- End of item-related commands.
  1178. +//
  1179.  ---------------------------------------
  1180.  
  1181.  *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  1182. @@ -3192,11 +3538,10 @@ window (see 'mes') paging it by 10 names as if with the 'next' command.
  1183.  You need to put a 'close' after that yourself.
  1184.  
  1185.  ---------------------------------------
  1186. -//=====================================
  1187. -2.2 - Guild-Related Commands
  1188. -//=====================================
  1189. +\\
  1190. +2,2.- Guild-related commands
  1191. +\\
  1192.  ---------------------------------------
  1193. -
  1194.  *getguildname(<guild id>)
  1195.  
  1196.  This function returns a guild's name given an ID number. If there is no 
  1197. @@ -3330,9 +3675,9 @@ Example:
  1198.  mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
  1199.  
  1200.  ---------------------------------------
  1201. -//=====================================
  1202. -2.2 - End of Guild-Related Commands
  1203. -//=====================================
  1204. +//
  1205. +2,2.- End of guild-related commands
  1206. +//
  1207.  ---------------------------------------
  1208.  
  1209.  *getskilllv(<skill id>)
  1210. @@ -3457,39 +3802,6 @@ Check sample in doc/sample/getmonsterinfo.txt
  1211.  
  1212.  ---------------------------------------
  1213.  
  1214. -*addmonsterdrop(<mob id or name>, <item id>, <rate>)
  1215. -
  1216. -This command will temporarily add a drop to an existing monster. If the
  1217. -monster already drops the specified item, its drop rate will be updated to the
  1218. -given value.
  1219. -
  1220. -Both the monster and the item must be valid.  Acceptable values for the drop
  1221. -rate are in the range [1:10000].
  1222. -
  1223. -Return value will be 1 in case of success (the item was added or its drop rate
  1224. -was updated), and 0 otherwise (there were no free item drop slots).
  1225. -
  1226. -Example:
  1227. -	// Add Poring Doll (741) to the Poring's (1002) drops, with 1% (100) rate
  1228. -	addmonsterdrop(1002, 741, 100);
  1229. -
  1230. ----------------------------------------
  1231. -
  1232. -*delmonsterdrop(<mob id or name>, <item id>)
  1233. -
  1234. -This command will temporarily remove a drop from an existing monster.
  1235. -
  1236. -Both the monster and the item must be valid.
  1237. -
  1238. -Return value will be 1 in case of success (the item was removed), and 0
  1239. -otherwise (the monster didn't have the specified item in its drop list).
  1240. -
  1241. -Example:
  1242. -	// Remove Jellopy (909) from the Poring's (1002) drops
  1243. -	delmonsterdrop(1002, 909);
  1244. -
  1245. ----------------------------------------
  1246. -
  1247.  *getmobdrops(<mob id>)
  1248.  
  1249.  This command will find all drops of the specified mob and return the item 
  1250. @@ -3578,10 +3890,11 @@ You can see the full list of available effect types you can possibly
  1251.  inflict in 'db/const.txt' under 'Eff_'.
  1252.  
  1253.  ---------------------------------------
  1254. -//=====================================
  1255. -3 - Checking-Related Commands
  1256. -//=====================================
  1257. ----------------------------------------
  1258. +
  1259. +========================
  1260. +|3.- Checking commands.|
  1261. +========================
  1262. +-------------------------
  1263.  
  1264.  *playerattached()
  1265.  
  1266. @@ -3893,11 +4206,10 @@ by the type parameter.
  1267.   6 - RENEWAL_ASPD (renewal ASPD)
  1268.  
  1269.  ---------------------------------------
  1270. -//=====================================
  1271. -3.1 - Checking Item-Related Commands
  1272. -//=====================================
  1273. +\\
  1274. +3,1.- Item-related commands
  1275. +\\
  1276.  ---------------------------------------
  1277. -
  1278.  *isequipped(<id>{,<id>{,<id>{,<id>}}})
  1279.  
  1280.  This function will return 1 if the invoking character has all of the item 
  1281. @@ -3945,16 +4257,15 @@ equipment slot, which makes this script command kinda pointless.
  1282.  For a list of equipment slots see 'getequipid'.
  1283.  
  1284.  ---------------------------------------
  1285. -//=====================================
  1286. -3.0 & 3.1 - End of Checking/Item-Related Commands
  1287. -//=====================================
  1288. +//
  1289. +3,1.- End of item-related commands
  1290. +//
  1291.  ---------------------------------------
  1292.  
  1293. ----------------------------------------
  1294. -//=====================================
  1295. -4 - Player-Related Commands
  1296. -//=====================================
  1297. ----------------------------------------
  1298. +==============================
  1299. +|4.- Player-related commands.|
  1300. +==============================
  1301. +-------------------------
  1302.  
  1303.  *attachrid(<account ID>)
  1304.  *detachrid;
  1305. @@ -4156,26 +4467,17 @@ character and produces no other output whatsoever.
  1306.  
  1307.  *itemheal <hp>,<sp>;
  1308.  
  1309. -This command heals given relative amounts of HP and/or SP on the invoking 
  1310. +This command heals given absolute amounts of HP and/or SP on the invoking 
  1311.  character. Unlike heal, this command is intended for use in item scripts. 
  1312. -It applies potion-related bonuses, such as alchemist ranking, cards, 
  1313. -status changes.
  1314. -It also applies a sp/vit-related bonus that is calculated by:
  1315. -	heal = heal*[(100+STATUS*2)/100]
  1316. -So if a player has 99 vit and the script is 'itemheal 5,0':
  1317. -	heal(hp) = 5*[(100+99*2)/100]
  1318. -	heal(hp) = 14,9
  1319. -	heal(hp) = 14
  1320. -	heal(sp) = 0
  1321. -
  1322. -When used inside an NPC script, potion-related bonuses are omitted.
  1323. +It applies potion-related bonuses, such as alchemist ranking, cards and 
  1324. +status changes. When used inside an NPC script, certain bonuses are 
  1325. +omitted.
  1326.  
  1327.  There is also a nice example on using this with the 'rand' function, to 
  1328.  give you a random amount of healing.
  1329.  
  1330. -	// If the player has 50 vit and no bonuses this will heal
  1331. -	// anything from 200 to 300 HP and 5 SP
  1332. -	itemheal rand(100,150),5;
  1333. +	// This will heal anything thing from 100 to 150 HP and no SP
  1334. +	itemheal rand(100,150),0;
  1335.  
  1336.  ---------------------------------------
  1337.  
  1338. @@ -4446,12 +4748,12 @@ server is currently running on (depends on whether you used a SVN or Git
  1339.  client for getting Hercules).
  1340.  
  1341.  	if ( get_version() >= 15000 )
  1342. -		mes "Welcome to Hercules!";
  1343. +		mes "Welcome Hercules!";
  1344.  
  1345.  ---------------------------------------
  1346. -//=====================================
  1347. -4.1 - Player Item-Related Commands
  1348. -//=====================================
  1349. +\\
  1350. +4,1.- Item-related commands
  1351. +\\
  1352.  ---------------------------------------
  1353.  
  1354.  *getitem <item id>,<amount>{,<account ID>};
  1355. @@ -4596,51 +4898,6 @@ two eggs, and may hatch from either, although, I'm not sure what kind of a
  1356.  mess will this really cause.
  1357.  
  1358.  ---------------------------------------
  1359. -*getitembound <item id>,<amount>,<bound type>{,<account ID>};
  1360. -*getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  1361. -
  1362. -This command behaves identically to 'getitem', but the items created will be
  1363. -bound to the target character as specified by the bound type. All items created
  1364. -in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  1365. -some cases cannot be traded or stored.
  1366. -
  1367. -Valid bound types are:
  1368. - 1 - Account Bound
  1369. - 2 - Guild Bound
  1370. - 3 - Party Bound
  1371. - 4 - Character Bound
  1372. -
  1373. ----------------------------------------
  1374. -
  1375. -*getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>;
  1376. -*getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>;
  1377. -
  1378. -This command behaves identically to 'getitem2', but the items created will be
  1379. -bound to the target character as specified by the bound type. All items created
  1380. -in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  1381. -some cases cannot be traded or stored.
  1382. -
  1383. -For a list of bound types see 'getitembound'.
  1384. -
  1385. ----------------------------------------
  1386. -
  1387. -*countbound({<bound type>})
  1388. -
  1389. -This function will return the number of bounded items in the character's
  1390. -inventory, and sets an array @bound_items[] containing all item IDs of the
  1391. -counted items. If a bound type is specified, only those items will be counted.
  1392. -
  1393. -For a list of bound types see 'getitembound'.
  1394. -
  1395. -Example:
  1396. -	mes "You currently have "+countbound()+" bounded items.";
  1397. -	next;
  1398. -	mes "The list of bounded items include:";
  1399. -	for(set .@i,0; .@i<getarraysize(@bound_items); set .@i,.@i+1)
  1400. -		mes getitemname(@bound_items[.@i]);
  1401. -	close;
  1402. -
  1403. ----------------------------------------
  1404.  
  1405.  *getnameditem <item id>,<character name|character ID>;
  1406.  *getnameditem "<item name>",<character name|character ID>;
  1407. @@ -4857,9 +5114,8 @@ skill requirements.
  1408.  
  1409.  ---------------------------------------
  1410.  
  1411. -*itemeffect <item id>;
  1412. -*itemeffect "<item name>";
  1413. -*consumeitem is an alias of itemeffect (added for compatibility)
  1414. +itemeffect <item id>;
  1415. +itemeffect "<item name>";
  1416.  
  1417.  This command will run the item script of the specified item on the 
  1418.  invoking character. The character does not need to posess the item, and 
  1419. @@ -4979,17 +5235,21 @@ the command will end silently.
  1420.  
  1421.  ---------------------------------------
  1422.  
  1423. -*successrefitem <equipment slot>{,<upgrade_count>};
  1424. +*successrefitem <equipment slot>;
  1425.  
  1426.  This command will refine an item in the specified equipment slot of the 
  1427. -invoking character by +1 (unless <upgrade_count> is specified).
  1428. -For a list of equipment slots see 'getequipid'. 
  1429. -This command will also display a 'refine success' 
  1430. +invoking character by +1. For a list of equipment slots see 'getequipid'. 
  1431. +This command will not only add the +1, but also display a 'refine success' 
  1432.  effect on the character and put appropriate messages into their chat 
  1433.  window. It will also give the character fame points if a weapon reached 
  1434.  +10 this way, even though these will only take effect for blacksmith who 
  1435.  will later forge a weapon.
  1436.  
  1437. +The official scripts seems to use the 'successrefitem' command as a 
  1438. +function instead: 'successrefitem(<number>)' but it returns nothing on the 
  1439. +stack. This is since jAthena, so probably nobody knows for sure why is it 
  1440. +so.
  1441. +
  1442.  ---------------------------------------
  1443.  
  1444.  *failedrefitem <equipment slot>;
  1445. @@ -5010,11 +5270,15 @@ so.
  1446.  
  1447.  This command will downgrade an item by - 1 (unless optional <downgrade_count> is provided)
  1448.  in the specified equipment slot  of the invoking character.
  1449. -So the item will not be destroyed unlike in the 
  1450. +So the item will not be destroyed unlike in the  
  1451.  failedrefitem script command. This will also display a 'refine failure' 
  1452.  effect on the character and put appropriate messages into their chat 
  1453.  window.
  1454.  
  1455. +The official scripts seems to use the 'downrefitem' command as a function 
  1456. +instead: 'downrefitem(<number>)' but it returns nothing on the stack. 
  1457. +This is since jAthena, so probably nobody knows for sure why is it so.
  1458. +
  1459.  ---------------------------------------
  1460.  
  1461.  *unequip <equipment slot>;
  1462. @@ -5037,7 +5301,7 @@ like storage or cart.
  1463.  ---------------------------------------
  1464.  
  1465.  *equip <item id>;
  1466. -*autoequip <item id>,<option>;
  1467. +*autoEquip <item id>,<option>;
  1468.  
  1469.  These commands are to equip a equipment on the attached character. 
  1470.  The equip function will equip the item ID given when the player has this 
  1471. @@ -5092,9 +5356,9 @@ Example:
  1472.  	searchstores 10,1;
  1473.  
  1474.  ---------------------------------------
  1475. -//=====================================
  1476. -4.1 - End of Player Item-Related Commands
  1477. -//=====================================
  1478. +//
  1479. +4,1.- End of item-related commands
  1480. +//
  1481.  ---------------------------------------
  1482.  
  1483.  *openstorage;
  1484. @@ -5137,9 +5401,9 @@ character.
  1485.  	end;
  1486.  
  1487.  ---------------------------------------
  1488. -//=====================================
  1489. -4.2 - Guild-Related Commands
  1490. -//=====================================
  1491. +\\
  1492. +4,2.- Guild-related commands
  1493. +\\
  1494.  ---------------------------------------
  1495.  
  1496.  *guildopenstorage()
  1497. @@ -5199,9 +5463,9 @@ a good idea for a fun quest. (Wasting a level point on that is really
  1498.  annoying :D)
  1499.  
  1500.  ---------------------------------------
  1501. -//=====================================
  1502. -4.2 - End of Guild-Related Commands
  1503. -//=====================================
  1504. +//
  1505. +4,2 End of guild-related commands.
  1506. +//
  1507.  ---------------------------------------
  1508.  
  1509.  *resetlvl <action type>;
  1510. @@ -5518,6 +5782,10 @@ Flag 3 is the same as flag 0 in that it saves to the database. However,
  1511.  these skills are ignored when any action is taken that adjusts the skill 
  1512.  tree (reset/job change).
  1513.  
  1514. +Flag 4 is the same as flag 1 in that it saves to the database. However, 
  1515. +these skills are ignored when any action is taken that adjusts the skill 
  1516. +tree (reset/job change).
  1517. +
  1518.  ---------------------------------------
  1519.  
  1520.  *nude;
  1521. @@ -5542,9 +5810,9 @@ next;
  1522.  undisguise; // Return to normal character sprite.
  1523.  
  1524.  ---------------------------------------
  1525. -//=====================================
  1526. -4.3 - Marriage-Related Commands
  1527. -//=====================================
  1528. +\\
  1529. +4,3 Marriage-related commands
  1530. +\\
  1531.  ---------------------------------------
  1532.  
  1533.  *marriage("<spouse name>");
  1534. @@ -5583,9 +5851,9 @@ This function will also destroy both wedding rings and send a message to
  1535.  both players, telling them they are now divorced.
  1536.  
  1537.  ---------------------------------------
  1538. -//=====================================
  1539. -4.3 - End of Marriage-Related Commands
  1540. -//=====================================
  1541. +//
  1542. +4,3.- End of marriage-related commands
  1543. +//
  1544.  ---------------------------------------
  1545.  
  1546.  *pcfollow <id>,<target id>;
  1547. @@ -5621,17 +5889,11 @@ Examples:
  1548.  // Enables the current char to move again.
  1549.  	pcblockmove getcharid(3),0;
  1550.  
  1551. +--------------------------------------- 
  1552.  
  1553. ----------------------------------------
  1554. -//=====================================
  1555. -4 - End of Player-Related Commands
  1556. -//=====================================
  1557. ----------------------------------------
  1558. -
  1559. ----------------------------------------
  1560. -//=====================================
  1561. -5 - Mob / NPC Related Commands
  1562. -//=====================================
  1563. +==================================
  1564. +|5.- Mob / NPC -related commands.|
  1565. +==================================
  1566.  ---------------------------------------
  1567.  
  1568.  *monster     "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  1569. @@ -5807,11 +6069,9 @@ commands can have non-empty event label.
  1570.  If you pass this function an empty string for the event label, it will 
  1571.  return the total count of monster without event label, including 
  1572.  permanently spawning monsters.
  1573. -
  1574.  With the dynamic mobs system enabled, where mobs are not kept in memory 
  1575.  for maps with no actual people playing on them, this will return a 0 for 
  1576.  any such map.
  1577. -
  1578.  If the event label is given as "all", all monsters will be counted, 
  1579.  regardless of having any event label attached.
  1580.  
  1581. @@ -5880,46 +6140,20 @@ above 91000 intimacy with its owner.
  1582.  
  1583.  ---------------------------------------
  1584.  
  1585. -*gethominfo(<type>)
  1586. -
  1587. -This function works as a direct counterpart of 'getpetinfo':
  1588. - 0 - Homunculus unique ID
  1589. - 1 - Homunculus Class
  1590. - 2 - Name
  1591. - 3 - Friendly level (intimacy score). 100000 is full loyalty.
  1592. - 4 - Hungry level. 100 is completely full.
  1593. - 5 - Rename flag. 0 means this homunculus has not been named yet.
  1594. - 6 - Homunculus level
  1595. -
  1596. ----------------------------------------
  1597. -
  1598. -*morphembryo;
  1599. -
  1600. -This command will try to put the invoking player's Homunculus in an
  1601. -uncallable state, required for mutation into a Homunculus S. The player
  1602. -will also receive a Strange Embryo (ID 6415) in their inventory if
  1603. -successful, which is deleted upon mutation.
  1604. -
  1605. -The command will fail if the invoking player does not have an evolved
  1606. -Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  1607. -
  1608. -Returns 1 upon success and 0 for all failures.
  1609. -
  1610. ----------------------------------------
  1611. -
  1612.  *hommutate {<ID>};
  1613.  
  1614. -This command will try to mutate the invoking player's Homunculus into
  1615. -a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  1616. +This command will try to mutate the invoking player's Homunculus into a 
  1617. +Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  1618.  
  1619. -The command will fail if the invoking player does not have an evolved
  1620. -Homunculus at level 99 or above, if it is not in the embryo state
  1621. -(from the 'morphembryo' command), or if the invoking player does not
  1622. -possess a Strange Embryo. The /swt emotion is shown upon failure.
  1623. +The command will fail if the invoking player does not have an evolved 
  1624. +Homunculus at level 99 or above, if it is not in the embryo state (from 
  1625. +the 'morphembryo' command), or if the invoking player does not possess a 
  1626. +Strange Embryo. The /swt emotion is shown upon failure.
  1627.  
  1628. -If the optional parameter <ID> is set, the invoking player's Homunculus
  1629. -will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  1630. -will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  1631. +If the optional parameter <ID> is set, the invoking player's Homunculus 
  1632. +will change into the specified Homunculus ID. Otherwise, a random 
  1633. +Homunculus S will be chosen. See 'db/homunculus_db.txt' for a full list of 
  1634. +IDs.
  1635.  
  1636.  Returns 1 upon success and 0 for all failures.
  1637.  
  1638. @@ -5936,12 +6170,26 @@ and will return the following values:
  1639.  
  1640.  ---------------------------------------
  1641.  
  1642. +*gethominfo(<type>)
  1643. +
  1644. +This function works as a direct counterpart of 'getpetinfo':
  1645. + 0 - Homunculus unique ID
  1646. + 1 - Homunculus Class
  1647. + 2 - Name
  1648. + 3 - Friendly level (intimacy score). 100000 is full loyalty.
  1649. + 4 - Hungry level. 100 is completely full.
  1650. + 5 - Rename flag. 0 means this homunculus has not been named yet.
  1651. + 6 - Homunculus level
  1652. +
  1653. +---------------------------------------
  1654. +
  1655.  *unitwalk <GID>,<x>,<y>;
  1656. -*unitwalk <GID>,<target_GID>;
  1657. +*unitwalk <GID>,<mapid>;
  1658.  
  1659.  This is one command, but can be used in two ways. If only the first 
  1660.  argument is given, the unit whose GID is given will start walking towards 
  1661. -the target whose GID is given.
  1662. +the map with the given mapid (we believe these are the map-indexes found 
  1663. +in db/map_index.txt).
  1664.  
  1665.  When 2 arguments are passed, the given unit will walk to the given x,y 
  1666.  coordinates on the map where the unit currently is.
  1667. @@ -5951,8 +6199,9 @@ Examples:
  1668.  //Will move/walk the poring we made to the coordinates 150,150
  1669.  	unitwalk .GID,150,150;
  1670.  
  1671. -//NPC will move towards the attached player.
  1672. -	unitwalk .GID,getcharid(3);//a player's GID is their account ID
  1673. +//Will move the poring towards alberta (if my assumed map-indexes are 
  1674. +//correct).
  1675. +	unitwalk .GID,3;
  1676.  
  1677.  ---------------------------------------
  1678.  
  1679. @@ -6108,11 +6357,10 @@ Returns 0 is successful, 1 if the NPC does not exist.
  1680.  Size is 0 = normal 1 = small 2 = big.
  1681.  
  1682.  ---------------------------------------
  1683. -//=====================================
  1684. -5.1 - Time-Related Commands
  1685. -//=====================================
  1686. +\\
  1687. +5,1.- Time-related commands
  1688. +\\
  1689.  ---------------------------------------
  1690. -
  1691.  *addtimer <ticks>,"NPC::OnLabel";
  1692.  *deltimer "NPC::OnLabel";
  1693.  *addtimercount <ticks>,"NPC::OnLabel";
  1694. @@ -6312,10 +6560,9 @@ color format is in RGB (0xRRGGBB). The color is currently ignored by the
  1695.  client and appears always green.
  1696.  
  1697.  ---------------------------------------
  1698. -//=====================================
  1699. -5.1 - End of Time-related commands
  1700. -//=====================================
  1701. ----------------------------------------
  1702. +//
  1703. +5,1.- End of time-related commands
  1704. +//
  1705.  
  1706.  *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  1707.  
  1708. @@ -6735,9 +6982,9 @@ Example:
  1709.  	mapwarp "prontera","alberta",150,150,1,63;
  1710.  
  1711.  ---------------------------------------
  1712. -//=====================================
  1713. -5.2 - Guild-Related Commands
  1714. -//=====================================
  1715. +\\
  1716. +5,2.- Guild-related Commands
  1717. +\\
  1718.  ---------------------------------------
  1719.  
  1720.  *maprespawnguildid "<map name>",<guild id>,<flag>;
  1721. @@ -6835,9 +7082,9 @@ Type indicates what information to return:
  1722.   2 - current hp
  1723.  
  1724.  ---------------------------------------
  1725. -//=====================================
  1726. -5.2 - End of Guild-Related Commands
  1727. -//=====================================
  1728. +//
  1729. +5,2.- End of guild-related commands
  1730. +//
  1731.  ---------------------------------------
  1732.  
  1733.  *npcspeed <speed value>;
  1734. @@ -6886,20 +7133,20 @@ Example:
  1735.  	moveNPC "Bugga",100,20;
  1736.  
  1737.  ---------------------------------------
  1738. -//=====================================
  1739. -6 - Other Commands
  1740. -//=====================================
  1741. +
  1742. +=====================
  1743. +|6.- Other commands.|
  1744. +=====================
  1745.  ---------------------------------------
  1746.  
  1747.  *debugmes "<message>";
  1748.  
  1749.  This command will send the message to the server console (map-server 
  1750.  window). It will not be displayed anywhere else.
  1751. -//
  1752. +
  1753.  	// Displays "NAME has clicked me!" in the map-server window.
  1754.  	debugmes strcharinfo(0)+" has clicked me!";
  1755. -	
  1756. -	// debugmes "\033[38D\033[K ==Message== \n"; // enable colour code.
  1757. +
  1758.  ---------------------------------------
  1759.  
  1760.  *logmes "<message>";
  1761. @@ -7081,8 +7328,8 @@ You can add your own effects this way, naturally.
  1762.  
  1763.  ---------------------------------------
  1764.  
  1765. -*playbgm "<BGM filename>";
  1766. -*playbgmall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  1767. +*playBGM "<BGM filename>";
  1768. +*playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  1769.  
  1770.  These two commands will play a Background Music to either the invoking 
  1771.  character only ('playBGM') or multiple characters ('playBGMall').
  1772. @@ -7245,54 +7492,15 @@ script is used.
  1773.  
  1774.  ---------------------------------------
  1775.  
  1776. -*pcre_match("<string>","<regex>");
  1777. -
  1778. -This command is only available if the server is compiled with regular
  1779. -expressions library enabled.
  1780. -
  1781. -The string <string> will be searched for a match to the regular expression
  1782. -<regex>, and the number of matches will be returned.
  1783. -
  1784. -An alternative way to invoke this command is to use the operators '~=' or '~!'.
  1785. -The operator '~=' is exactly the same as pcre_match, while the operator '~!'
  1786. -will return 1 if no matches were found, or 0 if at least a match was found.
  1787. -
  1788. -	if (pcre_match("string", "regex")) mes "There was a match.";
  1789. -	if ("string" ~= "regex") mes "There was a match.";
  1790. -	if ("string" ~! "regex") mes "There were no matches.";
  1791. -
  1792. -You can find more usage examples in the test script npc/custom/test.txt.
  1793. -
  1794. -Using regular expressions is high wizardry. But with this high wizardry
  1795. -comes unparalleled power of text manipulation. For an explanation of what
  1796. -a regular expression pattern is, see a few web pages:
  1797. -
  1798. -http://www.regular-expressions.info/
  1799. -http://www.weitz.de/regex-coach/
  1800. -
  1801. -Additionally, the following temporary variables will be filled (unless the
  1802. -command is invoked as '~!'):
  1803. -
  1804. -- $@regexmatchcount: The number of matches detected, including any
  1805. -  parenthesized capture-groups.
  1806. -- $@regexmatch$[0]: The part of <string> That matched the full <regex> pattern.
  1807. -- $@regexmatch$[1 .. $@regexmatchcount]: The parts of <string> that matched
  1808. -  each of the parenthesized capture-groups in <pattern>.
  1809. -
  1810. -A capture group is a part of a regex enclosed in (parentheses) in order to
  1811. -store in a variable the part of the expression that was matched by that part of
  1812. -the regex. For more details, see the links above, as this is not intended to be
  1813. -a regex tutorial.
  1814. -
  1815. ----------------------------------------
  1816. -
  1817.  *defpattern <set number>,"<regular expression pattern>","<event label>";
  1818.  *activatepset <set number>;
  1819.  *deactivatepset <set number>;
  1820.  *deletepset <set number>;
  1821.  
  1822.  This set of commands is only available if the server is compiled with 
  1823. -regular expressions library enabled.
  1824. +regular expressions library enabled. Default compilation and most binary 
  1825. +distributions aren't, which is probably bad, since these, while complex to 
  1826. +use, are quite fascinating.
  1827.  
  1828.  They will make the NPC object listen for text spoken publicly by players 
  1829.  and match it against regular expression patterns, then trigger labels 
  1830. @@ -7316,6 +7524,13 @@ pattern set number in this case will deactivate all pattern sets defined.
  1831.  'deletepset' will delete a pattern set from memory, so you can create a 
  1832.  new pattern set in its place.
  1833.  
  1834. +Using regular expressions is high wizardry. But with this high wizardry 
  1835. +comes unparalleled power of text manipulation. For an explanation of what 
  1836. +a regular expression pattern is, see a few web pages:
  1837. +
  1838. +http://www.regular-expressions.info/
  1839. +http://www.weitz.de/regex-coach/
  1840. +
  1841.  For an example of this in use, see doc/sample/npc_test_pcre.txt
  1842.  
  1843.  With this you could, for example, automatically punish players for asking 
  1844. @@ -7431,31 +7646,20 @@ setitemscript 2637,"";
  1845.  
  1846.  ---------------------------------------
  1847.  
  1848. -*atoi("<string>")
  1849. -*axtoi("<string>")
  1850. -*strtol("string", base)
  1851. +*atoi ("<string>")
  1852. +*axtoi ("<string>")
  1853.  
  1854.  These commands are used to convert strings to numbers. 'atoi' will 
  1855.  interpret given string as a decimal number (base 10), while 'axtoi' 
  1856. -interprets strings as hexadecimal numbers (base 16). 'strtol' lets
  1857. -the user specify a base (valid range is between 2 and 36 inclusive,
  1858. -or the special value0, which means auto-detection).
  1859. +interprets strings as hexadecimal numbers (base 16).
  1860.  
  1861. -The atoi and strtol functions conform to the C functions with the same
  1862. -names, and axtoi is the same as strtol, with a base of 16. Results are
  1863. -clamped to signed 32 bit int range (INT_MIN ~ INT_MAX)
  1864. +Hexadecimal number set: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
  1865.  
  1866.  Example:
  1867.  
  1868. -.@var = atoi("11");        // Sets .@var to 11
  1869. -.@var = axtoi("FF");       // Sets .@var to 255
  1870. -mes axtoi("11");           // Displays 17 (1 = 1, 10 = 16)
  1871. -.@var = strtol("11", 10);  // Sets .@var to 11 (11 base 10)
  1872. -.@var = strtol("11", 16);  // Sets .@var to 17 (11 base 16)
  1873. -.@var = strtol("11", 0);   // Sets .@var to 11 (11 base 10, auto-detected)
  1874. -.@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  1875. -.@var = strtol("011", 0);  // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  1876. -.@var = strtol("11", 2);   // Sets .@var to 3 (binary 11)
  1877. +set @var, atoi("11"); 	// Sets @var to 11
  1878. +set @var, axtoi("FF");	// Sets @var to 255
  1879. +mes axtoi("11");      	// Displays 17 (1 = 1, 10 = 16)
  1880.  
  1881.  ---------------------------------------
  1882.  
  1883. @@ -7661,7 +7865,7 @@ in the count parameter.
  1884.  Example:
  1885.  	replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  1886.  	replacestr("Donkey", "don", "mon", 0);	//returns "monkey"
  1887. -	replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  1888. +	replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test" 
  1889.  
  1890.  ---------------------------------------
  1891.  
  1892. @@ -7931,9 +8135,10 @@ Directions are the same as NPC sprite facing directions: 0=north,
  1893.  This will open a book item at the specified page.
  1894.  
  1895.  ---------------------------------------
  1896. -//=====================================
  1897. -7 - Instance-Related Commands
  1898. -//=====================================
  1899. +
  1900. +========================
  1901. +|7.- Instance commands.|
  1902. +========================
  1903.  ---------------------------------------
  1904.  
  1905.  *instance_create("<instance name>",<owner id>{,<optional owner_type>});
  1906. @@ -8042,14 +8247,6 @@ Returns name of the instanced map on success, otherwise an empty string.
  1907.  
  1908.  ---------------------------------------
  1909.  
  1910. -*has_instance2("<map name>");
  1911. -
  1912. -Same as has_instance, with exception it returns the instance id of the map,
  1913. -as long as the user is assigned to a instance containing that map.
  1914. -It will return -1 upon failure, valid instance ids are >= 0.
  1915. -
  1916. ----------------------------------------
  1917. -
  1918.  *instance_id();
  1919.  
  1920.  Retrieves the instance id of the script it is being run on.
  1921. @@ -8102,91 +8299,16 @@ if (instance_check_party(getcharid(1),2,2,149)) {
  1922.  }
  1923.  
  1924.  ---------------------------------------
  1925. -*instance_set_respawn(<map_name>,<x>,<y>{,<instance_id>});
  1926. -
  1927. -Updates the 'reload spawn' position of a instance,
  1928. -that is where players in the instance are sent to upon @reloadscript,
  1929. -uses the npc instance (if any) when instance_id is not provided,
  1930. -handy to update a instance's progress so that when/if @reloadscript happens
  1931. -the damage to the players progress is reduced.
  1932. -It is most effective when used with instance variables (which are @reloadscript persistent)
  1933. -
  1934. -If a player warps into a instance before this command has been used,
  1935. -it will use the player's warp destination as the initial respawn point,
  1936. -it can of course be modified by using this script command at any point.
  1937. -
  1938. ----------------------------------------
  1939. -*instance_mapname("<map name>"{,<instance id>})
  1940. -
  1941. -Returns the unique name of the instanced map. If no instance ID is specified,
  1942. -the instance the script is attached to is used. If the script is not attached to
  1943. -an instance, the instance of the currently attached player's party is used. If
  1944. -that fails, the command returns an empty string instead.
  1945. -
  1946. -
  1947. ----------------------------------------
  1948. -//=====================================
  1949. -7 - End of Instance-Related Commands
  1950. -//=====================================
  1951. ----------------------------------------
  1952. -
  1953. -
  1954. ----------------------------------------
  1955. -//=====================================
  1956. -8 - Quest Log-Related Commands
  1957. -//=====================================
  1958. ----------------------------------------
  1959. -
  1960. -*questinfo <Quest ID>, <Icon> {, <Map Mark Color>{, <Job Class>}};
  1961. -
  1962. -This is esentially a combination of checkquest and showevent. Use this only
  1963. -in an OnInit label. For the Quest ID, specify the quest ID that you want
  1964. -checked if it has been started yet.
  1965. -
  1966. -For Icon, use one of the following:
  1967. -
  1968. -No Icon		: QTYPE_NONE
  1969. -! Quest Icon	: QTYPE_QUEST
  1970. -? Quest Icon	: QTYPE_QUEST2
  1971. -! Job Icon	: QTYPE_JOB
  1972. -? Job Icon	: QTYPE_JOB2
  1973. -! Event Icon	: QTYPE_EVENT
  1974. -? Event Icon	: QTYPE_EVENT2
  1975. -Warg		: QTYPE_WARG
  1976. -Warg Face	: QTYPE_WARG2 (Only for packetver >= 20120410)
  1977. -
  1978. -Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  1979. -the available color values are:
  1980. -
  1981. -0 - No Marker
  1982. -1 - Yellow Marker
  1983. -2 - Green Marker
  1984. -3 - Purple Marker
  1985. -
  1986. -When a user shows up on a map, each NPC is checked for questinfo that has been set.
  1987. -If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  1988. -
  1989. -Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  1990. -
  1991. -Example
  1992. -izlude,100,100,4	script	Test	844,{
  1993. -	mes "[Test]";
  1994. -	mes "Hello World.";
  1995. -	close;
  1996. -
  1997. -	OnInit:
  1998. -		questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  1999. -		end;
  2000. -}
  2001.  
  2002. +=========================
  2003. +|8.- Quest Log commands.|
  2004. +=========================
  2005.  ---------------------------------------
  2006.  
  2007.  *setquest <ID>;
  2008.  
  2009.  Place quest of <ID> in the users quest log, the state of which is "active".
  2010.  
  2011. -If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  2012. -
  2013.  ---------------------------------------
  2014.  
  2015.  *completequest <ID>;
  2016. @@ -8234,42 +8356,33 @@ If parameter "HUNTING" is supplied:
  2017.  
  2018.  ---------------------------------------
  2019.  
  2020. -*showevent <icon>{,<mark color>}
  2021. +*showevent <state>, <color>;
  2022.  
  2023. -Show an emotion on top of a NPC, and optionally,
  2024. -a colored mark in the mini-map like "viewpoint".
  2025. -This is used to indicate that a NPC has a quest or an event to 
  2026. -a certain player. 
  2027. +Show a colored mark in the mini-map like "viewpoint" and an emotion on top 
  2028. +of a NPC. This is used to indicate that a NPC has a quest or an event to 
  2029. +certain player/s. 
  2030.  
  2031. -Available Icons:
  2032. +state can be:
  2033. +	0 = disable ( Used to disable and remove the mark and the emotion from 
  2034. +		the NPC. )
  2035. +	1 = exclamation emotion ( Used to show an important quest event to 
  2036. +		certain player. )
  2037. +	2 = interrogation emotion ( Used to show an non-important quest event 
  2038. +		to certain player. )
  2039. +Other value may cause client crashes.
  2040.  
  2041. -Remove Icon	: QTYPE_NONE
  2042. -! Quest Icon	: QTYPE_QUEST
  2043. -? Quest Icon	: QTYPE_QUEST2
  2044. -! Job Icon	: QTYPE_JOB
  2045. -? Job Icon	: QTYPE_JOB2
  2046. -! Event Icon	: QTYPE_EVENT
  2047. -? Event Icon	: QTYPE_EVENT2
  2048. -Warg		: QTYPE_WARG
  2049. -Warg Face	: QTYPE_WARG2 (Only for packetver >= 20120410)
  2050. +color can be:
  2051. +	0 = yellow "Quest"
  2052. +	1 = orange "Job"
  2053. +	2 = green "Event"
  2054. +	3 = an MVP flag
  2055. +Other values show a transparent mark in the mini-map.
  2056.  
  2057. -Mark Color:
  2058. -0 - No Mark
  2059. -1 - Yellow Mark
  2060. -2 - Green Mark
  2061. -3 - Purple Mark
  2062. +----------------------------------------
  2063.  
  2064. ----------------------------------------
  2065. -//=====================================
  2066. -8 - End of Quest Log-Related Commands
  2067. -//=====================================
  2068. ----------------------------------------
  2069. -
  2070. -
  2071. ----------------------------------------
  2072. -//=====================================
  2073. -9 - Battlegrounds-Related Commands
  2074. -//=====================================
  2075. +============================
  2076. +|9.- Battleground commands.|
  2077. +============================
  2078.  ---------------------------------------
  2079.  
  2080.  *waitingroom2bg_single(<battle group>,"<mapname>",<x>,<y>,"<npc name>");
  2081. @@ -8417,17 +8530,11 @@ This command will force the update of the displayed scoreboard.
  2082.  It is only usable when the map is defined as a Type 2 Battleground:
  2083.  mapflag%TAB%<mapname>%TAB%battleground%TAB%2
  2084.  
  2085. ----------------------------------------
  2086. -//=====================================
  2087. -9 - End of Battlegrounds-Related Commands
  2088. -//=====================================
  2089. ----------------------------------------
  2090. -
  2091. +----------------------------------------
  2092.  
  2093. ----------------------------------------
  2094. -//=====================================
  2095. -10 - Mercenary Commands
  2096. -//=====================================
  2097. +==========================
  2098. +|10.- Mercenary commands.|
  2099. +==========================
  2100.  ---------------------------------------
  2101.  
  2102.  *mercenary_create <class>,<contract time>;
  2103. @@ -8494,17 +8601,11 @@ following:
  2104.  If the character does not have a mercenary, the command returns ""
  2105.  for name and 0 for all other types.
  2106.  
  2107. ----------------------------------------
  2108. -//=====================================
  2109. -10 - End of Mercenary-Related Commands
  2110. -//=====================================
  2111. ----------------------------------------
  2112. -
  2113. +----------------------------------------
  2114.  
  2115. ----------------------------------------
  2116. -//=====================================
  2117. -11 - Queue-Related Commands
  2118. -//=====================================
  2119. +======================
  2120. +|11.- Queue Commands.|
  2121. +======================
  2122.  ---------------------------------------
  2123.  
  2124.  *queue();
  2125. @@ -8588,75 +8689,4 @@ Example:
  2126.  Deletes a queue iterator from memory and returns 1 when it fails,
  2127.  otherwise 0 is returned.
  2128.  
  2129. ----------------------------------------
  2130. -//=====================================
  2131. -11 - End of Queue-Related Commands
  2132. -//=====================================
  2133. ----------------------------------------
  2134. -
  2135. ----------------------------------------
  2136. -//=====================================
  2137. -12 - NPC Trader-Related Commands
  2138. -//=====================================
  2139. -Commands that control NPC Trader Shops
  2140. -See /doc/sample/npc_trader_sample.txt
  2141. ----------------------------------------
  2142. -
  2143. -*openshop({NPC_Name});
  2144. -
  2145. -opens the trader shop from the currently-attached npc unless,
  2146. -when the optional NPC_Name param is used.
  2147. -
  2148. ----------------------------------------
  2149. -
  2150. -*sellitem <Item_ID>{,<price>{,<qty>}};
  2151. -
  2152. -adds (or modifies) <Item_ID> data to the shop,
  2153. -when <price> is not provided (or when it is -1) itemdb default is used.
  2154. -qty is only necessary for NST_MARKET trader types.
  2155. -
  2156. -when <Item_ID> is already in the shop,
  2157. -the previous data (price/qty), is overwritten with the new.
  2158. -
  2159. ----------------------------------------
  2160. -
  2161. -*stopselling <Item_ID>;
  2162. -
  2163. -attempts to remove <Item_ID> from the current shop list.
  2164. -
  2165. ----------------------------------------
  2166. -
  2167. -*setcurrency <Val1>{,<Val2>};
  2168. -
  2169. -updates the currently attached player shop funds,
  2170. -to be used within a "OnCountFunds" event of a NST_CUSTOM trader type.
  2171. -
  2172. -<Val1> is the value used in the *Cash* Points field
  2173. -<Val2> is the value used in the Kafra Points field
  2174. -
  2175. ----------------------------------------
  2176. -
  2177. -*tradertype(<Type>);
  2178. -
  2179. -Modifies the npc trader type, item list is cleared upon modifiying the value.
  2180. -By default, all npcs staart with tradertype(NST_ZENY);
  2181. -
  2182. -- NST_ZENY (0) Normal Zeny Shop
  2183. -- NST_CASH (1) Normal Cash Shop
  2184. -- NST_MARKET (2) Normal NPC Market Shop (where items have limited availability and need to be refurbished)
  2185. -- NST_CUSTOM (3) Custom Shop (any currency, item/var/etca, check sample)
  2186. -
  2187. ----------------------------------------
  2188. -
  2189. -*purchaseok();
  2190. -
  2191. -Signs that the transaction (on a NST_CUSTOM trader) has been successful,
  2192. -to be used within a "OnPayFunds" event of a NST_CUSTOM trader.
  2193. -
  2194. ----------------------------------------
  2195. -
  2196. -*shopcount(<Item_ID>);
  2197. -
  2198. -Returns the amount of still-available <Item_ID> in the shop (on a NST_MARKET trader).
  2199. -
  2200. ----------------------------------------
  2201. +---------------------------------------
  2202. \ No newline at end of file
  2203.  
Viewed 826 times, submitted by AnnieRuru.