[Script CMD]autonext

Shikazu

New member
Messages
74
Points
0
Age
36
Location
Germany
Github
shikazu
So here is the plugin which has been requested here.

Thank you for requesting it, i was just thinking about stuff i can implement
default_tongue.png


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

 
Last edited by a moderator:
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?

 
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

 
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
default_smile.png


 
Yeah nana, it's just autonext
default_tongue.png
  the timer runs and cant be interrupted by the user
default_biggrin.png


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
default_biggrin.png


Additionally i have to say, that you should have the newest git version, because it's some bugfixing there =)

 
Last edited by a moderator:
This source is pretty old and only for windows, so i can't even compile it
default_biggrin.png


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

 
Last edited by a moderator:
I've got this error message when i tried to compile:

Error C2039: 'rid2sd' : is not a member of 'script_interface'

 
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.

 
  1. next button keep stacking up.
  2. script still running even the character no longer attach to the NPC ( ex: @warp during the npc conversation )
  3. message isnt cleared after the "autonext" which make like new page of message.

Preview :

s3zSFh7.gif


 
How to transform this script (plugin) into a script CMD commom? For emulator whitout plugin system...

thanks 

 
Back
Top