PDA

View Full Version : qglobals not working for me


Daecor
01-11-2009, 09:50 PM
hive searched the froums a few time and been playing with the code for around 5 hours and still cant figure out whats wrong i even went into the database and made sure the npc was able to use quest globals

basic idea im trying to do is this
i have a mob that sets the variable
(and indeed it makes it i checked database)
and another to check it and say one thing if its set and another if its not

E.G.

sub event_say
{
if ($qglobals{var_name} >= 1)
{
if ($text =~/hail/i)
{
quest::say("blah blah blah");
}
}
else
{
if ($text =~/hail/i)
{
quest::say("blah2 blah2 blah2");
}
}
}

the prob is nomatter it the variable is set or not the NPC still says the "blah2 blah2 blah2 part anyone have anyidea what im dooing wrong
thank you in advance for any help

joligario
01-11-2009, 10:18 PM
I would check to make sure you are setting the right option during setting the global.

http://www.eqemulator.net/forums/showthread.php?t=27207

Daecor
01-11-2009, 10:23 PM
i set the var using

quest::setglobal("var_name",1,5,"F");

Neiv
01-11-2009, 10:56 PM
Try this modified version:

sub event_say
{
if (defined($qglobals{var_name}))
{
if ($qglobals{var_name} >= 1)
{
if ($text =~/hail/i)
{
quest::say("blah blah blah");
}
}
}
else
{
if ($text =~/hail/i)
{
quest::say("blah2 blah2 blah2");
}
}
}

KLS
01-11-2009, 11:15 PM
The npcs also have to be set to use globals in the DB, qglobal = 1 in npctypes.

Neiv
01-11-2009, 11:28 PM
Upon reflection, shouldn't this be rewritten to something like this?
sub event_say
{
if ($text =~/hail/i)
{
if (defined($qglobals{var_name}))
{
if ($qglobals{var_name} >= 1)
{
quest::say("blah blah blah");
}
}
else
{
quest::say("blah2 blah2 blah2");
}
}
}

Daecor
01-11-2009, 11:32 PM
The npcs also have to be set to use globals in the DB, qglobal = 1 in npctypes.
Thank you KLS that was my prob NPC's didnt have qglobals set to 1 in DB

Yeormom
06-16-2009, 11:43 PM
The npcs also have to be set to use globals in the DB, qglobal = 1 in npctypes.
I spent 2 hours last night before I remembered to check this.

trevius
06-16-2009, 11:46 PM
I spent 2 hours last night before I remembered to check this.

And now you will never forget it again! :)

Yeormom
06-19-2009, 03:04 PM
Trevius, you would have thought so...but then I wasted another 15 minutes this afternoon trying to figure out what I did wrong with a replacement for the setglobal function. I didn't flip the bit again...