Posted 10 June 2012 - 07:43 PM
I have this code under "edit startup"
HorzLoadBar(15,35,"*")
function HorzMenu(menutable1, Ylocation)
local selection1 = 1
while true do
term.setCursorPos(1, Ylocation)
for i = 1,#menutable1 do
if i == selection1 then write"[" end
write(menutable1)
if i == selection1 then write"]" end
write" | "
end
local r,s = os.pullEvent()
if r == "key" then
if s == 203 then selection1 = selection1 - 1 end
if selection1 == 0 then selection1 = #menutable1 end
if s == 205 then selection1 = selection1 + 1 end
if selection1 == #menutable1 +1 then selection1 = 1 end
if s == 28 then
term.setCursorPos(1,Ylocation + 1)
return menutable1[selection1]
end
end
end
end
print ("Please Select")
items = {"Dump", "Emergency Shut OFF", "Reactor Startup"}
menuResult = HorzMenu(items, 6)
It works it just i dont know how to "assign" commands to the options… for example:
Dump—> I need the computer to send a a redstone pulse the code is redpulse left 100 1 but where does that go and where can i put this to be assigned to the "dump" selection
thanks alot
HorzLoadBar(15,35,"*")
function HorzMenu(menutable1, Ylocation)
local selection1 = 1
while true do
term.setCursorPos(1, Ylocation)
for i = 1,#menutable1 do
if i == selection1 then write"[" end
write(menutable1)
if i == selection1 then write"]" end
write" | "
end
local r,s = os.pullEvent()
if r == "key" then
if s == 203 then selection1 = selection1 - 1 end
if selection1 == 0 then selection1 = #menutable1 end
if s == 205 then selection1 = selection1 + 1 end
if selection1 == #menutable1 +1 then selection1 = 1 end
if s == 28 then
term.setCursorPos(1,Ylocation + 1)
return menutable1[selection1]
end
end
end
end
print ("Please Select")
items = {"Dump", "Emergency Shut OFF", "Reactor Startup"}
menuResult = HorzMenu(items, 6)
It works it just i dont know how to "assign" commands to the options… for example:
Dump—> I need the computer to send a a redstone pulse the code is redpulse left 100 1 but where does that go and where can i put this to be assigned to the "dump" selection
thanks alot