Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bug Reports

Development::Bug Reports Post detailed bug reports and what you would like to see next in the emu here.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-03-2009, 12:35 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default #reloadqst

I'm not 100% certain this is a bug, maybe it's supposed to work like this, but #reloadqst does not read quest globals properly. When I'm working on a quest and I'm storing a value in the database, if I have to do a reload, it acts like the $qglobal{somevalue} is no longer defined even though I can see it in the database. And since I check to see if it's defined and then set it if it's not, it gets reset in the db. When you have to turn in 100 items this can get to be very annoying. Would it be possible for someone to take a look? I briefly looked at the code and if I get time I'll look into it more if no one can do it before I do.
Reply With Quote
  #2  
Old 06-03-2009, 02:49 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I have never had a problem with it as long as my script is setup properly. Your post is a bit hard to follow :P Maybe you could you post your script so we can see if there's something wrong with it?
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 06-03-2009, 11:12 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Not sure why it's hard to follow...but maybe this will help...

When I use #reloadqst my quest globals become undefined.
Reply With Quote
  #4  
Old 06-03-2009, 11:35 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

We want that to happen, so the script reloads the values from the database. I too don't understand what the trouble is.
Reply With Quote
  #5  
Old 06-03-2009, 12:21 PM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by cavedude View Post
We want that to happen, so the script reloads the values from the database. I too don't understand what the trouble is.
I'm basically doing the Imildu's Tasks from the Abysmal Sea. It's a tradeskill task and part of the task is to basically make things and then give the results back to the the quest giver. For each step you have to hand in 100 items. I track the number of items handed in via a quest global. As I'm testing and modifying the script I have to #reloadqst from time to time as I change it. When I do this, the value in the database is correct for the last item I handed in. So when I do a #reloadqst my quest global becomes undefined and starts over, resetting it in the database. I expected it just to re-read it from the database and start from where that was, but it doesn't. It starts over. Since I'm checking like this:

Code:
if (!defined($qglobals{imildustep1})) {
    quest::setglobal("imildustep1",0,0,F);
}
Then when I update the value...

