|
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: Sat May 10, 2003 3:46 am
room name |
Is there an easy way to capture the room name into a variable? This is a sample of the output when i enter a room
<495hp 231m 610mv 100b>
A Wooden Cave Dwelling
This mound has been hollowed into a small cave with a dark, wooden interior. A
manifold of silver mats line the floor, and chunks of corky, soft wood are
scattered on top. The wood is light in color and appears to have been chewed
upon. In one corner of the room is a small stack of grey pellets. Parts of the
walls have shallow holes bored into them, with flaky piles of wood chips
underneath. A few pieces of crumbly, red earth lie on the floor amongst the
mats.
Some drops of blood can be seen on the ground.
Obvious exits:
East - A Coarse Silver Pathway
Kalus |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sat May 10, 2003 1:45 pm |
Try this (untested):
#ONINPUT {%t} {#T+ getroomname}
#TRIGGER "getroomname" {$(*)$} {#VAR RoomName "%1";#T- getroomname}
Kjata |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun May 11, 2003 1:06 am |
quote:
Try this (untested):
#ONINPUT {%t} {#T+ getroomname}
#TRIGGER "getroomname" {$(*)$} {#VAR RoomName "%1";#T- getroomname}
Kjata
If one's room names are strictly limited to alphabetic characters and spaces (a-z, A-
Z, space), it would probably be worth it to examine every word or a series of words at the beginning for proper case.
#trigger {^(%w*%w)$} {#forall %words(%1," ") {#if (%i=%proper(%1)) {#noop it's ok;Isroomname=1} {#noop whoops, this ain't no room name;Isroomname=0})};#if (@Isroomname) {Roomname = %1} {#noop}}
The above code should work for punctuation-less phrases (like your room name), but because of the wide variety of MUD formats concerning text messages in general I didn't think it would be appropriate to simplify things that much. If you find it's matching other, perhaps longer lines, replacing the #FORALL version of the above loop with a #LOOP equivalent would allow you to limit the length of the loop.
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|
|
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
|
|