View Single Post
  #1  
Old 04-25-2008, 07:44 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default Quest bug: no coordinates at spawn

This was driving me absolutely crazy trying to figure out why it wouldn't work, especially when it would work fine from the regular command-line Perl parser:

Code:
my $Area8 = 0;

sub EVENT_SPAWN {
	$xs = $x;
	$ys = $y;
	$zs = $z;
	if (($x >= 65.9) && ($x <= 734.1) && ($y >= -1022.1) && ($y <= -321.9) && ($z >= 100) && ($z <= 190)) {
		$Area8 = 1;
	}
}

sub EVENT_DEATH {
	if ($Area8 == 1) {
		quest::say("I'm in Area8: $xs, $ys, $zs ... $x, $y, $z");
	} else {
		quest::say("I'm NOT in Area8: $xs, $ys, $zs ... $x, $y, $z");
	}
}
It would almost always say it's not in the area, and show no values for $xs, $ys, & $zs (the starting values), but it would show values for $x, $y, & $z, so I knew it wasn't an issue with the variables. However, if I change sub EVENT_SPAWN to sub EVENT_AGGRO, it works fine. It almost seems like the script is executing before it has values for the location, so they are defined as null values. I think another (cleaner) alternative would probably be to create a 1 second timer to get the location

I'm not sure if this is resource dependent or not, but I am running 2 3.2GHz processors w/ 4GB of RAM.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote