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
Zenith_AU
Newbie


Joined: 22 Jan 2018
Posts: 4
Location: Australia

PostPosted: Mon Jan 22, 2018 6:05 am   

Automap script assistance
 
The MUD I play has an automap feature (essentially a 5x5 grid enclosed in square brackets) included in the room description text, eg:

Code:
Room Name
[^ 1  ] Room flavour text describing the contents
[^ #  ] of the room that you're currently
[^#@3#] standing in
[^%2?%]
[^%##?]
[Exits: north (south) east west]


There are a couple of things I'd like to achieve:

1) Capturing the automap text into a new window and hide/gag it from the main window (I'm hoping this will hide it from the automapper in CMUD as it doesn't like playing with MUD map). I'd need the window to clear/refresh with each time I move (the optional extra would be to also refresh when I 'look' as mobs - indicated by numbers - may have moved).
2) The Exits text puts brackets around any exit with a door (in the example I gave, (south) is a closed door). It'd be nice if I could get CMUD's mapper to understand this - I have modified the #NODIR trigger example listed in the manual so I can bump into doors to register them but it'd be nice if I could manage to be a bit smarter about it.

I'm not expecting someone to write this for me - I'm just new to this and floundering a little. If someone could push me in the right direction I'm should hopefully be able to figure it out for myself.

I tried using #C+ for the automap but couldn't figure out how to refine how much it was capturing, and of course it was just capturing an ongoing list of text rather than clearing/refreshing with each move.

Edited for clarity.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3825
Location: Pensacola, FL, USA

PostPosted: Mon Jan 22, 2018 5:48 pm   
 
You are on the right track with #C+.
#C- turns it back off, you just need to figure when.
#GAGON and #GAGOFF are the reciprocal commands for squelching the text.

And that's where a new state on your trigger comes in (set to within lines, 1)

Code:
#TR {Here is the map:} {
  #EXECWIN Map {#CLR}
  #C+ Map
  #GAGON
  }
#COND {*} {
  #IF (%begins(%trim(%line), "[")) {
    #STATE 1
    } {
    #C-
    #GAGOFF
    }
  } {within|param=1}

Something like that should work.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3825
Location: Pensacola, FL, USA

PostPosted: Tue Jan 23, 2018 3:41 am   
 
Alternatively, you could do:

Code:
#TR {(~[[%d%s%p]~]) } {
  #IF ((%len(%1)=7) {
    #SUB {}
    #WIN Map %1
    }
  }


and then do something like this to clear the map window:
#EVENT onRoomEnter {#EXECWIN Map {#CLR}}
But you would need to have the mapper following along with you for that to work properly.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Zenith_AU
Newbie


Joined: 22 Jan 2018
Posts: 4
Location: Australia

PostPosted: Tue Jan 23, 2018 8:36 am   
 
shalimar wrote:
Alternatively, you could do:

Code:
#TR {(~[[%d%s%p]~]) } {
  #IF ((%len(%1)=7) {
    #SUB {}
    #WIN Map %1
    }
  }


and then do something like this to clear the map window:
#EVENT onRoomEnter {#EXECWIN Map {#CLR}}
But you would need to have the mapper following along with you for that to work properly.

Okay, I'm part-way there.

The #TR ended up needing to be:
Code:
(~[[%d%s%p%a]~])


To get a successful pattern match.

I also discovered that on looking closer that the automap has spaces between each room, so I increased the value of #IF ((%len(%1)=7) up to 11 (#IF ((%len(%1)=11)) as that would be the total width including the square brackets and previously missed spaces.

Here it seems is where I'm stuck though - I don't understand the conversion between the code you post here (in the many threads I've looked at) and how to put that correctly into the Package Editor in CMUD. To see what I'm currently doing (and probably have a good chuckle at my foolishness - it's okay, I would too), this is the XML currently:

Code:

<trigger name="map" priority="300" id="30>
   <pattern>(~[[%d%s%p%a]~])</pattern>
   <value>#IF ((%len(%1)=11) {
    #SUB {}
    #WIN Map %1
   } </value>
</trigger>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3825
Location: Pensacola, FL, USA

PostPosted: Tue Jan 23, 2018 8:49 am   
 
What I posted is zScript and it can be entered directly into the command line to create a setting, which you can then find via the settings editor.
You keep posting the XML of the setting, which I can understand just fine but I tend to answer without even having CMUD open half the time.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Zenith_AU
Newbie


Joined: 22 Jan 2018
Posts: 4
Location: Australia

PostPosted: Tue Jan 23, 2018 9:31 am   
 
Sweet, I deleted what I'd made and just copy/pasted into the command line and it's working almost 100% along with the EVENT to clear the map (I always have the CMUD mapper open so that's fine).

The only minor issue I've discovered is that any room with a healer (displayed as H) throws it a bit of a curve ball. The character is not displayed in the Map window and the remainder of that line is in a blue colour. I'll fiddle with it to see if I can figure out what's causing that. That's the only issue thus far (and it's not particularly significant).

Speaking of colour, is it possible to capture the ANSI colours from the automap into the Map window? A quick read of the commands and functions seems to say no but I thought I'd ask someone who actually knows what they're doing.

Edit: Ahh... so, due to me connecting remotely from my work laptop with a tiny screen to my media PC at home, I'd missed that there are angle brackets on either side of the 'centre' room. The H displays correctly from adjacent rooms but when you move into the room it must not like the <H>.

Thanks so much for all the assistance you've provided.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3825
Location: Pensacola, FL, USA

PostPosted: Tue Jan 23, 2018 4:42 pm   
 
Not without also grabbing the text of the room description... the first example would be better for that.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3825
Location: Pensacola, FL, USA

PostPosted: Tue Jan 23, 2018 8:01 pm   
 
I should say, just use #CAP instead of #WIN to preserve colors.
But #CAP sends the whole line.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Zenith_AU
Newbie


Joined: 22 Jan 2018
Posts: 4
Location: Australia

PostPosted: Wed Jan 24, 2018 5:01 am   
 
Okay, attempting the first code example returns a Parse error "expression expected".

I'm usually not this helpless. When my work swing finishes in a week and I'm back home I think I need to sit quietly with the manual and do some proper reading instead of hurried glances between jobs.
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