Advanced Mapper Find

This script will help you find where you are on your zMud map when you get lost. Type "adfind" on the commandline, and the script does a glance in the room you are in, and searches for rooms on your zMud map which have the same room title and exits. If only one is found, your map location is automatically updated. If more than one is found, you are presented with a list of alternatives.

This is more accurate than the zMud inbuilt map search, as it matches against room exits as well as description, so helps in places like the Mouse Trails Sewers where pretty much all of the rooms have the same name. Obviously it is only as good as the maps you are searching, so is reliant on you capturing accurate room titles and exits when you create your maps.

zMud version

#CLASS 0
#ALIAS adfind {
  #t+ AdvancedFind
  #send {!glance}
  }
#CLASS {AdvancedFind}
#REGEX {^(?:>\s|)(.*)\(([a-z,]*)\)$} {
#VAR vCurrName %quote( %trim( %stripq( "%1"))) %null AdvancedFind
#VAR vCurrExits %subchar( "%2", ",", "|") %null AdvancedFind
#VAR vCurrExits %replace( @vCurrExits, "ne", "j")
#VAR vCurrExits %replace( @vCurrExits, "nw", "h")
#VAR vCurrExits %replace( @vCurrExits, "se", "l")
#VAR vCurrExits %replace( @vCurrExits, "sw", "k")
#VAR vCurrExits %sort( @vCurrExits)
#VAR vPossibleRooms %mapquery( {[Name] = %quote( @vCurrName)}) {} AdvancedFind
#VAR vRoomQuery {} {} AdvancedFind
#VAR vRejectQuery {} {} AdvancedFind
#VAR vFinalRooms {} {} AdvancedFind
#IF (%numitems( @vPossibleRooms) == 0) {#ECHO Room Not Found} {
  #IF (%numitems( @vPossibleRooms) == 1) {
    #TELEPORT @vPossibleRooms
    #ECHO Found
    } {
    #FORALL @vPossibleRooms {#IF (%sort( %roomexit( %i)) == @vCurrExits) {
        #ADDITEM vRoomQuery "[ObjID] like '%i'"
        #ADDITEM vFinalRooms %i
        } {#ADDITEM vRejectQuery "[ObjID] like '%i'"}}
    #IF (%numitems( @vFinalRooms) == 1) {
      #TELEPORT @vFinalRooms
      #ECHO Found
      } {#IF (%numitems( @vRoomQuery) > 100) {#ECHO Too Many Matches} {#IF (%numitems( @vRoomQuery) > 0) {#MAPQUERY {%expandlist( @vRoomQuery, ' or ')}} {#MAPQUERY {%expandlist( @vRejectQuery, ' or ')}}}}
    }
  }
#t- AdvancedFind
  }
#CLASS 0

cMud changes to the regex trigger code (modified by Dwolin)

#VAR vCurrName %quote( %trim( %stripq( "%1"))) %null AdvancedFind
#VAR vCurrExits %subchar( %2, ",", "|") %null AdvancedFind
#VAR vCurrExits %replace( @vCurrExits, "ne", "j")
#VAR vCurrExits %replace( @vCurrExits, "nw", "h")
#VAR vCurrExits %replace( @vCurrExits, "se", "l")
#VAR vCurrExits %replace( @vCurrExits, "sw", "k")
#VAR vCurrExits %sort( @vCurrExits)
#VAR vPossibleRooms %mapquery(%concat("[Name] = '",%quote( @vCurrName),"'")) {} AdvancedFind
#VAR vRoomQuery {} {} AdvancedFind
#VAR vRejectQuery {} {} AdvancedFind
#VAR vFinalRooms {} {} AdvancedFind
#IF (%numitems( @vPossibleRooms) == 0) {#ECHO Room Not Found} {
  #IF (%numitems( @vPossibleRooms) == 1) {
    #TELEPORT @vPossibleRooms
    #ECHO Found
    } {
    #FORALL @vPossibleRooms {#IF (%sort( %roomexit( %i)) == @vCurrExits) {
        #ADDITEM vRoomQuery %concat("[ObjID] like '",%i,"'")
        #ADDITEM vFinalRooms %i
        } {#ADDITEM vRejectQuery %concat("[ObjID] like '",%i,"'")}}
    #IF (%numitems( @vFinalRooms) == 1) {
      #TELEPORT @vFinalRooms
      #ECHO Found
MORE:  21-40 (48) 83% (help ?) 
      } {#IF (%numitems( @vRoomQuery) > 100) {#ECHO Too Many Matches} {#IF
(%numitems( @vRoomQuery) > 0) {#MAPQUERY {%expandlist( @vRoomQuery, " or ")}}
{#MAPQUERY {%expandlist( @vRejectQuery, " or ")}}}}
    }
  }
#t- AdvancedFind
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License