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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Mon Dec 08, 2008 4:36 am   

room exit finder
 
This is a typical message from my mudd.
You notice exits north, south, and in.

ERROR: Syntax error in Alias: escape : illegal character in expression: t (I get this error when i use the alias ESCAPE)
variables @roomexits and @escapedir are both automatically set to the value "%1" (without the quotes) when I move around.

This was my set-up from zmud which worked fine, but is not working with cmud.

TRIGGERS
________________________________________________________________
*You notice exits (*).

roomexits = %null
#if (%pos( ", ", "%1")) {
#noop the list has commas
RoomExits = %replace( "%1", " and ", " ")
} {
#noop the list does not have commas
RoomExits = %replace( "%1", " and ", ", ")
}
RoomExits = %replace( @RoomExits, ", ", "|")
#if (%pos( ", ", "%1")) {
#noop the list has commas
RoomExits2 = %replace( "%1", " and ", " ")
} {
#noop the list does not have commas
RoomExits2 = %replace( "%1", " and ", ", ")
}
RoomExits2 = %replace( @RoomExits2, ", ", "|")
removeroom
____________________________________________________________
You notice a single exit, (%w) ~(a closed door~).

#say This is a locked room!
RoomExits = %1 "(a closed door)"
RoomExits2 = %1 "(a closed door)"
removeroom

ALIASES
_____________________________________________________________
REMOVEROOM (this is to remove closed door exits from the roomexits list so that it can be used for auto movement, the roomexits2 list is used for display on the status bar only so I dont want to remove the closed door exits on that list)

#delitem roomexits "north (a closed door)"
#delitem roomexits "northeast (a closed door)"
#delitem roomexits "east (a closed door)"
#delitem roomexits "southeast (a closed door)"
#delitem roomexits "south (a closed door)"
#delitem roomexits "southwest (a closed door)"
#delitem roomexits "west (a closed door)"
#delitem roomexits "northwest (a closed door)"
#delitem roomexits "in (a closed door)"
#delitem roomexits "out (a closed door)"
#delitem roomexits "up (a closed door)"
#delitem roomexits "down (a closed door)"
#delitem roomexits "north (a closed gate)"
#delitem roomexits "northeast (a closed gate)"
#delitem roomexits "east (a closed gate)"
#delitem roomexits "southeast (a closed gate)"
#delitem roomexits "south (a closed gate)"
#delitem roomexits "southwest (a closed gate)"
#delitem roomexits "west (a closed gate)"
#delitem roomexits "northwest (a closed gate)"
#delitem roomexits "in (a closed gate)"
#delitem roomexits "out (a closed gate)"
#delitem roomexits "up (a closed gate)"
#delitem roomexits "down (a closed gate)"
___________________________________________________________________
ESCAPE (panic escape alias using roomexits list)

#if (%numitems( @RoomExits)) {@escapedir = %item( @RoomExits, %random( 1, %numitems( @RoomExits)))} {#noop}
@escapedir


Well this is beyond my cmud skills to debug so I present it here. I think I covered all relevant information.
*waits with fingers crossed*
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Dec 08, 2008 11:11 am   
 
The first thing is that your use of %1 in the script is bad. %1 won't be intpretted when it is in quotes. I would suggest running the Compatibility Report in the Package Editor to help you locate other such problems.

I also reduced the code down some while fixing that one thing. Rather then checking for the presence of commas we simply replace things. We know the "and" will be present a flat replacement of it can result in either ", , " or " , ". By doing a 2 different replacements we are assured to cover both cases. Then using #DELITEM we can remove the blank item when it is present.
Code:
#TRIGGER {^You notice exits (*).$} {
 RoomExits = %replace( %1, "and", ",")
 RoomExits = %replace( @RoomExits, ", ", "|")
 RoomExits = %replace( @RoomExits, " , ", "|")
 #DELITEM RoomExits {}
 RoomExits2=@RoomExits
 removeroom
}

#TRIGGER {^You notice a single exit, (%w) ~(a closed door~).} {
 #say This is a locked room!
 RoomExits = ""
 RoomExits2 = %concat(%1, " (a closed door)")
}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Mon Dec 08, 2008 2:56 pm   
 
The new triggers seem to update the @roomexits list now, but still no luck with @esapedir.
I set @escapedir to a value manually, and it will not change automatically. It just remains at whatever value I set it to.
I don't have a trigger that chooses a value for @escapedir, it is suppose to be picked when I use the ESCAPE alias.
Also when I try to use the alias ESCAPE I get the following:
ERROR: Syntax error in Alias: escape : unmatched braces
Ideas and suggestions are appreciated.
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Mon Dec 08, 2008 4:57 pm   
 
Not sure if this is the problem or not, but when you assign the value to escapedir in your escape alias you have the @ sign in front of escapedir and it shouldn't be there since it is an assignment I don't believe.
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Thu Dec 11, 2008 6:56 am   
 
You notice exits east, south, and west (an open door).
for multiple exits im using the trigger posted above by Vijilante
When I have the open door situation, my @roomexits variable would get set to: east|south|west (an open door)
Is there an easy way to get rid of the (an open door) part, so that its just: east|south|west

I'm experiencing problems with cmud not recognizing spaces for some reason.
for example when I see: You notice a single exit, southwest (an open door).
@roomexits gets the value southwest(an open door) without a space between the direction and the parenthesis
Im really not sure why that happens, but whatever the reason all I need it to do is set the value of @roomexits to the direction of the opening.
This is my trigger:
You notice a single exit, (%w) ~(an open door~).
RoomExits = %1 "(an open door)"
RoomExits2 = %1 "(an open door)"
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Thu Dec 11, 2008 12:29 pm   
 
Quote:
You notice exits east, south, and west (an open door).
for multiple exits im using the trigger posted above by Vijilante
When I have the open door situation, my @roomexits variable would get set to: east|south|west (an open door)
Is there an easy way to get rid of the (an open door) part, so that its just: east|south|west

The easy way based on what you already have is just to another replace to your trigger:
Code:
#TRIGGER {^You notice exits (*).$} {
 RoomExits = %replace( %1, "and", ",")
 RoomExits = %replace( @RoomExits, ", ", "|")
 RoomExits = %replace( @RoomExits, " , ", "|")
 RoomExits = %replace( @RoomExits, " (an open door)", "")
 #DELITEM RoomExits {}
 RoomExits2=@RoomExits
 removeroom
}

If you want the (an open door) part to still be present in RoomExits2 you would have to move the new %replace after you assign the value to RoomExits2 instead.

Quote:
I'm experiencing problems with cmud not recognizing spaces for some reason.
for example when I see: You notice a single exit, southwest (an open door).
@roomexits gets the value southwest(an open door) without a space between the direction and the parenthesis
Im really not sure why that happens, but whatever the reason all I need it to do is set the value of @roomexits to the direction of the opening.
This is my trigger:
You notice a single exit, (%w) ~(an open door~).
RoomExits = %1 "(an open door)"
RoomExits2 = %1 "(an open door)"

The space is getting lost in your assignment to RoomExits. If you change it to the following it should work:
Code:
RoomExits = {%1 (an open door)}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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