PDA

View Full Version : Climb a tree


Loxo
02-14-2013, 07:34 PM
##a_Pine.pl
sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
quest::set_proximity($x - 8, $x + 8, $y - 8, $y + 8, $z - 200, $z + 50);
}

sub EVENT_ENTER
{
$climberchar = ($client);
$npc->SignalClient($climberchar, 1);
}
sub EVENT_EXIT
{
$npc->SignalClient($climberchar, 2);
$climberchar = undef;
}


##player.pl
sub EVENT_SIGNAL
{
if ($signal == 1)
{
$weight = ($client->GetWeight() / 10);
$basedex = $client->GetBaseDEX();
$basestr = $client->GetBaseSTR();
$climbertime = ((($basedex + $basestr) / ($weight + 1)*2));
quest::settimer("treeclimb",3);
quest::settimer("climber",$climbertime);
}
elsif ($signal == 2)
{
quest::stoptimer("climber");
quest::stoptimer("treeclimb");
$client->SetFlyMode(0);
}
else
{
quest::emote(" is broken");
}
}

sub EVENT_TIMER
{
if ($timer eq "treeclimb")
{
$client->SetFlyMode(1);
$client->Message(10, "You begin to climb...");
quest::stoptimer("treeclimb");
}
elsif ($timer eq "climber")
{
$climbervar = quest::ChooseRandom(1, 2, 3);
if ($climbervar == 1)
{
$client->Message(10, "You almost lose your grip...");
quest::doanim(12);
}
elsif ($climbervar == 2)
{
$client->Message(10, "You feel a bug crawl up your leg and almost lose your grip...");
quest::doanim(23);
}
else
{
$client->SetFlyMode(0);
$client->Message(10, "You lose your grip...");
quest::stoptimer("climber");
}
}
}



It always seems to work when all the parenthesis are there.

orionsun
02-14-2013, 08:12 PM
It always seems to work when all the parenthesis are there.

Is there a programming language where improper syntax results in working code?

Secrets
02-14-2013, 08:17 PM
Is there a programming language where improper syntax results in working code?

Yes.

if(var = othervar) in C++ will compile, but will not have the proper comparison.

orionsun
02-14-2013, 08:21 PM
if(var = othervar) in C++ will compile, but will not have the proper comparison.

Is there a programming language where improper syntax results in working code?

Notice I didnt just say that it would compile. Got more hairs to split Secrets?

Secrets
02-14-2013, 08:23 PM
Notice I didnt just say that it would compile. Got more hairs to split Secrets?

It works as unintended.

Confirmed working.

http://i.imgur.com/O0YQjdH.jpg

lerxst2112
02-14-2013, 08:48 PM
Yes.

if(var = othervar) in C++ will compile, but will not have the proper comparison.

Luckily almost every compiler out there has warnings to tell you if you've made this mistake. If it isn't a mistake, and there are valid reasons to use this construct, then you can write your code to avoid the warning in those cases.

Drajor
02-14-2013, 08:55 PM
Yes.

if(var = othervar) in C++ will compile, but will not have the proper comparison.

This is valid c++.

http://stackoverflow.com/questions/151850/why-would-you-use-an-assignment-in-a-condition

ghanja
02-14-2013, 10:20 PM
Notice I didnt just say that it would compile. Got more hairs to split Secrets?

Cata, is that you?