ComputerCraft Tutorials for Minecraft 1.6 - Part 4 : Basic but Practical Programs

preview_player
Показать описание
In this episode we'll start writing a basic but very useful program. Topics covered are redstone, menus, password input, loops, startup, and termination prevention.

Code:

Рекомендации по теме
Комментарии
Автор

You don't have to worry at all!If all of the videos in this series will be like those first ones, it's worth waiting!

xXEmpolyXx
Автор

awesome intro to CC programming! I can't wait for turtles!!!

MrSoccerboy
Автор

Love your tutorials and even if I know most of it, I always learn from you. Are you planning to make a tutorial for reading/writing to files?

Whiptail
Автор

Trying to get them up as fast I can. I want to make sure the quality is top notch since my first series had a lot of audio issues, vanilla derps, and just plain bad code :)

funshinex
Автор

Program I'd be interested in: Door program with MULTIPLE passwords that (secretly) keeps a log of WHEN certain passwords have been used (based on time and day). That would make it easier to see who stole, griefed, etc.

weckar
Автор

Hey Ron, I'm a newbie at programming and one question I have is during 13:00 how does the computer know to check the password only if the number "1" was the input?

tjmcmanus
Автор

Ron, is it possible for a computer/turtle to get redstone input?For example, I want my turtle to work just when it gets a redstone signal, is it possible for me to do it?

xXEmpolyXx
Автор

check line 1 of both the startup program and the other program, paste them here

funshinex
Автор

when I do all the if/else commands for each input 1-4, I only call the checkPassword function if the input=="1"

funshinex
Автор

hi funshine.I would like to know, if i can make a floppy disk that would have a code. So if you would place that floppy in a computer you could skip the password? and if that is possible can you make a tutorial of that

MrPyrosoldier
Автор

pretty cool tutorial... nothing i didnt know but very interesting... looking forward to the more advanced subjects!

nipps
Автор

You'd need a program running a loop that calls os.pullEvent() and check if the event is redstone.

funshinex
Автор

Great! Also it would be easier with the one option for the door, and lights. Also you could save th current state of them.into a file, then read that when the computer is opened. You could also save the number of tries for the password, so if someone were to try and use CTRL + R then it would restart the timer to 30 seconds. Also when you had the "Q= Quit" many people would just put "q" and you could make it so the computer put all inputs to a lowercase, I've done that before, but I've forgotten

koslasmatthew
Автор

I know that this is an old video but for anyone interested here is a script that will toggle the redstone coming out the comptuer! Also allowed lowercase q :)

while true do
term.clear()
term.setCursorPos(1, 1)

print("What do you want to do?")
print("1: Toggle Door")
print("Q: Quit")

input = io.read()

if input == "1" then
rs.setOutput("back", not rs.getOutput("back") )

elseif input == "Q" or input == "q" then
break

else
print("INVALID ENTRY.")
end
end

verrofy
Автор

lets say the door var would be door = true/false and the code to 'switch' it would be
door = not door
rs.setOutput('side', door)
not is the opposite of the value of a boolean variable. Hope this helped!

bitslime
Автор

I have redone the coding twice and I have now got the following error message when I go to run the program:
bios:366:[string "drctrl"]:16:unexpected symbol
I am not sure what I have done wrong, I have checked and rechecked and done everything as done in the tutorial.
Any help would be greatly appreciated.

lisarothery
Автор

What he did was nested a if statement -> he put an if statement inside a if statement.
The first thing he checked was if the number is equal to "1". And if it is it continues to the next if statement which checked the password. If it isn't equal to "1" then it doesn't run the other if statement inside the first one.

Hope it made sense. Otherwise just tell me where I lost you :P

totalspelnerd
Автор

hello i have typed exact thing but with 8 controls with 4 sides using redstone and says: bios:337: [string "control"] : 75 : 'end' expected (to close 'while' at line 23).
You told me to add an end but where would i put it?

logancottreau
Автор

These are great tutorials, thanks so much!

maxmiller
Автор

I got a problem, the code works, but the redstone will not be active or deactive before a block update next to the redstone. This means I need to place a block or remove a block befor it's updated.

MCGameCraft
welcome to shbcf.ru