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

GUI menu trubbles [will not run program]

Started by rex41043, 10 April 2012 - 08:20 PM
rex41043 #1
Posted 10 April 2012 - 10:20 PM
i'm having trubble with a GUI menu when i try to run the help program it will not run and its there in the dir but it will not run it it just dos nothing but yet the shutdown and reboot works can eny 1 help


sid = 0

function menu(id, text)
if sid == id then
write(">>")
else
write(" ")
end
print(text)
end

while true do
term.clear()
term.setCursorPos(1,1)
shell.run("id")
term.setCursorPos(34,1)
write("iCube v0.1_alpha")
term.setCursorPos(14,6)
write("+——————–+")
term.setCursorPos(14,7)
write("|")
menu(0,"Download Center |")
term.setCursorPos(14,8)
write("|")
menu(1,"Programs |")
term.setCursorPos(14,9)
write("|")
menu(2,"Restart |")
term.setCursorPos(14,10)
write("|")
menu(3,"Shutdown |")
term.setCursorPos(14,11)
write("|")
menu(4,"Help |")
term.setCursorPos(14,12)
write("+——————–+")

event, key = os.pullEvent("key")
if key == 200 and sid > 0 then sid = sid - 1
elseif key == 208 and sid < 4 then sid = sid + 1
elseif key == 28 then
if sid == 0 then shell.run("ICO/root/downloadc")
elseif sid == 1 then shell.run("ICO/root/programs")
elseif sid == 2 then os.reboot()
elseif sid == 3 then os.shutdown()
elseif sid == 4 then shell.run("ICO/root/help")
end
end
end
OmegaVest #2
Posted 10 April 2012 - 10:29 PM
Okay, umm, are you trying to run the default help program? Because that requires arguments to run. So, in this case, you would need to write a window, or line that prompts the user for a help query, such as "apis" or "programming".

If you are not using the default help program, then we would need the code for the help program that you ARE using.
Luanub #3
Posted 10 April 2012 - 10:33 PM
Make sure the 3 files are present. Also try to add a break after the shell.run's to break the while loop.

so

if sid == 0 then
shell.run("ICO/root/downloadc")
break

I made the 3 files on my computer. Just had them simply clear the screen, print a message, sleep for 1 second. The code works great as is, no breaks needed.

You probably dont have access to those programs on the computer you are on or there is a problem with those programs.
Edited on 10 April 2012 - 08:48 PM
rex41043 #4
Posted 10 April 2012 - 10:38 PM
Okay, umm, are you trying to run the default help program? Because that requires arguments to run. So, in this case, you would need to write a window, or line that prompts the user for a help query, such as "apis" or "programming".

If you are not using the default help program, then we would need the code for the help program that you ARE using.
no its 1 we made
rex41043 #5
Posted 10 April 2012 - 10:50 PM
Make sure the 3 files are present. Also try to add a break after the shell.run's to break the while loop.

so

if sid == 0 then
shell.run("ICO/root/downloadc")
break

I made the 3 files on my computer. Just had them simply clear the screen, print a message, sleep for 1 second. The code works great as is, no breaks needed.

You probably dont have access to those programs on the computer you are on or there is a problem with those programs.
THANX SO MUCH IT WORKED