- ComputerCraft | Programmable Computers for Minecraft
- → Xhisor's Content
Xhisor's Content
There have been 37 items by Xhisor (Search limited from 10-February 22)
#32088 Nice little house [Updated]
Posted by
Xhisor
on 15 September 2012 - 08:37 PM
in
Turtle Programs
#32087 [Programming][Menu] Making a border
Posted by
Xhisor
on 15 September 2012 - 08:32 PM
in
Ask a Pro
EmTeaKay, on 15 September 2012 - 07:23 PM, said:
+----------+
| [1] |
| 2 |
| 3 |
+----------+
Also, here is my current code:
function clear()
term.clear()
term.setCursorPos(1,1)
end
function one()
sleep(.5)
clear()
print("Hello")
end
function two()
sleep(.5)
clear()
print("Hey")
end
function three()
sleep(.5)
clear()
print("Hi")
end
local menuOptions = {"1", "2", "3"}
local termX, termY = term.getSize()
local selected = 1
function centerText(text, termY)
term.setCursorPos(termX/2-#text/2,termY)
term.write(text)
return true
end
function start()
while true do
term.clear()
for i,v in ipairs(menuOptions) do
if i == selected then
centerText("["..v.."]", i)
else
centerText(v,i)
end
end
local id, key = os.pullEvent()
if key == 208 and selected < #menuOptions then
selected = selected + 1
elseif key == 200 and selected > 1 then
selected = selected - 1
elseif key == 28 then
return selected
end
end
end
x = start()
print()
if selected == 1 then
one()
end
if selected == 2 then
two()
end
if selected == 3 then
three()
end
http://www.computerc...__fromsearch__1Look through that thread, lots of good menu systems!
#29120 [Answered] Need help with clock
Posted by
Xhisor
on 01 September 2012 - 10:07 PM
in
Ask a Pro
ExtraRandom, on 01 September 2012 - 10:04 PM, said:
heres the code if you need it
function infiniteLoop() while true do local time = os.time() time = textutils.formatTime(time, false) print(time) sleep(0.8) end end infiniteLoop()
function infiniteLoop() while true do local time = os.time() time = textutils.formatTime(time, false) term.clear() term.setCursorPos(1,1) print(time) sleep(0.8) end end infiniteLoop()There you go!
#29117 I don't know why this doesn't work?
Posted by
Xhisor
on 01 September 2012 - 10:01 PM
in
Turtle Programs
aileron565, on 31 August 2012 - 10:43 PM, said:
Can someone please help me?
I am new to this.
Thx.
turtle.select(1) up8() layer() layer() layer() layer() layer() layer() layer() layer() function up8() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() end function forward13() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() turtle.forward() end function layer() row() right() row() left() row() right() row() left() row() right() row() left() row() right() row() left() row() right() row() left() row() right() row() left() row() turtle.turnright() forward13() turtle.turnright() forward13() turtle.forward() turtle.forward() turtle.turnright() turtle.turnright() turtle.down() end function row() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() digg() end function right() turtle.turnright() turtle.forward() turtle.turnright() end function left() turtle.turnleft() turtle.forward() turtle.turnleft() end function.digg() turtle.dig() turtle.forward() end
#24237 Have The Option To Code The Rom For Each Computer in-Game
Posted by
Xhisor
on 07 August 2012 - 11:30 AM
in
Suggestions
#24144 Have The Option To Code The Rom For Each Computer in-Game
Posted by
Xhisor
on 06 August 2012 - 11:13 PM
in
Suggestions
There you go, knock yourself out!
#24057 A quick guide through menu making
Posted by
Xhisor
on 06 August 2012 - 04:04 PM
in
Tutorials
BigSHinyToys, on 02 August 2012 - 04:16 PM, said:
local function menu(...) -- ver 0.1
local sel = 1
local list = {...}
local offX,offY = term.getCursorPos()
local curX,curY = term.getCursorPos()
while true do
if sel > #list then sel = 1 end
if sel < 1 then sel = #list end
for i = 1,#list do
term.setCursorPos(offX,offY+i-1)
if sel == i then
print("["..list[i].."]") -- very customisible example print(">"..list[i])
else
print(" "..list[i].." ") -- very customisible
end
end
while true do
local e,e1,e2,e3,e4,e5 = os.pullEvent()
if e == "key" then
if e1 == 200 then -- up key
sel = sel-1
break
end
if e1 == 208 then -- down key
sel = sel+1
break
end
if e1 == 28 then
term.setCursorPos(curX,curY)
return list[sel],sel
end
end
end
end
end
-- Example Usage
print("Please select Option")
local selection = menu("Redstone","Hardware","WiFi","Event Monitor","Turtle Driver","Infomation/Help","Exit")
if selection == "Redstone" then
RedstoneControl()
elseif selection == "Hardware" then
Hardware()
elseif selection == "WiFi" then
wifi()
elseif selection == "Event Monitor" then
EventMonitor()
elseif selection == "Turtle Driver" then
TurtleDriver()
elseif selection == "Infomation/Help" then
help()
elseif selection == "Exit" then
bRunning = false
end
#23949 [Turtle] Replacement for `go` utility
Posted by
Xhisor
on 06 August 2012 - 08:23 AM
in
Turtle Programs
["f"] = turtle.forward()(But with more lines, of course!)
#23783 Nice little house [Updated]
Posted by
Xhisor
on 05 August 2012 - 09:20 PM
in
Turtle Programs
#23761 Help with laying program
Posted by
Xhisor
on 05 August 2012 - 07:41 PM
in
Ask a Pro
turtle.up() while true do turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.select(1) turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.place() turtle.forward() turtle.select(1) end
#23724 [Lua] [Error] Simple Login System
Posted by
Xhisor
on 05 August 2012 - 05:01 PM
in
Ask a Pro
function optionsMenu()
print(" =====================")
print(" || Options Menu ||")
print(" =====================")
print(" || 1 Reboot ||")
print(" || 2 Shutdown ||")
print(" || 3 Admin Mode ||")
print(" || 4 Back to login||")
print(" =====================")
write("-")
local event, input2 = os.pullEvent("char")
if input2 == "1" then
print("Rebooting...")
sleep(3)
os.reboot()
elseif input2 == "2" then
print("Powering down...")
sleep(3)
os.shutdown()
elseif input2 == "3" then
print("Admin Mode")
elseif input2 == "4" then
term.clear()
term.setCursorPos(1,1)
greet()
end
end
#23710 Login To Use Computer Startup
Posted by
Xhisor
on 05 August 2012 - 04:03 PM
in
Programs
odd_kid, on 05 August 2012 - 03:54 PM, said:
Place the computer you have the program on and the disk drive beside each other and place the floppy disk in the disk drive. Write
cp startup disk/startupand there you go! Now use the disk drive and the floppy to copy the program to any computer you want using
cp disk/startup startup.
#23704 Login To Use Computer Startup
Posted by
Xhisor
on 05 August 2012 - 03:39 PM
in
Programs
Leonardoas111, on 05 August 2012 - 02:20 PM, said:
Every time I script something I use Notepad++ and just save the file in
#23703 Nice little house [Updated]
Posted by
Xhisor
on 05 August 2012 - 03:33 PM
in
Turtle Programs
acters124, on 05 August 2012 - 02:07 PM, said:
But what version of CC are you using?
#23685 Nice little house [Updated]
Posted by
Xhisor
on 05 August 2012 - 12:53 PM
in
Turtle Programs
#23677 Nice little house [Updated]
Posted by
Xhisor
on 05 August 2012 - 12:18 PM
in
Turtle Programs
#23674 Nice little house [Updated]
Posted by
Xhisor
on 05 August 2012 - 12:00 PM
in
Turtle Programs
- ComputerCraft | Programmable Computers for Minecraft
- → Xhisor's Content


