Guest User

Untitled

a guest
Jun 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. function mmp.roomFindT(query)
  2.   if query:ends('.') then query = query:sub(1,-2) end
  3.   local result = mmp.searchRoom(query)
  4.  
  5.   if type(result) == "string" or not next(result) then
  6.     cecho("<grey> UNKNOWN.") return end
  7.  
  8.   cecho("<DarkSlateGrey>")
  9.  
  10.  
  11.   if not tonumber(select(2, next(result))) then -- old style
  12.     for roomid, roomname in pairs(result) do roomid = tonumber(roomid)
  13.       cecho(string.format("  <LightSlateGray>%s<DarkSlateGrey> (<blue>",
  14.         tostring(roomname)))
  15.       echoLink(roomid, 'mmp.gotoRoom('..roomid..')', string.format("Go to %s (%s)", roomid, tostring(roomname)))
  16.       cecho(string.format("<DarkSlateGrey>) in the <LightSlateGray>%s<DarkSlateGrey>.\n", tostring(mmp.areatabler[getRoomArea(roomid)])))
  17.     end
  18.  
  19.   else -- new style
  20.     for roomname, roomid in pairs(result) do roomid = tonumber(roomid)
  21.       cecho(string.format("  <LightSlateGray><DarkSlateGrey> (<blue>",
  22.         tostring(roomname)))
  23.       echoLink(roomid, 'mmp.gotoRoom('..roomid..')', string.format("Go to %s (%s)", roomid, tostring(roomname)))
  24.       cecho(string.format("<DarkSlateGrey>) in <yellow>%s<DarkSlateGrey>.\n", tostring(mmp.areatabler[getRoomArea(roomid)])))
  25.     end
  26.   end
  27. end
Add Comment
Please, Sign In to add comment