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

[ERROR] Startup script.

Started by Velthos, 07 July 2012 - 11:40 AM
Velthos #1
Posted 07 July 2012 - 01:40 PM
Im trying to make a script that turns on / off certain machines in my tekkit house.
Spoiler


term.clear() -- 1

print("Choose your options.") -- 2

print("1. Shroom") -- 3

print("2. Engines") -- 4



debug = "roflmao" -- 6

shrooms = "1" -- 7

shroom = true -- 8

engines = "2" -- 9

engine = true -- 10

input = read(); -- 11

term.clear() -- 12



function choose() -- 14

if input == shrooms and shroom == false then -- 15

rs.setBundledOutput("back", rs.getBundledOutput("back")+2048) -- 16

print("Shrooms have been toggled. Have a nice day."); -- 17

shroom = true -- 18

term.clear() -- 19

chose() -- 20



else -- 22

if input == shrooms and shroom == true then -- 23

rs.setBundledOutput("back", rs.getBundledOutput("back")-2048) -- 24

print("Shrooms have been toggled. Have a nice day.") -- 25

shroom = false -- 26

term.clear() -- 27

chose() -- 28



else --30

if input == engines and engine == false then

rs.setBundledOutput("back", rs.getBundledOutput("back")+1)

print("Engines have been toggled. Have a nice day.")

engine = true

term.clear()

chose()


else
if
input == engines and engine == true then

rs.setBundledOutput("back", rs.getBundledOutput("back")-1)

print("Engines have been toggled. Have a nice day!")

engine = false

term.clear()

chose()


else
if
input == debug then

term.clear()

exit()

end
end
end
end
end
end



function chose()

choose()

end
Error:
Spoiler

bios:206: [string "startup"]:54: 'end' expected (to close 'if' at line 47)
No idea whats wrong. I had the 'ends' before and now I removed them and its still not working.


—Update—
Figured out the end part but now nothing happens :
Velthos #2
Posted 07 July 2012 - 05:31 PM
Anyone?
MysticT #3
Posted 07 July 2012 - 06:11 PM
You never call the functions, so it won't do anything.
Also, try using a loop instead of a recursive function.