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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed May 19, 2010 9:12 am   

Mapping with ATCP and Room Descriptions
 
While the mapper works great with 3.17, the one problem I have is that it does not map any of the room descriptions because oddly this information does not get sent via ATCP. I can get everything else including the environment of the room, but not the description.

There are a couple of problems I have regarding this. First, I can create a trigger to capture the line immediately after the room name. The problem with this method is that it captures the weather information, which changes, as well as any items in the room and people in the room. Secondly, it is broken into multiple parts.

For instance, in Achaea a typical room description is like:

Quote:
A room name.
The stars twinkle. The actual description. There is a plant here. Blah blah stands here. You may enter NEWS from this location.


That's a crude representation of what you see, but you get the point. The problem is that I need to capture the actual description, excluding the weather information, any plants or items or people standing there, and INCLUDE information like You may enter NEWS here or WILDERNESS here etc. Yet I can't use ANSI trigger because they are different colors, and I am not sure how to do it.

How do I capture the actual COMPLETE room descriptions? How can I break this up so I can also record items in the room and so on? I don't use ansi triggers much.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed May 19, 2010 3:00 pm   
 
The easiest way to create an ANSI trigger is to open the Package Editor, create a blank trigger, set it to ANSI Trigger, then cut and paste an example of the line you want to trigger on. Then edit it as needed. If you set it to ANSI Trigger before pasting into the trigger pattern, the pattern should contain the appropriate ANSI codes for the colors.

If the part you want is always a particular color, and the only example of that color in the description line, it should not be too hard. Just change the specific text to an * between the ANSI codes in the pattern.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed May 19, 2010 3:20 pm   
 
Here is a simple configuration class for the mapper. Most of the triggers are nomap and nodir.

The main point is how I am capturing the description.

This is for Achaea though so maybe it will help a little.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="MapCap" copy="yes">
    <event event="onPrompt" priority="25" copy="yes">
      <value>#if (@newlook==1) {
