PDA

View Full Version : delquest not working?


Hmm
09-03-2010, 03:33 AM
Here's sample of my code...

if (plugin::check_handin(\%itemcount, $tinybone => 1)) {
quest::say("You found it! Thanks.");
quest::say("Talk to me when you are ready for next adventure.");
quest::level(4);
quest::delglobal("weiuaFirst");
} else {
plugin::return_items(\%itemcount);
quest::say("I have no use for this item, $name. Take it back.");
}

Now, the problem is that setglobal works, and returns true when defined $qglobals{WeiuaFirst} is checked, but once its defined, it don't seem to change back to false after delglobal is used. That is, unless I use clear quest cache command.

Is there wrong with how I use delglobal?

joligario
09-03-2010, 05:38 AM
That is correct. The delglobal() command does not clear the cache. You need to undefine the variable or (even better) just set the global to 0 if you are going to reuse it.

Hmm
09-04-2010, 01:39 AM
I thought undefine is what delglobal does? Right now I'm just using it as boolean variable - that is, if it exists it's true, otherwise false.

trevius
09-04-2010, 01:48 AM
No, delglobal() only deletes the database entry as far as I know.

Hmm
09-04-2010, 01:50 AM
Oh. How do I undefine it? :)

Hmm
09-04-2010, 07:52 PM
I did some perl research and tried this...

undef $qglobals{weiuaFirst};

It still didn't work. :(

joligario
09-04-2010, 08:05 PM
You're better off setting a different value than deleting the global if you want to reuse it.

The proper way would be: $qglobals{weiuaFirst} = undef;

Hmm
09-06-2010, 02:12 PM
Okay will try :)

Thanks.

Hmm
09-07-2010, 07:53 PM
Didn't work, but since my quests grant levels, I just used $ulevel to make sure quest can't be repeated.

Zoning seems to actually remove the global variable, but theres no way to clear it up while staying in zone without quest clear cache or just zoning.