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
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Thu May 06, 2004 7:30 pm   

Automapping the automapping
 
I have experimented some if it is possible to make a script to automatically build a map of an area. So far this seems to work now and then and sometimes it doesn't work at all Smile.

If someone would find it fun to try some mapping like this you can try the script below out. Don't blame me if anything goes wrong though.

Code:

#CLASS {mapmaker}
#ALIAS explore {
  #noop // Is there some unexplored exit in this room?
  #if (@lastroom=%roomnum( )) {
    #echo I am stuck! Trying to recover!
    #nodir
    unexplored = %delitem( @lastroom, @unexplored)
    ignorerooms=%push( @lastroom|@lastexit, @ignorerooms)
    }
  counter=0
  exit=%item( exits, @counter)
  #forall @exits {
    #if (%roomlink( , %i) = -2) {
      #if (not %ismember( %roomnum( )|%i, @ignorerooms)) {
        exit=%i
        counter=%eval( @counter+1)
        }
      }
    }
  #if (@exit!=%null) {
    #noop // We found an exit. If we have unexplored exits left add this location to the 'unexplored' list.
    #if (@counter>1) {unexplored=%push( %roomnum( ), @unexplored)}
    lastroom=%roomnum( )
    lastexit=@exit
    #exec @exit
    } {
    #noop // No exit found. Do we have any in the 'unexplored' list?
    #if (@unexplored!=%null) {
      roomnumber=%pop( unexplored)
      lastroom=%roomnum( )
      #walk @roomnumber
      } {
      #echo Exploration Finished
      #t- autoexplorer
      }
    }
  }
#VAR unexplored {}
#VAR exits {north|south|east|west|up|down}
#VAR ignorerooms {}
#ALARM "autoexplorer" {-1} {#if (%inwalk( )=false) {explore}} "" {disable}
#BUTTON 1 {Auto-map} {
  unexplored=""
  ignorerooms=""
  lastexit=""
  lastroom=""
  #if (%maplocked( )==false) {#t+ autoexplorer} {#echo Mapper not in mapping mode!}
  } {} {#t- autoexplorer} {%class(autoexplorer)} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {autoexplorerbutton}
#CLASS 0
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Wed Sep 08, 2004 11:01 am   Re: Automapping the automapping
 
Testing automatic syntax-colouring.

#CLASS {mapmaker}
#ALIAS
 explore {
  #noop
 // Is there some unexplored exit in this room?
  #if
 (@lastroom=%roomnum( )) {
    #echo
 I am stuck! Trying to recover!
    #nodir

    unexplored 
= %delitem( @lastroom, @unexplored)
    ignorerooms
=%push( @lastroom|@lastexit, @ignorerooms)
    
}
  counter
=0
  exit
=%item( exits, @counter)
  #forall
 @exits {
    #if
 (%roomlink( , %i) = -2) {
      #if
 (not %ismember( %roomnum( )|%i, @ignorerooms)) {
        exit
=%i
        counter
=%eval( @counter+1)
        
}
      
}
    
}
  #if
 (@exit!=%null) {
    #noop
 // We found an exit. If we have unexplored exits left add this location to the 'unexplored' list.
    #if
 (@counter>1) {unexplored=%push( %roomnum( ), @unexplored)}
    lastroom
=%roomnum( )
    lastexit
=@exit
    #exec
 @exit
    
} {
    #noop
 // No exit found. Do we have any in the 'unexplored' list?
    #if
 (@unexplored!=%null) {
      roomnumber
=%pop( unexplored)
      lastroom
=%roomnum( )
      #walk
 @roomnumber
      
} {
      #echo
 Exploration Finished
      #t
- autoexplorer
      
}
    
}
  
}
#VAR
 unexplored {}
#VAR
 exits {north|south|east|west|up|down}
#VAR
 ignorerooms {}
#ALARM
 "autoexplorer" {-1} {#if (%inwalk( )=false) {explore}} "" {disable}
#BUTTON
 1 {Auto-map} {
  unexplored
=""
  ignorerooms
=""
  lastexit
=""
  lastroom
=""
  #if
 (%maplocked( )==false) {#t+ autoexplorer} {#echo Mapper not in mapping mode!}
  
} {} {#t- autoexplorer} {%class(autoexplorer)} {1} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {autoexplorerbutton}
#CLASS
 0
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