#Tag name @Roomname
#tag description @DescriptionPara
#tag exitpara @Room_exits_Line
#tag prompt
newlook=0}</value>
    </event>
    <trigger priority="9" ansi="true" copy="yes">
      <pattern>%e~[1~;34mYou*exit*</pattern>
      <value>#T- DescriptionP
#Nomap</value>
    </trigger>
    <trigger priority="53" ansi="true" copy="yes">
      <pattern>^%e~[33~;44m(*)</pattern>
      <value>DescriptionPara=%null
#T+ DescriptionP</value>
      <notes>^\033\[33m</notes>
    </trigger>
    <trigger name="DescriptionP" priority="1992100" ansi="true" copy="yes">
      <pattern>^%e[1;32m(*?)%e[0m</pattern>
      <value>#if (@DescriptionPara=%null) {
  DescriptionPara=%stripansi(%1)} {
  $pos=%pos(%e,%1)
  #if ($pos>0)
    {DescriptionPara=%concat(@DescriptionPara,%cr,%stripansi(%left(%1,$pos)))}
    {DescriptionPara=%concat(@DescriptionPara,%cr,%1)}
 }</value>
      <notes>#if (%null(@DescriptionPara)) {
  DescriptionPara=%stripansi(%left(%1,%pos(%e,%1)))}
 {
  DescriptionPara=%concat(@DescriptionPara,%cr,%stripansi(%left(%1,%pos(%e,%1))))
 }</notes>
    </trigger>
    <trigger type="Telnet" param="200" priority="2038930" copy="yes">
      <pattern>Room.Exits (*)</pattern>
      <value>Room_exits_Line=%sort( %subchar(%1, ",", "|"))</value>
    </trigger>
    <trigger type="Telnet" param="200" priority="2038930" copy="yes">
      <pattern>Room.Brief (*)</pattern>
      <value>$roomname=%1
roomname=$roomname
newlook=1
#raiseevent onroomenter</value>
    </trigger>
    <class name="NoMapC" copy="yes">
      <trigger priority="1210" prompt="true" copy="yes">
        <pattern>There are no obvious exits.</pattern>
        <value>#tag exit ""
#nomap</value>
      </trigger>
      <trigger priority="1720" regex="true" copy="yes">
        <pattern>.*follows you \a+\.$|You begin moving your frozen body slowly \w+\.</pattern>
        <value>#nomap</value>
      </trigger>
      <trigger priority="1730" copy="yes">
        <pattern>You begin to steadily swim (%w)</pattern>
        <value>#nomap</value>
      </trigger>
      <trigger priority="2110" copy="yes">
        <pattern>Now now, don't be so hasty!</pattern>
        <value>#Nomap
stopwalk
#move %reversedir(@nextstep)
#if (@walk==1)
 {
  madeIt=1
  cwalk
 }</value>
      </trigger>
      <trigger priority="22570" copy="yes">
        <pattern>You pass over the surface of the water.</pattern>
        <value>#nomap</value>
      </trigger>
      <trigger priority="22600" prompt="true" copy="yes">
        <pattern>You pass through an open %w.$</pattern>
        <value>#nomap</value>
      </trigger>
      <trigger priority="22610" prompt="true" copy="yes">
        <pattern>You pass through an open door[. ]$</pattern>
        <value>#nomap;#if (%maplocked = 0) {#door %lastdir()}</value>
      </trigger>
      <trigger priority="22770" trigontrig="false" copy="yes">
        <pattern>You remove * key from inside</pattern>
        <value>#nomap</value>
      </trigger>
      <trigger priority="22790" trigontrig="false" copy="yes">
        <pattern>You unlock the door.</pattern>
        <value>#nomap</value>
      </trigger>
    </class>
    <class name="NoDirC" copy="yes">
      <trigger priority="1400" regex="true" copy="yes">
        <pattern>There is no exit in that direction.|You are regaining balance and are unable to move.|You are recovering equilibrium and cannot move yet.|The forest seems to close up before you and you are prevented from moving that</pattern>
        <value>#nodir
#nomap
stopwalk</value>
      </trigger>
      <trigger priority="1950" copy="yes">
        <pattern>There is no exit in that direction.</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="22810" copy="yes">
        <pattern>The undergrowth is too thick to pass that way[. ]$</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="22820" copy="yes">
        <pattern>There is a door that way, and it is shut[. ]$</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="22830" copy="yes">
        <pattern>You can't go that way!</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="22840" copy="yes">
        <pattern>You will either need to swim, or use a boat to go that way[. ]$</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="22850" copy="yes">
        <pattern>Your steed refuses to set foot in the water[. ]$</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="1610" ansi="true" copy="yes">
        <pattern>^%e~[37mThere~'s water ahead of you.</pattern>
        <value>#nodir</value>
      </trigger>
      <trigger priority="1630" regex="true" copy="yes">
        <pattern>^There is a door in the way\.\s?$</pattern>
        <value>#nodir</value>
      </trigger>
    </class>
    <class name="MSurveyC" copy="yes">
      <alias name="msurvey" autoappend="true" copy="yes">
        <value>#if (%maplocked=1) {
  #NOOP %maplocked( 0)
  survey = 1
  }
#send {Survey}</value>
      </alias>
      <var name="survey" copy="yes">1</var>
      <trigger priority="22750" copy="yes">
        <pattern>You survey your surroundings and conclude that they conform to the standards</pattern>
      </trigger>
    </class>
    <var name="NewLook" usedef="true" copy="yes">
      <value>0</value>
      <default>0</default>
    </var>
    <var name="roomname" usedef="true" copy="yes"/>
    <var name="Room_exits_Line" usedef="true" copy="yes"/>
    <var name="DescriptionPara" usedef="true" copy="yes"/>
  </class>
</cmud>
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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