This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LDDestroier's profile picture

Text disappears from monitor after resizing, even after 'redrawing'

Started by LDDestroier, 20 July 2015 - 04:55 PM
LDDestroier #1
Posted 20 July 2015 - 06:55 PM
I was testing my minimap program, and just for sh*ts and giggles, I tried getting it to work with monitors. And I wanted it to work really well, and by that I mean redraw the whole screen if the monitor is resized, detected with the monitor_resize and term_resize events. But when it redraws (which I tell you works otherwise!) after breaking a block from the top of the monitor (it's like, 3x5), it redraws without any text. I see the border and the area where the list of commands are located, but no text. When I add a layer of monitors on top of the monitor it's using, then it only partially redraws the text, but not all of it. When I either place or destroy monitors on the left (and maybe right) side(s), no text disappears, and everything looks fine. That's what makes me think this is a bug rather than a programming mistake. Although I could be wrong.

Code to program:
Spoiler

-- 'Map' (GPS Minimap) by EldidiStroyrr (LDDestroier)
-- This program can be copied, and it can be modified, but it
-- can NOT be copied, modified slightly, and then claimed as your own original project.
-- You must give me, EldidiStroyrr, credit for the creation and
-- only reference yourself as some guy who changed a bit.
--Get with
-- pastebin get x9ajKSc0 map
pastebinID = "x9ajKSc0"
local mapVersion = "1.3.4" --Version of Map. Must be string.
parentDir = "/" .. fs.getDir(shell.getRunningProgram())
if fs.isReadOnly(shell.resolve(shell.getRunningProgram())) then --In case Map is located in a write-protected directory.
waypointFile = "/.waypoints"
mapConfigFile = "/.map_conf"
else
waypointFile = "/" .. fs.combine(parentDir, ".waypoints")
mapConfigFile = "/" .. fs.combine(parentDir, "/.map_conf")
end
function updateMapProgram()
if not fs.isReadOnly(shell.resolve(shell.getRunningProgram())) then
  mapName = shell.getRunningProgram()
else
  mapName = fs.getName(shell.getRunningProgram())
end
local updateFile = http.get("http://pastebin.com/raw.php?i=" .. pastebinID).readAll()
local file = fs.open(mapName, "w")
file.write(updateFile)
file.close()
return fs.getSize(mapName)
end
if term.isColor() then
colormode = true
grayAllowed = true
else
colormode = false
if _CC_VERSION then
  grayAllowed = true
else
  grayAllowed = false
end
end
local tArg = {...}
if tArg[1] ~= nil then
if tArg[1] == "cc" then
  if fs.exists(mapConfigFile) then
   fs.delete(mapConfigFile)
   print("Config cleared.")
  else
   print("No config to clear.")
  end
  return
elseif tArg[1] == "cw" then
  if fs.exists(waypointFile) then
   fs.delete(waypointFile)
   print("Waypoints cleared.")
  else
   print("No waypoints to clear.")
  end
  return
elseif tArg[1] == "update" then
  write("Updating " .. shell.getRunningProgram() .. "...")
  local mapName = shell.getRunningProgram()
  local fileSize = updateMapProgram()
  print("done (got " .. fs.getSize(mapName) .. " bytes)")
  return true
end
if tArg[1] ~= "mon" then
  term.redirect(term.native())
end
end
function runMapProgramAlready() --This is to allow me to run pcall on the program.
function waitUntil(param)
repeat sleep(0) until param
return param
end
function defineMapBorders()
scr_x, scr_y = term.getSize()
if not monitorMode then
  mapCorners = { --Top left corner, bottom right corner
   {
    2,
    2,
   },
   {
    scr_x - 1,
    scr_y - 6,
   }
  }
else
  mapCorners = {
   {
    1,
    1,
   },
   {
    scr_x,
    scr_y - 3,
   }
  }
end
corner1 = mapCorners[1]
corner2 = mapCorners[2]
midPoint = {
  math.floor((corner1[1] + corner2[1]) / 2),
  math.floor((corner1[2] + corner2[2]) / 2)
}
mapDimensions = {
  corner2[1] - corner1[1],
  corner2[2] - corner1[2]
}
end
--[[ In case adding this to the config messes something up, I want to easily fix it.
mapColors = { --This controls most of the colors in the program, except for some hardcoded colors. If you are using a normal computer, grayscale or not, colors will not be pulled from this list.
  colors.gray, --Background color
  colors.white, --Border color
  colors.yellow, --Waypoint color
  colors.red, --Off-screen waypoint text color
  colors.lightBlue, --Player color
  colors.black, --Command screen text color
  colors.lightGray, --Command screen background color
  colors.red --Background color if not connected to a GPS server
}

directionSensitivity = 0.15 --This is used to prevent the arrow on the middle of the screen from going crazy.
--]]
displayStuffs = true
currentlyConnected = false --We don't know, so assume false because of glitch with numpad
isConnected = true --We still don't know, and it's just safer to assume false because of visual bugs
arrows = {
">",
"v",
"<",
"^"
}
youChar = "O" --This used to be a config item, too bad it was useless. Luckily, it was replaced with many, much more useful options for you to screw up.
playerChar = youChar
function displayTitleScreen()
term.clear()
term.setCursorPos(1,1)
if term.isColor() then
  paintutils.drawImage(mapTitleScreen_adv, 1, 1)
else
  if grayAllowed then
   paintutils.drawImage(mapTitleScreen_gray, 1, 1)
  else
   paintutils.drawImage(mapTitleScreen_norm, 1, 1)
  end
end
sleep(0.1)
repeat
  event, param1 = os.pullEvent()
until event == "key" or event == "mouse_click" or event == "monitor_touch"
end
function getConfig(mode)
if not fs.exists(waypointFile) then
  file = fs.open(waypointFile, "w")
  file.write({})
  file.close()
end
file = fs.open(waypointFile, "r")
contents = file.readAll()
contents = textutils.unserialize(contents)
file.close()
waypoints = {}
for a = 1, #contents do
  table.insert(waypoints, contents[a])
end

--This part has been modified to automatically fix missing config options, at the cost of the inability to add custom ones. Sorry, but this is more useful.
spoofMode = false
scaleFactor = 0.25
displayTitle = false
labelMode = true
waypointChar = '*'
blankChar = ' '
refreshSleep = 0.4
autoUpdate = false
turtleMode = false
keyAgoesRight = false
mapColors = { --This controls most of the colors in the program, except for some hardcoded colors. If you are using a normal computer, grayscale or not, colors will not be pulled from this list.
  colors.gray, --Background color
  colors.white, --Border color
  colors.yellow, --Default waypoint color
  colors.red, --Off-screen waypoint text color
  colors.lightBlue, --Player color
  colors.black, --Command screen text color
  colors.lightGray, --Command screen background color
  colors.red, --Background color if not connected to a GPS server
}
directionSensitivity = 0.15 --This is used to prevent the arrow on the middle of the screen from going crazy.
monitorTextScale = 0.5 --This determines what scale factor the text has if Map is being ran on a monitor.

shell.run(mapConfigFile) --Get the existing config options.

refreshOtherConfig() --Set the config file to what the variables are.

if not monitorTextScale then --This whole bit is for monitors, should you be arsed to use them with this.
  monitorTextScale = 0.5
end
if monitorTextScale < 0.5 then
  monitorTextScale = 0.5
elseif monitorTextScale > 5 then
  monitorTextScale = 5
end
if type(monitorTextScale) ~= "number" then
  monitorTextScale = 0.5
end
mon = peripheral.find("monitor")
if mon then
  mon.setTextScale(monitorTextScale)
end
if mode == "waypoint" then
  return waypoints
else
  return contents
end
end
function set(list) --Used to check if a phrase is in a table. Straight from StackOverflow, by Jon Ericson.
local set = {}
for _, l in ipairs(list) do
  set[l] = true
end
return set
end
function stringToColor(color)
local stringColors = {"white","orange","magneta","lightBlue","yellow","lime","pink","gray","lightGray","cyan","purple","blue","brown","green","red","black"}
local numberColors = {colors.white,colors.orange,colors.magneta,colors.lightBlue,colors.yellow,colors.lime,colors.pink,colors.gray,colors.lightGray,colors.cyan,colors.purple,colors.blue,colors.brown,colors.green,colors.red,colors.black}
if string.sub(color, 1, 7) == "colors." then
  local color = string.sub(color, 8)
end
for a = 1, #stringColors do
  if string.lower(color) == string.lower(stringColors[a]) then
   return numberColors[a]
  end
end
return false
end
function setConfig(pointname, mode, x, y, z, derf)
config = getConfig("waypoint")
file = fs.open(waypointFile, "w")
if mode == "delete" then
  for a = 1, #config do
   point = config[a]
   if point[1] == pointname then
    table.remove(config, a)
    file.writeLine(textutils.serialize(config))
    file.close()
    getConfig()
    return true
   end
  end
  file.close()
  return false
elseif mode == "add" then
  if x == nil or y == nil or z == nil then
   file.close()
   return false
  end
  table.insert(config, {pointname, x, y, z, derf})
  file.writeLine(textutils.serialize(config))
  file.close()
elseif mode == "rename" then
  for a = 1, #config do
   point = config[a]
   if point[1] == pointname then
    table.remove(point, 1)
    table.insert(point, 1, x)
    file.writeLine(textutils.serialize(config))
    file.close()
    getConfig()
    return true
   end
  end
  file.close()
  return false
end
getConfig()
file.close()
end
function refreshOtherConfig()
file = fs.open(mapConfigFile, "w")
settings = {
  {
   "spoofMode = " .. tostring(spoofMode),
   "boolean, set true if testing program in emulator. Replaces gps movement detection with arrow keys. Default: false",
  },
  {
   "scaleFactor = " .. tostring(scaleFactor),
   "number, the zoom factor for the minimap. Lower means wider range. Does not affect GPS range. Default: 0.25",
  },
  {
   "displayTitle = " .. tostring(displayTitle),
   "boolean, whether or not to display the title screen. I find it kind of garish, but I already did the work. Default: false",
  },
  {
   "labelMode = " .. tostring(labelMode),
   "boolean, true if waypoint labels are their names, false if their distances. Default: true",
  },
  {
   "waypointChar = '" .. tostring(waypointChar) .. "'",
   "string, the character that waypoints on the map are represented by. Default: '*'",
  },
  {
   "blankChar = '" .. tostring(blankChar) .. "'",
   "string, the blank character that the inside of the map is made of. Default: ' '",
  },
  {
   "refreshSleep = " .. tostring(refreshSleep),
   "number, the delay between each GPS request. Default: 0.4",
  },
  {
   "autoUpdate = " .. tostring(autoUpdate),
   "boolean, whether or not Map automatically updates to the latest version. this is reccommended FALSE because new updates could break the program into a state where it can't update again. Default: false",
  },
  {
   "turtleMode = " .. tostring(turtleMode),
   "boolean, whether Map should be tuned to turtle controlling. Especially useful if used in conjunction with Lyqyd's NSH. Default: false",
  },
  {
   "keyAgoesRight = " .. tostring(keyAgoesRight),
   "boolean, determines whether to invert the left/right turtle turning controls. Requires turtleMode=true. This option exists because the 'A' button turns the turtle left on the map, but not in minecraft world. Default: false",
  },
  {
   "mapColors = " .. textutils.serialize(mapColors),
   "table, there are 8 items in this array, and this controls most of the colors in the program, except for some hardcoded colors and for normal computers. The colors are, in sequence: background color, border color, waypoint color, offscreen waypoint arrow color, direction indicator color, command screen text color, command screen background color, background color if not connected to GPS. Do not input any values into this config option that isn't a color, or the program will crash. Default: {colors.gray, colors.white, colors.yellow, colors.red, colors.lightBlue, colors.black, colors.lightGray, colors.red}",
  },
  {
   "directionSensitivity = " .. tostring(directionSensitivity),
   "number, this is used to prevent the arrow on the middle of the screen from going crazy. it will only change the middle indicator if you move that amount of meters. Default: 0.15",
  },
  {
   "monitorTextScale = " .. tostring(monitorTextScale),
   "number, this determines what scale factor the text has if Map is being ran on a monitor. Default: 0.5",
  },
}
file.writeLine("-" .. "- Do not break the format of this config.")
file.writeLine("-" .. "- This is for EldidiStroyrr/LDDestroier's 'Map' (GPS Minimap). Do 'map cc' to fix broken config.")
file.writeLine("-" .. "- This config has been last used on version " .. mapVersion .. ", for reference.")
for a = 1, #settings do
  file.writeLine(settings[a][1] .. "  -" .. "-" .. settings[a][2])
end
file.writeLine("")
file.close()
end
function round(num, idp)
local mult=10^(idp or 0)
return math.floor(num * mult + 0.5 ) / mult
end
function setDefaultBackgroundColor()
if isConnected then
  if colormode then
   term.setBackgroundColor(mapColors[1])
  else
   if grayAllowed then
    term.setBackgroundColor(colors.gray)
   else
    term.setBackgroundColor(colors.black)
   end
  end
else
  if colormode then
   term.setBackgroundColor(mapColors[8])
  else
   term.setBackgroundColor(colors.white)
  end
end
end
function setDefaultTextColor()
if colormode then
  term.setTextColor(mapColors[2])
else
  if isConnected then
   term.setTextColor(colors.white)
  else
   term.setTextColor(colors.black)
  end
end
end
function setDefaultColors()
setDefaultTextColor()
setDefaultBackgroundColor()
end
function getCoordinates()
if spoofMode then
  isConnected = true
  currentlyConnected = true
  return {fakeX, fakeY, fakeZ}
else
  local coord_x, coord_y, coord_z = gps.locate(0.75)
  if coord_x == nil then
   currentlyConnected = false
   if displayStuffs then
    term.setCursorPos(2,1)
    if colormode then
	 term.setTextColor(colors.lightGray)
    else
	 term.setTextColor(colors.white)
    end
   end
   if isConnected then
    if displayStuffs then
	 term.clearLine()
	 print("GPS not found...searching")
    end
    for a = 1, 5 do
	 local coord_x, coord_y, coord_z = gps.locate(1)
    end
    if displayStuffs then
	 if coord_x == nil then
	  term.clearLine()
	 end
    end
   end
  end
  if coord_x == nil then
   isConnected = false
   return nil
  else
   isConnected = true
   currentlyConnected = true
   return {coord_x, coord_y, coord_z}
  end
end
end
function flashScreen(times)
if (not times) or (type(times) ~= "number") then
  times = 1
end
if colormode or grayAllowed then
  flashes = {
   colors.black,
   colors.gray,
   colors.lightGray,
   colors.white,
   colors.lightGray,
   colors.gray,
  }
else
  flashes = {
   colors.black,
   colors.white,
  }
end
local flashDelay = 0 --Delay between each frame in the flash.
for a = 1, times do
  for b = 1, #flashes do
   term.setBackgroundColor(flashes[b])
   term.clear()
   sleep(flashDelay)
  end
end
flashes = nil
setDefaultColors()
end
function clearMap()
if displayStuffs then
  setDefaultColors()
  local buffX = corner1[1] + 1
  local mapLengthInner = (corner2[1]) - (corner1[1]) - 1
  local longBlankChar1 = string.rep(blankChar, mapLengthInner)
  longBlackCharHalf = string.rep(blankChar, math.floor(mapLengthInner/2))
  for y = corner1[2] + 1, corner2[2] - 1 do
   term.setCursorPos(buffX,y)
   if y == math.floor(midPoint[2]) then
    write(longBlackCharHalf)
    term.setCursorPos(midPoint[1]+1,y)
    write(longBlackCharHalf)
   else
    write(longBlankChar1)
   end
  end
  local buffX = corner1[1] - 1
  for y = corner1[2], corner2[2] do
   term.setCursorPos(buffX,y)
   write(" ") --I do " " because 'blankChar' is for the inside of the map.
  end
  local buffX = corner2[1] + 1
  for y = corner1[2], corner2[2] do
   term.setCursorPos(buffX,y)
   write(" ") --Same here.
  end
  if isConnected then
   buffY = corner1[2] - 1
   term.setCursorPos(1,buffY)
   term.clearLine()
  end
end
return
end
function drawBorder()
--Drawing border. Always is drawn first.
defineMapBorders()
if displayStuffs then
  if colormode then
   term.setTextColor(colors.lightGray)
   term.setBackgroundColor(mapColors[2])
  else
   if isConnected then
    term.setTextColor(colors.white)
    term.setBackgroundColor(colors.white)
   else
    if grayAllowed then
	 term.setTextColor(colors.white)
	 term.setBackgroundColor(colors.gray)
    else
	 term.setTextColor(colors.white)
	 term.setBackgroundColor(colors.black)
    end
   end
  end
  local mapLength = corner2[1] - corner1[1]
  local mapHeight = corner2[2] - corner1[2]
  local longMapChar = string.rep(" ", mapLength)
  local longMapCharHalf = string.rep(" ", math.floor(mapLength/2))
  term.setCursorPos(corner1[1],corner1[2])
  write(longMapCharHalf)
  term.setCursorPos(midPoint[1]+1,corner1[2])
  write(longMapCharHalf)
  term.setCursorPos(corner1[1],corner2[2])
  write(longMapChar)
  for b = corner1[2], corner2[2] do
   term.setCursorPos(corner1[1],B)/>
   if b ~= midPoint[2] then
    write(" ")
   else
    write("X")
   end
  end
  for b = corner1[2], corner2[2] do
   term.setCursorPos(corner2[1],B)/>
   write(" ")
  end
 
  term.setCursorPos(midPoint[1],corner1[2])
  write("Z")
--  term.setCursorPos(corner1[1],midPoint[2])
--  write("X")
  setDefaultColors()
end
return
end
function drawScaleIndicator()
if displayStuffs then
  scaleX = corner1[1] + 1
  if not monitorMode then
   scaleY = corner2[2] + 1
  else
   scaleY = scr_y - 2
  end
  term.setCursorPos(scaleX,scaleY)
  setDefaultColors()
  term.clearLine()
  if isConnected then
   term.setTextColor(colors.white)
  else
   if colormode then
    term.setTextColor(colors.white)
   else
    if grayAllowed then
	 term.setTextColor(colors.gray)
    else
	 term.setTextColor(colors.black)
    end
   end
  end
  write("Scale: ")
  if colormode then
   term.setTextColor(colors.orange)
  else
   if grayAllowed then
    term.setTextColor(colors.lightGray)
   else
    if isConnected then
	 term.setTextColor(colors.white)
    else
	 term.setTextColor(colors.black)
    end
   end
  end
  write(scaleFactor .. "x")
end
end
function renderMap()
getCoordinates()
setDefaultColors()
term.clear()
drawBorder()
renderCommands()
changedDirection = false
while true do
  if displayStuffs then
   wasConnected = true
   repeat
    poses = getCoordinates()
    if not isConnected then
	 if displayStuffs then
	  if colormode then
	   term.setBackgroundColor(colors.red)
	  else
	   term.setBackgroundColor(colors.white)
	  end
	  term.clear()
	  drawBorder()
	  renderCommands()
	  repeat
	   poses = getCoordinates()
	   sleep(0)
	  until isConnected == true
	  setDefaultColors()
	  term.clear()
	  renderCommands()
	  drawBorder()
	 end
    end
   until isConnected == true
   setDefaultColors()
  end
  oldCoord_x = posX
  oldCoord_y = posY
  oldCoord_z = posZ
  posX = poses[1]
  posY = poses[2]
  posZ = poses[3]
  if oldCoord_x ~= nil then
   if math.abs(oldCoord_x - posX) > directionSensitivity or math.abs(oldCoord_z - posZ) > directionSensitivity and not (turtleMode and changedDirection) then
    if math.abs(oldCoord_x - posX) > math.abs(oldCoord_z - posZ) and oldCoord_x - posX > 0 then
	 direction_long = "east"
	 direction = "east"
	 changedDirection = true
    elseif math.abs(oldCoord_x - posX) > math.abs(oldCoord_z - posZ) and oldCoord_x - posX < 0 then
	 direction_long = "west"
	 direction = "west"
	 changedDirection = true
    elseif math.abs(oldCoord_z - posZ) > math.abs(oldCoord_x - posX) and oldCoord_z - posZ > 0 then
	 direction_lat = "south"
	 direction = "south"
	 changedDirection = true
    elseif math.abs(oldCoord_z - posZ) > math.abs(oldCoord_x - posX) and oldCoord_z - posZ < 0 then
	 direction_lat = "north"
	 direction = "north"
	 changedDirection = true
    end
   end
  end
  if displayStuffs then
   setDefaultColors()
   if (oldCoord_x ~= posX or oldCoord_z ~= posZ) then
    drawBorder()
    clearMap()
   end
   if hadCleared then
    drawBorder()
    clearMap()
   end
   hadCleared = false
   if oldCoord_x ~= posX or oldCoord_z ~= posZ or oldCoord_y ~= posY or redrawMap == true then
   redrawMap = false
   for a = 1, #waypoints do
    point = waypoints[a]
    wayX = point[2]
    wayY = point[3]
    wayZ = point[4]
    waypointColor = point[5]
   
    oldItemX = itemX
    oldItemZ = itemZ
   
    itemX = math.ceil((midPoint[1] + (posX - wayX) * scaleFactor))
    itemZ = math.floor((midPoint[2] + (posZ - wayZ) * scaleFactor))
    term.setCursorPos(itemX,itemZ)
    if itemX >= corner1[1] and itemX <= corner2[1] and itemZ <= corner2[2] and itemZ >= corner1[2] then
	 if not (itemX == math.floor(midPoint[1]) and itemZ == math.floor(midPoint[2])) then
	  if isConnected then
	   if ((itemZ == corner1[2] or itemZ == corner2[2]) or (itemX == corner1[1] or itemX == corner2[1])) and ((itemX >= corner1[1] and itemX <= corner2[1]) and (itemZ >= corner1[2] and itemZ <= corner2[2])) then
	    term.setCursorPos(itemX,itemZ)
	    if colormode then
		 if waypointColor then
		  term.setTextColor(waypointColor)
		 else
		  term.setTextColor(mapColors[3])
		 end
		 term.setBackgroundColor(mapColors[2])
	    else
		 if grayAllowed then
		  term.setTextColor(colors.gray)
		  term.setBackgroundColor(colors.white)
		 else
		  term.setTextColor(colors.black)
		  term.setBackgroundColor(colors.white)
		 end
	    end
	   else
	    if colormode then
		 if waypointColor then
		  term.setTextColor(waypointColor)
		 else
		  term.setTextColor(mapColors[3])
		 end
		 term.setBackgroundColor(mapColors[1])
	    else
		 term.setTextColor(colors.white)
		 if grayAllowed then
		  term.setBackgroundColor(colors.gray)
		 else
		  term.setBackgroundColor(colors.black)
		 end
	    end
	   end
	   write(waypointChar)
	  else
	   if colormode then
	    term.setTextColor(mapColors[8])
	   else
	    term.setTextColor(colors.black)
	   end
	  end
	 end
    else
	 if colormode then
	  if waypointColor then
	   term.setTextColor(waypointColor)
	  else
	   term.setTextColor(mapColors[4])
	  end
	  term.setBackgroundColor(mapColors[2])
	 else
	  term.setTextColor(colors.black)
	  term.setBackgroundColor(colors.white)
	 end
	 --To anyone who can replace the code below with something that more accurately represents what direction an offscreen waypoint is in, please do so. I will totally mention you in the code and visible program! And not just in the help screen!
	 if itemX <= corner1[1] and itemZ <= corner2[2] and itemZ >= corner1[2] then
	  term.setCursorPos(corner1[1],itemZ)
	  write("<")
	 elseif itemX <= corner1[1] and itemZ <= corner1[2] then
	  term.setCursorPos(corner1[1],corner1[2])
	  if (itemX+corner1[1]) * -1 >= (itemZ+corner1[2]) * -1 then
	   write("<")
	  else
	   write("^")
	  end
	 elseif itemX <= corner1[1] and itemZ >= corner2[2] then
	  term.setCursorPos(corner1[1],corner2[2])
	  if (itemX+corner1[1]) * -1 >= (itemZ-corner2[2]) then
	   write("<")
	  else
	   write("v")
	  end
	 elseif itemX >= corner2[1] and itemZ <= corner2[2] and itemZ >= corner1[2] then
	  term.setCursorPos(corner2[1],itemZ)
	  write(">")
	 elseif itemX >= corner2[1] and itemZ <= corner1[2] then
	  term.setCursorPos(corner2[1],corner1[2])
	  if (itemX-corner1[1]) >= (itemZ+corner1[2]) * -1 then
	   write(">")
	  else
	   write("^")
	  end
	 elseif itemX >= corner2[1] and itemZ >= corner2[2] then
	  term.setCursorPos(corner2[1],corner2[2])
	  if (itemX-corner2[1]) >= (itemZ-corner2[2]) then
	   write(">")
	  else
	   write("v")
	  end
	 elseif itemX >= corner1[1] and itemX <= corner2[1] and itemZ <= corner1[2] then
	  term.setCursorPos(itemX,corner1[2])
	  write("^")
	 elseif itemX >= corner1[1] and itemX <= corner2[1] and itemZ >= corner2[2] then
	  term.setCursorPos(itemX,corner2[2])
	  write("v")
	 end
	 --Code-that-needs-replacing end.
	
	 if colormode then
	  term.setTextColor(mapColors[3])
	 else
	  term.setTextColor(colors.white)
	  term.setBackgroundColor(colors.black)
	 end
    end
    setDefaultColors()
    if itemZ < corner2[2] + 2 then
	 if labelMode == true then
	  pointName = point[1]
	  pointMidX = math.ceil(itemX - (string.len(pointName) / 2))
	  pointMidZ = itemZ - 1
	  term.setCursorPos(pointMidX,pointMidZ)
	 elseif labelMode == false then
	  pointName = tostring(round(math.sqrt((point[2]-posX)^2 + (point[3]-posY)^2 + (point[4]-posZ)^2), 2))
	  pointMidX = itemX - math.floor(string.len(pointName) / 2)
	  pointMidZ = itemZ - 1
	  term.setCursorPos(pointMidX,pointMidZ)
	 end
	 if pointMidX + string.len(pointName) >= scr_x then
	  subLength = (scr_x - pointMidX) + 1
	  subName = string.sub(pointName, 1, subLength)
	  if pointMidX <= scr_x + 1 then
	   pointName = subName
	  end
	 end
	 if pointMidX <= scr_x then
	  for i = 1, #pointName do
	   labelPosX, labelPosY = term.getCursorPos()
	   term.setCursorPos(labelPosX,labelPosY)
	   if ((labelPosY == corner1[2] or labelPosY == corner2[2]) or (labelPosX == corner1[1] or labelPosX == corner2[1])) and ((labelPosX >= corner1[1] and labelPosX <= corner2[1]) and (labelPosY >= corner1[2] and labelPosY <= corner2[2])) then
	    if colormode then
		 term.setTextColor(mapColors[1])
		 term.setBackgroundColor(mapColors[2])
	    else
		 if grayAllowed then
		  term.setTextColor(colors.gray)
		  term.setBackgroundColor(colors.white)
		 else
		  term.setTextColor(colors.black)
		  term.setBackgroundColor(colors.white)
		 end
	    end
	   else
	    if colormode then
		 term.setTextColor(mapColors[3])
		 term.setBackgroundColor(mapColors[1])
	    else
		 term.setTextColor(colors.white)
		 if grayAllowed then
		  term.setBackgroundColor(colors.gray)
		 else
		  term.setBackgroundColor(colors.black)
		 end
	    end
	   end
	   write(string.sub(pointName, i, i))
	  end
	 end
    end
    setDefaultColors()
   end
   end --Do not remove this end.
   term.setCursorPos(midPoint[1],midPoint[2])  
   if colormode then
    term.setTextColor(mapColors[5])
   else
    if grayAllowed then
	 term.setTextColor(colors.lightGray)
	 if isConnected then
	  term.setBackgroundColor(colors.gray)
	 else
	  term.setBackgroundColor(colors.white)
	 end
    else
	 term.setTextColor(colors.white)
	 if isConnected then
	  term.setBackgroundColor(colors.black)
	 else
	  term.setBackgroundColor(colors.white)
	 end
    end
   end
   if direction == "east" then
    playerChar = ">"
   elseif direction == "west" then
    playerChar = "<"
   elseif direction == "south" then
    playerChar = "v"
   elseif direction == "north" then
    playerChar = "^"
   else
    playerChar = "O"
   end
   write(playerChar)
  end
  if not spoofMode then
   sleep(refreshSleep)
  else
   sleep(0)
  end
end
end
function renderCommands()
commands = {
  "(L)abel/dist",
  "Optio(n)s",
  "E(x)it",
}
if not isConnected then
  term.setCursorPos(2,1)
  if colormode then
   term.setTextColor(colors.gray)
  else
   term.setTextColor(colors.black)
  end
  gpsNotFoundString = "GPS not found."
  print(gpsNotFoundString .. string.rep(" ", scr_x-string.len(gpsNotFoundString)-2))
end
startX = 2
if not monitorMode then
  startY = corner2[2] + 1
else
  startY = scr_y - 3
end
commandX = startX
commandY = startY + 1
if displayStuffs then
--  term.setCursorPos(startX,startY)
--  term.clearLine()
  term.setCursorPos(commandX,commandY)
  if colormode then
   term.setTextColor(mapColors[6])
   term.setBackgroundColor(mapColors[7])
  else
   term.setTextColor(colors.black)
   if grayAllowed then
    term.setBackgroundColor(colors.lightGray)
   else
    term.setBackgroundColor(colors.white)
   end
  end
  term.clearLine()
  for f = 1, #commands do
   comPosX, comPosY = term.getCursorPos()
   scr_x, scr_y = term.getSize()
   if scr_x - comPosX <= string.len(commands[f]) + 1 then
    term.setCursorPos(startX,comPosY+1)
    term.clearLine()
   end
   write(commands[f])
   if not monitorMode then
    if f ~= #commands then
	 write(", ")
    end
   else
    if f < 2 then
	 write(", ")
    end
   end
  end
  drawScaleIndicator()
end
return
end
function displayHelp()
term.setCursorPos(1,2)
if colormode then
  term.setTextColor(colors.orange)
end
print(" 'Map v1.3' is a GPS minimap program made by EldidiStroyrr (LDDestroier).")
setDefaultColors()
print(" * 'map cc' clears config.")
print(" * 'map cw' clears waypoints.")
print(" * A red screen means no access to a GPS server.")
print(" * Pressing numpad '+' or '-' will zoom in and out without a prompt.")
print(" * Do 'map update' to update Map.")
print(" * In turtleMode, turning is reversed for a good reason.")
sleep(0.1)
if colormode then
  term.setTextColor(colors.lightGray)
end
print("")
print("Press a key to continue.")
sleep(0)
local event, key = os.pullEvent("key")
return
end
function doesColorExist(color)
if type(color) == "string" then
  local colors = set({"white","orange","magneta","lightBlue","yellow","lime","pink","gray","lightGray","cyan","purple","blue","brown","green","red","black"})
  if string.sub(color, 1, 7) == "colors." then
   if colors[string.sub(color, 8)] == true then
    return true
   else
    return false
   end
  else
   if colors[color] == true then
    return true
   else
    return false
   end
  end
else
  local colors = set({colors.white,colors.orange,colors.magneta,colors.lightBlue,colors.yellow,colors.lime,colors.pink,colors.gray,colors.lightGray,colors.cyan,colors.purple,colors.blue,colors.brown,colors.green,colors.red,colors.black})
  if colors[color] == true then
   return true
  else
   return false
  end
end
end
function setWaypoint()
term.setCursorPos(1,2)
defaultNewPointName = "way" --Not used, in favor of a way to cancel.
print("Set waypoint.")
print("Call it what?")
sleep(0)
write(">")
newName = tostring(read())
if newName == "" then
  print("Cancelling.")
  sleep(0.2)
  return
end
print("What X? (default: current xyz)")
write(">")
newX = tonumber(read())
if newX == nil then
  newX = posX
  newY = posY
  newZ = posZ
else
  print("What Y? (default: here)")
  write(">")
  newY = tonumber(read())
  if newY == nil then
   newY = posY
  end
  print("What Z? (default: here)")
  write(">")
  newZ = tonumber(read())
  if newZ == nil then
   newZ = posZ
  end
end
print("What color?")
write(">")
newColor = tostring(read())
if not doesColorExist(newColor) then
  print("Not a color. Defaulting to 'yellow'")
  sleep(0.2)
  newColor = nil
else
  newColor = stringToColor(newColor)
end
setConfig(newName, "add", newX, newY, newZ, newColor)
refreshOtherConfig()
print("Waypoint '" .. newName .. "' set!")
getConfig()
sleep(0.2)
end
function setScale()
term.setCursorPos(1,2)
print("Set scale factor. Currently " .. scaleFactor .. ".")
repeat
  sleep(0)
  newScale = nil
  write(">")
  newScaleRaw = read()
  if tostring(newScaleRaw) == "" then
   print("Cancelling.")
   sleep(0.2)
   return
  end
  newScale = tonumber(newScaleRaw)
  if newScale == nil then
   print("That's not a number!")
  end
until type(newScale) == "number"
scaleFactor = newScale
print("Scale factor set to " .. scaleFactor .. ".")
refreshOtherConfig()
getConfig()
sleep(0.2)
return true
end
function deleteWaypoint()
term.setCursorPos(1,2)
print("Delete what waypoint?")
if colormode then
  term.setTextColor(colors.orange)
end
for a = 1, #waypoints do
  point = waypoints[a]
  print(" -'" .. point[1] .. "'")
end
if colormode then
  term.setTextColor(colors.white)
end
sleep(0)
write(">")
delName = tostring(read())
for a = 1, #waypoints do
  point = waypoints[a]
  if point[1] == delName then
   setConfig(delName, "delete")
   print("Deleted '" .. delName .. "'.")
   refreshOtherConfig()
   getConfig()
   sleep(0.2)
   return true
  end
end
print("Invalid waypoint '" .. delName .. "'!")
sleep(0.2)
return false
end
function renameWaypoint()
term.setCursorPos(1,2)
print("Rename which waypoint?")
if colormode then
  term.setTextColor(colors.orange)
end
for a = 1, #waypoints do
  point = waypoints[a]
  print(" -'" .. point[1] .. "'")
end
if colormode then
  term.setTextColor(colors.white)
end
write(">")
sleep(0)
renName = tostring(read())
print("Rename to what?")
write(">")
renOutput = tostring(read())
for a = 1, #waypoints do
  point = waypoints[a]
  if point[1] == renName then
   setConfig(renName, "rename", renOutput)
   print("Renamed '" .. renName .. "' to '" .. renOutput .. "'.")
   refreshOtherConfig()
   getConfig()
   sleep(0.2)
   return true
  end
end
print("Invalid waypoint '" .. renName .. "'!")
sleep(0.2)
return false
end
function redrawSceen()
-- setDefaultColors()
-- term.clear()
drawBorder()
-- clearMap()
-- renderCommands()
end
function printOutput(commie)
oldCurX, oldCurY = term.getCursorPos()
if type(commie) == "table" then
  for a = 1, #commie do
   term.setCursorPos(2,scr_y-(#commie-a))
   if colormode then
    term.setTextColor(colors.gray)
    term.setBackgroundColor(colors.lightGray)
   else
    term.setTextColor(colors.black)
    term.setBackgroundColor(colors.white)
   end
   term.clearLine()
   write(tostring(commie[a]))
  end
else
  setDefaultColors()
  term.setCursorPos(1,scr_y-1)
  term.clearLine()
  term.setCursorPos(2,scr_y)
  if colormode then
   term.setTextColor(colors.gray)
   term.setBackgroundColor(colors.lightGray)
  else
   term.setTextColor(colors.black)
   term.setBackgroundColor(colors.white)
  end
  term.clearLine()
  write(tostring(commie))
  if turtle then
   if type(turtle.getFuelLevel()) ~= "string" then
    if turtle.getFuelLevel() < 1 then
	 write(" (out of fuel)")
    else
	 write(" (fuel:" .. turtle.getFuelLevel() .. ")")
    end
   else
    write(" (fuel:" .. turtle.getFuelLevel() .. ")")
   end
  end
end
term.setCursorPos(oldCurX,oldCurY)
setDefaultColors()
return commie
end

function displayTurtleControls()
term.setCursorPos(1,2)
print("Turtle Control Scheme:")
for a = 1, scr_x do write("-") end
print("")
print(" Q W E  U I O P <up")
print(" A S D  J K L ; <front")
print(" TAB    M , . / <down")
print("")
print(" Q = down, E = up")
print(" WASD = move")
print(" U J M = hit   7 8 9 red")
print(" I K , = place 4 5 6 stone")
print(" O L . = dig   1 2 3 ctrl")
print(" P ; / = inspect")
write(" TAB = refuel")
sleep(0.1)
os.pullEvent("key")
return
end
function waypointSettings()
repeat
  sleep(0)
  setDefaultColors()
  term.setCursorPos(1,2)
  print(" Map Options:")
  term.setCursorPos(1,3)
  for a = 1, scr_x do
   write("-")
  end
  term.setCursorPos(1,5)
  if colormode then
   term.setTextColor(colors.orange)
  end
  print(" * (C)reate Waypoint")
  print(" * (D)elete Waypoint")
  print(" * (R)ename Waypoint")
  print(" * Edit C(o)nfig")
  print(" * (S)et Scale")
  print(" * Show (H)elp")
  if turtleMode then print(" * Show (t)urtle controls") end
  if turtleMode then print(" * Send turtle to coords/(p)oint") end
  print(" * E(x)it")
  event, key = os.pullEvent("key")
  key = keys.getName(key)
  if key == nil then key = " " end
until string.find("cdroshtpx", key)
if key == "d" then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  deleteWaypoint()
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  redrawSceen()
  return
end
if key == "r" then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  renameWaypoint()
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  redrawSceen()
  return
end
if key == "s" then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  setScale()
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  redrawSceen()
  drawScaleIndicator()
  return
end
if key == "o" then
  displayStuffs = false
  setDefaultBackgroundColor()
  term.clear()
  sleep(0.1)
  shell.run("edit " .. mapConfigFile)
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  getConfig()
  setDefaultColors()
  term.clear()
  redrawSceen()
  return
end
if key == "c" then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  if isConnected then
   setWaypoint()
  else
   term.setCursorPos(1,2)
   print("You are not connected to a GPS server, so you cannot set waypoints.")
   print("Press a key to continue")
   sleep(0)
   os.pullEvent("key")
  end
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  redrawSceen()
end
if key == "h" then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  displayHelp()
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  clearMap()
  drawBorder()
  renderCommands()
end
if key == "t" and turtleMode then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  sleep(0)
  displayTurtleControls()
  term.clear()
  sleep(0)
  flashScreen(1)
  displayStuffs = true
  clearMap()
  drawBorder()
  renderCommands()
end
if key == "p" and turtleMode then
  displayStuffs = false
  setDefaultColors()
  term.clear()
  term.setCursorPos(1,2)
  if isConnected then
   print("Go to coordinates or waypoint?")
   print("[c/w/X]")
   repeat
    sleep(0)
    event, key = os.pullEvent("key")
    key = keys.getName(key)
    if key == nil then key = " " end
   until string.find("cwx", key)
   print("")
   if key == "c" then
    print("Enter destination...")
    print("...X:")
    sleep(0)
    destinationX = tonumber(read())
    if destinationX == nil then
	 print("Not a number! Cancelling.")
	 sleep(0.2)
	 flashScreen(1)
	 return
    end
    print("...Y:")
    sleep(0)
    destinationY = tonumber(read())
    if destinationY == nil then
	 print("Not a number! Cancelling.")
	 sleep(0.2)
	 flashScreen(1)
	 return
    end
    print("...Z:")
    sleep(0)
    destinationZ = tonumber(read())
    if destinationZ == nil then
	 print("Not a number! Cancelling.")
	 sleep(0.2)
	 flashScreen(1)
	 return
    end
    term.clear()
    term.setCursorPos(1,2)
    write("Going...")
    local result, bool = printOutput(goToCoordinates(destinationX, destinationY, destinationZ))
    if not bool == false then
	 print("done!")
	 sleep(0.2)
    else
	 sleep(0.1)
	 print("Press a key to continue")
	 os.pullEvent("key")
    end
   elseif key == "w" then
    print("Which waypoint?")
    if colormode then
	 term.setTextColor(colors.orange)
    end
    for a = 1, #waypoints do
	 point = waypoints[a]
	 print(" -'" .. point[1] .. "'")
    end
    if colormode then
	 term.setTextColor(colors.white)
    end
    sleep(0)
    local destWaypoint = tostring(read())
    if destWaypoint == "" then
	 print("Cancelling.")
	 sleep(0.1)
	 flashScreen(1)
	 return
    end
    write("Going...")
    printOutput(goToCoordinates(tostring(destWaypoint)))
    print("finished.")
    sleep(0.2)
   end
  else
   print("You are not connected to a GPS server, so you cannot send turtles.")
   print("Press a key to continue")
   sleep(0)
   os.pullEvent("key")
  end
  flashScreen(1)
  term.clear()
  sleep(0)
  displayStuffs = true
  clearMap()
  drawBorder()
  renderCommands()
  redrawMap = true
end
if key == "x" then
  sleep(0)
  flashScreen(1)
  return
end
return
end
function refuelTurtle(amount)
local originalSlot = turtle.getSelectedSlot()
for a = 1, 16 do
  turtle.select(a)
  if turtle.refuel(0) then
   turtle.refuel(amount)
   turtle.select(originalSlot)
   return "refuelled " .. amount
  end
end
turtle.select(originalSlot)
return "can't refuel " .. amount
end
function goToCoordinates(destX, destY, destZ)
if not turtleMode then
  return "turtleMode is not true"
end
if destY == nil then
  local pointName = destX
  for a = 1, #waypoints do
   point = waypoints[a]
   if point[1] == pointName then
    destX = tonumber(point[2])
    destY = tonumber(point[3])
    destZ = tonumber(point[4])
   end
  end
  if destY == nil then
   return "no such waypoint"
  end
  if turtle then
   if type(turtle.getFuelLevel()) == "number" then
    if math.abs(destX-posX)+math.abs(destY-posY)+math.abs(destZ-posZ) > turtle.getFuelLevel() then
	 return "insufficient fuel", false
    end
   end
   printOutput("going to waypoint '" .. pointName .. "'")
  end
else
  if turtle then
   if type(turtle.getFuelLevel()) == "number" then
    if math.abs(destX-posX)+math.abs(destY-posY)+math.abs(destZ-posZ) > turtle.getFuelLevel() then
	 return "insufficient fuel", false
    end
   end
   printOutput("going to " .. destX .. "," .. destY .. "," .. destZ .. "...")
  end
end

gx = destX
gy = destY
gz = destZ

--Credit to mhiekuru for this goto script. Thanks!
if gx == nil or gy == nil or gz == nil then
  return
end
--defining x, y, z, f position
cx, cy, cz = gps.locate( 2, false )
if cf == nil then
  turtle.dig()
  repeat until turtle.forward()
  local fx, fy, fz = gps.locate( 2, false )
  if cz < fz then
   cf = 0
  elseif cx > fx then
   cf = 1
  elseif cz > fz then
   cf = 2
  elseif cx < fx then
   cf = 3
  end
  repeat until turtle.back()
end
while cx ~= gx or cz ~= gz do
  if cf == 0 then
   if cx < gx then
    turtle.turnLeft()
    cf = 3
   elseif cx > gx or cz > gz then
    turtle.turnRight()
    cf = 1
   end
  elseif cf == 1 and cx <= gx then
   if cz > gz or cx ~= gx then
    turtle.turnRight()
    cf = 2
   elseif cz < gz then
    turtle.turnLeft()
    cf = 0
   end
  elseif cf == 2 then
   if cx > gx then
    turtle.turnLeft()
    cf = 1
   elseif cx < gx or cz < gz then
    turtle.turnRight()
    cf = 3
   end
  elseif cf == 3 and cx >= gx then
   if cz < gz or cx ~= gx then
    turtle.turnRight()
    cf = 0
   elseif cz > gz then
    turtle.turnLeft()
    cf = 2
   end
  end
  if cf == 1 or cf == 3 then
   while cx ~= gx or not turtle.detectDown() do
    if turtle.down() then
	 cy = cy - 1
    elseif cx ~= gx then
	 while not turtle.forward() do
	  while not turtle.up() do
	   while not turtle.back() do
	    while not turtle.down() do
		 return
	    end
	    cy = cy - 1
	   end
	   if cf == 1 then
	    cx = cx + 1
	   else
	    cx = cx - 1
	   end
	  end
	  cy = cy+1
	 end
	 if cf == 1 then
	  cx = cx - 1
	 else
	  cx = cx + 1
	 end
    end
   end
  elseif cx == gx then
   while cz ~= gz or not turtle.detectDown() do
    if turtle.down() then
	 cy = cy - 1
    elseif cz ~= gz then
	 while not turtle.forward() do
	  while not turtle.up() do
	   while not turtle.back() do
	    while not turtle.down() do
		 return
	    end
	    cy = cy - 1
	   end
	   if cf == 0 then
	    cz = cz - 1
	   else
	    cz = cz + 1
	   end
	  end
	  cy = cy + 1
	 end
	 if cf == 0 then
	  cz = cz + 1
	 else
	  cz = cz - 1
	 end
    end
   end
  end
end
while cy ~= gy do
  if cy < gy then
   turtle.digUp()
   if turtle.up() then
    cy = cy + 1
   end
  else
   turtle.digDown()
   if turtle.down() then
    cy = cy - 1
   end
  end
end
--End of script by mhiekuru.
return "went to coordinates " .. destX .. "," .. destY .. "," .. destZ .. "."
end
local function turtleTurnLeft()
if direction == "north" then direction = "west"
elseif direction == "west" then direction = "south"
elseif direction == "south" then direction = "east"
elseif direction == "east" then direction = "north" end
printOutput(turtle.turnLeft())
end
local function turtleTurnRight()
if direction == "north" then direction = "east"
elseif direction == "east" then direction = "south"
elseif direction == "south" then direction = "west"
elseif direction == "west" then direction = "north" end
printOutput(turtle.turnRight())
end
function keyPress() --Captures keypresses when normally viewing the map.
displayStuffs = true
while true do
  local event, key = os.pullEvent("key")
  key = tostring(keys.getName(key))
  if spoofMode then
   if key == "left" then
    fakeX = fakeX + 1
    sleep(0.07)
   end
   if key == "right" then
    fakeX = fakeX - 1
    sleep(0.07)
   end
   if key == "down" then
    fakeZ = fakeZ - 1
    sleep(0.07)
   end
   if key == "up" then
    fakeZ = fakeZ + 1
    sleep(0.07)
   end
  end
  if currentlyConnected or (currentlyConnected == false and isConnected == false) then
   if key == "l" then
    if labelMode == true then
	 labelMode = false
    elseif labelMode == false then
	 labelMode = true
    end
    refreshOtherConfig()
    drawBorder()
    clearMap()
    redrawMap = true
   end
   if key == "n" then
    displayStuffs = false
    setDefaultColors()
    term.clear()
    sleep(0)
    waypointSettings()
    term.clear()
    sleep(0)
    displayStuffs = true
    clearMap()
    drawBorder()
    renderCommands()
    redrawMap = true
   end
   if key == "numPadAdd" or key == "add" then
    scaleFactor = scaleFactor * 1.1
    refreshOtherConfig()
    clearMap()
    drawBorder()
    drawScaleIndicator()
    redrawMap = true
   elseif key == "minus" or key == "numPadSubtract" then
    scaleFactor = scaleFactor / 1.1
    refreshOtherConfig()
    clearMap()
    drawBorder()
    drawScaleIndicator()
    redrawMap = true
   end
 
   if turtleMode then --Used for turtle control, and is helpful with Lyqyd's NSH.
    if turtle then
	 if key == "w" then printOutput(turtle.forward()) end
	 if key == "s" then printOutput(turtle.back()) end
	 if key == "a" then
	  if keyAgoesRight then
	   turtleTurnRight()
	  else
	   turtleTurnLeft()
	  end
	 end
	 if key == "d" then
	  if keyAgoesRight then
	   turtleTurnLeft()
	  else
	   turtleTurnRight()
	  end
	 end

	 if key == "q" then printOutput(turtle.down()) end
	 if key == "e" then printOutput(turtle.up()) end
	
	 if key == "i" then printOutput(turtle.placeUp()) end
	 if key == "k" then printOutput(turtle.place()) end
	 if key == "comma" then printOutput(turtle.placeDown()) end
	
	 if key == "o" then printOutput(turtle.digUp()) end
	 if key == "l" then printOutput(turtle.dig()) end
	 if key == "period" then printOutput(turtle.digDown()) end
	
	 if key == "p" then
	  bool, inspection = turtle.inspectUp()
	  inspection = {inspection["name"], inspection["metadata"]}
	  printOutput(inspection)
	 end
	 if key == "semiColon" then
	  bool, inspection = turtle.inspect()
	  inspection = {inspection["name"], inspection["metadata"]}
	  printOutput(inspection)
	 end
	 if key == "slash" then
	  bool, inspection = turtle.inspectDown()
	  inspection = {inspection["name"], inspection["metadata"]}
	  printOutput(inspection)
	 end
	
	 if key == "u" then printOutput(turtle.attackUp()) end
	 if key == "j" then printOutput(turtle.attack()) end
	 if key == "m" then printOutput(turtle.attackDown()) end
	 if key == "tab" then printOutput(refuelTurtle(1)) end
	
	 if key == "numPad8" then
	  local rsSide = "front"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
	 if key == "numPad2" then
	  local rsSide = "back"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
	 if key == "numPad4" then
	  local rsSide = "left"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
	 if key == "numPad6" then
	  local rsSide = "right"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
	 if key == "numPad7" then
	  local rsSide = "top"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
	 if key == "numPad9" then
	  local rsSide = "bottom"
	  if redstone.getOutput(rsSide) == false then
	   redstone.setOutput(rsSide, true)
	   printOutput(rsSide .. " RS on")
	  else
	   redstone.setOutput(rsSide, false)
	   printOutput(rsSide .. " RS off")
	  end
	 end
    else
	 printOutput("Not a turtle.")
    end
   end
  end
  if key == "x" then
   sleep(0)
   return
  end
end
end
function waitForResize()
while true do
  scr_x, scr_y = term.getSize()
  event = os.pullEvent()
  if event == "monitor_resize" or event == "term_resize" and displayStuffs == true then
   mon = peripheral.find("monitor")
   if mon then
    mon.setTextScale(monitorTextScale)
   end
   scr_x, scr_y = term.getSize()
   if scr_x > 16 or scr_y > 10 then --Determines if Map is being ran on a single monitor block.
    monitorMode = false
   else
    monitorMode = true
   end
   setDefaultColors()
   term.clear()
   defineMapBorders()
   drawBorder()
   clearMap()
   renderCommands()
   redrawMap = true
  end
end
end
getConfig()
fakeX = 3 --Used if spoofMode == true, if not then these are set in the event that it is later set true.
fakeY = 62
fakeZ = 5
--The following...huge...tables are the title screens for advanced, grayscale, and monochrome computers.
--In order to edit these, you need to somehow convert it back to the default paint format, then use sketch
--to edit it, then do the following command on the file (let's call it 'pernt'):
-- sed ':a;N;$!ba;s/\n//g' pernt | sed 's/[[:space:]]//g'
--And that only works if you have linux. If you don't, then go write your own program to strip spaces and newlines.
mapTitleScreen_adv = {{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,16,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,16,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,128,32768,1,1,32768,1,1,128,128,32768,1,1,128,32768,1,1,1,128,128,128,16,32768,256,256,256,256,256,256,256,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,32768,1,128,32768,1,128,32768,1,32768,1,128,32768,1,32768,1,128,32768,1,128,128,16,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,32768,1,128,32768,1,128,32768,1,32768,1,1,1,1,32768,1,1,1,1,128,128,16,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,32768,1,128,32768,1,128,32768,1,32768,1,128,32768,1,32768,1,128,128,128,128,128,16,32768,32768,1,1,1,32768,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,32768,1,128,128,128,128,32768,1,32768,1,128,32768,1,32768,1,128,128,128,128,128,16,32768,32768,1,32768,32768,1,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,16,32768,32768,1,1,1,1,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,32768,16,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,16,32768,32768,1,32768,32768,32768,32768,32768,256,32768,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8192,8192,8192,32768,16,256,256,256,256,128,256,256,256,128,128,128,256,256,128,128,128,256,256,256,256,256,16,32768,32768,1,32768,32768,32768,32768,32768,256,32768,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,},{32,32,32,32768,16,1,1,1,1,128,1,1,1,128,1,1,128,1,128,1,1,128,1,1,1,1,16,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},{32,32,32,32768,16,1,1,1,1,128,1,1,1,128,1,1,128,1,128,1,1,128,1,1,1,1,16,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},{32,32,32,32768,16,1,1,1,1,128,128,128,1,128,128,128,1,1,128,128,128,1,1,1,1,1,16,32768,1,1,1,1,1,1,32768,256,32768,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},{32,32,32,32768,16,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,16,32768,1,1,1,1,1,1,32768,256,32768,32,32,32,32,32,32,1,1,1,1,1,1,1,1,},}
mapTitleScreen_norm = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,32768,1,1,32768,1,1,32768,32768,32768,1,1,32768,32768,1,1,1,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,1,32768,32768,1,32768,32768,1,32768,1,32768,32768,1,32768,1,32768,32768,1,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,1,32768,32768,1,32768,32768,1,32768,1,1,1,1,32768,1,1,1,1,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,1,32768,32768,1,32768,32768,1,32768,1,32768,32768,1,32768,1,32768,32768,32768,32768,32768,1,32768,32768,1,1,1,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,1,32768,32768,32768,32768,32768,1,32768,1,32768,32768,1,32768,1,32768,32768,32768,32768,32768,1,32768,32768,1,32768,32768,1,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,32768,1,1,1,1,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,32768,1,32768,32768,32768,32768,32768,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{32768,32768,32768,32768,1,1,1,1,1,32768,1,1,1,32768,32768,32768,1,1,32768,32768,32768,1,1,1,1,1,1,32768,32768,1,32768,32768,32768,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,},{32768,32768,32768,32768,1,1,1,1,1,32768,1,1,1,32768,1,1,32768,1,32768,1,1,32768,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,},{32768,32768,32768,32768,1,1,1,1,1,32768,1,1,1,32768,1,1,32768,1,32768,1,1,32768,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,},{32768,32768,32768,32768,1,1,1,1,1,32768,32768,32768,1,32768,32768,32768,1,1,32768,32768,32768,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,},{32768,32768,32768,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,},}
mapTitleScreen_gray = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,1,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,1,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,128,32768,1,1,32768,1,1,128,128,32768,1,1,128,32768,1,1,1,128,128,128,1,32768,256,256,256,256,256,256,256,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,32768,1,128,32768,1,128,32768,1,32768,1,128,32768,1,32768,1,128,32768,1,128,128,1,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,32768,1,128,32768,1,128,32768,1,32768,1,1,1,1,32768,1,1,1,1,128,128,1,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,32768,1,128,32768,1,128,32768,1,32768,1,128,32768,1,32768,1,128,128,128,128,128,1,32768,32768,1,1,1,32768,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,32768,1,128,128,128,128,32768,1,32768,1,128,32768,1,32768,1,128,128,128,128,128,1,32768,32768,1,32768,32768,1,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,1,32768,32768,1,1,1,1,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{1,1,1,32768,1,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,1,32768,32768,1,32768,32768,32768,32768,32768,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{128,128,128,32768,1,256,256,256,256,128,256,256,256,128,128,128,256,256,128,128,128,256,256,256,256,256,1,32768,32768,1,32768,32768,32768,32768,32768,256,32768,128,128,128,128,128,128,128,128,128,128,128,128,128,128,},{256,256,256,32768,1,1,1,1,1,128,1,1,1,128,1,1,128,1,128,1,1,128,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,256,256,256,256,256,256,256,256,256,256,256,256,256,256,},{256,256,256,32768,1,1,1,1,1,128,1,1,1,128,1,1,128,1,128,1,1,128,1,1,1,1,1,32768,32768,32768,32768,32768,32768,32768,32768,256,32768,256,256,256,256,256,256,256,256,256,256,256,256,256,256,},{256,256,256,32768,1,1,1,1,1,128,128,128,1,128,128,128,1,1,128,128,128,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,256,32768,256,256,256,256,256,256,256,256,256,256,256,256,256,256,},{256,256,256,32768,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,32768,1,1,1,1,1,1,1,256,32768,256,256,256,256,256,256,256,256,256,256,1,1,1,1,},}
defineMapBorders()
if displayTitle then
displayTitleScreen() --New title screens for norm/adv/gray computers in 1.3.4!
end
if autoUpdate then
write("Automagically updating Map...") --Yes I know I misspelled that, that was on purpose.
updateMapProgram()
print("up to date!")
end
flashScreen(1)
parallel.waitForAny(renderMap, keyPress, waitForResize)
end --This end is to close the runMapProgramAlready() function, so don't remove it.
function handleMapErrorMessage(errorMsg)
errorMessage = errorMsg
interjects = {
  "Oh nose!",
  "Golly gee!",
  "Eh, shit.",
  "Holy spaghetti and meatballs, Batman!",
  "Holy rusted metal, Batman!",
  "Jiminy!",
  "Leaping leptons!",
}
interjection = interjects[math.random(1, #interjects)]
message = {
  interjection,
  "Map v" .. mapVersion .. " has gotten",
  "an error:",
  " ",
  tostring(errorMessage),
  " ",
}
if colormode then
  term.setBackgroundColor(colors.red)
else
  if grayAllowed then
   term.setBackgroundColor(colors.gray)
  else
   term.setBackgroundColor(colors.white)
  end
end
term.clear()
scr_x, scr_y = term.getSize()
term.setCursorPos(1,1)
for y = 1, 2 do
  for x = 1, scr_x do
   if x % 2 == 0 then
    if colormode then
	 term.setBackgroundColor(colors.black)
	 term.setTextColor(colors.lightGray)
    else
	 if grayAllowed then
	  term.setBackgroundColor(colors.black)
	  term.setTextColor(colors.lightGray)
	 else
	  term.setBackgroundColor(colors.black)
	  term.setTextColor(colors.white)
	 end
    end
    write("x")
   else
    if colormode then
	 term.setBackgroundColor(colors.white)
	 term.setTextColor(colors.orange)
    else
	 if grayAllowed then
	  term.setBackgroundColor(colors.white)
	  term.setTextColor(colors.gray)
	 else
	  term.setBackgroundColor(colors.white)
	  term.setTextColor(colors.black)
	 end
    end
    write("X")
   end
  end
  term.setCursorPos(1,scr_y)
end
midPoint = {
  scr_x / 2,
  scr_y / 2,
}
yoffset = 0
for a = 1, #message do
  term.setCursorPos(midPoint[1]-(#message[a]/2),a+2+yoffset)
  if a == 5 then
   if colormode then
    term.setBackgroundColor(colors.gray)
    term.setTextColor(colors.white)
   else
    if grayAllowed then
	 term.setBackgroundColor(colors.gray)
	 term.setTextColor(colors.white)
    else
	 term.setBackgroundColor(colors.black)
	 term.setTextColor(colors.white)
    end
   end
  else
   if colormode then
    term.setBackgroundColor(colors.red)
    term.setTextColor(colors.white)
   else
    if grayAllowed then
	 term.setBackgroundColor(colors.lightGray)
	 term.setTextColor(colors.black)
    else
	 term.setBackgroundColor(colors.white)
	 term.setTextColor(colors.black)
    end
   end
  end
  if #message[a] > scr_x then
   curPosX, curPosY = term.getCursorPos()
   term.setCursorPos(1,curPosY)
   print(string.sub(message[a], 1, scr_x))
   yoffset = yoffset + 1
   term.setCursorPos(midPoint[1]-(#string.sub(message[a], scr_x)/2),a+2+yoffset)
   print(string.sub(message[a], scr_x))
  else
   print(message[a])
  end
end
if colormode then
  term.setBackgroundColor(colors.yellow)
  term.setTextColor(colors.black)
else
  if grayAllowed then
   term.setBackgroundColor(colors.lightGray)
   term.setTextColor(colors.black)
  else
   term.setBackgroundColor(colors.white)
   term.setTextColor(colors.black)
  end
end
msg = " E(x)it, or (R)estart? "
term.setCursorPos(midPoint[1]-(#msg/2),#message+4)
print(msg)
repeat
  sleep(0.1) --To prevent premature keypresses.
  event, key = os.pullEvent("char") --We don't need any key output other than letters.
  key = string.lower(key) --In case shift+key returns a capital key.
until string.find("xr", key)
message = nil
if key == "x" then
  return false
elseif key == "r" then
  return true
end
error("How did you get here??")
end
while true do
local status, error = pcall(runMapProgramAlready) --Finally, good error handling.
if status == false then
  local outcome = handleMapErrorMessage(error)
  if outcome == false then
   break
  end
else
  break
end
end
term.setTextColor(colors.white)
term.setBackgroundColor(colors.black)
term.clear()
term.setCursorPos(1,1)
print("Thanks for using Map v" .. mapVersion .. "!")
print("(code: " .. pastebinID .. ")")
sleep(0)

Someone please help…although it's really not that high a priority…
SquidDev #2
Posted 20 July 2015 - 08:55 PM
Possible related to this and this?
LDDestroier #3
Posted 21 July 2015 - 12:34 AM
Possible related to this and this?

I think so! I was on LurCraft, which uses the beta.
Bomb Bloke #4
Posted 21 July 2015 - 02:44 AM
I believe you should be able to work around this by changing your text scale (to something other than what you want it to be, then back again), but presumably Dan'll fix it sooner or later.