Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
TarkenKalia
Newbie


Joined: 25 Jan 2008
Posts: 7

PostPosted: Tue Jun 24, 2008 9:19 pm   

(solved) Finding and information from the database, then subbing it in
 
Ok, so in my game people own ships of various types and classes and statuses. The only way you know who owns what ship is from personal knowledge and finding out when someone tells you or you see them...Anyways, not my point. Here is what I am trying to do.

Say, I am standing in a harbor. This is what I see:

The RSF Crayer -<(*Silencer*)>- (landed) (shielded)
The UNK Frigate Dragnipur (anchored) (shielded)
The VAL Frigate Terrapin (landed) (shielded)
The SKE Frigate Waterboy (anchored) (shielded)

Ok. Now, what I'm trying to do now is have my trigger take each ship name, look up the owners name (if there is one) and sub it next to to the ship name. As you can see, special characters are already allowed in the ship name and I've found the way to get rid of those since it can change. An example of what I'm trying to get:

The RSF Crayer -<(*Silencer*)>- (Tarken) (landed) (shielded)
The UNK Frigate Dragnipur (UNKNOWN) (anchored) (shielded)
The VAL Frigate Terrapin (UNKNOWN) (landed) (shielded)
The SKE Frigate Waterboy (Valkrist) (anchored) (shielded)

The problem I have looks something like this:

The RSF Crayer -<(*Silencer*)>- (valkrist) (landed) (shielded)
The UNK Frigate Dragnipur () (anchored) (shielded)
The VAL Frigate Terrapin () (landed) (shielded)
The SKE Frigate Waterboy (valkrist) (anchored) (shielded)

Depending on how I have the ship names and owner put in the db, it just subs in the last one of the database on all the ships it found a match to. If it helps, the database columns are "Ship" then "Player"...fairly simple... Here is the code I have so far:

Pattern:
Code:

^[Tt]he ([A-Z]{2,3}) (Boat|Sloop|Ferry|Lugger|Cutter|Cog|Curraugh|Ketch|Brig|Schooner|Clipper|Swiftship|Brigantine|Corvette|Knorr|Caravel|Balinger|Frigate|Merchantman|Whaler|Carrack|Crayer|Buza|Barque|Nef|Galleon|Galleass|Man-of-war|Privateer|Indiaman|Viking Longship|Bireme|Dromond|War Galleon|Destroyer|Juggernaut|Corsair|Dreadnought|Viking Warship|Trireme|Drakkar) (.{1,25}?)( \((sinking|crashed)\)){0,1}( \((landed|anchored)\)){0,1}( \(hatch open\)){0,1}( \((sinking|crashed)\)){0,1}( \(ethereal\)){0,1}( \<.{3,15}\>){0,1}( \(fighting\)){0,1}( \((partially shielded|shielded)\)){0,1}$

Value:
Code:

#var tshipname %subchar( %3, "!@#$%^&*()-+_=[{]}\|;:',<.>/?`~~żĄ")
#FORALL %find( @tshipname) {#var shipowner &Player}
#sub {%ansi(cyan)%1 %2 %3 %ansi(green)(@shipowner)%ansi(cyan) %6 %8 %14}
#var shipowner {}
#var tshipname {}


I know its a bit tricky and complex, but can anyone shed some light?




Solved my own problem with this:
Code:

#var tshipname %subchar( %3, "!@#$%^&*()-+_=[{]}\|;:',<.>/?`~~żĄ")
#var dbnum %find( @tshipname)
#var shipowner %db( @dbnum, Player)
#sub {%ansi(cyan)%1 %2 %3 %ansi(green)(@shipowner)%ansi(cyan) %6 %8 %14}
#var shipowner {}
#var tshipname {}
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Jun 24, 2008 10:03 pm   
 
Can ship names ever contain spaces?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
TarkenKalia
Newbie


Joined: 25 Jan 2008
Posts: 7

PostPosted: Tue Jun 24, 2008 10:25 pm   
 
yep! I tested it and it works really nice..you have to add "~ " into that subchar list but the actual ship name doesn't contain spaces...like maryjane is a true ship name but the player may have bought the ability to display it as Mary Jane
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net