PDA

View Full Version : qglobal issues


boo2
03-15-2010, 05:27 PM
sub EVENT_SAY {

my $journey = quest::saylink("journey", 0, "journey");

if($text=~/hail/i){
$client->Message(10, "Grizzly Adams says, 'Hello there $name. I am the recruiter of all the new soldiers in the Qeynos Militia. Would you like to begin your $journey?'");

}


elsif($text=~/journey/i){
{
quest::summonitem(1078);
quest::setglobal("NoteToSun",1,5,"F");
$client->Message(10, "Grizzly Adams says, 'Welcome to the Militia, $name. You will report to Tzu with this note, and he will take it from there. Good luck.'"); }

}
elsif($text=~/journey/i && !defined $qglobals{NoteToSun}); {
$client->Message(10, "Grizzly Adams says, 'I have already recruited you'"); }
}
}

------------------


What is wrong with the qglobal? I just can't seem to get it to work!

Can anyone explain it further?

nenelan
03-15-2010, 06:43 PM
A. Use the code tags when posting codes. It preserves formatting and makes it a hell of a lot easier to read.

B. Double check to make sure that your mob has qglobals enabled, it most likely is because C is your issue here. Doesn't hurt to double check.

C. You have Statement 1: "If Text is Hail", Statement 2: else "If Text is Journey", Statement 3: else "if Text is Journey AND qglobal is not defined". Statement 2 will always be evaluated before Statement 3, and even if Statement 3 is true, Statement 2 will be true first. Change the 2nd Statement to if the qglobal is defined and the text is there, and the final one as an elsif qglobal is not defined and the text is there.

boo2
03-15-2010, 08:12 PM
# Grizzly

my $globalname = "Grizzly";

sub EVENT_SAY {
my $NPCName = $npc->GetCleanName();

my $journey = quest::saylink("journey", 0, "journey");

if($text=~/hail/i && $qglobals{$globalname} == 2){
quest::emote(" stares at you with disbelief.");
}
elsif($text=~/hail/i && !$qglobals{$globalname} ){
quest::say("Greetings $name, I am the Milita Recruiter. Would you like to begin your $journey?");
}
elsif($text=~/journey/i){
quest::setglobal("$globalname",1,2,"F");
quest::summonitem(33969);
quest::say("Welcome to the Militia, $name. You will report to Tzu with this note, and he will take it from there. Good luck."); }
}
}



that is what i have now, now it crashes the zone.

I want you to be able to get your note from this guy, and then he will just stare at you in disbelief if you hail him again.

joligario
03-15-2010, 08:52 PM
# Grizzly

sub EVENT_SAY {
my $journey = quest::saylink("journey", 0, "journey");

if($text=~/hail/i) {
if($qglobals{Grizzly} == 2) {
quest::emote("stares at you with disbelief.");
}
else {
quest::say("Greetings $name, I am the Milita Recruiter. Would you like to begin your $journey?");
}
}
if($text=~/journey/i) {
quest::setglobal("Grizzly",1,2,"F");
quest::summonitem(33969);
quest::say("Welcome to the Militia, $name. You will report to Tzu with this note, and he will take it from there. Good luck.");
}
}

Not sure about the saylink.. I haven't used those before.

trevius
03-15-2010, 11:04 PM
Yeah, saylinks need to be made within an EVENT, not outside of them. Though, while looking at this, I figured out why that is and will fix it tonight so it stops crashing zones at least if defined outside of an EVENT.

As for the saylink there, you can simplify it to just this:

my $journey = quest::saylink("journey");

And that will do the same thing. The 0 you had is an option to let you make the saylink silent if you set it to 1. Then, you don't see the response from the player at all. The second text at the end is just an option so the link can say a different message from what the player actually says when clicking it. So, you can have the link show "bind your soul", and when clicked, the player might say "bind my soul", and so on.