Jump to content

Toasty's Warper


ToastOfDoom

Recommended Posts


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   48
  • Joined:  11/19/11
  • Last Seen:  

Toasty's Warper
by: ToastOfDoom
So this is a project I've been working on and off for a while and only really just had it done to a release standard recently. The original reason I started this script was cause of Annie's Favorite Warper script. While pretty original in that I think it was the 1st one to implement a favorites menu in a warper, I absolutely detested how ugly that script looked. No offence to annie, but it looked like an absolute nightmare to configure (menu structure in one area, warp data in another, lots of duplicated data all over the place making it very easy to make a mistake). So I set out to write a warper that meets this one objective:


  • Be able to portray the configuration of all map and menu structure data in a single glance.

Features:

  • Easy to configure layout
  • Zeny cost configuration on menu/submenu/map levels
  • Configurable dynamic access to menus and maps
  • Remembers last warps
  • Brain hurting complexity in other parts of the script (not guaranteed)

Download:

Mirrors:

 

How to configure:

  • Look for the 'LoadData' label in the script (line 184).
  • All menu and map data is stored in this one subroutine. Configuring the menus is as easy as moving lines around. Details for each function as follows.
  • AddLastWarpNode(): Will add a menu item to access previously used warps. The maximum amount of stored last maps is 64, however by default it has been set to 10 (.numLastWarps)
  • AddNode(<node_name>{, <modifier>, <modifier_value>{, <modifier>, ...}}): This will add a submenu to the current menu. The cost value for zeny is optional. The cost value will carry on to all nodes and maps within the submenu unless overwritten but another cost value either at a lower node or map. Setting cost to 0 will cancel any costs from being carried down.
    //Eg. This will make a menu called "Dungeons" with a menu called "Abbey, Cursed Monastery" within
    StartNode("Dungeons");
    StartNode("Abbey, Cursed Monastery");
    AddMap("Abbey, Cursed Monastery - Level 1", "abbey01", 51, 14);
    AddMap("Abbey, Cursed Monastery - Level 2", "abbey02", 150, 11);
    ...
    EndNode();
    EndNode();
  • EndNode(): This will exit the current menu that was opened with AddNode() and go back to the parent menu of that menu. Consider it like brackets. All StartNode()s must end somewhere with an EndNode().
  • AddMap(<map_title>, <map_name>, <x>, <y>{, <modifier>, <modifier_value>{, <modifier>, ...}}): This will add a map to the current menu.
    //Eg. This will make a menu called "Towns" and place 5 maps within
    StartNode("Towns");
    AddMap("Alberta", "alberta", 28, 234);
    AddMap("Aldebaran", "aldebaran", 140, 131);
    AddMap("Amatsu", "amatsu", 198, 84, 5000);
    AddMap("Ayothaya", "ayothaya", 150, 163);
    AddMap("Comodo", "comodo", 209, 143);
    EndNode();

