EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Proximity and hasitem (https://www.eqemulator.org/forums/showthread.php?t=28726)

Randymarsh9 06-30-2009 12:46 AM

Proximity and hasitem
 
I am trying to make something that will basically move someone away if they don't have an item in their inventory and then let them pass by if they do have it.
Code:

sub EVENT_SPAWN{
my $x;
my $y;
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity( $x-30,$x+30,$y-5,$y+5);
}

sub EVENT_ENTER{
if(plugin::check_hasitem($client, 1531)) {
 quest::emote("You pass beyond the barrier");
 }
elsif{
 quest::movechar(189,0,0,0);
 }
}

Nothing happens either way. I never really use proximities, so I'm sure this is another simple mistake

Sion 06-30-2009 01:36 AM

This should work:
Code:

sub EVENT_SPAWN {
my $x;
my $y;
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity( $x-30,$x+30,$y-5,$y+5);
}

sub EVENT_ENTER {
if(plugin::check_hasitem($client, 1531)) {
 quest::emote("You pass beyond the barrier");
 }
else{
 quest::movepc(189,0,0,0);
 }
}

It looks like you used elseif instead of else and used quest::movechar when its supposed to be quest::movepc.

Randymarsh9 06-30-2009 01:48 AM

Does elsif really not work? I have it in another quest where it works fine

Shendare 06-30-2009 01:55 AM

The elsif statement is used to check another condition. The else statement is used when there is no other condition to check.

Example:

Code:

if ($faction == 1)
{
  quest::say("Faction 1!");
}
elsif ($faction == 2)
{
  quest::say("Faction 2!");
}
else
{
  quest::say("Faction 3+!");
}


Sion 06-30-2009 02:08 AM

elsif works but in this case you would want to just use else. elsif is basically an else statement and an if statement combined.


All times are GMT -4. The time now is 09:40 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.