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


Joined: 21 Sep 2010
Posts: 22

PostPosted: Mon Dec 13, 2010 1:07 am   

Script to add items to mapped room
 
Hello, I just purchased CMUD 3.32 and have been scouring the net for scripts to make my gameplay experience more enjoyable.

I play on a MUD called Moral Decay (it's a very uncommon one with a player base of 8 or so LOL) so I do not see any scripts available for it.

I managed to find a thread by Matt Lofton that had a script to map room using this uncommon mud format.

The script I used was

Code:
#oninput "tRoomInfo" {^{@movecommands}$} {
  minimap = ""
  rdesc = ""
}
#condition {^(*)$} {
  #if (%begins(%1,"        The obvious exits are ")) {
    //this is the exits line
    #state tRoomInfo 0
    #call %match(%1,"        The obvious exits are (*).",@rexits)
  } {
    //this is part of the description, check for a minimap
    #if (%pos("   ",%1)) {
      //there's a minimap here
      #additem minimap %left("    ~~~~~       You are at a crossing of two roads. The roads are made",16)
      rdesc = %additem(@rdesc,%right("    ~~~~~       You are at a crossing of two roads. The roads are made",16))
    }
  }
} {manual}
#condition {[b]whatever comes after exits line[/b]} {
  #tag desc %expandlist(@rdesc,%cr)
  #tag exit @rexits
}


I had to slightly edit the strings to make it work on Moral Decay but for the most part it works great!. Inside a town it maps perfectly, outside of town it maps nothing. I am ok with this as outside of town only consists of running to another town and nothing else really.

My question is, is there a way to add to this script or make a new one that will take items inside a room and add it to the list. Even better would be items AND npc's (I don't care if you treat both the same). My goal is just to have an ability to log everything so as I explore it will populate each room with the contents of that room on the map. So if I need to find something in a future reference I can refer to the map for the NPC or ITEM.

Here is an example output of entering a room.

General Store:
This well-lit General Store has served the city of Vesla for all of its
age. Displays house hundreds of items, from the trivial to the vastly
useful. The storekeep must be a neatnick because everything is in its
place. A sign reads, 'Type <list> to see our stock, <sell> to sell an
item, or <buy> to buy one.' A solid door leaves the room behind the
counter; a door through which you are quite sure you will never pass.
After completing your business, you are free, however, to exit north,
back to Park Street.
Obvious exits are: west, east, north

Forrin the blacksmith
A dead corpse
Key
Chainmail
pile of silver coins

>

if it helps make it easier to categorize or find the npc/item to add to the room the game color codes the text.

The Room name and description are always green
the NPC's are always yellow
the items are always blue

so if I need to asign ansi colors to find the items thats fine as well.

So far, the above script will generate a map room and associating doors. I just need to know if it's possible to tweak the script so upon entering the room it will pull data beyond obvious exits and add that to room info.. My plan of action looks like this.

Waitfor line stating " Obvious exits are: " once received
While:
if color is yellow, take this line, add contents of this line to map under NPC's and move on to next line
if color is blue, take this line, add contents of this line to map under ITEMS and move on to next line
if next line is ">"end processing of this room, there are nothing more to process. Wait for a room change.
end while

I hope this is enough information to discern a workable script.

I appreciate everything and look forward to hearing from you guys.
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