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

Multiple Points Error

Started by Mackan90096, 14 August 2013 - 09:30 AM
Mackan90096 #1
Posted 14 August 2013 - 11:30 AM
Hi there, first of all, i just want to say that this is not my code.

But when trying to run it, I get an error saying multiple points.
What is this error? How do I fix it, what causes it?

Code:
Spoiler

print("0")--This code doesn't even run
local m = peripheral.wrap("top")
local w, h = m.getSize() 
print("1")
term.redirect(m)
local function clear ()
  term.setBackgroundColor(colors.white)
  term.clear()
end
print("2")
local function topleft (color)
  paintutils.drawPixel(1, 1, color)
  paintutils.drawPixel(2, 1, color)
  paintutils.drawPixel(2, 2, color)
  paintutils.drawPixel(1, 2, color)
end
print("3")
local function topright (color)
  paintutils.drawPixel(w, 1, color)
  paintutils.drawPixel(w, 2, color)
  paintutils.drawPixel(w - 1, 1, color)
  paintutils.drawPixel(w - 1, 2, color)
end
print("4")
local function bottomleft (color)
  paintutils.drawPixel(1, h, color)
  paintutils.drawPixel(2, h, color)
  paintutils.drawPixel(1, h - 1, color)
  paintutils.drawPixel(2, h - 1, color)
end
print("5")
local function bottomright (color)
  paintutils.drawPixel(w, h, color)
  paintutils.drawPixel(w, h - 1, color)
  paintutils.drawPixel(w - 1, h - 1, color)
  paintutils.drawPixel(w - 1, h, color)
end
print("6")
local function bool(var)
  return not var ---*Face palm for me* I forget alot about no
end
print("7")
local tl = false
local tr = false
local bl = false
local br = false
print("8")
while true do
  local event, x, y, button = os.pullEvent("mouse_click")
  w, h = m.getSize()
  clear()
  local xy = x .. "," .. y

  if xy == "1,1" or xy == "1,2" or xy == "2,1" or xy == "2,2" then
    tl = bool(tl)  
  elseif xy == w.. ",1" or xy == w.. ",2" or xy == w - 1.. ",1" or xy == w - 1.. ",2" then 
    tr = bool(tr)
  elseif xy == "5,5" then
    bl = bool(bl)
  elseif xy == "6,6" then
    br = bool(br)
  end

  if tl then
    topleft(colors.red)
  elseif tr then
    topright(colors.red)
  elseif bl then
    bottomleft(colors.red)
  elseif br then
    bottomright(colors.red)
  end
end

term.restore()
Lyqyd #2
Posted 14 August 2013 - 11:47 AM
Somewhere in there is a `w - 1..`, which is causing it to think that you're trying to say that 1.. is a number with multiple decimal points, when you really intend it to be an expression with a concatenation operator to manipulate the result into a string. Add some parentheses and it should be fixed. Repeat for any other times you get the error: `(w - 1)..`
Mackan90096 #3
Posted 14 August 2013 - 11:51 AM
Ah. Thanks