Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-25-2004, 07:07 AM
ndnet
Hill Giant
 
Join Date: Oct 2003
Posts: 105
Default

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.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:01 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3