Lyqyd, on 01 February 2014 - 11:02 PM, said:
i have 8gb ram in my pc, 4 for minecraft, how do i activate the debug mode for CC?
There have been 8 items by quique18c (Search limited from 10-February 22)
Posted by
quique18c
on 01 February 2014 - 10:29 PM
in
Ask a Pro
local database = {
["9999999999"] = {
pin = 1014;
balance = 100;
name = "quique18c";
};
["9999999999"] = {
pin = 4321;
balance = 100;
name = "test";
};
}
local file = fs.open('.database','r')
local database = textutils.unserialize(file.readAll())
file.close()
database[tostring(srandom)] = {
pin = 0;
balance = 0;
name = sinput;
} -- I create a new entry
database[tostring(srandom)].balance = 0
database[tostring(srandom)].pin = tonumber(input2) -- i change the values
database[tostring(srandom)].name = sinput
local file = fs.open('.database','w')
file.write(textutils.serialize(database))
file.close()
local reader = peripheral.wrap("left")
local modem = peripheral.wrap("right")
local printer = peripheral.wrap("bottom")
local cmdblock = peripheral.wrap("back")
local vsnm = "0.4"
os.pullEvent = os.pullEventRaw
local function cprint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
local function cwrite(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
write(text)
end
local function csp(text, var1)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
textutils.slowPrint(text, var1)
end
function clear()
term.clear()
term.setCursorPos(1, 1)
end
local function dateprint(text)
print(os.day()..":"..os.time().." -"..text)
end
local function wite(number, name)
reader.setInsertCardLight(true)
repeat
reader.beginWrite(number, name)
local event = os.pullEvent()
if event == "mag_write_done" then
reader.setInsertCardLight(false)
cprint("Done")
cprint("Card data:")
cprint(number.." - "..name)
sleep(3)
clear()
startup()
end
until event == "mag_write_done"
end
function startup()
local file = fs.open('.database','r')
local database = textutils.unserialize(file.readAll())
file.close()
if term.isColor() == true then
term.setTextColor(32)
end
local srandom = math.random(1000000000, 9999999999)
cprint("=================================")
cprint("======Quique's ATM V."..vsnm.."======")
cprint("=================================")
cprint("What do you want?")
cprint("1 - Make a new credit card")
cprint("2 - Check balance")
cprint("3 - Withdraw money")
cprint("4 - Deposit money - comming soon")
cprint("5 - Transfer money - comming soon")
cwrite("Option:")
finput = read()
if finput == "1" then
cprint("Selected option 1")
sleep(0.5)
clear()
uno()
elseif finput == "2" then
cprint("Selected option 2")
sleep(0.5)
clear()
dos()
elseif finput == "3" then
cprint("Selected option 3")
sleep(0.5)
clear()
tre()
elseif finput == "4" then
cprint("Selected option 4")
sleep(0.5)
clear()
cua()
elseif finput == "5" then
cprint("Selected option 5")
sleep(0.5)
clear()
cin()
else
cprint(finput.."Isnt an option!")
sleep(0.5)
clear()
startup()
end
end
function uno()
cprint("Important info, read ALL LINES")
cprint("Before making a new credit card, craft one")
cprint("If u have a blank credit card now, type next")
cprint("If not, type cancel to cancel operation")
tinput = read()
if tinput == "next" then
clear()
uno2()
elseif tinput == "cancel" then
cprint("Operation canceled")
sleep(1)
clear()
startup()
else
cprint(tinput.."isnt an option!")
sleep(0.5)
clear()
uno()
end
end
function uno2()
cprint("You have a credit card.")
cprint("Please enter your playername")
cprint("DO NOT FAIL THIS")
cprint("Or type cancel to cancel")
cprint("Example: quique18c")
cwrite("Name:")
sinput = read()
if sinput == database then
cprint("Already used.")
sleep(1)
clear()
uno2()
elseif sinput == "cancel" then
cprint("Operation canceled")
sleep(0.5)
clear()
startup()
else
cprint("Name: "..sinput)
cprint("Now, type your pin (MAX 4 DIGITS)")
input2 = read()
if input2 == tonumber(input2) > 9999 then
cprint("4 digits max, please")
sleep(1)
clear()
uno2()
else
clear()
cprint("Name: "..sinput)
cprint("Pin: "..input2)
cprint("Please, enter your card")
database[tostring(srandom)] = {
pin = 0;
balance = 0;
name = sinput;
}
database[tostring(srandom)].balance = 0
database[tostring(srandom)].pin = tonumber(input2)
database[tostring(srandom)].name = sinput
local file = fs.open('.database','w')
file.write(textutils.serialize(database))
file.close()
wite(srandom, sinput)
end
end
end
function dos()
cprint("Please, enter your card")
repeat
reader.setInsertCardLight(true)
local event,arg1,arg2 = os.pullEvent()
if event == "mag_swipe" then
if tostring(arg1) == database then
cprint("Balance:")
cprint("$"..database.[tostring(arg1)].balance)
sleep(2)
reader.setInsertCardLight(false)
clear()
startup()
else
cprint("Invalid Card")
sleep(1)
reader.setInsertCardLight(false)
clear()
startup()
end
end
until event == "mag_swipe"
end
function tre()
cprint("Please insert your card")
repeat
reader.setInsertCardLight(true)
local event,arg1,arg2 = os.pullEvent()
if event == "mag_swipe" then
nmb = tostring(arg1)
if nmb == database then
reader.setInsertCardLight(false)
clear()
cprint("Welcome, "database.[nmb].name)
cprint("Insert Your PIN")
cwrite("Pin:")
jinput = read("*")
if jinput == database.[nmb].pin then
cprint("Valid Pin!")
sleep(1)
clear()
cprint("How much money do you want to withdraw?")
cwrite(" ")
kinput = read()
if tonumber(kinput) > database.[nmb].balance then
cprint("U cant withdraw money that you dont have!")
sleep(2)
clear()
startup()
elseif tonumber(kinput) < 0 then
cprint("U cant withdraw negative money!")
sleep(1)
clear()
startup()
else
cprint("Operation in progress")
csp("#==================#", 4)
sleep(5)
database.[nmb].balance = database.[nmb].balance - tonumber(kinput)
cmdblock.setCommand("/eco give @p "..kinput)
cmdblock.runCommand()
cmdblock.setCommand(" ")
cprint("Operation completed")
local file = fs.open('.database','w')
file.write(textutils.serialize(database))
file.close()
sleep(2)
clear()
startup()
end
else
cprint("Invalid Pin!")
sleep(1)
clear()
startup()
end
else
cprint("Invalid Card")
sleep(1)
reader.setInsertCardLight(false)
clear()
startup()
end
end
until event == "mag_swipe"
end
function cua()
cprint("Comming soon")
cprint("Quique's ATM updates automatically, dont worry")
cprint("Current version:" ..vsnm)
sleep(2)
clear()
startup()
end
function cin()
cprint("Comming soon")
cprint("Quique's ATM updates automatically, dont worry")
cprint("Current version:" ..vsnm)
sleep(2)
clear()
startup()
end
Posted by
quique18c
on 24 January 2014 - 05:26 PM
in
Peripherals and Turtle Upgrades
Posted by
quique18c
on 13 January 2014 - 12:57 PM
in
Ask a Pro
term.setCursorPos(1,1)it should be
term.setCursorPos(1, 1)and change os.run to shell.run
term.clear()
term.setCursorPos(1, 1)
term.setTextColor(1024)
print("AppleOS V1")
shell.run("turtledoor")
Posted by
quique18c
on 12 January 2014 - 03:32 PM
in
Ask a Pro
Moody, on 12 January 2014 - 12:26 PM, said:
p.setBundledOutput()shouldnt work at all i think [line49]
setBundledOutput(string side, number colors )but you do it like this:
p.setBundledOutput(onoffcolor, energycolor)whicht should be
p.setBundledOutput(onoffcolor + energycolor)
p.setBundledOutput()to
p.setBundledOutput(colors.brown), because i dont use brown, thanks!
Posted by
quique18c
on 12 January 2014 - 02:08 AM
in
Ask a Pro
function clear()
term.clear()
term.setCursorPos(1, 1)
end
local function cprint(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
local function cwrite(text)
local x,y = term.getSize()
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
write(text)
end
local reactor = ("2")
local nucleo = ("4")
local onoffcolor = (colors.red)
local energycolor = (colors.blue)
local onoff = "OFF"
local energy = "OFF"
local p = peripheral.wrap("back")
function menu()
clear()
term.setTextColor(32)
cprint("Reactor " ..reactor)
cprint("#===============================================#")
cprint("# #")
cprint("# Nucleo " ..nucleo .." #")
cprint("# 1- Apagar/Prender el reactor #")
cprint("# 2- Cortar/Abrir energia saliente #")
cprint("# Estado del nucleo " ..onoff .." #")
cprint("# Energia Saliente: "..energy .." #")
cprint("# #")
cprint("#===============================================#")
end
function menusel()
cwrite("Su eleccion:")
input = read()
if input == "1" and onoff == "OFF" and energy == "OFF" then
p.setBundledOutput(onoffcolor)
onoff = " ON"
sleep(1)
clear()
menu()
menusel()
elseif input == "1" and onoff == " ON" and energy == "OFF" then
p.setBundledOutput()
onoff = "OFF"
sleep(1)
clear()
menu()
menusel()
elseif input == "1" and onoff == "OFF" and energy == " ON" then
p.setBundledOutput(onoffcolor, energycolor)
onoff = " ON"
sleep(1)
clear()
menu()
menusel()
elseif input == "1" and onoff == " ON" and energy == " ON" then
p.setBundledOutput(energycolor)
onoff = "OFF"
sleep(1)
clear()
menu()
menusel()
elseif input == "2" and onoff == "OFF" and energy == "OFF" then
p.setBundledOutput(energycolor)
energy = " ON"
sleep(1)
clear()
menu()
menusel()
elseif input == "2" and onoff == "OFF" and energy == " ON" then
p.setBundledOutput()
energy = "OFF"
sleep(1)
clear()
menu()
menusel()
elseif input == "2" and onoff == " ON" and energy == "OFF" then
p.setBundledOutput(onoffcolor, energycolor)
energy = " ON"
sleep(1)
clear()
menu()
menusel()
elseif input == "2" and onoff == " ON" and energy == " ON" then
p.setBundledOutput(onoffcolor)
energy = "OFF"
sleep(1)
clear()
menu()
menusel()
else
cprint("Seleccion incorrecta")
sleep(1)
clear()
menu()
menusel()
end
end
menu()
menusel()



