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

Need really Help with my OS

Started by ONIXTurtle, 24 July 2016 - 11:47 AM
ONIXTurtle #1
Posted 24 July 2016 - 01:47 PM
German : Hey und Hallo ! Ich habe mir heute ein programm geschrieben mit dem man andere programme öffnen kann . Diese Funktionen soll man nutzen indem man z.B. Lock eingibt und dann sich das Fenster öffnet. Es hat funktioniert aber ich bin mir nicht sicher was jetzt falsch ist D=! Die Programme z.B. N-Cat,clear etc. Funktionieren und sind installiert!

English : Hey and Welcome! I wrote today morning a programm for opening others . This functions should be used when someone writes for example Lock it should open. It doesn`t function now but maybe you can help D= The Programs for example N-Cat,clear etc. does function and are installed!


My Script :
Mein Skript :

shell.run("clear")
term.setCursorPos(7,3)
print("Hey and …")
term.setCursorPos(25,10)
print(" :D/>")
term.setCursorPos(7,13)
sleep(5)
print("Now you …")

sleep(10)
shell.run("clear")
print("If you …")

password = read()

if password == ("Lock") then true
print("lock is …")
sleep(2)
shell.run("clear")
shell.run("ONIX")

elseif password == ("Help") then true
print("Hey…")
sleep(2)
print("——")
sleep(2)
print("Here…")
print(" ")
sleep(2)
print("Lock : In lock…")
print("to send a signal …")
print("you may have a problem :D/> TNT")
print(" ")
sleep(4)
print("Main : …")
print("can user …")
sleep(4)
print("Help : …")
print("Programm …")
sleep(10)
print("You have to …")

else
print("Invalid entry")

elseif password == ("Animation") then true
shell.run("clear")
print("This is a …")
sleep(4)
shell.run("N-Cat")

end
eof=true
CCJJSax #2
Posted 24 July 2016 - 09:16 PM
Well first off use code tags when posting code


[ code] --no space
-- enter code here
–no space


Second, you should use term.clear() instead of shell.run("clear"). I'd imagine it'd be faster for the computer and to type out.

Third your if and elseif statements have 'true' after 'then'. This has nothing to do with that boolean. It should look like


password = read()
if password == "help" then
return "help"
elseif password == "animation" then
return "animation"
else
return "yo dawg.  your password is all wrong"
end

edit: also should mention that you have an elseif statement after your else, which is why you're erroring. put that last elseif before the else.
Edited on 25 July 2016 - 06:43 AM