Code:
if(plugin::check_handin(\%itemcount, #### => 1)) {
    $val = $qglobal{imildustep1} + 1;
    $qglobal{imildustep1} += 1;
    quest::setglobal("imildustep1",$val,0,F);
}
I'm watching the value in the database increase as it should...

This works fine until I hit #reloadqst, then instead of getting the current value in the database, I get it starting over and the value in the database get sets set to 0.
Reply With Quote
  #6  
Old 06-03-2009, 12:44 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

The first bit is your problem... quest::setglobal("imildustep1",0,0,F); is setting the global value in the DB to 0.
Reply With Quote
  #7  
Old 06-03-2009, 12:47 PM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

I understand that. However, once it's set in the DB, it shouldn't be undefined.

Code:
if (!defined($qglobals{imildustep1})) {
    quest::setglobal("imildustep1",0,0,F);
}
Shouldn't the value of that be defined since it's being read from the database on #reloadqst? Maybe I don't understand how this all works as well as I thought I did.
Reply With Quote
  #8  
Old 06-03-2009, 01:14 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

I see what you mean now. I don't believe I've ever run into that before. The only thing I can think of, try putting an if statement before that checking for the global's value and have it do nothing. Perhaps if you force the script the read the global it'll realize it is defined.
Reply With Quote
  #9  
Old 06-03-2009, 10:32 PM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Here is the complete script: ( more or less working. to the extent that it's complete, but it's not done.)

If one of you could take a look at it and let me know what you think. I'll probably peruse the code to see if I can get a better understanding of how it works.


Code:
##########################################################
#   NPC:  Imildu Woodstreak                              #
#   Zone:  Abysmal Sea                                   #
#   Quest:  Imildu's Task                                #
#   Author:  Andrew80k                                   #
##########################################################
# Items:  
#    Wayfarer Arrowhead -- 58173, 
#    Wayfarer Shaft -- 58207, 
#    Wayfarer Fletching --58186, 
#    Wayfarer Arrow -- 58170, 
#    Wayfarer Bow Staff -- 58178,
#    Wayfarer Bow String -- 58179,
#    Wayfarer Bow -- 58177,
#    Wayfarer Honing Stone -- 58191,
#    Scavenged Bow Staff -- 58077,
#    Salvaged Arrowhead --  58072
sub EVENT_SAY {
        $charid  = $client->CharacterID();
        @item_array = ( 58173,58207,58186,58170,58178,58179,58177,58191,58077,58072 );
        if($text =~ /Hail/i) {
                quest::say("Welcome $name, Tunare smiles upon us all.  I don't want to impose, I know that we are all very busy, but if you have the time and inclination, I could use your help finishing some [tasks] that have been overwhelming me.");
        }
        if($text =~ /tasks/i) {
                quest::say("As you may know, many of our scouts have been lost. That has not kept us from trying to explore, but to do so we need supplies. We also must keep those that stay behind stocked with weapons to use in our defense. This has kept me in here working on those supplies and has prevented me from getting out to see the new lands. A dwarf brought me back some strange stone from Taelosia and it's made me want to go out and explore with all my heart. The stone has magical properties too. If treated properly, it can be used much like flint to make some of the sharpest arrowheads I've ever come across. If you could [aid] me with some of the simple tasks, I might be able to do more work with the [Taelosian Stone].");
        }
        if($text =~ /aid/i) {
                foreach $id (@item_array) {
                        if (plugin::check_hasitem($client,$id)) {
                                quest::say("May the Mother of All smile upon you.  You already have some work assigned to you, you should finish that before coming to ask for more.");
                                return;
                        }
                }
                if (!defined($qglobal{imildustep1})) { 
                        quest::setglobal("imildustep1",0,0,'F');
                        $qglobal{imildustep1}=0;
                }
                if ($qglobal{imildustep1} >= 100) {
                        quest::setglobal("imildustep2",0,0,'F');
                        quest::delglobal("imildustep1");
                }
                if ($qglobal{imildustep2} >= 100) {
                        quest::setglobal("imildustep3",0,0,'F');
                        quest::delglobal("imildustep2");
                }
                if ($qglobal{imildustep3} >= 100) {
                        quest::setglobal("imildustep3",0,0,'F');
                        quest::delglobal("imildustep3");
                }
                if ($qglobal{imildustep4} >= 100) {
                        quest::setglobal("imildustep4",0,0,'F');
                        quest::delglobal("imildustep4");
                }
                if (defined($qglobal{imildustep1})){
                        quest::say("You are as welcome here as a shade tree in the Desert of Ro, friend.  I and others have created the components needed to make arrows for the Wayfarers.  I would be grateful if you could do the final assembly for me.  Just take a Wayfarer Arrowhead, a Wayfarer Shaft, and a Wayfarer Fletching and combine them in your fletching kit.  There are many chores that need to be completed.  If you assist me with them, I might be willing to share with you the secret for treating the Chunks of Taelosian Rock to create the useful Taelosian Stones.  When you have those arrows finished, please bring them right back to me and I will make certain that they get to those that need them.");
                        quest::summonitem(58173,20);
                        quest::summonitem(58186,20);
                        quest::summonitem(58207,20);
                }
                if (defined($qglobal{imildustep2})) {
                        quest::say("Hail, traveler.  Thank you for taking the time to help me.  I have several bow staves and strings that need to be assembled.  A simple enough task, but time consuming.  All you need to do is place the Wayfarer Bow Staff and the Wayfarer Bow String into your fletching hit and combine them.  These bows will be needed soon, so please bring them directly to me when you have them assembled.");
                        quest::summonitem(58178,20);
                        quest::summonitem(58189,20);
                }
                if (defined($qglobal{imildustep3})) {
                        quest::say("Like warm fire on a chill northern eve, you are welcome.  We have run low on bow staves.  New wood has been hard to find, but we have several staves that can be repaired with some careful work.  Place a Scavenged Bow Staff and a Wayfarer Honing Stone into your fletching kit and combine them.  The stones are not of the best quality, and will be worthless by the time you fix a single staff, but stone is not difficult to find.  When you have repaired the staves, bring them to me so I can get someone to assemble them into bows for use.");
                        quest::summonitem(58191,20);
                        quest::summonitem(58077,20);
                }
                if (defined($qglobal{imildustep4})) {
                        quest::say("You are the stars on a clear night.  I am grateful to you for your assistance.  We have several ill-prepared or damaged arrowheads that we would like to repair and put into service.  All resources must be watched carefully.  Please take a Salvaged Arrowhead and a Wayfarer Honing Stone and combine them in your fletching kit.  Some of these are badly damaged, but I think you have the skill to repair them.  Bring them to me when you are done.");
                        quest::summonitem(58191,20);
                        quest::summonitem(58072,20);
                }
                if (defined($qglobal{imildustep5})) {
                        quest::emote("beams a bright smile at you, one that softens his usually dour face dramatically.");
                        quest::say("May Tunare bless you, friend.  I can no longer keep you here.  Certainly you too wish to get back out under the sun and see the new land.  Your help has allowed me much freedom, and for that I thank you.  Look at this compound.  Using it when you work with the Chunks of Taelosian Rock and the Chunks of Discordian Rock will allow you to work them into the shapes you desire.'  The smell of the liquid leads you to understand what he has given you.  You will be able to incorporate that material into all of your fletching kits and work with this new stone easily.  In fact, you believe that in time you can improve on the compound and get better results.");
                }
        }

        if($text =~ /Taelosian Stone/i) {
                quest::say("Truly unusual material. I suspect that there has been some long-term unnatural stress on it. If handled one way, it can be ground to powder relatively easily, but with some clever manipulation it can be sheared to make very fine edges. It also seems to hold some magical potential, though. I just haven't had time to explore that possibility. If you come across a Chunk of Taelosian Rock, please bring it to me. I'll treat it for you at the cost of keeping a small portion of the treated stone for myself.");
        }
}
sub EVENT_ITEM {
        my $val = $qglobal{imildustep1};
        if (plugin::check_handin(\%itemcount,58170 => 1)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep1} + 1;
                $qglobal{imildustep1} += 1;
                quest::setglobal("imildustep1",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58170 => 2)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep1} + 2;
                $qglobal{imildustep1} += 2;
                quest::setglobal("imildustep1",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58170 => 3)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep1} + 3;
                $qglobal{imildustep1} += 3;
                quest::setglobal("imildustep1",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58170 => 4)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep1} + 4;
                $qglobal{imildustep1} += 4;
                quest::setglobal("imildustep1",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58177 => 1)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep2} + 1;
                $qglobal{imildustep2} += 1;
                quest::setglobal("imildustep2",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58177 => 2)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep2} + 2;
                $qglobal{imildustep2} += 2;
                quest::setglobal("imildustep2",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58177 => 3)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep2} + 3;
                $qglobal{imildustep2} += 3;
                quest::setglobal("imildustep2",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58177 => 4)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep2} + 4;
                $qglobal{imildustep2} += 4;
                quest::setglobal("imildustep2",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58178 => 1)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep3} + 1;
                $qglobal{imildustep3} += 1;
                quest::setglobal("imildustep3",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58178 => 2)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep3} + 2;
                $qglobal{imildustep3} += 2;
                quest::setglobal("imildustep3",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58178 => 3)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep3} + 3;
                $qglobal{imildustep3} += 3;
                quest::setglobal("imildustep3",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58178 => 4)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep3} + 4;
                $qglobal{imildustep3} += 4;
                quest::setglobal("imildustep3",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58072 => 1)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep4} + 1;
                $qglobal{imildustep4} += 1;
                quest::setglobal("imildustep4",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58072 => 2)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep4} + 2;
                $qglobal{imildustep4} += 2;
                quest::setglobal("imildustep4",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58072 => 3)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep4} + 3;
                $qglobal{imildustep4} += 3;
                quest::setglobal("imildustep4",$val,0,'F');
        } elsif (plugin::check_handin(\%itemcount, 58072 => 4)) {
                quest::say("You are very helpful, we thank you.");
                $val = $qglobal{imildustep4} + 4;
                $qglobal{imildustep4} += 4;
                quest::setglobal("imildustep4",$val,0,'F');
        } else {
                plugin::return_items(\%itemcount);
        }
}
Reply With Quote
  #10  
