Posted 03 November 2012 - 01:21 PM
pleaseeee help me
i need to print a title at the top of my menu. this is a menu for a program i coded called turtle control. it wirelessly controls turtles using a menu. here is my code:
please note i only coded some of the code. some i got from a tutorial so im not 100% sure what ends end what part of the code.
all help would be grateful.
thanks -Cheeky
i need to print a title at the top of my menu. this is a menu for a program i coded called turtle control. it wirelessly controls turtles using a menu. here is my code:
id = 15 --change to turtle id #
n=1
options = {
"Drop Payload",
"Go Up",
"Go Down",
"Go Left",
"Go Right",
"Go Forward",
"Go Backward",
"Dig",
"Turn Left",
"Turn Right",
}
local function opt(m,mY)
l=#m
while true do
for i=1, l, 1 do
if i==n then
local x, y = term.getSize()
local b = string.len(">"..m[i].."<")/2
local x = (x/2)-b
term.setCursorPos(x,i+mY)
term.clearLine()
print(">"..m[i].."<")
else
local x, y = term.getSize()
b = string.len(m[i])/2
x = (x/2)-b
term.setCursorPos(x,i+mY)
term.clearLine()
print(m[i]) end
end
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then n=n-1 end
if b==208 and n<l then n=n+1 end
if b==28 then break end
end
end
term.clear() term.setCursorPos(1,1)
return n
end
while true do
term.clear()
rednet.open("top") --Change to the side of your modem
local input = opt(options,0)
if input == 1 then
rednet.send(id,"payload,1")
elseif input == 2 then
rednet.send(id,"up,1")
elseif input == 3 then
rednet.send(id,"down,1")
elseif input == 4 then
rednet.send(id,"left,1")
elseif input == 5 then
rednet.send(id,"right,1")
elseif input == 6 then
rednet.send(id,"forward,1")
elseif input == 7 then
rednet.send(id,"back,1")
elseif input == 8 then
rednet.send(id,"dig,1")
elseif input == 9 then
rednet.send(id,"lLeft,1")
elseif input == 10 then
rednet.send(id,"lRight,1")
end
end
please note i only coded some of the code. some i got from a tutorial so im not 100% sure what ends end what part of the code.
all help would be grateful.
thanks -Cheeky