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
Brenex
Beginner


Joined: 13 May 2008
Posts: 25

PostPosted: Tue May 13, 2008 3:04 pm   

Problem with simple trigger
 
Hey everyone, I'm trying to get a trigger to set off to make a door in a direction specified by the output of the MUD. Simple enough. The output looks like:
Code:
[Exits: (north) south (west)]


With the parenthesis marking the door direction. Sometimes it works but other times when I enter a room it places the door with correct direction on the previous room (instead of the room I just entered.) Here is my trigger (with repeat within line checked.:)
Code:
~(([north|south|east|west])~)


Any ideas?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue May 13, 2008 3:48 pm   
 
You've given us the trigger, but it might be useful to see the value of the trigger too.

When this happens, is it correctly updating your location on the map? If not, the problem is with the room matching.

Do you really have square brackets [] in that trigger? I believe you want curly brackets {} instead. I'm surprised this is working at all if you have square brackets.
Reply with quote
Brenex
Beginner


Joined: 13 May 2008
Posts: 25

PostPosted: Tue May 13, 2008 4:16 pm   
 
Oops sorry, #DOOR %1. I switched the square brackets to curly brackets (must have been thinking in regular expression mode while messing with that earlier.) And it does correctly find my location, it creates a new room when I move into it and places me inside it. Just creates the door in the direction in the last room I just left.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue May 13, 2008 4:33 pm   
 
Hm. Does it still have a problem now that you have the curly braces? I don't think that's the problem, but want to check.

You say it's working some of the time but not always? I wonder if somehow it is not matching the room and updating the map location until after this trigger fires sometimes. If that's the problem, a crude solution would be to put a #wait before the #door command. But I'd rather see if there's a better solution. It might have to do with your mapper configuration, and how it is matching the new rooms. I'm not sure how much help I can give there.
Reply with quote
Brenex
Beginner


Joined: 13 May 2008
Posts: 25

PostPosted: Tue May 13, 2008 4:45 pm   
 
[Curly brackets didn't fix it] Actually I retried it and it doesn't work in the rooms I thought it did at first. Suffers from the same problem. Even with a #WAIT it still places the door on the previous room instead of the one I entered. Go figure. Perhaps it would be better to use a regular expression rather than using repeat within line.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue May 13, 2008 5:50 pm   
 
Your pattern should be
Code:
~(({north|south|east|west})~)


Sounds like you found out about the 'Repeat within line' option already, which is good.

Try using an onRoomCreate event handler to tell you when the room is actually created. You should be able to create your doors there, after you've saved the door directions in a variable string list with your trigger above.
Reply with quote
Brenex
Beginner


Joined: 13 May 2008
Posts: 25

PostPosted: Tue May 13, 2008 6:17 pm   
 
Alright thanks Larkin, works now with a #FORALL door_direction string list. I was looking though and saw the OnRoomEnter event and was thinking that if I use that event I can fix doors that perhaps were open when I created the room but are now closed for a second walk through but the variable won't clear with door_direction="" at the end of the event like it does with OnRoomCreate.'

*EDIT* Actually I just made the OnRoomCreate event do a forall and then made the OnRoomEnter be:
Code:
#IF (@door_direction !="") {door_direction = ""}

which clears it. The problem was that if I went into a room that isn't created but still sets the door_direction variable, on a room create it would place that door in that room since the door_direction wasn't empty. If there is a better way let me know. Thanks!
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