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

Programming help?

Started by ToxicGecko, 13 January 2013 - 09:00 AM
ToxicGecko #1
Posted 13 January 2013 - 10:00 AM
Okay so I'm making one of those games where you type commands for them to do something, and If you guys have ever heard of the game don't shit your pants, I'm making that in minecraft tekkit. Me and my friends are planning on starting a tekkit world soon and they're relying on me for programming, so i'm practicing by making programs. Heres the coding for the game:

edit Don't shit your pants!
GAME CODING
———–


term.clear()
term.setCursorPos(1,1)

password = "push door"
password2 = "pull door"
password3 = "shit"
password4 = "take pants off"
Print("Welcome to Don't shit your pants! Minecraft edition v.1.0  Remember you only have 60 seconds to complete the game!")
timer.Simple(60, os.shutdown)
write("You really have to shit your pants, your standing in front of the bathroom door")
input = read()

if input == password then
		 print("You opened the door") then
		 sleep(1)
if input == password2 then
		 print("YOU DON'T PULL THE DOOR!")
if input == password3 then
		 print("YOU SHIT YOUR PANTS YOU LOSE!") then
os.shutdown
if input == password4 then
		 print("There's something you have to do first")
else
		 print("NOPE!")

term.clear()
term.setCursorPos(1,1)

password = "take pants off"
password2 = "sit on toilet"
password3 = "shit"
write("You opened the door now what?")
input = read()

if input == password then
		 print("You took your pants off") then
		 sleep(1)
if input == password2 then
		 print("There's something you have to do first")
if input == password3 then
		 print("YOU SHIT YOUR PANTS YOU LOSE!") then
os.shutdown
else
		 print("NOPE!")

term.clear()
term.setCursorPos(1,1)

password = "sit on toilet")
password2 = "shit"
write("You took you pants off now whats left?")
input = read()

if input == password then
		 print("You sat on the toilet you deserve a cookie")
if input == password2 then
		 print("You shit on the floor YOU LOSE!") then
os.shutdown
else
		 print("NOPE!")

term.clear()
term.setCursorPos(1,1)

password = "shit"
write("One thing left what now?")
input = read()

if input == password then
		 print("CONGRATULATIONS YOU DIDN'T SHIT YOUR PANTS YOU WIN!") then
os.shutdown
else
		 print("NOPE!")


I keep getting errors so if you see anything wrong tell below It will be greatly appreciated.
Also btw the edit don't shit your pants and GAME CODING
——————–
Thats not actually what i'm putting in, also i'm new at this so go easy.
Edited by
Lyqyd #2
Posted 13 January 2013 - 10:04 AM
Moved to Ask a Pro.
remiX #3
Posted 13 January 2013 - 10:49 AM
Can you tell us what errors you're getting?

Edit: the problem is, is that you're not ending your if statements:


if input == password then
--code
end -- need to end each one

-- you can also do this

if input == password then
elseif input == password1
-- etc
end

And the functions are case sensitive, so you need to print() and not Print()

PS: Please use
-code here[/cod[b]e[/b]] tags :)/>
ToxicGecko #4
Posted 13 January 2013 - 05:23 PM
Can you tell us what errors you're getting?

Edit: the problem is, is that you're not ending your if statements:


if input == password then
--code
end -- need to end each one

-- you can also do this

if input == password then
elseif input == password1
-- etc
end

And the functions are case sensitive, so you need to print() and not Print()

PS: Please use
-code here[/cod[b]e[/b]] tags :)/>
Thanks I'll be trying to fix it :D/>