EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Qglobal problem (https://www.eqemulator.org/forums/showthread.php?t=20701)

aza77 06-09-2006 09:47 AM

if ($zavious == 0)
{
$zavious = undef;
if ($text=~/Hail/i)
{
quest::say("Hello $name. I have been expecting you. Ambassador Dumont told
me you would be arriving shortly. Do you have the four books that the
Ambassador told you to retrieve from Crushbone? If so, hand them to me.
#summonitem 51510");
quest::setglobal("zavious",1,0,"M2");
$zavious = undef;
}
}

i don't know why u have $zavious == 0 in there ... the way u write it is a little bit confusing.

Adrianne 06-09-2006 04:37 PM

wouldnt that be correct? I only want it to say:

Hello $name. I have been expecting you. Ambassador Dumont told
me you would be arriving shortly. Do you have the four books that the
Ambassador told you to retrieve from Crushbone? If so, hand them to me.
#summonitem 51510

one time, so when its 0 it doesnt have a variable there, but after you say it it doesnt say that anymore because it changes the variable to 1 so that it will now say:

Have you retrieved the four books that the Ambassador requested
from Crushbone?


Is this not the proper way to do this?

I kinda want this quest to progress step by step, and basically each player have to turn in the four books before they can turn in the battleplans to get the final reward, and get the item to give to the next npc to continue the main quest of our server.

Adrianne 06-21-2006 01:23 AM

Any clue? Im still totally boggled with this, and this is the main thing holding me back atm. Any help would be appreciated.

Cripp 06-21-2006 05:06 AM

can you repost what you have currently and ill take a look. too lazy to read all the other posts ;-)

Belfedia 06-21-2006 10:11 AM

Quote:

Originally Posted by Cripp
can you repost what you have currently and ill take a look. too lazy to read all the other posts ;-)

O...M...G... lol

Adrianne 06-22-2006 08:05 AM

