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


Joined: 13 May 2012
Posts: 6

PostPosted: Sun May 13, 2012 11:55 pm   

CMUD built in mapper problem
 
To all the guru's out there, your help is greatly appreciated. I've put this question off for 8-10 years or so and am finally fed up with lack of success :P

trigger {^~[&vnum~] &rname ~[ &flags ~] ~[&sectorType~]$} {#GAG;#ECHO @rname~. [@vnum];;}

ROOM DESC:
Quote:
[ 14] The Aiel Project Room [ INDOORS GODROOM PROOF ] [Inside]
This room will be totally dedicated to the running of the Aiel World expansion,
as stated the post regarding future expansion on board 1. We will be spreading
east, and starting a PK enviroment between aiel and wetlands; thus setting the
scene of the Aiel War. Before we can do so, we have to have to set a fair
environment for Aiels to exp and PK and get reasonable eq. The board here is
for you to accumulate ANY information regarding Aiel, any ideas, and wants,
anything.
[ Exits: n ]
A board to discuss the weaving of the Waste floats here.


The trigger makes the first line change to:
Quote:
The Aiel Project Room. [ 14]


Problems:
1: The trigger takes the vnum (14), saves it into the room properties on the map. But when I select "show room numbers" it shows the order of creation rather than the VNUM (14). How do I fix this so that the map shows the room's IN GAME vnum as the room number?

2. The trigger causes the mapper to incorrectly interpret the first line of the description as the room name for ~25% of the rooms created. (note: 75% are captured correctly, and this error does not occur when the trigger is turned off.

3. I tried, and failed miserably, for a way to color code the map rooms by the room flags.
AKA. INDOORS would show as brown, ROAD would show as dark gray, etc.?

Thanks again guys!
-Rob
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon May 14, 2012 2:20 am   
 
1) is easy. Type the following command:
Code:
#CALL %roommode(0)


2) We will need more information. Are the rooms consistent--that is, if a particular room does not fire the trigger correctly, does that room always fail to fire the trigger correctly? If so, give us the actual text from the mud for that room, and the resulting output from your trigger. Otherwise, can you identify anything consistent about the failures?

3) The following code should get you started:
Code:

#GAG
$flaglist = %replace(@flags, " ", "|")
#SWITCH (%ismember("INDOORS", $flaglist)) {$namecolor = "brown"}
  (%ismember("ROAD", $flaglist)) {$namecolor = "darkgray"}
  (%ismember("PLAINS", $flaglist)) {$namecolor = "green"}
  {$namecolor = "default"}

#SHOW {<color $namecolor>@rname~.</color> [@vnum];;}

See the documentation for %colorname for the list of color names (but beware that some appear to be broken for now)
Reply with quote
rjt027
Newbie


Joined: 13 May 2012
Posts: 6

PostPosted: Mon May 14, 2012 2:42 am   
 
First, All room setups are identical.

Second:
Quote:
A Worn Path. [ 2603]
The worn path which runs throughout the canyon housing Whispering Springs Hold
comes to a junction here. To the north lies the entrance to the hold, while to
the east and west the path runs to the most visited shops the hold has to
offer. To the south the path takes an upward slope towards the three levels of
the hold hosting the Roofs of each of the societies as well as the Roof of the
Hold's Roofmistress and the Roof of the Wise Ones.
[ Exits: n e s w ]


This room causes:
Room Name:
Quote:
The worn path which runs throughout the canyon housing Whispering Springs Hold

rather than "A Worn Path" as it should be.


Quote:
Entrance to Whispering Springs Hold. [ 2601]
The opening here forms a narrow pass, which prevents large numbers of people
from entering the hold quickly during battle. The high walls of the canyon to
the east and west provide shade here throughout most of the day, making it easy
for concealed guards to surprise unwanted visitors. To the north lie the
dangers of life in the Three-fold land, while to the south lies the relative
safety of the Whispering Springs Hold.
[ Exits: n s ]
A metal-cased oil lamp suspended from the ceiling rests here. (LIT)
A hardened Aethan Dor leader, wielding a short thrusting spear and a short thrusting spear is standing here.


This and most others cause proper depositing of the room name "Entrance to Whispering Springs Hold."

EDIT: I just noticed that... it seems to be the SHORTER room names that cause this problem. I changed the problem room name listed above to be "A Worn PathA Worn PathA Worn PathA Worn Path" and it stored properly. Ran into another room labelled "A Worn Path" (not the same as the first), and it occurred again.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon May 14, 2012 3:37 am   
 
1)you can't change which number the Show Room Numbers displays on the map canvas. At any rate, why would you want all that clutter? You cannot customize where it appears (always to the upper right), and with large zones you will quickly end up with an unreadable mass of gibberish.

If you are willing to hammer out the details for the mouseover hints, you can show that info using the special tags of <vnum>, <id>, and <name> (plus a couple more), as well as the output of various mapper-related functions. For example, I use this in Aardwolf:
Quote:

%roomname(<id>)\n%if(%roomid(<id>) = ""," ",%roomid(<id>))\n#<id> (<vnum>)\n%if(%ismember(%roomzone(<id>),"8|57|156|164|239|250|269"),%right(%item(%roomnote(<id>),1),5),%if(%copy(%roomnote(<id>),4,1) = 0,"The Continent of Mesolar",%case(%copy(%roomnote(<id>),4,1),"The Southern Ocean","Gelidus","The Dark Continent, Abend","Alagh, the Blood Lands","The Uncharted Oceans","Vidblain, the Ever Dark")))


to show a 4-line mouseover hint like so:
Quote:

Among the Philosophes
questor
#12345 (34034)
The Continent of Mesolar


The first line is the actual room name assigned to the room object. Second line is the short name I set for the room. Third line is the room key (the number used by the mapper) with the in-game vnum in parentheses. The fourth line will be the name of the continent this room's zone is in; if the current zone happens to be one of the continent zones, it will display the in-game coordinates assigned to the room.

2)Use #TAG. I find #TAG to be preferable, myself, since I might wish to alter the formatting in some way and I've almost always have another scripting project related to the external use of the room data. Might as well kill two birds with one stone. Tips and tricks:

a)Use a multi-state trigger to match the whole thing, or as much of it as possible. Depending on what you want to handle, this might just be one trigger with 8 states or it could be two triggers with 4 states each. By using a multi-state trigger, you can guarantee the order of patternmatching so that nothing fires out of turn or has a chance to match on something unintended.

b)Plan carefully. Are there any further projects you might want the room info data for? As an IMM or whatever staffers are called in your game, is there anything you won't see as a normal player or when you are on the normal player level with your IMM? Incorporating these things can cut out any complexities involving overlapping triggers or differing mapper configs that might mess up your data because something didn't fire or took too long to load.

c)when building #TAG triggers (or anything that incorporates things like the mapper or database stuff), use a command like #CW as a testing command to see what exactly your trigger pattern and code is doing. The first try at something is generally going to have mistakes, and for something like a map or db file that will eventually have potentially many thousands of records you don't want mistakes creeping in and either ruining your file or undoing a bunch of your hard work. #TAG is generally as simple as these test commands, so they act as convenient placeholders.

As for the trigger, try this out:
Code:

#trigger "tRoomInfo" {~[([%s%d])~] ([%w%s]) ~[ ([%w%s]) ~] ~[(%w)~]$} {
  RNum = %trim(%1)
  RName = %trim(%2)
  RFlags = %3
  RTerrain = %4
  RDesc = ""
  RExits = "-1|-1|-1|-1|-1|-1"
  RItems = ""
  RPeople = ""
}
#condition {(*)} {
  //this state handles description and the exits line
  #if (%match(%1,"~[ Exits: ([newsud]) ~]",$exits)) {
    //put stuff you want to do to the $exits variable here
    //I use a system of numbers to indicate the exit type and state:
    //-1 for not there, 0 for a regular exit, 1 for a closed door, and 2 for a locked door
    RExits = $exits
    #state tRoomInfo 2
  } {
    Rdesc = %additem(%1,@Rdesc)
  }
} {manual}
#condition {(*)} {
  //this state handles what comes after the exits line and the prompt (you didn't show it, though)
  #if (%match(%1,"your prompt pattern goes here")) {
    //stuff to do with the prompt info goes here
    #tag name @RName
    #tag vnum @RNum
    #if (@RDesc != "") {
      //this makes the desc show in multiline format like it appeared on your screen, rather than the stringlist format it was stored in (variables don't evaluate properly with CRLF characters in their data)
      #tag desc %expandlist(@RDesc,%cr)
    } {
      //this is to properly handle any room that might have a blank description, as using the @RDesc variable when empty causes CMud to misinterpret the #TAG reference as "tag the matched line as the desc"
      #tag desc ""
    }
    #tag exit @Rexits
    #tag prompt
    #state tRoomInfo 0
  } {
    RItems = %additem(%1,@RItems)
  }
} {manual}


You seemed to have a handle on subbing, so I didn't put that in (but instead of #gag and #echo, try out #SUBSTITUTE instead). Be sure to run the configuration wizard again so that the mapper will incorporate this trigger.

3)for this, check out the %roomcol() function. This sets the room object's color, as seen in the Room Properties window (click on the color palette icon in the Room Properties window). This function accepts two arguments, the room number and the color to set. Since you want to color the current room, you would use this: #call %roomcol(,color goes here). You can use any of the color names (it's in the help files, under the #COLOR command if I recall), an RGB value, or the 16-color colorset used by #CW/#COLOR/color syntax color codes. Your best bet would be to create an OnRoomCreate event and putting that #call command in it, as this event is automatically raised by CMud.
_________________
EDIT: I didn't like my old signature
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