EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   qglobals not working for me (https://www.eqemulator.org/forums/showthread.php?t=27219)

Daecor 01-11-2009 09:50 PM

qglobals not working for me
 
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.
Code:

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
Code:

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

Neiv 01-11-2009 10:56 PM

Try this modified version:
Code:

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?
Code:

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

Quote:

Originally Posted by KLS (Post 162800)
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

Quote:

Originally Posted by KLS (Post 162800)
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

Quote:

Originally Posted by Yeormom (Post 172345)
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...


All times are GMT -4. The time now is 03:47 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.