|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Mon Mar 19, 2007 9:24 pm
any easy way to capture a paragraph |
basically i am still working on my uber tiny super automapper class.
One issue i have is there is no way that i know of to show the room name and the room description at the same time. So i have to do a glance to get the room name and a look to get the room description.
anyhow when i am randomly wandering around i get some interesting text that appears between rooms sometimes. I will put an example below. My goal is to figure out how to write one trigger which will capture the room description and only the room description for all of the below senerios. I can sort of see one way to do it, if i was to somehow write a multiline capture trigger and create seperatations based on paragraphs and then somehow just set the room description to the last paragraph captured... that seems like it would work most of the time.
Anyone have some better idea's?
before you look to closly at all these rooms. i cut and pasted several examples all together so somtimes the rooms that i am showing arn't really contigous in the game.
Quote: |
> n
You walk north along Kortal Road.
Kortal Road runs through the forest here on a relentless north/south path. The sun
streams in through a break in the trees, overhead, but darkness is the rule in the forest.
Underbrush has taken the opportunity to flourish here in the presence of the sun, thus
making it difficult to get a good glimpse into the woods. Immediately north, the road
drops down into a rocky ravine. In the distance, it looks like the forest ends; mountains
are visible on the horizon, peaking through the clouds. To the south, Kortal Road cuts
through the forest. A path leads east.
-- There are three obvious exits: north, south and east.
A hungry bear.
> n
You walk north along Kortal Road, approaching the end of the ravine.
The ground is sandy and the air is dry here. Small boulders lie about and smaller
plants try to eek out a meager existence in the boulders' shade. Large, black monolithic
fragments of rock dot the wasteland and provide an unusual feature to the otherwise
desolate and uninteresting landscape. A large cliff looms overhead immediately to the
south. In the distant north, another cliff appears to demark the northern boundary of the
wasteland.
A dusty road cuts across the wasteland here on its relentless north/south path between
the cliffs. Directly to the south, the road exits the wasteland through a giant fissure
in the face of the cliffs.
There are obsidian monoliths to the north and northwest.
-- There are six obvious exits: north, east, west, northeast, northwest
and south.
> n
You push your way through the underbrush and find yourself on a path....
The underbrush surrounding the narrow trail upon which you stand is lush, tangled, and
has been so a very long time. The signs of recent trailblazing are here. Clean cut
stumps adorn the underbrush, freshly cut branches and vines lay about, and dirt has been
kicked up. Overhead, you make out the trunks of large evergreen trees, and sunlight
filters in through the canopy. The trail runs north, but deadends to the south where it
looks like the trailblazers gave up.
-- There is one obvious exit: north.
> n
You walk north down the muddy road.
At this point, the road splits off of the main road. It is lined with low shrubbery,
and heads toward an open field where colored tents of all shapes and sizes have been
erected. The road is quite muddy, and you have to step carefully to keep your boots from
becoming stuck.
-- There are two obvious exits: east and south.
A loud hawker.
> A hawker shouts: Your attention please...
A hawker shouts: Your attendance is requested at the Fair.
A hawker shouts: Just a short distance from here; follow the wagon tracks...
e
You slip and slide your way up the muddy road.
It's a traveling Fair! Although it appears as if the troupe has just arrived, already
the tents have been erected and various performers can be seen practicing their crafts. A
large, blue and white tent lies directly to the north, protecting the workers inside from
the dry winds and blistering heat.
-- There are two obvious exits: west and east.
> w
You push aside a small bush and head down the path. After a series of tortuous twists and
turns, you are hopelessly lost.
Sheer panic grips you as you tear through the forest, finally bursting out into a small
clearing.
This is a small glade in the middle of a dense forest. Thick, overgrown vegetation and
ominous shadows border the clearing. The distinctive smell of roasting meat wafts across
the meadow. Suddenly, the wind changes direction, and it is gone. Small, dark shadows
streak across the sky, heading off to the west. In the distance, you hear a shrill cry.
-- There are two obvious exits: east and west.
> w
You head for the source of the smoke.
This is the western end of the glade. A freshly killed piece of meat lies skewered
over a small campfire at the edge of the trees. There is also a mysterious device
sticking out of the ground, like a pole, but with a 'T' shape at the top. It does not
reveal its purpose. Small, dark shadows circle overhead. Over the wind, you hear a
shrill cry.
-- There are two obvious exits: east and west.
A strange young man.
> The strange young man invokes Llardin......
The strange young man's skin turns into thick bark and he sprouts a fine crop of leaves.
w
You enter the darkness of the forest.
As the glaciers of the north receded to the ice plains, they carved their path through
this area, leaving behind this stone ravine. Walls of sheer rock rise before you on two
sides, without even a crack to wedge your hands or feet into.
-- There are three obvious exits: north, east and southeast.
A gray wolf.
> n
You trip on some loose gravel.
You fall on your feet like a cat.
>>> You are now in good shape. <<<
> n
You head north, out of the ravine, and back towards the forest.
Tall trees and dense foliage cover this area in complete darkness. Under your feet,
the ground is no longer soft; the low moss that once cushioned your feet has given way to
gnarled tree roots and gray rock. Even the wind has ceased, leaving you feeling utterly
alone.
-- There are four obvious exits: north, south, east and west.
> e
You scramble halfway up the incline before stumbling and sliding back down.
> e
You scramble up the rise and out of the ravine. A moment later, you stumble out of the
forest.
This is the western end of the glade. A freshly killed piece of meat lies skewered
over a small campfire at the edge of the trees. There is also a mysterious device
sticking out of the ground, like a pole, but with a 'T' shape at the top. It does not
reveal its purpose. Small, dark shadows circle overhead. Over the wind, you hear a
shrill cry.
-- There are two obvious exits: east and west.
A strange young man.
> > e
You follow the path into the forest. In a matter of minutes, you are completely twisted
up and turned around. You aimlessly wander the forest hoping to maintain a southern
course as best you can.
Finally, you spy some light up ahead and race towards it. pushing aside a small bush, you
step out into the light...
The grassy field ends at this point, being bordered by a lush forest to the west and
north. Just north of here, a bizarre green and brown tent sits at the edge of the forest,
almost blending in with the landscape. Directly south lies a large blue and white tent.
It appears that something exciting is going on inside, as you can hear wild applause and
notice a steady stream of people entering. The path you are on continues to the east.
-- There are four obvious exits: west, north, south and east.
> |
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Mar 20, 2007 2:00 am |
It would appear that your correct as to the best method for doing it. Since you already have some triggers designed to handle portions of it I am not going to suggest a complex multistate trigger. Instead something quite simple.
#VAR TempDescCap {} {}
#VAR RoomDesc {} {}
#TRIGGER "DescCap" {*} {#IF (%begins(%line,">")) {#T- DescCap;RoomDesc="";TempDescCap=""} {#IF (%line="") {RoomDesc=%right(TempDescCap,1);TempDescCap=""} {TempDescCap=%concat(@TempDescCap,%cr,%line)}}} "" {prompt}
#ONINPUT {^{ne|nw|se|sw|n|e|s|w|u|d}$} {#T+ DescCap;RoomDesc="";TempDescCap=""}
You should be able to add that to your existing class. You will have to put #T- DescCap into your exit line trigger, and at that point it should have the right stuff in the RoomDesc variable. I am also going to include some really old script I have laying around from a project I did involving automatic mapping of a mud. Of course I was granted immortal access since I was doing it for the admin of the mud. Make of it what you will, this is only a snippet of the full script; but I thought you might like a few ideas.
Code: |
#CLASS {AutomatedMapping}
#ALIAS UScan {Unfinished="";Scanning=1;#WHILE (@UScanNum<=%numrooms) {#FORALL %roomexit(%mapvnum(@UScanNum)) {#IF (%roomlink(%mapvnum(@UScanNum),%j)=-2) {#IF (%ismember(%j,%db(@Exclude,%mapvnum(@UScanNum)))=0) {#ADDKEY Unfinished {%mapvnum(@UScanNum)} {%additem(%j,%db(@Unfinished,%mapvnum(@UScanNum)))}}}};#ADD UScanNum 1};Scanning=0}
#ALIAS AutoStep {#IF (@DirQueue) {#ECHO Error DirQueue not empty!!! Autostepping shut off.;DoAuto=0} {Stepping=@RoomVNum;#IF (%db(@Unfinished,@RoomVnum)!="") {#ADDITEM Stepping {%item(%db(@Unfinished,@RoomVnum),1)};#EXEC %item(@Stepping,2);#T+ StepDetect} {#IF (%numkeys(@Unfinished)) {goto %word(%word(%expanddb(@Unfinished),%numkeys(@Unfinished)),1,"=");#T+ StepDetect}}}}
#VAR Unfinished {}
#VAR Stepping {} {}
#VAR DoAuto {0} {0}
#VAR Scanning {0} {0}
#VAR Exclude {}
#VAR UnavailableRooms {35091|28111|28411|28711|6875|28311|28511|35123|28911|637|28611|8133|18823|8708|35010|27388}
#VAR StatErrF {}
#VAR UScanNum {1}
#VAR ErrIndex {0} {0}
#TRIGGER "StepDetect" ((@DirQueue="")) {} "" {disable}
#COND {*.501} {#T- StepDetect;#IF (%numitems(@Stepping)=2) {#IF (%numitems(%db(@Unfinished,%item(@Stepping,1)))>1) {#ADDKEY Unfinished {%item(@Stepping,1)} {%delitem(%item(@Stepping,2),%db(@Unfinished,%item(@Stepping,1)))}} {#DELKEY Unfinished {%item(@Stepping,1)}};Stepping="";#FORALL %roomexit {#IF (%roomlink(,%i)=-2) {#ADDITEM Stepping {%i}}};#IF (@Stepping) {#ADDKEY Unfinished {@RoomVnum} {@Stepping}}};#IF (%numkeys(@Unfinished)) {#IF (%numitems(@DirQueue)) {#ECHO Error, DirQueue not emptied!!! Retrying in 2 seconds.;#ALARM +2 {AutoStep}} {#IF (@DoAuto) {AutoStep}}} {DoAuto=0}} {alarm|disable}
#TRIGGER {{Zone change|Maze detected!}$} {DoAuto=0}
#BUTTON 996 "AutoStep %if(@DoAuto,On,Off)" {DoAuto=%eval(!@DoAuto);#IF (@DoAuto) {AutoStep}} {} {} {} {} {} {Size} {80} {23} {Pos} {4} {1} {} {} {} {} "" {} {} {}
#BUTTON 997 "%if(%btnenable(ErrorBtn,%if((@DoAuto=0)&(@AutoStat=0)&(@ErrIndex<%numkeys(@StatErrF)),1,0)))Errors: %numkeys(@StatErrF)" {#ADD ErrIndex 1;#IF (@ErrIndex<=%numkeys(@StatErrF)) {#T+ RoomStatCap;#IF (@StatVnum=%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),1)) {#INPUT {%walk(%db(@StatExits,%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),2)))};#T- RoomStatCap} {stat room %word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),1)}} {#TELEPORT @RoomVnum;#INPUT No more errors found}} {} {} {%numkeys(@StatErrF)} {} {} {Size} {160} {13} {Pos} {0} {180} {32832} {} {Gauge||14|100|10|10} {} "" {Explore|Inset} {} {ErrorBtn}
#BUTTON 998 "%if(%btnenable(ErrorDelete,%if(@ErrIndex,1)))Err:@ErrIndex%if(@ErrIndex, -%word(%expanddb(@StatErrF,~"=~",~" ~"),@ErrIndex,~"=~"))" {#IF (%numitems(%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),2))>1) {#ADDKEY StatErrF {%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),1)} {%delnitem(%db(@StatErrF,%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),1)),1)};#ADD ErrIndex -1} {#DELKEY StatErrF {%word(%word(%expanddb(@StatErrF,"="," "),@ErrIndex,"="),1)};#ADD ErrIndex -1}} {} {} {@ErrIndex} {} {} {Size} {160} {15} {Pos} {15} {180} {} {} {Gauge||12|%numkeys(@StatErrF)||7} {} "" {Explore|Inset} {} {ErrorDelete}
#BUTTON 999 "%if(%btnenable(ErrOff,%if((@ErrIndex)|(@RoomVnum!=%roomvnum),1)))X" {ErrIndex=0;#TELEPORT @RoomVnum;#FREEZE 0} {} {} {} {} {} {Size} {30} {30} {Pos} {0} {341} {} {} {} {} "" {} {} {ErrOff}
#STAT {Unfinished: %numkeys(@Unfinished) %if(@Scanning,Scan: @UScanNum of %numrooms)}
#CLASS 0 |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Tue Mar 20, 2007 2:25 am |
another idea is ansi, can you set the ansi vars on your mud? some ideas of things i do is putting strange chars in the ansi such as Ñ.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 20, 2007 3:12 am |
Question about that code Vijilante - why do you use %mapvnum(@UScanNum)? UScanNum will always be the VNum anyway, won't it (since the script ranges it from 1-%numrooms, which is the same as vnums). Will %roomexit and %roomlink not take an integer as their parameter, only the number returned from %mapvnum? Or is there some other reason I'm not seeing?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Mar 20, 2007 4:34 am |
Lets say you create rooms 1-10. Then delete room 6 and 7, then add rooms 11 and 12. %numrooms will give 10, the vNums for them being 1, 2, 3, 4, 5, 8, 9, 10, 11, 12. Also, for example, you could set the vNum of the 12th room made to 387, and the first to 254. Then looking for a vNum of 1 won't work. Hence the %mapvnum function.
%roomexit and %roomlink look for the vNum as long as that is the setting in %roommode. So I have to make sure I have the proper matching values. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Tue Mar 20, 2007 8:58 pm |
whats %line="" do? catch a blank line?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Mar 21, 2007 1:45 am |
Yes. %line is the last line received from the MUD, and it's checking if it's null, blank.
|
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Wed Mar 21, 2007 10:21 pm |
can i use the state command to loop a state? if the type is set to pattern?
Ie.
#trigger {*} {#if (%line = "") {state 0} {#if (%begin(%line, "-- there")) {state 1} {state 0}}}
so would this loop state 0 over and over till the %line began with "-- there? then jump to state 1? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Mar 21, 2007 11:25 pm |
Yes, but it'd be much easier just to do:
#trig {^-- there} {}
#cond {} {}
You also don't need to explicitly set the state to 1, since it'll move on its own once the trigger's script has finished. |
|
|
|
|
|
|
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
|
|