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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Thu Mar 08, 2007 10:47 pm   

autobot mapper help
 
Code:
#TRIGGER "multilinecapture" {^-- There {is|are} (%w) obvious {exit|exits}:} {
  #CLR Exits
  #TEMP multilinecaptureend {.$} {#STATE multilinecapture 0}
  #CAP Exits
  }
#COND {} {#CAP Exits} {looppat}


I have been able to capture the exit lines to a seperate window, now i just need to get the directions into variables. any idea? some times the exits are on two lines some times on two.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Mar 09, 2007 7:42 am   
 
A few small additions and minor changes should do it.
Code:
#VARIABLE RoomExits {} {}
#TRIGGER "multilinecapture" {^-- There {is|are} %w obvious {exit|exits}:(*)} {
  #VAR RoomExits {%1}
  #CLR Exits
  #TEMP multilinecaptureend {.$} {#STATE multilinecapture 0;#VAR RoomExits {%subchar(%replace(@RoomExits," and ","|")," ,.","||");#DELITEM RoomExits {}}
  #CAP Exits
  }
#COND {} {#ADDITEM RoomExits {%line}#CAP Exits} {looplines|param=2}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Fri Mar 09, 2007 9:40 pm   
 
Code:
#VAR RoomExits {%subchar(%replace(@RoomExits," and ","|")," ,.","||");#DELITEM RoomExits {}}
                                                                     ^ syntax error


I am currently trying to work through why this error is showing up

if the formating shows wrong the error is pointing at the ; directly before the #DELITEM
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Fri Mar 09, 2007 9:52 pm   
 
You need the } after ) and before #delitem, imo.



Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Sat Mar 10, 2007 3:41 pm   I have got to be close
 
I am just trying to concat the at maximum two lines of room exits and put them into one string, which i will then manipulate into an array or exit commands. Golly this is harder than I would have expected. It seems like sometimes zmud sort of bugs out and starts giving me responses that i wouldn't expect, even though its probably just bad syntax on my part. I thought i was getting close and i have manually typing the #show @RoomExits on the command line after i enter a room and my favorite new response to that comand is "=" .

One other thing is there a simple way to make the second conditional trigger not fire if the first exit line ends in a period. so that i don't get a stinking ogre as a room exit name.
Thanks for any help


Here are possible MUD outputs:

Quote:
-- There are three obvious exits: north, south and east.
A stinking ogre.

Quote:
-- There are three obvious exits: north, south and up.
>

Quote:
-- There are six obvious exits: north, south, west, east, northwest and
northeast.
>



Code:
#CLASS {MapperBot}
#VAR RoomExits {} {}
#TRIGGER "CaptureExits" {-- There [is|are] %w obvious [exit|exits]:(*)} {#VAR RoomExits= %1}
#COND {(*).} {RoomExits= %concat( @RoomExits, %1)} {within|param=1}
#CLASS 0
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Mar 10, 2007 6:13 pm   
 
Before you go any further, does your mud have a word-wrapping function? If it does, simply increasing this to as high as you can go will fix your problem very easily.
_________________
EDIT: I didn't like my old signature
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Sat Mar 10, 2007 6:30 pm   
 
yes it does have that ability but i am playing because i enjoy programming. I am trying to write a mapper bot that will map my whole mud and i am trying to do it in as few lines of code as possible, just for the fun of programming. My friends say that i am too intense and i need a hobby so i decided to mud, kills two birds with one stone. I have used the wrap function to play with this problem. but its more the concept that i am trying to master.

Thanks again for any input.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Mar 11, 2007 12:00 am   
 
In that case, don't use a multi-state trigger. Multi-state triggers are only generally helpful if the lines will always appear rather than only sometimes.

#TRIGGER "CaptureExits" {-- There [is|are] %w obvious [exit|exits]:(*)} {#VAR RoomExits= %1}

2)insert (before or after, it really doesn't matter), an #IF check employing the %ends() function to test for the inclusion of a period. If it exists, the exits are all contained on one line. If it doesn't exist, you need to enable the trigger (your #CONDITION above) that will capture the extra line. This other trigger will also have to turn itself off.
_________________
EDIT: I didn't like my old signature
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: Sun Mar 11, 2007 8:09 pm   Thank God I Finally Figured It Out!!! Thanks For All Your Help.
 
Code:
#TRIGGER "CaptureLines" {-- There [is|are] %w obvious [exit|exits]:(*)} {RoomExits=%1}
#CONDITION {(*).} {
  #IF ((%line ="*.$")|(%concat( %line, ".$")="*.$")) {#STATE CaptureLines 0} {RoomExits=%concat( @RoomExits, " ", %line)}
  #STATE CaptureLines 0
  } {looplines|param=2|notrig}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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