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
haiku
Wanderer


Joined: 19 Nov 2004
Posts: 70

PostPosted: Sun Aug 05, 2007 1:55 am   

Generic trigger questions, best practices, etc
 
One of the reasons I was writing a mud client in Ruby was so that I could rethink my (mostly) procedural method of writing triggers. What I planned to do this time was make an OO bot, where my character (an object) interacted with the various room object which would have methods and whatnot themselves. The zMud mapper never worked well with the particular mud that I play on (I guess I should say that only one person was ever able to make it work at all, and it was very buggy even then). On this particular mud, the room descriptions can change based on things you (or others) have done. Instead of writing procedural bots based on one line of the room description or something, what I'd like to do is write a bot based on a room object - which is loaded based on the information in the entire text of the room description. Is there any way I can create Room objects that I navigate through, where they can have alternate rdescs?

Eventually, I'd like to have my character object have a figureOutWhereIAm() method (say for instance I get summoned somewhere) that searches through a database of rdescs and alternate rdescs. I guess the main problem is that after a few programming classes and after a year or so of actual programming experience, the bots that I wrote 2-3 years ago make me ill to look over and debug (part of the reason I'm going to try out cMud... I'd like to scrap all my triggers and start over.)

Any advice would be appreciated. :)
Reply with quote
haiku
Wanderer


Joined: 19 Nov 2004
Posts: 70

PostPosted: Sun Aug 05, 2007 2:04 am   
 
I guess I'm essentially looking for a mud trigger design patterns course :)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Aug 05, 2007 2:31 am   
 
What do the room names/descriptions/exits look like, exactly, on this MUD?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
haiku
Wanderer


Joined: 19 Nov 2004
Posts: 70

PostPosted: Sun Aug 05, 2007 2:41 am   
 
Great North Road <-- Room title.
[Exits: north south west] <-- exits

You can barely see the outline of the road, as it is quite obscured by
weeds and bits of dark gray stones. The faint outline of the passage can
move bush <-- procedural trigger kicked off by the previous line
just be seen going north and west. A rocky hill lies to your east,
showing many signs of weathering. Several shrubs, covered with prickly
brown thorns, grow just in front of the hill. <-- rdesc

<h|1078hp 373e 318mv 318wm 74961076xp NSW> You pull aside the bush, revealing a cave to the east. (note that the exits are also in the prompt)

<h|1078hp 373e 318mv 318wm 74961076xp NESW> <-- prompt (note that the exits in the prompt change) Rooms that have exits that are doors would have the exit in lower case, e.g. <h|1078hp 373e 318mv 318wm 74961076xp NEsW>

The <h| part of the prompt indicates that I'm hidden. There are multiple flags that can be in the prompt P, S, B, and they can stack so you might see hBPS to indicate that you are hidden in a pkill zone, burdened and in a safe (sanc) room.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Aug 05, 2007 3:09 am   
 
If your only aim is to get the mapper working, my response is that you're probably making this (much) harder than you need to. The mapper doesn't need to know the room description - it only actually needs the exits. The name helps for obvious reasons, but in cases such as yours, the description just makes things more complex. You can leave it out without causing any problems. So something like this should work:

#trig {^~[Exits: *~]$} {#tag name %line2;#tag exit %line}

If this is causing false positives you could make the pattern more exact by using a regex along the lines of

#regex {^[Exits:( north)?( east)?( south)?( west)?]$} {#tag name %line2;#tag exit %line}

that'll probably need tweaking but I'm sure you get the idea.

It'll be even easier to get the trigger matching only your exit line if your exit line is in a different colour by using the line colour or ANSI trigger options. With ANSI trigger, you can turn on the option and then paste coloured text copied from the MUD and it'll recreate the colour codes in the pattern for you, giving you something like %e[56m to represent the colour. In regex, you need to provide the escape code yourself rather than using %e - the regex equivalent of that example is \033\[56m.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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