|
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Tue Mar 25, 2003 6:05 pm
Database multiline #add |
Hello
I need a little help entering some stuff into a database. What I'm trying to do is add the name, room descriptions, exits, items and mobiles from my logs into a database. I can add everything except the room descriptions.
[Room name.]
Blah, Blah Blah, etc
(this description be up to ten lines long)
Exits are...
North: Room 2
South: Room 3
I have seperate triggers for Name and Exits and capture the info and enter it like this:
#tr {^~[(%*)~] $} {#VAR roominfo %null;#ADDKEY roominfo name {%1}}
#tr {^North:(*)} {#ADDKEY roominfo north {%1}}
So how do I write a trigger that will capture everything between the room name and exits... into the roominfo variable?
Anyone help?
Thanks
Turnip |
|
|
|
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Wed Mar 26, 2003 1:15 pm |
Ok, I've messed about with trigger states and come up with a really nifty trigger, for me anyway :) that incorporates all the individual triggers that I had to capture info before. Problem I'm having is still the same though. I can't seem to capture teh description into a variable and then add it to my database record.
This is what i have do far.
#TRIGGER "CaptureTrigger" {^~[(*)~]} {#VAR roominfo %null;#ADDKEY roominfo name {%1};#var description ""}
#COND "CaptureTrigger" {(*)} {#additem description %1} {LoopLines|param=99}
#COND "CaptureTrigger" {^exits:} {#addkey roominfo desc {@description}}
#COND "CaptureTrigger" {north:%s(%*)} {#co 71;#addkey roominfo n {%1}
#COND "CaptureTrigger" {northeast:%s(%*)} {#co 71;#addkey roominfo ne {%1}}
#COND "CaptureTrigger" {northwest:%s(%*)} {#co 71;#addkey roominfo nw {%1}}
#COND "CaptureTrigger" {east:%s(%*)} {#co 71;#addkey roominfo e {%1}}
#COND "CaptureTrigger" {west:%s(%*)} {#co 71;#addkey roominfo w {%1}}
#COND "CaptureTrigger" {southwest:%s(%*)} {#co 71;#addkey roominfo sw {%1}}
#COND "CaptureTrigger" {south:%s(%*)} {#co 71;#addkey roominfo s {%1}}
#COND "CaptureTrigger" {southeast:%s(%*)} {#co 71;#addkey roominfo se {%1}}
#COND "CaptureTrigger" {up:%s(%*)} {#co 71;#addkey roominfo u {%1}}
#COND "CaptureTrigger" {down:%s(%*)} {#co 71;#addkey roominfo d {%1};#new all roominfo;#var roominfo;#state CaptureTrigger 0}
It all works fine if I take out the bits to do with capturing the decription so I reckon I must be close but that last bit is eluding me.
Thanks in advance
Turnip |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Mar 26, 2003 1:24 pm |
What you are missing is that the first state should create a temporary trigger that advances your multi-state trigger to the next state when it fires. Take a look at the article posted about this in the Support Library. Look at the example for LoopLines. The only difference is that you would most likely create the temporary trigger for the "Exits are" line, so you would remove that state from the multi-state trigger, and that you would not want to go back to state 0 but rather to state 2.
Kjata |
|
|
|
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Wed Mar 26, 2003 1:29 pm |
Kjata,
Thanks, it works perfectly now.
Turnip |
|
|
|
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Wed Mar 26, 2003 4:23 pm |
Hi again
I've got all the info into my database and I'd now like to know if its possible to write a script to create a map from this.
All the room names are unique and there are no "other" exits, only compass directions.
Can this be done and if so, where do I start :)
Turnip |
|
|
|
|
|