EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   Climb a tree (https://www.eqemulator.org/forums/showthread.php?t=36496)

Loxo 02-14-2013 07:34 PM

Climb a tree
 
Code:

##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;
}

Code:

##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

Quote:

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

Quote:

Originally Posted by orionsun (Post 218242)
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

Quote:

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

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

Quote:

Originally Posted by orionsun (Post 218246)
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

Quote:

Originally Posted by Secrets (Post 218244)
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

Quote:

Originally Posted by Secrets (Post 218244)
Yes.

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

This is valid c++.

http://stackoverflow.com/questions/1...in-a-condition

ghanja 02-14-2013 10:20 PM

Quote:

Originally Posted by orionsun (Post 218246)
Notice I didnt just say that it would compile. Got more hairs to split Secrets?

Cata, is that you?


All times are GMT -4. The time now is 10:16 PM.

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