Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::need work

Quests::need work This is where quests that are outdated or still need work

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-03-2006, 07:57 AM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

Sorry to bump an old thread but ...

I don't agree with you on using multiple 'if' statements instead of stringing them together.

The original code ...
Code:
if($text=~/accessories/i && $class == 'ranger') {
.. do something ..
}
The only semi-clean way to duplicate that statement is by nesting the 'ifs' ...
Code:
if($text=~/accessories/i) {
if($class == 'ranger') {
.. do something ..
}
}
The problem is, if you want to add an 'else', or change the logic to 'or' (||)instead of 'and' (&&) ... it would be really ugly to code when the 'ifs' are nested. Granted, if you have to perform 50 operations, it would be ugly to have them all in one statement, but for small ones, I believe they should be strung together, it promotes good coding practice.

I do agree on the use of proper operators though. In this case, it works because the '==' (numerical equality operator) simply converts the text to it's ascii value and compares the two values. Since any text with the same ascii values will be the same text, the operation works. However, you should get in the practice of using operaters that match the variable type.

Last edited by Theeper; 06-03-2006 at 04:03 PM..
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 01:15 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