EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Quests (https://www.eqemulator.org/forums/forumdisplay.php?f=624)
-   -   $ulevel question (https://www.eqemulator.org/forums/showthread.php?t=12635)

ryder911 03-24-2004 11:00 AM

$ulevel question
 
Can $ulevel be used with a number. Like $ulevel => 10? then player would have to be greater then 10 to do the quest?

And when using $ulevel in a quest sitution would it look like this?

if ($text=~ /Hail/i)($ulevel=>10){quest::say("Hello $name")


and another question, sorry for being a noob lol, but Wat is difference between { and ( im not sure when to use which. What does each do / stand for

Thanks any help or tips is appreciated

smogo 03-24-2004 11:36 AM

This is pure perl language. Answer to first is yes, and to second ... i wouldn't be able to explain :oops:

You'll get all answers in http://aspn.activestate.com/ASPN/doc...perlintro.html
documentation

ryder911 03-24-2004 11:47 AM

K thanks man!

ryder911 03-24-2004 12:07 PM

I found what () are for, but i cant find anything on {} seems like all the guides just skip explaining them lol, It doesn't say anything about it and all of a sudden on the guide it starts using them

Monrezz 03-25-2004 04:31 AM

Code:

if ($text=~ /Hail/i)($ulevel=>10){quest::say("Hello $name")
should be:

Code:

if ($text=~ /Hail/i && $ulevel >= 10){quest::say("Hello $name")
I believe ( is for an array, and { the start of the function. A wild guess, though :/

ndnet 03-25-2004 07:07 AM

In general, braces {} are used to block code together, such as:

if(condition){code block to execute}

Parentheses are used for a couple of reasons: 1.) Group together mathematical expressions to control evaluation order (things are evaluated in the parentheses together before things outside, and 2.) Enclosing the arguments of a function.

Quick examples of each.

1.) Controlling the order in which expressions are evaluated.

1 + 5 / 7 = 12/7 = ~1.714
but
(1+5) / 7 = 6/7 = ~0.857

2.) Passing arguments to a function

quest::say("Hello $name");

quest::say() is a function that takes an argument, your string there, which is passed by enclosing it in parentheses.

Code:

if ($text=~ /Hail/i && $ulevel >= 10){quest::say("Hello $name")
should probably be:

Code:

if ($text=~ /Hail/i && $ulevel >= 10){quest::say("Hello $name");}
Should end lines with semicolons. Also good practice to keep watch of what braces {} and parentheses () you open to make sure you close them later.

ryder911 03-26-2004 02:42 PM

k thanks

Monrezz 03-26-2004 11:36 PM

Quote:

Originally Posted by ndnet
Code:

if ($text=~ /Hail/i && $ulevel >= 10){quest::say("Hello $name")
should probably be:

Code:

if ($text=~ /Hail/i && $ulevel >= 10){quest::say("Hello $name");}

Oooops, didn't see that. Just quoted and corrected the beginning. Nice spot :P


All times are GMT -4. The time now is 04:52 AM.

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