Andrew80k
06-03-2009, 12:35 AM
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.
Andrew80k
06-03-2009, 12:21 PM
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:
if (!defined($qglobals{imildustep1})) {
quest::setglobal("imildustep1",0,0,F);
}
Then when I update the value...
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.
Andrew80k
06-03-2009, 12:47 PM
I understand that. However, once it's set in the DB, it shouldn't be undefined.
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.
Andrew80k
06-03-2009, 10:32 PM
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.
################################################## ########
# 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,58 077,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);
}
}
trevius
06-03-2009, 11:17 PM
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:
if (!defined($qglobal{imildustep1})) {
quest::setglobal("imildustep1",0,0,'F');
$qglobal{imildustep1}=0;
}
I would change that to
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.
trevius
06-04-2009, 06:30 AM
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:
command_add("reloadquest","- Clear quest cache",150,command_reloadqst) ||
command_add("reloadqst",NULL,0,command_reloadqst) ||
command_add("reloadpl",NULL,0,command_reloadqst) ||
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.