View Single Post
  #14  
Old 09-09-2008, 05:07 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Any time you are only checking for certain classes and not all classes, then you have to do a Not Equal check as well for the other classes you don't want to use that turn in.

Don't ask me why it doesn't work the other way, as I have no clue. I also don't know why for equals you have to use ==, but for not equals, you have to use "ne". It doesn't make sense to me, but it does work.

Here is an example of what I mean:

Code:
if (($class == 'Wizard' || $class == 'Magician' || $class == 'Enchanter' || $class == 'Necromancer') && ($class ne 'Warrior' && $class ne 'Rogue' && $class ne 'Monk' && $class ne 'Berserker' && $class ne 'Shadowknight' && $class ne 'Paladin' && $class ne 'Ranger' && $class ne 'Bard' && $class ne 'Beastlord' && $class ne 'Cleric' && $class ne 'Druid' && $class ne 'Shaman'))
So, for every if(class) check, you have to include every class and just ne the ones you don't want.

Also, don't forget to add this at the bottom as shown in my example:
Code:
else {
 	    plugin::return_items(\%itemcount);
	}
Or the NPC will eat any incorrect items turned into it.

I imagine there are much better ways of doing this, but I haven't really gone back and tried lately. The next time I make a similar armor quest using better code, I will definitely post it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-10-2008 at 01:10 AM..
Reply With Quote