I don't know if anyone still uses this forum, but I'm running tekkit, and I've put together a code for (edit startup) the startup of the console for use on controlling some gates I've built for my hidden base, but I need a way to exit it if I want to add onto the code at any point. Here's how the code looks:
function newMenu()
term.setCursorPos(1,1)
print("Please Enter Corosponding Command")
term.setCursorPos(1,3)
write("Commands (Case Sensitive)")
end
function selection()
print(" ")
print("O - Open Gates")
print("C - Close Gates")
print("R - Reboot")
term.setCursorPos(1,8)
end
term.clear()
newMenu()
selection()
local input = read()
if input == "O" then
print("Opening")
sleep(1)
redstone.setOutput("right", true)
sleep(1)
redstone.setOutput("right", false)
sleep(1)
redstone.setOutput("top", true)
sleep(1)
redstone.setOutput("top", false)
sleep(1)
redstone.setOutput("top", true)
sleep(1)
redstone.setOutput("top", false)
sleep(1)
os.reboot()
elseif input == "C" then
print("Closing")
sleep(1)
redstone.setOutput("left", true)
sleep(1)
redstone.setOutput("left", false)
sleep(1)
redstone.setOutput("left", true)
sleep(1)
redstone.setOutput("left", false)
sleep(1)
redstone.setOutput("back", true)
sleep(1)
redstone.setOutput("back", false)
sleep(1)
os.reboot()
elseif input == "R" then
print("Rebooting")
sleep(1)
os.reboot()
else
print("Invalid Selection, Please Try Again")
sleep(1)
os.reboot()
end
and it currently only runs the code and I can't exit it if I want to add onto it at any point in time. Basically it runs the code only and won't allow me to run the cmd line (LUA command prompt?). Help?
PS, if I need to, I can also rename the startup file in the root of tekkit's save directory if it will help anything...
Startup Virus's are super popular on the server i play on and stuff so this is the program i wrote to remove them.
term.clear()
term.setCursorPos(1,1)
print("[Scanning For Viruses]")
sleep(1)
textutils.slowPrint("......")
term.setCursorPos(1,2)
term.clearLine()
textutils.slowPrint("......")
term.setCursorPos(1,2)
term.clearLine()
textutils.slowPrint("......")
fs.exists("startup")
if fs.exists("startup") == true then
term.clear()
term.setCursorPos(1,1)
print("[Potential Harm Detected]")
print("")
print("-Delete")
print("-Store")
input = read()
if input == "delete" then
term.clear()
term.setCursorPos(1,1)
print("[Potential Harm Deleted]")
fs.delete("startup")
print("")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
elseif input == "store" then
term.clear()
term.setCursorPos(1,1)
print("[Store Under What Name]")
a = read()
fs.move("startup",a)
print("[File Stored Under Name ",a,"]")
print("")
fs.delete("startup")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
end
end
if fs.exists("startup") == false then
term.clear()
term.setCursorPos(1,1)
print("[No Threat Detected]")
print("")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
end
I upgraded my lock code to Hydrogen's v3 code. Just revised it a bit - Thanks Hydro this is a lovely code with anti grief built in
--Title: TangentLock
--Version: Ver. 3
--Last Revised: 12/26/2011
--Last Revised By: Streetstar5 / FuzzyPurp187
--Author: TangentDelta (alias Hydrogen)
--Platform: ComputerCraft LUA Virtual Machine
--Notes: Please don't claim this as your own, give me credit if you use this!
code = "minecraft" --the password to "unlock" it
debug = "debug" --password to enter the terminal
output = "left" --the side that will send out the "unlock" signal
tries = 5 --how many times you can guess before it ends your session
pulsout = 5 --how long you want the redstone to be on for. I think it's in seconds.
hax = true --set to true if you want it to send out a redstone signal if password is wrong
haxout = "right" --side that you want the "incorrect password" signal to be on
print "Norton Security System Initialized"
write "Password: "
for triescnt = 1,tries,1 do
password = read()
if password == debug then
print "Debug Mode Activated"
break
end
if password == (code) then
print "Access Granted!"
redstone.setOutput(output, true)
sleep(pulsout)
redstone.setOutput(output, false)
os.shutdown()
else
if hax then
print "Acces Denied! \nLaunching Anti-Grief Security.."
print "Stand still.. This won't hurt : )"
redstone.setOutput(haxout, true)
sleep(pulsout)
redstone.setOutput(haxout, false)
os.shutdown()
else
print ("Access Denied. Attempts left: ",tries-triescnt)
write "Password: "
end
end
if triescnt == tries then
print "Maximum Attempts Reached. \nJust who the are you?"
sleep(2)
print "System is shutting down.."
sleep(1)
os.shutdown()
else
end
end
Hope the Op is changed to use this one under my lock program.
Thanks so much for this! I think it is excellent.
Rollback Post to RevisionRollBack
I came up with the idea for Mo' Armor, a mod being developed by CORE modders.
I'm working on a algebra program and could use some help. so far this is what ive got, current version available at http://pastebin.com/kyN9269h (ps if would help if someone would tell me how to put stuff in spoilers...)(pps if ur an admin/mod put the code in a spoiler please)
equ = 1
var = 2
varleft = 1
var1 = 1
var2 = 1
var3 = 1
num1 = 1
num2 = 1
var21 = 1
var22 = 1
var23 = 1
num21 = 1
num22 = 1
leftconfig = variableintegervariable
op1 = 1
plus = add
times = multiply
minus = subtract
divide = divide
ans = 1
fans = 1
print ("Welcome to King's Algebra Calculator /nHow many equations?")
equ = read()
print(How many variables?")
var = read()
if var == (1) then
print("how many variables are on the left side of the equals sign?")
varleft = read()
if varleft == (1) then
print("what is the configuration of integers of variables? example: variablevariableinteger")
leftconfig = read()
if leftconfig == "variable integer" then
print("what is the integer?"
num1 = read()
print("what is the operation between them? HINT: spell it out")
op1 = read()
print("what number is on the right?")
num2 = read()
if op1 == (plus)then
num2-num1 = ans
if op1 == (minus)then
num1+num2 = ans
if op1 == (times)then
num2\num1= ans
if op1 == (divide)then
num2*num1=ans
ans/var1=fans
print(fans)
if varleft == (0) then
print("what number is on this side?")
num1= read()
I don't know if anyone still uses this forum, but I'm running tekkit, and I've put together a code for (edit startup) the startup of the console for use on controlling some gates I've built for my hidden base, but I need a way to exit it if I want to add onto the code at any point. Here's how the code looks:
and it currently only runs the code and I can't exit it if I want to add onto it at any point in time. Basically it runs the code only and won't allow me to run the cmd line (LUA command prompt?). Help?
PS, if I need to, I can also rename the startup file in the root of tekkit's save directory if it will help anything...
try modifying streetstar5's code (actually hydro's but she posted it) to power different sides... its pretty simple
Rollback Post to RevisionRollBack
I came up with the idea for Mo' Armor, a mod being developed by CORE modders.
Name of program: Fallout 3/NV style 'hackable' terminal Functions: opening doors, with a lot of work. Download link/Copy of code:http://kyoshiku.net/fo3_term.rar A description (Optional):
Terminal to open a single door, in Fallout 3 style.
Top output goes to the door to open it, bottom input for the reset(from a secure room would be good.)
Important! all files must be in the local computer running the program. You can't just dump this one into /roms/programs/. Put them all into the /saves/worldname/computer/#/ for the computer(s) you want it in.
Is anyone able to create a download link for this? Because that one doesn't work.
how do we exactly use this codes for computercraft. Srry that I don't know how to use it plz help :'(
Make a compter, type "id" in the computer, find your world saves folder (mac: command+shift+g, then type ~/Library/Application Support/minecraft/saves) (windows: windows key+R, then type %APPDATA%, and open the minecraft/.minecraft folder and open the saves folder) now find your world folder (grey text under world name) open it and open computer and open your computer's ID, then make a text file and paste in the code... complicated
Full mostly working computer (owner's passcode is "passcode")
Name of program: PencilOS Functions: runs a computer on a computer in a computer (maybe even in a computer) Download link/Copy of code:: below A description (Optional): Full mostly working computer
this should be the startup file (must be in a floppy disk called disk):
function fB(user)
shell.run("cd /disk/files/"..user.."/")
fileBrowser(user)
end
function fileBrowser(user)
print("Use \"open\" to open a folder, \"move\" to put a file in a folder, \"rename\" to rename a file, \"delete\" to delete a file, \"EXIT\" to leave, and \"new\" to make a new folder.\n")
print("\n ..")
shell.run("ls")
write(">> ")
local wtd = read()
if (wtd == "open") then
write("Folder>> ")
local cdto = read()
shell.run("cd "..cdto)
print("\n ..")
shell.run("ls")
else
if (wtd == "EXIT") then
login()
else
if (wtd == "new") then
write("Name>> ")
shell.run("mkdir "..read())
else
if (wtd == "delete") then
shell.run("ls")
write("\nFile>> ")
local fil = read()
write("Y/N>> ")
if (read()=="Y") then
shell.run("rm ./"..fil)
end
else
if (wtd == "move") then
write("File>> ")
local fill = read()
write("Folder>> ")
local fold = read()
print(fill)
print(fold)
shell.run("mv ./"..fill.." ./"..fold.."/"..fill)
else
if (wtd == "rename") then
else
print("Not Recognized\n")
end
end
end
end
end
end
fileBrowser(user)
end
function at()
write(shell.dir()..">> ")
local read = read()
if (read=="EXIT") then
user()
else
if (read=="shell") then
print("You Are Not Allowed To Do That!")
else
shell.run(read)
end
end
if (shell.dir()=="") then
shell.run("cd /disk/files/")
end
at()
end
function textEdit(user)
write("Welcome to TextEdit\n")
write("File>> ")
shell.run("edit /disk/files/"..user.."/"..read())
login()
end
function user()
write("Logged in\nPrograms:\n\tLog Out(q)\n\tFile Browser (f)\n\tText Edit(t)\n\tShell (s)\nRun> ")
local program = read()
if ((program=="Log Out") or (program=="q") or (program=="Q")) then
write("Logging Out...")
login()
else
if (program == "Text Edit" or (program=="t") or (program=="T")) then
textEdit("Owner")
else
if ((program == "Shell") or (program == "s") or (program == "S")) then
print("Type EXIT to exit")
at()
else
if ((program == "File Browser") or (program == "f") or (program == "F")) then
fB("Owner")
end
end
end
end
end
function guest()
write("Logged in\nPrograms:\n\tLog Out(q)\n\tFile Browser (f)\n\tText Edit(t)\n\tShell (s)\nRun> ")
local program = read()
if ((program=="Log Out") or (program=="q") or (program=="Q")) then
write("Logging Out...")
login()
else
if (program == "Text Edit" or (program=="t") or (program=="T")) then
textEdit("Guest")
else
if ((program == "Shell") or (program == "s") or (program == "S")) then
print("You do not have permission to use the Shell")
guest()
else
if ((program == "File Browser") or (program == "f") or (program == "F")) then
fB("Owner")
end
end
end
end
end
function login()
term.clear()
term.setCursorPos(1, 1)
write("Enter your username\nUsers:\n\tOwner\n\tGuest\n\tShut Down\nUser> ")
local input = read()
if (input == "Owner") then
print("Logging in...\n")
write("What's the passcode?\nPasscode> ")
local pswd = read("*")
if (pswd == "passcode") then
for j=1, 10 do
term.clear()
term.setCursorPos(1, 1)
print("Logging in...")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Logging in.")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Logging in..")
sleep(0.1)
end
term.clear()
term.setCursorPos(1, 1)
write("Passcode Correct\n")
user()
else
for j=1, 10 do
term.clear()
term.setCursorPos(1, 1)
print("Logging in...")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Logging in.")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Logging in..")
sleep(0.1)
end
term.clear()
term.setCursorPos(1, 1)
write("Passcode Incorrect...\n")
sleep(1)
login()
end
else
if (input == "Guest") then
guest()
end
if (input == "Shut Down") then
for j=1, 10 do
term.clear()
term.setCursorPos(1, 1)
print("Shutting Down...")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Shutting Down.")
sleep(0.1)
term.clear()
term.setCursorPos(1, 1)
print("Shutting Down..")
sleep(0.1)
end
term.clear()
term.setCursorPos(1, 1)
os.shutdown()
login()
else
print("That is not a user")
login()
end
end
end
print("Welcome")
login()
make a folder and call it files, put it in your disk
Does anyone have a script that moves the text output line on an advanced monitor down one line? Please help, can't find any way to make this work.
Rollback Post to RevisionRollBack
Gen: 1. If you see this, please paste this into your signature and add 1 to the Gen number.
""""Criticism is not hate. Criticism isn't trolling. Please, please do not make the mistake of confusing the two." -megabyte12345" -Klockkid12Jr" -Broccoli_Monkey" -Derwan This link seems soulless...
This mod is just really awesome, but I got a problem:
I've made a program that's an infinite loop. It's something like this:
while true do
print("password: ")
pass = read()
if (password matches then door opens, if not dispensers shoot etc.)
end
end
Now to the problem: I want to edit my code. How can I do that? The program is never terminating itself as it's an infinite loop, and I cannot find any other way to exit the program than destroying the machine, which will delete my program :/
This mod is really really awesome, and it'll be really good if anyone could help me fix my problem
this will fix your problem
while true do
print("password: ")
pass = read()
if (password==pass) then
print("wellcome")
break
else
end
end
end
sorry i posted 2 quotes of the same thing, don't know how to delete this post
This mod is just really awesome, but I got a problem:
I've made a program that's an infinite loop. It's something like this:
while true do
print("password: ")
pass = read()
if (password matches then door opens, if not dispensers shoot etc.)
end
end
Now to the problem: I want to edit my code. How can I do that? The program is never terminating itself as it's an infinite loop, and I cannot find any other way to exit the program than destroying the machine, which will delete my program :/
This mod is really really awesome, and it'll be really good if anyone could help me fix my problem
this will fix that
amount_shoot=0
while true do
print("password: ")
pass = read()
if password==pass then
print("Wellcome")
break
-- you can use (break) to exit a loop
--you can also use (return) but this will exit the entire program as (break) will only exit the loop
else
print("goodbye")
--added comedy
while (amount_shoot <= 20) do
redstone.setOutput(side,true)
sleep(.5)
redstone.setOutput(side,true)
amount_shoot=amount_shoot+1
Does anyone have a script that moves the text output line on an advanced monitor down one line? Please help, can't find any way to make this work.
this will do that
monitor = peripheral.wrap("right")
-- you probbly already know this
-- you need to have the script (monitor = peripheral.wrap("right")) above any thing using it like
(monitor.clear())
monitor.clear()
monitor.setCursorPos(1,1)
--i put it in a function for easy access\etc
function cursorset()
x,y = monitor.getCursorPos()
--(y) is the up and down and (x) is the left and right
monitor.setCursorPos(1,y+1)
end
while true do
cursorset()
sleep(.5)
monitor.write(read())
end
how do you clear a computer inside the program and then set a delay for it to then print some more text?
term.clear() --clear the screen
sleep(1) --sleeps for 1 second
term.setCursorPos(1, 1) --set the cursor to top left corner
print("text") --print text on screen
A great resource for beginning coders: computercraft.info/forums2/ask-a-pro/
Rollback Post to RevisionRollBack
I came up with the idea for Mo' Armor, a mod being developed by CORE modders.
This program allows a server admin to easily and expertly control a Hunger Games style Minecraft server. Spend your time being creative making interesting and challenging game areas instead of being frustrated by command blocks and redstone clocks.
Features
1 Command Computer (replaces all command blocks and redstone circuits). Oh yeah!
Easy to follow menus that help you administer your Hunger Games experience, which can be tailored to suit any map.
Powerful control and flexibility over game flow features such as: teams (up to 4), team joining time in the lobby area, grace time (explore time with no PvP), main combat time, final showdown time (smaller map area to flush out the hiders - just like in the movie), team names, coordinates for spawn and death areas, coordinates for team joining areas, team spawn areas, and final showdown area.
Name and save your game configurations. This give you the opportunity to make a number of different Hunger Games experience in the one map, perhaps recycling your lobby (or other areas).
Colourful console messages that inform players of things like: game events, time left to join, grace time left, combat time left, who won the game.
Coloured team scoreboard (you can pick the team names - default team names: Spiders, Zombies, Skeletons, Creepers) where team kills made before you died are added to the team count.
Personal kills tally shown in player list (press TAB in game). Players name tags above their avatars are in the colour of their team, as well the number of personal kills they have made.
Death area for people who were killed, where they are no longer part of the main game but can still slay others and boost their own death tally (no longer adds to team tally however), but still gives people something to play for. Make this area a particularly awesome place and the losing players on your server will be well entertained until there is a winner.
Basic anti griefing and anti-cheat measures (if you want more control, you could add a 3rd party server admin mod [experienced server admins only]. MinecraftEdu comes with easy to use server admin tools that shouldn’t be ignored).
Requirements
Minecraft 1.7.10 (PC version) modified with Minecraft Forge 1.7.10
ComputerCraft 1.71 or higher (CraftOS 1.7)
Run a server with the above 2 specifications.
May be compatible with higher versions of Minecraft, Minecraft Forge and ComputerCraft but has not been tested with these. Will not be compatible with lower versions. Should be compatible with other mods.
Recommended
To get up and running quickly and easily one of the following options is recommended (they have what is required plus more features that you would find useful):
Tekkit Legends (1.7.10 mod pack) installed with the Technic Launcher.
MinecraftEdu (1.7.10)
How to Get It
The Easy Way - In game, right-click on a command computer and type into the console: “pastebin get kAE7UqiB hg” (without the “ “). Press “Enter”. This will download the program onto your command computer. The file will be called “hg”. Type “hg” to run the program. (Won’t work in some work places or schools that have a firewall or username authentication. In such cases, you’ll need to try one of the methods below).
The Hard Way - Type “edit hg” into your console screen. Press “Enter”. Press “Ctrl”. Select “Save”. You will need to find where this file is physically on your (actual) computer and open it with “notepad” or some other text editor (open the text editor and drag-drop the file into it). [for Tekkit Legends the usual path will be: “%appdata%\.technic\modpacks\tekkit-legends\saves\<world_name>\computer\<computer_number>\hg”] [for MinecraftEdu the usual path will be: “%appdata%\minecraftedu\servertool\worlds\tmpworld\computer\<computer_number>\hg”]. The file will be blank. Go to “pastebin.com/kAE7UqiB”. Click the small tab labelled “raw” (this will show just the program text in a new tab). Copy (Ctrl + c). Paste (Ctrl + v) into the blank “hg” file (that you have open in the text editor). Save the file. Type “dir” then press “Enter” in your console screen to see if the file is present. If present type “hg” to run the program.
PS, if I need to, I can also rename the startup file in the root of tekkit's save directory if it will help anything...
try using this instead.
os.pullEvent = os.pullEventRaw
pass = "127"
core = "1"
print "password: "
input = read("x")
if input == pass then
print "ACCESS GRANTED"
print "codecodecodecodecodecode"
return true
elseif input == core then
print "codecodecodecodecode"
sleep(1)
os.shutdown()
else
print "Wrong Password."
sleep(0.5)
print "shutting down."
sleep(0.5)
print "shutting down.."
sleep(0.5)
print "shutting down..."
sleep(0.5)
os.shutdown()
end
term.clear()
term.setCursorPos(1,1)
print("[Scanning For Viruses]")
sleep(1)
textutils.slowPrint("......")
term.setCursorPos(1,2)
term.clearLine()
textutils.slowPrint("......")
term.setCursorPos(1,2)
term.clearLine()
textutils.slowPrint("......")
fs.exists("startup")
if fs.exists("startup") == true then
term.clear()
term.setCursorPos(1,1)
print("[Potential Harm Detected]")
print("")
print("-Delete")
print("-Store")
input = read()
if input == "delete" then
term.clear()
term.setCursorPos(1,1)
print("[Potential Harm Deleted]")
fs.delete("startup")
print("")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
elseif input == "store" then
term.clear()
term.setCursorPos(1,1)
print("[Store Under What Name]")
a = read()
fs.move("startup",a)
print("[File Stored Under Name ",a,"]")
print("")
fs.delete("startup")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
end
end
if fs.exists("startup") == false then
term.clear()
term.setCursorPos(1,1)
print("[No Threat Detected]")
print("")
print("[Press Enter To Continue]")
read()
term.clear()
term.setCursorPos(1,1)
return true
end
this must be named disk/startup
Thanks so much for this! I think it is excellent.
try modifying streetstar5's code (actually hydro's but she posted it) to power different sides... its pretty simple
Is anyone able to create a download link for this? Because that one doesn't work.
Make a compter, type "id" in the computer, find your world saves folder (mac: command+shift+g, then type ~/Library/Application Support/minecraft/saves) (windows: windows key+R, then type %APPDATA%, and open the minecraft/.minecraft folder and open the saves folder) now find your world folder (grey text under world name) open it and open computer and open your computer's ID, then make a text file and paste in the code... complicated
Name of program: PencilOS
Functions: runs a computer on a computer in a computer (maybe even in a computer)
Download link/Copy of code:: below
A description (Optional): Full mostly working computer
this should be the startup file (must be in a floppy disk called disk):
Gen: 1. If you see this, please paste this into your signature and add 1 to the Gen number.
""""Criticism is not hate. Criticism isn't trolling. Please, please do not make the mistake of confusing the two." -megabyte12345" -Klockkid12Jr" -Broccoli_Monkey" -Derwan This link seems soulless...
this will fix your problem
while true do
print("password: ")
pass = read()
if (password==pass) then
print("wellcome")
break
else
end
end
end
sorry i posted 2 quotes of the same thing, don't know how to delete this post
don't use this one use the other one it's better
this will fix that
amount_shoot=0
while true do
print("password: ")
pass = read()
if password==pass then
print("Wellcome")
break
-- you can use (break) to exit a loop
--you can also use (return) but this will exit the entire program as (break) will only exit the loop
else
print("goodbye")
--added comedy
while (amount_shoot <= 20) do
redstone.setOutput(side,true)
sleep(.5)
redstone.setOutput(side,true)
amount_shoot=amount_shoot+1
end
end
end
end
hope this helps
this will do that
monitor = peripheral.wrap("right")
-- you probbly already know this
-- you need to have the script (monitor = peripheral.wrap("right")) above any thing using it like
(monitor.clear())
monitor.clear()
monitor.setCursorPos(1,1)
--i put it in a function for easy access\etc
function cursorset()
x,y = monitor.getCursorPos()
--(y) is the up and down and (x) is the left and right
monitor.setCursorPos(1,y+1)
end
while true do
cursorset()
sleep(.5)
monitor.write(read())
end
hope this helps
i was actualy looking for an awnser to that. lol.
A great resource for beginning coders: computercraft.info/forums2/ask-a-pro/
This program allows a server admin to easily and expertly control a Hunger Games style Minecraft server. Spend your time being creative making interesting and challenging game areas instead of being frustrated by command blocks and redstone clocks.
Features
Requirements
May be compatible with higher versions of Minecraft, Minecraft Forge and ComputerCraft but has not been tested with these. Will not be compatible with lower versions. Should be compatible with other mods.
Recommended
To get up and running quickly and easily one of the following options is recommended (they have what is required plus more features that you would find useful):
How to Get It
For detailed instructions go to: bit.ly/hgsap