PDA

View Full Version : reloading perl quests


m0oni9
01-13-2004, 02:31 PM
I got tired of having to restart the server when I made changes to perl quests. It works for me, YMMV.

--
in command.cpp, add to command_init() below the reloadqst reference:

command_add("reloadpl","- Reload perl quest for target",0,command_reloadpl) ||

--
in command.cpp, insert below the command_reloadqst() function:

void command_reloadpl(Client *c, const Seperator *sep)
{
if (c->GetTarget() == 0 || !c->GetTarget()->IsNPC()) {
c->Message(0, "Error: Bad target");
return;
}
c->Message(0, "Reloading perl quest script for NPC type %i.",
c->GetTarget()->GetNPCTypeID());

((PerlembParser *)parse)->LoadScript(c->GetTarget()->GetNPCTypeID(),
zone->GetShortName());
}

--
in command.h, insert below the command_reloadqst() prototype:

void command_reloadpl(Client *c, const Seperator *sep);

Scorpious2k
01-13-2004, 03:00 PM
Nice work!

Alternately, you could also just modify command_reloadqst to

void command_reloadqst(Client *c, const Seperator *sep)
{
#ifdef EMBPERL
if (c->GetTarget() == 0 || !c->GetTarget()->IsNPC())
{
c->Message(0, "Error: Bad target");
return;
}

c->Message(0, "Reloading perl quest script for NPC type %i.",
c->GetTarget()->GetNPCTypeID());

((PerlembParser *)parse)->LoadScript(c->GetTarget()->GetNPCTypeID(), zone->GetShortName());
#else
parse->ClearCache();
c->Message(0, "Clearing *.qst memory cache.");
#endif

And have #reloadqst reload either old qst or perl depending on which is being used...

farce
01-13-2004, 03:48 PM
you guys forgot to mention that one should

#include "embparser.h"

in command.cpp too =)



farce

Lurker_005
01-13-2004, 05:31 PM
you guys forgot to mention that one should

#include "embparser.h"

in command.cpp too =)


Should already be in an ifdef statment at the top... Actually it is in #ifdef EMBPERL_PLUGIN

so I guess if you don't do the plugins you are correct.

m0oni9
01-13-2004, 07:00 PM
FYI: Been a problem or two with specific and default quests alike getting assigned incorrectly. Problems seem to come up when reload is used in conjunction with #depop.

mollymillions
01-13-2004, 07:38 PM
I have found that using quest::depop(NPCID) depops the whole zone? Is it possible to Repop one NPC, or move it back to its spawn point, from a quest?

farce
01-14-2004, 02:42 AM
Lurker... ahhh. yeah i dont think mine's set up for plugins. thanks for the info

farce

smogo
03-12-2004, 02:51 PM
Any idea why this could not be included in the distro ?