I am working on making a mob arena which gets harder as time passes. I'm using computercraft and soul shards to do this but need help with a program that lets a spawner spawn mobs every 20 seconds or so, i've written a program but it doesn't work as it seems to ignore the "if round < 30 then" or whatever and do the code even if that if statement is wrong
So here's the program:
sec = 0
round = 1
while true do
if sec==60 then
sec = 0
round = round + 1
end
sec = sec + 20
if redstone.getInput("right", true) then
if round > 30 then
if round < 51 then
redstone.setOutput("back", false)
sleep(2)
redstone.setOutput("back", true)
term.clear()
sleep(18)
end
end
if round > 50 then
if round < 71 then
redstone.setOutput("back", false)
sleep(4)
redstone.setOutput("back", true)
sleep(16)
end
end
if round > 70 then
if round < 101 then
redstone.setOutput("back", false)
sleep(6)
redstone.setOutput("back", true)
sleep(14)
end
end
end
if redstone.getInput("left", true) then
redstone.setOutput("back", true)
term.clear()
term.setCursorPos(1, 1)
print("There's no round in play.")
round = 1
sec = 0
sleep(1)
end
end
Thankyou, please help!!
5 replies to this topic
#1
Posted 04 March 2013 - 10:15 AM
#2
Posted 04 March 2013 - 04:32 PM
Moved to Ask a Pro. In the future, please read the stickies and forum guidelines before posting wherever you want.
#3
Posted 04 March 2013 - 04:55 PM
Please use code format and spoilers
Why do you use two if statements when detecting the round number?
Spoiler
Why do you use two if statements when detecting the round number?
#4
Posted 04 March 2013 - 06:15 PM
Read comments
Spoiler
#5
Posted 05 March 2013 - 05:08 AM
I use two if statements cause i'm new to computercraft and don't know everything about it yet...
#6
Posted 05 March 2013 - 05:24 AM
Don't know how to make spoilers but the extra end is to end the if redstone.getInput("right", true) statement. There wasn't a missing end at the beggining either and i've made the and statements but i found the problem, it was that when there was a redstone signal on the right but the round wasn't high enough, it didn't know what to do so it ignored the "if round > 30 then" statement and did the code below it for some reason so i made a new if statement saying if the round was lower then it would clear the screen and set the cursor to the start and then print that the round isn't high enough. Thankyou though
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