Modifiers:
With the 'AddNode' and 'AddMap' commands you are able to add modifiers to either give a set price or dynamically allow access to the specified menu or map (and some other things).
All modifiers will cascade down all children nodes until overwritten by another modifier. You can apply multiple modifiers but only one of each (ie..can't use 2x "gm" modifiers, but you can use 1x "gm", 1x "woe")
Descriptions of all avaiable modifiers and examples follow:


  • "zeny" - This sets a zeny cost to either all maps within the set node or the set map depending on how it was used.
    //Eg. This will make all maps within the 'Dungeons' menu cost 1000z
    StartNode("Dungeons", "Zeny", 1000);
    StartNode("Abbey, Cursed Monastery");
    AddMap("Abbey, Cursed Monastery - Level 1", "abbey01", 51, 14);
    AddMap("Abbey, Cursed Monastery - Level 2", "abbey02", 150, 11);
    ...
    EndNode();
    EndNode();
  • "gm"- This limits access to the menu/map according to the player's gm level. If set to positive it will check if the player's gm level is above or equal. If set to negative, it will check if the player's gm level is below or equal to the absolute of the value
    //Eg. This will make all maps within the 'Fields' menu accessible to only GMs above or equal to level 20
    StartNode("Fields", "gm", 20);
    StartNode("Amatsu Fields");
    AddMap("Amatsu Field 1", "ama_fild01", 190, 197);
    EndNode();
    StartNode("Ayothaya Fields");
    AddMap("Ayothaya Field 1", "ayo_fild01", 173, 134);
    AddMap("Ayothaya Field 2", "ayo_fild02", 212, 150);
    ...
    EndNode();
    EndNode();
    //This will make all maps within the 'Fields' menu accessible to only players below or equal to level 40
    StartNode("Fields", "gm", -40);
    StartNode("Amatsu Fields");
    AddMap("Amatsu Field 1", "ama_fild01", 190, 197);
    EndNode();
    StartNode("Ayothaya Fields");
    AddMap("Ayothaya Field 1", "ayo_fild01", 173, 134);
    AddMap("Ayothaya Field 2", "ayo_fild02", 212, 150);
    ...
    EndNode();
    EndNode();
  • "woe"- This limits access to the menu/map according to the current state of WoE. This relies on the OnAgitStart/OnAgitEnd events at the end of the script.
    //1: active when woe inactive
    //2: active when woe active
    //3: active regardless of woe setting(default)
    //Eg. This will only allow access to the Castles menus and maps when WoE is active
    StartNode("Castles", "woe", 2);
    StartNode("Aldebaran Castles");
    AddMap("Neuschwanstein(Aldebaran)", "alde_gld", 48, 83, "mapUsers", "aldeg_cas01");
    AddMap("Hohenschwangau(Aldebaran)", "alde_gld", 95, 249, "mapUsers", "aldeg_cas02");
    ...
    EndNode();
    EndNode();
  • "job"- This limits access to the menu/map according to the player's current job. Calculation method is exactly the same as the one used for jobs in item_db (ie..add up the bitmasks)
    (S.) Novice (2^00): 0x00000001
    Swordman (2^01): 0x00000002
    Mage (2^02): 0x00000004
    Archer (2^03): 0x00000008
    Acolyte (2^04): 0x00000010
    Merchant (2^05): 0x00000020
    Thief (2^06): 0x00000040
    Knight (2^07): 0x00000080
    Priest (2^08): 0x00000100
    Wizard (2^09): 0x00000200
    Blacksmith (2^10): 0x00000400
    Hunter (2^11): 0x00000800
    Assassin (2^12): 0x00001000
    Unused (2^13): 0x00002000
    Crusader (2^14): 0x00004000
    Monk (2^15): 0x00008000
    Sage (2^16): 0x00010000
    Rogue (2^17): 0x00020000
    Alchemist (2^18): 0x00040000
    Bard/Dancer (2^19): 0x00080000
    Unused (2^20): 0x00100000
    Taekwon (2^21): 0x00200000
    StarGladi (2^22): 0x00400000
    Soul Linker (2^23): 0x00800000
    Gunslinger (2^24): 0x01000000
    Ninja (2^25): 0x02000000
    //Eg. This will only allow access to the Payon dungeons to Wizards and Hunters and only when WoE is inactive
    StartNode("Payon Dungeon", "job", 0x00000A00, "woe", 1);
    AddMap("Payon Dungeon - Lvl 1", "pay_dun00", 21, 183);
    AddMap("Payon Dungeon - Lvl 2", "pay_dun01", 19, 33);
    AddMap("Payon Dungeon - Lvl 3", "pay_dun02", 19, 63);
    AddMap("Payon Dungeon - Lvl 4", "pay_dun03", 155, 159);
    AddMap("Payon Dungeon - Lvl 5", "pay_dun04", 201, 204);
    EndNode();
  • "upper"- This limits access to the menu/map according to wherever the player is a normal/high/baby class. Like with 'job' this works the same as the 'upper' value in item_db.
    //1: Normal jobs
    //2: Upper jobs
    //4: Baby jobs
    //Eg. This will only allow access to the casino to baby classes
    AddMap("Casino", "cmd_in02", 179, 129, "upper", 4);
  • "gender"- This limits access to the menu/map according to the sex of the player. 0 is female, 1 is male, 2 for both.
  • "blvl"- This limits access to the menu/map according to the base level of the player. This works exactly the same as with "gm" except with baselevels instead of gmlevels.
  • "flag"- This will limit access to the menu/map depending on the value of a specified variable. This is very useful for restricting access to things when an event is on or wherever the player as passed a certain quest.
    //Eg. This will only allow access to the guild dungeons if the global variable $@testEvent is not set to 0.
    StartNode("Guild Dungeons", "flag", "$@testEvent");
    AddMap("Baldur Guild Dungeon", "gld_dun01", 119, 93);
    AddMap("Luina Guild Dungeon", "gld_dun02", 39, 161);
    AddMap("Valkyrie Guild Dungeon", "gld_dun03", 50, 44);
    AddMap("Britoniah Guild Dungeon", "gld_dun04", 116, 45);
    EndNode();
  • "function"- This will limit access to a menu/map depending on the output of a specified function. Works very similar to the 'flag' modifier only will allow greater control but is also alot more computationally expensive. Recommend only using when needed and to keep things simple in the function. The script will automatically pass the following variables to the function:
    //Node: "Node", <nodeid>, <nodename>
    //Map: "Map", <mapid>, <maptitle>, <mapname>, <mapx>, <mapy>, <mapcost>
    //Eg. This will only allow access to the Thanatos tower to players that are in a party and above or equal to level 90
    StartNode("Thanatos Tower", "function", "PartyCheckFunc", "blvl", 90);
    AddMap("Thanatos Tower - Lvl 1", "tha_t01", 150, 39);
    AddMap("Thanatos Tower - Lvl 2", "tha_t02", 150, 136);
    AddMap("Thanatos Tower - Lvl 3", "tha_t03", 220, 158);
    AddMap("Thanatos Tower - Lvl 4", "tha_t04", 59, 143);
    AddMap("Thanatos Tower - Lvl 5", "tha_t05", 62, 11);
    ...
    EndNode();
    ...
    
    function script PartyCheckFunc {
    return strcharinfo(1) != "";
    }
  • "mapUsers"- This will change the map used for the getmapusers() calculation. This allows you to warp to one map, but display the user count for another map (like for castles)

Other Settings:

  • .showNodeUserCount: 0/1 turns on/off the user count display for nodes/menus
  • .showMapUserCount: 0/1 turns on/off the user count display for maps

Important Notes:

  • In the case that you add a map that doesn't exist a message will be displayed within your map server console indicating the name of the map.
  • There is a limit to the length of the menu can reach. This limit is defined by 2047 characters. When this limit is reached the client will crash. The script has measures to prevent client crashes, but the menu in question will still be broken. A message in the map server console will display indicating the affected menu. Please modify the structure of the menu to prevent the overflow. Additionally all GMs above the set .gmAccessLvl will have the option to check which menus will overflow.
  • Likewise this overflow problem will also affect the lastwarp menu so it is advised you keep the .numLastWarp value to a reasonable value (10-20)

Technical stuff:
Just some data on the structure of the script for those who want to modify functions (read this if you are interested in picking apart the script)

  • ShowMenu(): Displays the menu and returns the map id of the selected map
  • ComputeMenu(<menu_ptr>): Generates menu string. Modify this to change how you want the menus to look
  • SelectMap(<mapid>): Does the final zeny subtraction and warping to the map after selection. You can modify this to have it do other things with the cost value (eg, subtract coins instead)
  • All map data are stored in an infinite style array of the following names:
    # = index / 128, % = index % 128
    .maps_name_#[%]
    .maps_map_#[%]
    .maps_x_#[%]
    .maps_y_#[%]
    .maps_cost_#[%]
  • Node data are stored in the following manner:
    node_ptr$ = .menu_<nodeid>$
    node[0] = Node title
    node[1] = Basic precomputed node menu string
    node[2+] = Either a pointer to a map or another node_ptr$. If it is a number it is a map id otherwise it is the menu pointer for the next submenu.
  • Last warp menu is simply a pointer to "@menu_lastwarps$"

As always will appreciate bugs reports, suggestions & criticism.
88x31.png
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

Edited by ToastOfDoom
Added Mirrored link.
  • Upvote 11
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   11
  • Joined:  01/01/12
  • Last Seen:  

This is why your my favorite scripter on eAthena/rAthena, Love the organization.

Keep up the good work.

Edited by Obliterate
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  63
  • Reputation:   3
  • Joined:  12/22/11
  • Last Seen:  

Another superb script from Toasty :) thanks for sharing