Old 06-03-2009, 11:17 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

From what I can tell, it looks like your quest should be working properly. At least, I don't notice anything right away that stands out. Though, I don't think I have used the 0 option for qglobals, so maybe that code has issues. I always use 5 or 7 in most scripts I have qglobals in and they work perfectly.

Here is a link to a similar working script I made that adds values and checks for defined globals and such. It is different, but same basic concept and works just fine:

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

I am curious if this task you are talking about is an actual Task on Live, or if it is a Quest. If it is a task, you could just use the Task System and I think it should be able to handle everything you are trying to do. Though, I think it would be a deliver task and I am not sure how well a deliver task with 100 turn ins would work lol. Might be worth looking into though if it is a Task on Live. Tasks take some getting used to at first, but using the Task Master tool KLS wrote makes them fairly easy to create and manage.

One thing I always do when working on quests that aren't functioning properly is to put in some debugging say messages. So, where you have:

Code:
               if (!defined($qglobal{imildustep1})) { 
                        quest::setglobal("imildustep1",0,0,'F');
                        $qglobal{imildustep1}=0;
                }
I would change that to

Code:
                 if (!defined($qglobal{imildustep1})) { 
                        quest::setglobal("imildustep1",0,0,'F');
                        quest::say("Global not defined, so setting it and making it 0");
                }
