Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2007, 03:08 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default Proper Use of Plurals With $race and $class?

Hey folks. I recently got a big batch of log files and have been sifting through all the aggro speak and such for NPCs. Here's a quick example:

Quote:
Roror says 'Dark Elves like you are better left dead than alive.'
Roror says 'It's Dark Elves like you who have ruined your own lands, You'll not ruin mine!'
Roror says 'You ssssshall know the horror of Cazic-Thule!'

a lizardman watcher says 'Errrrrr. Die soft skin!'

Basher Sklama says 'I shall pluck you limb from limb!!'
Basher Sklama says 'Shadow Knights like you always bring out the worst in me.'
Basher Sklama says 'Those who play with da Basher always gets bashed good!!'

a spectre says 'Areeeeewwwww'
a spectre says 'I really hate Necromancers like you.'
What I'm curious of is how to make the phrases come out correctly. I can get the singular race or class just fine (Necromancer, Dark Elf, etc.), but is there a special variable that can be used for plurals? "Dark Elves", etc. If not, I guess I'll just write some long work-around using variables. $npc->CastToClient()->GetBaseRace() and then a list of all the races and what they should come out to be plural. Then store those in variables and plug it into the quest::say... But that seems like such a long way to go to make something that should be simple work :P

That's why I'm asking for ideas Thanks for any help, guys and gals.
Reply With Quote
  #2  
Old 06-06-2007, 03:45 AM
Darkonig
Hill Giant
 
Join Date: Dec 2006
Posts: 102
Default

Instead of using $race, use ${race}s
The {} is not normally needed around the variable name in a string if it is immediately followed by something that is obviously not part of the name, like a space.
so if $race = "Ogre" then
quest::say("$race"); prints Ogre
quest::say("${race}s"); print Ogres
quest::say("$races"); gives an error because there is no variable $races

Code:
quest::say("${race}s like you are better left dead than alive.");
quest::say("It's ${race}s like you who have ruined your own lands, You'll not ruin mine!");
quest::say("${class}s like you always bring out the worst in me.");
Reply With Quote
  #3  
Old 06-06-2007, 04:10 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

Fantastic! Thank you!

Any way to account for Dark Elves becoming Dark Elfs, or should we just accept it?
Reply With Quote
  #4  
Old 06-06-2007, 04:38 AM
Darkonig
Hill Giant
 
Join Date: Dec 2006
Posts: 102
Default

Easiest to just accept it unless you feel like adding a some extra code to build the plurals yourself. Best would be a lookup table for plurals rather than trying to implement some sort of rule based determination since there aren't that many you would want plurals for anyway.
Reply With Quote
Reply


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:17 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3