PDA

View Full Version : What is wrong with this? Super simple


snedecor
05-05-2010, 08:30 PM
sub EVENT_SAY {
if(($text=~/hail/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 0)){
$client->Message(5,"Have you heard of the new [tyrant] of Last World?");
quest::setglobal("illsalin","1","5","F");
}
elsif(($text=~/tyrant/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)){
$client->Message(5,"His name is Vertallis, he is a monstrosity from another realm who subsides in the Caves of Time. He holds the key to the next realm of [adventure]...");
}
elsif(($text=~/adventure/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)){
$client->Message(5,"Yes, the ancient Ruins of Illsalin. Deep within the ruins dwells creatures beyond any power you have ever seen...you must gain access to these ruins. One of adventurers went there several seasons back and has never returned...he could be alive. Poor Daemonloth...");
}


I dont understand why this simple script doesnt work? It's a hail to set globals - thats it. I've written tons of scripts its just that there must be a space somewhere im not seeing or something.... quite irritating actually. Maybe someone sees something i dont - Thanks for your time.


Just to eliminate some things - .pl file is named correctly, in correct file - npcs globals are turned on and everything. When you hail, he does nothing.


Also I've used the global check for "Zero" before and never had problems - but to be sure i removed it and just put if hailed = then he says stuff.... still nothing? I dont understand.

nilbog
05-05-2010, 08:39 PM
You're missing a curly bracket here.

sub EVENT_SAY {
if(($text=~/hail/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 0)){
$client->Message(5,"Have you heard of the new [tyrant] of Last World?");
quest::setglobal("illsalin","1","5","F");
}
elsif(($text=~/tyrant/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)){
$client->Message(5,"His name is Vertallis, he is a monstrosity from another realm who subsides in the Caves of Time. He holds the key to the next realm of [adventure]...");
}
elsif(($text=~/adventure/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)){
$client->Message(5,"Yes, the ancient Ruins of Illsalin. Deep within the ruins dwells creatures beyond any power you have ever seen...you must gain access to these ruins. One of adventurers went there several seasons back and has never returned...he could be alive. Poor Daemonloth...");
}
}

snedecor
05-05-2010, 08:48 PM
Okay well i didnt copy and paste the last bracket - but it is there - sorry. Good lookin out though.

joligario
05-05-2010, 09:14 PM
Try this:

sub EVENT_SAY {
if($text=~/hail/i) {
if(!defined($qglobals{illsalin})) {
$client->Message(5,"Have you heard of the new [tyrant] of Last World?");
quest::setglobal("illsalin",1,5,"F");
}
else {
quest::say("Welcome back, $name. Do you need to hear about the [tyrant] Vertallis again?");
}
}
if(($text=~/tyrant/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)) {
$client->Message(5,"His name is Vertallis, he is a monstrosity from another realm who subsides in the Caves of Time. He holds the key to the next realm of [adventure]...");
}
elsif(($text=~/adventure/i) && (defined($qglobals{illsalin})) && ($qglobals{illsalin} == 1)) {
$client->Message(5,"Yes, the ancient Ruins of Illsalin. Deep within the ruins dwells creatures beyond any power you have ever seen...you must gain access to these ruins. One of adventurers went there several seasons back and has never returned...he could be alive. Poor Daemonloth...");
}
}

If it still doesn't work, then it is somewhere else in the file that is broken.

This is assuming, as you said above, that this NPC has qglobals set to 1 in the database.

snedecor
05-05-2010, 11:20 PM
I'll give it a shot - also do you know of a way to reset script on mob without restarting? Cuz i got like 30 players on my server on average so i dont wanna keep restarting - Only asking cuz I never tried. Thanks

nilbog
05-06-2010, 12:01 AM
#reloadpl

#repop

snedecor
05-06-2010, 01:05 AM
#reloadpl will save me so much time =) Thank you. Also for the portion that jolligoro submitted - when i hail him he says the quest::say part and doesnt respon to "tyrant" at all....? Im wondering why any of the;

$client->Message(5,"Have you heard of the new [tyrant] of Last World?");

arent working? I just dont understand... the syntax/text everything is exactly the same as working quests - is there some plugin fix or something? Not quite sure what to do to fix - Thanks.

snedecor
05-06-2010, 02:36 AM
nvm I figured it out - just missing some brackets - Thanks

Zordana
06-08-2010, 11:39 PM
http://ult-tex.net/tools/ultra/line_count.pl

i like to use this if i wanna check for syntax errors :)