Shikazu 11 Posted June 2, 2013 (edited) So here is the plugin which has been requested here. Thank you for requesting it, i was just thinking about stuff i can implement The problem with this is, that the "next" buttons are still in the bottom of the window of that npc and they are not going to disappear, because the next is made by the server and not by the user. Just like XKore from openkore ^^ Anyways, here is the script for anyone who wants to use it. #include <stdio.h>#include <string.h>#include "../common/HPMi.h"#include "../map/script.h"#include "../map/pc.h"HPExport struct hplugin_info pinfo = { "autonext", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "1.0", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};BUILDIN(autonext) { TBL_PC* sd; int timeout; sd = script->rid2sd(st); if( sd == NULL ) return true;#ifdef SECURE_NPCTIMEOUT sd->npc_idle_type = NPCT_WAIT;#endif timeout=script_getnum(st,2); if(st->sleep.tick == 0) { st->state = RERUNLINE; st->sleep.tick = timeout; } else {// sleep time is over st->state = RUN; st->sleep.tick = 0; } clif->scriptnext(sd, st->oid); return true;}/* Server Startup */HPExport void plugin_init (void) { clif = GET_SYMBOL("clif"); script = GET_SYMBOL("script"); if( HPMi->addScript != NULL ) { HPMi->addScript("autonext","i",BUILDIN_A(autonext)); }} The Script command is used like this: autonext 1000; This means, the script is waiting for 1000 milliseconds and then it's using next! If the user is pressing "next" on it's own, it is just ignored! Don't forget that! If you encounter any bugs, just ping me! ~Shikazu Edited June 2, 2013 by Shikazu 1 nanakiwurtz reacted to this Quote Share this post Link to post Share on other sites
nanakiwurtz 11 Posted June 2, 2013 But what happen if the user clicks it before the timer runs out? Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 For now it's causing a debug notice in the map-server console window, but that is fixed in the next commit. If he clicks it, before it runs out, just nothing happens because the timeout is made with the script sleep causing the script sleeping so i cant change anything while the sleep is going on. If you really need the next button to work, i have to rewrite some of that stuff also. so what do you need? Quote Share this post Link to post Share on other sites
thanna 11 Posted June 2, 2013 Sir Shikazu can I ask how to add plugin because I read the wiki but Im a little confuse about adding plugin, thanks in advance Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 Yeah it's pretty easy to add a plugin. What compiler are you using? Quote Share this post Link to post Share on other sites
nanakiwurtz 11 Posted June 2, 2013 So basically it will act like 'next' button when the timer ran out, but it doesn't interfere if the user presses it before it ran out. Because if it's like that, the script will be paused for x seconds, waiting for the timer to end Quote Share this post Link to post Share on other sites
thanna 11 Posted June 2, 2013 SIr Shikazu Im using visual studio 2010 Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 (edited) Yeah nana, it's just autonext the timer runs and cant be interrupted by the user So you need to go to /src/plugins/ and place the source above as "autonext.c". Then you are creating the plugin project like here: http://herc.ws/wiki/Building_HPM_Plugin_for_MSVC or you are just using the sample plugin project and replace the source with the one on page 1. after that you can easily compile it. Then you have to add "autonext" if the name of the .c file was autonext.c to your plugins.conf in your conf-folder and everything should be up and running. I use gcc cause i'm compiling on a test server on my root Additionally i have to say, that you should have the newest git version, because it's some bugfixing there =) Edited June 2, 2013 by Shikazu Quote Share this post Link to post Share on other sites
thanna 11 Posted June 2, 2013 thanks sir I will try it out, and one more thing sir can you help me with thishttp://herc.ws/board/topic/952-can-someone-convert-this-and-make-it-as-a-plugin/?p=6775 Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 (edited) This source is pretty old and only for windows, so i can't even compile it It wouldn't even run on newer windows systems, because it is using raw sockets, which have been fucked up by microsoft since xp service pack 2. Edit:// If i have some time left in the next week or so i'll check how to make a win/unix version out of it. ~Shikazu Edited June 2, 2013 by Shikazu Quote Share this post Link to post Share on other sites
nanakiwurtz 11 Posted June 2, 2013 I've got this error message when i tried to compile: Error C2039: 'rid2sd' : is not a member of 'script_interface' Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 You have to update, it got fixed by Ind already https://github.com/HerculesWS/Hercules/commit/86e9900db60e06738880a57820125ca169c37520 Quote Share this post Link to post Share on other sites
nanakiwurtz 11 Posted June 2, 2013 Oh my, I guess it's time to do some "Git Pull' Quote Share this post Link to post Share on other sites
Shikazu 11 Posted June 2, 2013 Heh, no problem. Since it's like i'm the first one trying to use it, there are a lot of untested things, so i am reporting everything to him, so he can fix it. Quote Share this post Link to post Share on other sites
Emistry 145 Posted May 29, 2014 next button keep stacking up. script still running even the character no longer attach to the NPC ( ex: @warp during the npc conversation ) message isnt cleared after the "autonext" which make like new page of message. Preview : Quote Share this post Link to post Share on other sites
HD Scripts 3 Posted August 31, 2015 How to transform this script (plugin) into a script CMD commom? For emulator whitout plugin system... thanks Quote Share this post Link to post Share on other sites