diff options
-rw-r--r-- | db/Changelog.txt | 14 | ||||
-rw-r--r-- | db/const.txt | 15 | ||||
-rw-r--r-- | doc/script_commands.txt | 41 | ||||
-rw-r--r-- | src/map/script.c | 32 |
4 files changed, 81 insertions, 21 deletions
diff --git a/db/Changelog.txt b/db/Changelog.txt index 35e48275c..655fdbe80 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -43,21 +43,23 @@ 2385 Recuvative_Armor Should trigger HP/SP return with magical kills as well. ======================= -2008/07/23 +2008/03/27 + * Added constants for the cell checking script function [ultramage] +2008/03/23 * Rev. 12426 Corrected Bishop and Gopinich exp rewards. [L0ne_W0lf] -2008/07/20 +2008/03/20 * Rev. 12420 Updated special effect rates on 11.3 gear. [L0ne_W0lf] -2008/07/20 +2008/03/20 * Rev. 12408 Corrected more duplicates in mob drops. [L0ne_W0lf] - Updated a few custom existing drops as well. - Fixed Hode so it drops Slotted Town Sword -2008/07/19 +2008/03/19 * Rev. 12401 Fallen Bishop lost his card...he found it though. [L0ne_W0lf] * Rev. 12400 Updated some monster stats that got missed. [L0ne_W0lf] * Rev. 12399 Updated Cursed Abbey monster drops. [L0ne_W0lf] -2008/07/18 +2008/03/18 * Rev. 12397 Moscovia mobs will now do more damage. [L0ne_W0lf] -2008/07/17 +2008/03/17 * Rev. 12386 Whoops. Incorrect ID in item_avail. :D [L0ne_W0lf] * Rev. 12385 Whoops. Incorrect IDs in item_avail. [L0ne_W0lf] * Rev. 12384 Added another item entry to item_avail. [L0ne_W0lf] diff --git a/db/const.txt b/db/const.txt index 78582aa38..c8a24ade4 100644 --- a/db/const.txt +++ b/db/const.txt @@ -233,6 +233,21 @@ cell_landprotector 5 cell_novending 6 cell_nochat 7 +//cell_gettype 0 +cell_chkwall 1 +cell_chkwater 2 +cell_chkcliff 3 +cell_chkpass 4 +cell_chkreach 5 +cell_chknopass 6 +cell_chknoreach 7 +//cell_chkstack 8 +cell_chknpc 9 +cell_chkbasilica 10 +cell_chklandprotector 11 +cell_chknovending 12 +cell_chknochat 13 + StatusPoint 9 1 BaseLevel 11 1 SkillPoint 12 1 diff --git a/doc/script_commands.txt b/doc/script_commands.txt index cd687cc90..611e38bbc 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4,7 +4,7 @@ //= A reference manual for the eAthena scripting language. //= Commands are sorted depending on their functionality. //===== Version =========================================== -//= 3.17.20080312 +//= 3.18.20080327 //========================================================= //= 1.0 - First release, filled will as much info as I could //= remember or figure out, most likely there are errors, @@ -106,6 +106,8 @@ //= Woopth. Fixed spelling. ;P Should be a bit clearer now. [L0ne_W0lf] //= 3.17.20080312 //= Corrected cashshop description. (#FREEPOINTS->#KAFRAPOINTS) [L0ne_W0lf] +//= 3.18.20080327 +//= Added documentation for the 'checkcell' command [ultramage] //========================================================= This document is a reference manual for all the scripting commands and functions @@ -6176,5 +6178,42 @@ to proceed until all barricades are destroyed. This script would place and remove a nonwalkable row of cells after the barricade mobs. --------------------------------------- + +*checkcell ("<map name>",<x>,<y>,<type>); + +This command will return 1 or 0, depending on whether the specified cell has +the 'type' flag set or not. There are various types to check, all mimicking +the server's cell_chk enumeration. The types can be found in db/const.txt. + +The meaning of the individual types can be confusing, so here's an overview: + - cell_chkwall/water/cliff + these check directly for the 'terrain component' of the specified cell + - cell_chkpass/reach/nopass/noreach + passable = not wall & not cliff, reachable = passable wrt. no-stacking mod + - cell_chknpc/basilica/landprotector/novending/nochat + these check for specific dynamic flags (their name indicates what they do) + +Example: + + mes "Pick a destination map."; + input .@map$; + mes "Alright, now give me the coordinates."; + input .@x; + input .@y; + if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) + { + mes "Can't warp you there, sorry!"; + close; + } + else + { + mes "Ok, get ready..."; + close2; + warp .@map$, .@x, .@y; + end; + } + +--------------------------------------- + Whew. That's about all of them. diff --git a/src/map/script.c b/src/map/script.c index 339afb495..15e83aeec 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11635,19 +11635,6 @@ BUILDIN_FUNC(distance) return 0; } -BUILDIN_FUNC(checkcell) -{ - int m; - const char *map = script_getstr(st, 2); - m = mapindex_name2id(map); - if(m){ - script_pushint(st,map_getcell(m, script_getnum(st,3), script_getnum(st,4),(cell_chk)script_getnum(st,5))); - } else { - script_pushint(st,0); - } - return 0; -} - // <--- [zBuffer] List of mathematics commands // [zBuffer] List of dynamic var commands ---> //FIXME: some other functions are using this private function @@ -12994,6 +12981,23 @@ BUILDIN_FUNC(openauction) return 0; } +/// Retrieves the value of the specified flag of the specified cell. +/// +/// checkcell("<map name>",<x>,<y>,<type>) -> <bool> +/// +/// @see cell_chk* constants in const.txt for the types +BUILDIN_FUNC(checkcell) +{ + int m = map_mapname2mapid(script_getstr(st,2)); + int x = script_getnum(st,3); + int y = script_getnum(st,4); + cell_chk type = (cell_chk)script_getnum(st,5); + + script_pushint(st, map_getcell(m, x, y, type)); + + return 0; +} + /// Modifies flags of cells in the specified area. /// /// setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>; @@ -13303,7 +13307,6 @@ struct script_function buildin_func[] = { BUILDIN_DEF(sqrt,"i"), BUILDIN_DEF(pow,"ii"), BUILDIN_DEF(distance,"iiii"), - BUILDIN_DEF(checkcell,"siii"), // <--- [zBuffer] List of mathematics commands // [zBuffer] List of dynamic var commands ---> BUILDIN_DEF(getd,"*"), @@ -13364,6 +13367,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(checkchatting,"*"), BUILDIN_DEF(openmail,""), BUILDIN_DEF(openauction,""), + BUILDIN_DEF(checkcell,"siii"), BUILDIN_DEF(setcell,"siiiiii"), {NULL,NULL,NULL}, }; |