Code:

      sub EVENT_SAY
  {
  if ($text=~/hail/i && $zavious == 1)
  {
    $zavious = undef;
    quest::say("Have you retrieved the four books that the Ambassador requested
    from Crushbone?");
  }
  if ($text=~/hail/i && $zavious == 2)
  {
    $zavious = undef;
    quest::say("Are you [willing] to perform another task for the council?");
  }
  if ($text=~/hail/i && $zavious == 3)
  {
    $zavious = undef;
    quest::say("Have you discovered what else the orcs are doing in Crushbone?");
  }
  if ($text=~/hail/i && $zavious == 4)
  {
    $zavious = undef;
    quest::say("Good luck on your journey $name. May the Five light your path.");
  }
  if ($text=~/willing/i && $zavious == 2)
  {
    $zavious = undef;
    quest::say("Good, then you shall set off immediately to Crushbone. Some of
    the adventurers that returned reported seeing a log cabin holding someone of
    importance. We wish you to seek this person out and discover what else the
    Orcs are doing. #summonitem 69977");
    quest::setglobal("zavious",3,0,"M2");
    $zavious = undef;
  }
  if ($zavious == 0)
  {
  $zavious = undef;
  if ($text=~/Hail/i)
  {
    quest::say("Hello $name. I have been expecting you. Ambassador Dumont told
    me you would be arriving shortly. Do you have the four books that the
    Ambassador told you to retrieve from Crushbone? If so, hand them to me.
    #summonitem 51510");
    quest::setglobal("zavious",1,0,"M2");
    $zavious = undef;
  }
  }
}


  sub EVENT_ITEM
  {
  if (plugin::check_handin(\%itemcount, 51510 => 4) && $zavious == 1)
  {
  $zavious = undef;
  quest::say("Ahhh you have returned with the books. You say the humanoids call
  themselves Orcs?  Hmmm.. Interesting.. The council will study these books to
  decipher what is written within them. Ambassador Dumont thanks you as do I,
  brave $race. If your still [willing] they have another task for you.");
  quest::setglobal("zavious",2,0,"M2");
  $zavious = undef;
  }
  elsif (plugin::check_handin(\%itemcount, 69977 => 1) && $zavious == 3)
  {
    $zavious = undef;
  quest::say("What is this $name? It appears to be some kind of battleplan. Is
  that Felwithe?! This truly is an amazing discovery my friend. Take this to
  Councillor Elandilira. I think she may like to hear of this discovery. It is
  a quick translation of the battleplans.");
  quest::summonitem(1004);
  quest::setglobal("zavious",4,0,"M2");
  $zavious = undef;
  }
  else
  {
  (plugin::return_items(\%itemcount));
  quest::say("This isn't what I'm looking for.");
  }
}
}

Code:

if ($zavious == 0)
  {
  $zavious = undef;
  if ($text=~/Hail/i)
  {
    quest::say("Hello $name. I have been expecting you. Ambassador Dumont told
    me you would be arriving shortly. Do you have the four books that the
    Ambassador told you to retrieve from Crushbone? If so, hand them to me.
    #summonitem 51510");
    quest::setglobal("zavious",1,0,"M2");
    $zavious = undef;

basically $zavious doesnt exist before this. #summonitem 51510 is just temperary so the tester knows what items to summon to test it. The "if ($zavious == 0)" is the first variable. Then global sets this to 1, so now, it no longer gives this message when you hail. it gives:
Code:

{
  if ($text=~/hail/i && $zavious == 1)
  {
    $zavious = undef;
    quest::say("Have you retrieved the four books that the Ambassador requested
    from Crushbone?");

Up to this point, the script works correctly as far as I know, now.. Heres the part that seems broken. I try to update the variable $zavious in the database to 2.. and it doesnt want to update.. Ive tried everything known to me:P heres the part:

Code:

{
  if (plugin::check_handin(\%itemcount, 51510 => 4) && $zavious == 1)
  {
  $zavious = undef;
  quest::say("Ahhh you have returned with the books. You say the humanoids call
  themselves Orcs?  Hmmm.. Interesting.. The council will study these books to
  decipher what is written within them. Ambassador Dumont thanks you as do I,
  brave $race. If your still [willing] they have another task for you.");
  quest::setglobal("zavious",2,0,"M2");
  $zavious = undef;

after the turn in of the 4 items with the item number of 51510, and $zavious == 1.. which it does, it works, because variable is 1. you now have the option to say [willing] since $zavious == 2.
Code:

if ($text=~/hail/i && $zavious == 2)
  {
    $zavious = undef;
    quest::say("Are you [willing] to perform another task for the council?");
  }

well your supposed to... but for the life of me, zavious, in mysql.. I use navicat to check, will not update... it will go from 0 to 1, where 0 is when the variable doesnt exist.. so basically it will create a 1 in the variable for zavious. quest::setglobal("zavious",2,0,"M2"); doesnt seem to update at all, and $zavious = undef; doesnt work. The variable just is stuck at 1...

If theres a better way of doing this, please tell me. I just need my quest to progress so that people cant do it over and over again, or even repeat previous steps, to prevent wasted time by the player. I would appreciate any examples, or ideas with some kinda examples or fix. Thanks alot guys. I know you guys work hard, but if I can just figure this out, Id be willing to post my finished scripts, because this will help alot of newer people, Im positive:P

Adrianne 06-25-2006 08:41 PM

sigh.. dont kno what to do.. think Im gonna rewrite everything.

Muuss 06-25-2006 11:21 PM

2 little suggestions.

Add parenthesis to your tests :

Code:

if (plugin::check_handin(\%itemcount, 51510 => 4) && ($zavious == 1))

Second one. This structure :
Code:

if (plugin::check_handin(\%itemcount, 51510 => 4) && $zavious == 1) {

} elsif (plugin::check_handin(\%itemcount, 69977 => 1) && $zavious == 3) {

} else {
  plugin::return_items(\%itemcount);
}

Will lead to some issues with item turn in and items returned.
The tests with check_handin remove items from the list of handed items if it succeded. In that case, lets say for your first test, if the player gives 4x51510 but $zavious is not set to 1, the test will fail and he WONT get his items back (because check_handin succeded).

2 possibilities :
Code:

if (($zavious==1) && plugin::check_handin(\%itemcount, 51510 => 4)) {
or

Code:

if ($zavious==1) {
  if (plugin::check_handin(\%itemcount, 51510 => 4)) {

  }
} elsif ($zavious==3) {
  if (plugin::check_handin(\%itemcount, 59977=>1)) {

  }
}
plugin::return_items(\%itemcount);

If the tests $zavious==2 stil don't work, you could try with ($zavious eq "2")...

Aramid 08-12-2006 03:19 PM

Quote:

Originally Posted by Adrianne
sigh.. dont kno what to do.. think Im gonna rewrite everything.

Was wondering if you ever got this working?

I picked up a Gambling Script that used Quest::setglobal and it wouldn't reset them either. I ended up having to delete the global variable and reset them each time along with using ($variable=undef);

Even if you set the Global Variable to last only 3 seconds, I could never change it without deleting it.

It's probably ugly by script writers standards, but it works... :grin:

I'm learning, but what a pain it is when your in the dark. Having to stop the server and restart it in order to change the quest (you DO have to do this, right) takes so much time. Oh well, once I get it under my belt, It won't take so long.

ylosh 08-13-2006 08:02 AM

don't need to restart the server, #reloadpl in the zone after you've made changes to the .pl file.

Aramid 08-13-2006 08:22 AM

Thanks ylosh.. I'm printing out the # commands now so I don't make this mistake again.. What a time saver this would have been... lol


All times are GMT -4. The time now is 12:16 PM.

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