For testing purposes only and then either comment out the say message or remove it completely once everything is working. I would add in Say messages all around the areas that you are having problems with to isolate exactly what is happening. Make sure to put the say message at the end of the if section so it ensures that the steps inside did go through. If you don't get the say message, then part of that if is failing.

Note that I also removed "$qglobal{imildustep1}=0;" from that part of your code as I am not sure what that is doing.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 06-04-2009 at 07:25 AM..
Reply With Quote
  #11  
Old 06-04-2009, 12:11 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

I'll take another look at it. I did the quest on live. I usually do to make sure I get it exactly right or as close as I can come. It is a quest as opposed to part of the task system. I'm making a run through the code to see if I can determine what the deal is.
Reply With Quote
  #12  
Old 06-04-2009, 06:25 AM
KingMort
Banned
 
Join Date: Sep 2006
Posts: 841
Default

Try #reloadpl instead
Reply With Quote
  #13  
Old 06-04-2009, 06:30 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Quote:
Originally Posted by KingMort View Post
Try #reloadpl instead
#reloadquest, #reloadpl and #reloadqst all do exactly the same thing. They are all just aliases for the #reloadqst command. That means they are just different names that all point to the same command, so one is no different than the other at all.

command.cpp:
Code:
command_add("reloadquest","- Clear quest cache",150,command_reloadqst) ||
command_add("reloadqst",NULL,0,command_reloadqst) ||
command_add("reloadpl",NULL,0,command_reloadqst) ||
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #14  
Old 06-16-2009, 11:46 PM
Yeormom
Discordant
 
Join Date: Apr 2004
Location: 127.0.0.1
Posts: 402
Default

I'm betting the qglobal flag in npc_types was set to 0 for the npc you wrote the quest for. I tested this a few minutes ago and noticed an NPC with qglobals disabled cannot get values, which would set it your value back each time as you experienced.
__________________
Yeorwned
Bane of Life [Custom Classic/PvP]
Reply With Quote
  #15  
Old 06-17-2009, 12:25 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by Yeormom View Post
I'm betting the qglobal flag in npc_types was set to 0 for the npc you wrote the quest for. I tested this a few minutes ago and noticed an NPC with qglobals disabled cannot get values, which would set it your value back each time as you experienced.
pretty sure it's 1. First thing I did when I started writing the quest. I'll double check though...thanks.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:36 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3