- ComputerCraft | Programmable Computers for Minecraft
- → EmTeaKay's Content
EmTeaKay's Content
There have been 110 items by EmTeaKay (Search limited from 10-February 22)
#104412 Riddles
Posted by
EmTeaKay
on 01 April 2013 - 09:06 AM
in
Forum Games
#104339 Riddles
Posted by
EmTeaKay
on 01 April 2013 - 06:45 AM
in
Forum Games
Dlcruz129, on 17 March 2013 - 02:07 PM, said:
Don't know.
Hangs the picture she took.
#32325 Is it possible to boot a computer or turtle and run a program remotely?
Posted by
EmTeaKay
on 17 September 2012 - 03:50 AM
in
Ask a Pro
--Put this into sender
print("Enter ID of sender: ")
id = read()
print("What would you like to send: ")
msg = read()
rednet.send(id, msg)
end
--Put this into receiver
id, msg = rednet.receive()
print(msg)
if msg == "runClear" then
shell.run("clear")
end
#32142 [Programming][Help] Making a menu
Posted by
EmTeaKay
on 16 September 2012 - 04:59 AM
in
Ask a Pro
And, sorry for the double post.
#32129 [Programming][Help] Making a menu
Posted by
EmTeaKay
on 16 September 2012 - 02:26 AM
in
Ask a Pro
startup:28:attempt to call nilAnd here is my current code, in the form of Pastebin:
http://pastebin.com/8RCmSMpE
#32117 Team Econ (Using peripherals to make life better!)
Posted by
EmTeaKay
on 16 September 2012 - 01:03 AM
in
General
Best program: Password Door Lock/Light Switch
What your current project is: Making a menu for different "stuff".
Your github username: I don't have one. And I won't get one either.
Notes: I am somewhat good at Lua, not the best, and not the worst.
#32097 A quick guide through menu making
Posted by
EmTeaKay
on 15 September 2012 - 10:07 PM
in
Tutorials
Also, my options looke like this:
1
2
3
When I want them to look like this:
1 2 3
Any help?
Here's the 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
#32072 [Programming][Menu] Making a border
Posted by
EmTeaKay
on 15 September 2012 - 07:23 PM
in
Ask a Pro
+----------+
| [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
#31977 [Programming][Help] Making a menu
Posted by
EmTeaKay
on 15 September 2012 - 04:50 AM
in
Ask a Pro
http://pastebin.com/3zEBxREP
Also, thank you in advance.
#31826 [Programming][Help] Making a menu
Posted by
EmTeaKay
on 14 September 2012 - 04:24 AM
in
Ask a Pro
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
x,y = os.pullEvent()
if y == keys.down and selected < #menuOptions then
selected = selected + 1
elseif y == keys.up and selected > 1 then
selected = selected - 1
elseif y == keys.enter then
return selected
end
end
end
x = start()
print()
print("You have selected option: "..x)
Also, it shows up like[1]
[2]
[3]
#31821 [Programming][Help] Making a menu
Posted by
EmTeaKay
on 14 September 2012 - 03:25 AM
in
Ask a Pro
All I need is the code and an explanation and I'll be able to figure it out.
- ComputerCraft | Programmable Computers for Minecraft
- → EmTeaKay's Content