Edited by Jin Freecs
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  38
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

I haven't try it, but I must say I really like the way you're showing your script in this post, and I love how the code looks, I'll use it as an example every time I'm gonna script something.

Great work and thanks for sharing.

Edited by Erid
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   8
  • Joined:  01/09/12
  • Last Seen:  

I use this. Very good job man.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  01/14/12
  • Last Seen:  

...nvm, my fault

Edited by gustav
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  161
  • Reputation:   6
  • Joined:  11/13/11
  • Last Seen:  

Debug! need help T_T

Why the warper sometimes debug?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

LOL......=='' that line..................is not a BUG / Problem....

it is a....INFORMATION show by that NPC after it load...

>.< i remember back then this questions has been asked several times...>.<

Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Thanks for a great script. :(

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

Great script, but I have a question. If I want to add mid camp to the warper but only want players who have completed the quest to be able to warp there.

What would I set the flag to?


StartNode("Mid Camp", "flag", "???");

Does anyone know how I would do this?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Great script, but I have a question. If I want to add mid camp to the warper but only want players who have completed the quest to be able to warp there.

What would I set the flag to?


StartNode("Mid Camp", "flag", "???");

Does anyone know how I would do this?

like this ?

"flag"- This will limit access to the menu/map depending on the value of a specified variable. This is very useful for restricting access to things when an event is on or wherever the player as passed a certain quest.

//Eg. This will only allow access to the guild dungeons if the global variable $@testEvent is not set to 0.
StartNode("Guild Dungeons", "flag", "$@testEvent");

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

Great script, but I have a question. If I want to add mid camp to the warper but only want players who have completed the quest to be able to warp there.

What would I set the flag to?


StartNode("Mid Camp", "flag", "???");

Does anyone know how I would do this?

like this ?

"flag"- This will limit access to the menu/map depending on the value of a specified variable. This is very useful for restricting access to things when an event is on or wherever the player as passed a certain quest.

//Eg. This will only allow access to the guild dungeons if the global variable $@testEvent is not set to 0.
StartNode("Guild Dungeons", "flag", "$@testEvent");

Yeah I know the flag function would be the best one to do that, but I was wondering if anyone know what the quest ID and state is for completing the quest. I have looked in the script and there is over 15 different quest IDs and I can't seem to find the one for when you finally complete the quest.

quests_13_1.txt

I attached the quest im taking about.

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Hoi,

nice script but he ain't compatible anymore with latest rA version, since script engine update. (arround 15997)

You'll have an error here :

while(getd(getarg(0) + "[" + .@i + "]") != "") {

[Error]: script:op_2: invalid data for operator C_NE

[Debug]: Data: number value=0

[Debug]: Data: string value=""

Edited by Lighta
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  175
  • Reputation:   8
  • Joined:  03/10/12
  • Last Seen:  

How to fix it Lighta?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  530
  • Reputation:   33
  • Joined:  01/17/12
  • Last Seen:  

man the awesome Warper hope it gets fixed, lots of changes being done and all the awesome scripts are having problem now :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  291
  • Reputation:   4
  • Joined:  04/24/12
  • Last Seen:  

so how to fix this one?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

I think It was already fixed by epoque11,,just updating your svn revision

warp script work fine with 16020 :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  175
  • Reputation:   8
  • Joined:  03/10/12
  • Last Seen:  

CooL! Let me confirm that

Edit: and it is confirmed. Uyeh~! Thanks epoque!

Edited by xRaisen
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

how to go nidhggour nest dungeon?? by quest??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  175
  • Reputation:   8
  • Joined:  03/10/12
  • Last Seen:  

Yes with quest. You can also go there 1@nyd map with no quest and no mvp i guess.

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   1
  • Joined:  05/15/12
  • Last Seen:  

Hye, Firstly I would like to thank you for this awesome warper.

It's very easy to configure.

+1 Reputation for you..

I would like to ask you.. Is it okay with this debug?

post-4649-0-97104800-1337860363_thumb.jpg

Thanks in advance..

  • Love 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

if you are hardworking...you should have discovered this in this forum ... or even in eAthena ...

the message is just a "Info" about the loaded map for this npc..

nothing harm about it.

if you feel that it is annoying..you can remove it..

find the debugmes command line..and remove that line.

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   1
  • Joined:  05/15/12
  • Last Seen:  

Thanks for your reply, Sir Emistry..

+1 Reputation..

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  154
  • Reputation:   1
  • Joined:  05/02/12
  • Last Seen:  

Hello.. Im having this error, anyone knows how to fix this?

http://i49.tinypic.com/4uj706.png

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

 set .@enable, .@enable && ((.@gm >= 0)?(getgmlevel() >= .@gm)(getgmlevel() + .@gm) <= 0));
 set .@enable, .@enable && (.@woe & ((agitcheck() || agitcheck2()) + 1) > 0);
 set .@enable, .@enable && ((.@job & (1 << .@player_job)) > 0);
 set .@enable, .@enable && ((.@upper & pow(2, Upper)) > 0);
 set .@enable, .@enable && (.@gender == Sex || .@gender == 2);
 set .@enable, .@enable && ((.@blvl >= 0)?(BaseLevel >= .@blvl):(BaseLevel + .@blvl <= 0));
 set .@enable, .@enable && ((.@flag$ != "")?getd(.@flag$):1);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...