View Single Post
  #24  
Old 06-03-2009, 06:44 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

If you really had a reason to use numbers for classes, it would be easy to make a hash to do it. But, it would just be extra work that isn't really needed unless you needed numbers to do a random or something. Here is an example:

Code:
%ClassConvert = (	#Convert each Class Name into a Number
	"Warrior" => 1,
	"Rogue" => 2,
	"Monk" => 3,
	"Berserker" => 4,
	"Shadowknight" => 5,
	"Paladin" => 6,
	"Ranger" => 7,
	"Bard" => 8,
	"Beastlord" => 9,
	"Cleric" => 10,
	"Druid" => 11,
	"Shaman" => 12,
	"Wizard" => 13,
	"Magician" => 14,
	"Enchanter" => 15,
	"Necromancer" => 16
);
Note: These numbers are in no particular order and are definitely not the normal order EQ knows these classes as.

Then, to get that class number, you could just do this:

Code:
my $classnum = $ClassConvert{$class};
You would want to do that conversion inside the EVENT you are using it on, so it does the conversion each time that something triggers that event so it can be accurate for the current class doing it.

Then, you can do:

Code:
if ($classnum == 1)
  quest::say("You are a Warrior!");
I am sure there are other ways to do it, but if that is something you were needing, this way should work fine for you.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote