Log in

View Full Version : Could use some help with == vs. eq


Neiv
08-28-2008, 10:29 PM
Here is my zone/player.pl
sub EVENT_ENTERZONE
{
if(plugin::check_hasitem($client, 13732))
{
$client->SetPVP(1);
quest::settimer("aggro",20);
$client->Message(257, "A mysterious voice whispers to you, 'I'm coming for you!' ");
}
}

sub EVENT_TIMER
{
if($timername eq "aggro")
{
my $guard_one = $entity_list->GetMobByNpcTypeID(999243);

if ($guard_one)
{
my $hate_guard_one = $guard_one->CastToNPC();
$hate_guard_one->AddToHateList($client, 1);
}
quest::stoptimer("aggro");
}
}

Each time I enter this zone, everything is white and the aggro function does not work. When I look at the log, it gives me this line (several instances of it):
[08.28. - 20:02:38] Use of uninitialized value in string eq at quests/eastkarana/player.pl line 14.
When I change the eq operator to == , the aggro function works, but everything is still white. When I look at the log, it gives me this line:
[08.28. - 18:17:46] Argument "aggro" isn't numeric in numeric eq (==) at quests/eastkarana/player.pl line 14.
[08.28. - 18:17:46] Use of uninitialized value in numeric eq (==) at quests/eastkarana/player.pl line 14.
I can't seem to win for losing on this. Which is it, and why does the "right" one still give me an error in the log? And why is everything white?

Andrew80k
08-28-2008, 10:58 PM
Have you tried running this from the command line? Try this:

perl quests/eastkarana/player.pl

And see what it outputs. There seems to be some unbalanced ' in one of your lines that might be causing you some issues.

joligario
08-28-2008, 11:00 PM
try $timer instead of timername?

Not sure if there is a difference

Neiv
08-28-2008, 11:04 PM
Yes, the perl cmd works fine. And I think I finally got the "eq" operator working properly (the aggro function now works with it). Any suggestions on why my zone might be white?

joligario
08-28-2008, 11:20 PM
White text?

Neiv
08-28-2008, 11:21 PM
try $timer instead of timername?
That's exactly what I did, and it fixed that part of the problem (Lexicon needs to be updated in this regard, unless timername is used solely for a numeric--as opposed to a text--timer designation).

joligario
08-28-2008, 11:30 PM
I don't know if it needs to be fixed. I think eq only works with strings. $timer is an id and the best bet is to use ==. $timername may still be a valid string.

Neiv
08-29-2008, 01:35 AM
White text?
White, featureless ground; white, featureless npcs; white featureless trees; white, featureless everything.

Neiv
08-29-2008, 02:24 AM
I figured it out. It appears to be a problem with the entries in the eastkarana_chr.txt file. I can add additional character models to it, and it works fine until I modify a quest in the zone. Then it seems to become corrupted and it turns everything white. I deleted all but the first entry and now the zone is back to normal (except of course for the NPCs that bear the character model IDs that I deleted--which are all the interesting ones). I guess this will be a question for the Windows Server forum.