Posted 11 December 2015 - 08:06 PM
current = ""
linked = ""
local Buttons = {}
Buttons["2,2"] = "1"
Buttons["2,4"] = "2"
Buttons["2,6"] = "3"
Buttons["2,8"] = "4"
Buttons["2,10"] = "5"
Buttons["2,12"] = "6"
Buttons["2,14"] = "7"
Buttons["2,16"] = "8"
Buttons["2,18"] = "9"
Buttons["2,20"] = "0"
Buttons["2,22"] = "LINK"
Buttons["2,23"] = "LINK"
Buttons["2,24"] = "LINK"
Buttons["2,25"] = "LINK"
Buttons["2,1"] = "F"
Buttons["2,2"] = "F"
Buttons["3,1"] = "B"
Buttons["3,2"] = "B"
Buttons["4,1"] = "TL"
Buttons["4,2"] = "TL"
Buttons["5,1"] = "TR"
Buttons["5,2"] = "TR"
Buttons["6,1"] = "BB"
Buttons["6,2"] = "BB"
function draw()
if linked ~= "" then
term.clear()
term.setCursorPos(2,20)
print("Linked to ID "..linked)
term.setCursorPos(1,2)
print("[] Forward")
print("[] Backward")
print("[] Turn Left")
print("[] Turn Right")
print("[] Break Block")
elseif linked == "" then
term.clear()
term.setCursorPos(2,2)
term.setTextColor(colors.blue)
print("1 2 3 4 5 6 7 8 9 0 LINK")
term.setCursorPos(1,4)
print(current)
elseif linked ~= "" and press == "F" then
rednet.send(linked,"Forward")
end
end
while true do
draw()
local event, button, x, y = os.pullEvent("mouse_click")
press = Buttons[y..","..x]
if press == "1" or press == "2" or press == "3" or press == "4" or press == "5" or press == "6" or press == "7" or press == "8" or press == "9" or press == "0" and linked == "" then
term.setCursorPos(4,4)
current = current..press
elseif press == "LINK" and current ~= "" then
linked = current
end
end
Around the area where im testing for F it includes that area in a string, its highlighted red. I have no idea why this is happening , help I think this is the cause of my code not working, though im not entirely sure