TarkenKalia Newbie
Joined: 25 Jan 2008 Posts: 7
|
Posted: 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 {}
|
|
|