- ComputerCraft | Programmable Computers for Minecraft
- → Fatal_Exception's Content
Fatal_Exception's Content
There have been 104 items by Fatal_Exception (Search limited from 10-February 22)
#41911 camera blocks
Posted by
Fatal_Exception
on 19 October 2012 - 12:54 AM
in
Suggestions
Who will it be tomorrow?
#41239 Title above main menu
Posted by
Fatal_Exception
on 17 October 2012 - 01:02 PM
in
Ask a Pro
...snip...
--[[ Main Methods ]]--
function main()
while running do
term.clear()
term.setCursorPos(1,1) -- << These two lines
print("Your Title Here") -- <<
term.setCursorPos(1,2)
printMenu(mainMenu)
event, key = os.pullEvent("key")
onKeyPressed(key, mainMenu)
end
end
edit: sneaky ninjas in the shadows
#41231 os.pullEvent with multiple loops
Posted by
Fatal_Exception
on 17 October 2012 - 12:08 PM
in
Ask a Pro
Call os.startTimer with the time in seconds until the timer fires, and save the return value.
Use pullEvent to check for a "timer" event with its first argument equal to the return value you saved.
Any complication with this is purely in your head, I assure you.
#41127 os.pullEvent with multiple loops
Posted by
Fatal_Exception
on 17 October 2012 - 02:28 AM
in
Ask a Pro
myTimer = os.startTimer(5) -- timer will fire in 5 seconds
event, arg1, arg2, arg3 = os.pullEvent()
if event == "timer" and arg1 == myTimer then
print("My Timer fired!")
end
#40779 Help with Installation
Posted by
Fatal_Exception
on 16 October 2012 - 02:53 AM
in
Ask a Pro
Why do you have a minecraft zip?
And why are you even considering deleting the jar?
#40776 Converting to base 2 (aka binary)
Posted by
Fatal_Exception
on 16 October 2012 - 02:46 AM
in
Ask a Pro
#40775 Email Application
Posted by
Fatal_Exception
on 16 October 2012 - 02:41 AM
in
Ask a Pro
#40771 Small issue about turtle API returns
Posted by
Fatal_Exception
on 16 October 2012 - 02:22 AM
in
Ask a Pro
#40490 Retrieving items
Posted by
Fatal_Exception
on 15 October 2012 - 11:31 AM
in
Ask a Pro
#40472 [Question] Starting a timer in the middle of code.
Posted by
Fatal_Exception
on 15 October 2012 - 09:58 AM
in
Ask a Pro
#40430 Email Application
Posted by
Fatal_Exception
on 15 October 2012 - 05:35 AM
in
Ask a Pro
#40363 Is there any way to get rid of the "too long without yielding" error?
Posted by
Fatal_Exception
on 15 October 2012 - 12:58 AM
in
Ask a Pro
The solution is as Lyqyd said. Throw in some sleep(0) to let it yield.
#40012 Unhackable Password Door (Simple)
Posted by
Fatal_Exception
on 14 October 2012 - 06:56 AM
in
Programs
ChaddJackson12, on 14 October 2012 - 03:19 AM, said:
When someone's presses Ctrl, have the computer reboot; but before rebooting have it delete disk/startup, or even multiple disk startups; and THEN reboot the computer, meaning that if they put a disk in then press control, their disk would no longer have a startup to exit the normal program!
Tell me how well this works for you!
Like this:
repeat
event, key = os.pullEvent("key")
os.sleep(0.1)
until key == (# for LCTRL) or key == (# for RCTRL) or key == (# for ENTER)
If key == (# for LCTRL) or key == (# for RCTRL) then
if fs.exists("disk/startup") then
fs.delete("disk/startup")
os.reboot()
else
os.reboot()
end
elseif key == (# for ENTER) then
-- password script
end
Sorry I don't have the numbers for the IDs of the keys but I am unsure of them and am too lazy to look for them at the moment :3. Hope that I helpedAll you'd have to do is shut the computer down, then switch disks.
#40010 "Small" Problem
Posted by
Fatal_Exception
on 14 October 2012 - 06:48 AM
in
Ask a Pro
#40009 Strange Problem
Posted by
Fatal_Exception
on 14 October 2012 - 06:46 AM
in
Ask a Pro
#39928 "Small" Problem
Posted by
Fatal_Exception
on 14 October 2012 - 01:56 AM
in
Ask a Pro
#39920 "Small" Problem
Posted by
Fatal_Exception
on 14 October 2012 - 01:35 AM
in
Ask a Pro
#39918 How do I make a GUI with key events?
Posted by
Fatal_Exception
on 14 October 2012 - 01:33 AM
in
Ask a Pro
#39890 Problem with rednet sending
Posted by
Fatal_Exception
on 14 October 2012 - 12:07 AM
in
Ask a Pro
local alphabet = { (a table of characters here) }
local str = ""
for i = 1, 6 do
str = str .. alphabet[math.random(1,#alphabet)]
end
#39887 How do I make a GUI with key events?
Posted by
Fatal_Exception
on 14 October 2012 - 12:01 AM
in
Ask a Pro
As for receiving and detecting other events at the same time:
local event, arg1, arg2, arg3 = os.pullEvent() if event == "rednet_message" then -- arg1 is senderid -- arg2 is message -- arg3 is distance elseif event == "key" then -- arg1 is keycode end
#39693 startup on server?
Posted by
Fatal_Exception
on 13 October 2012 - 10:17 AM
in
Ask a Pro
#39690 Print doesn't work correctly.
Posted by
Fatal_Exception
on 13 October 2012 - 10:12 AM
in
Ask a Pro
#39332 Looping program forces computer to shutdown.
Posted by
Fatal_Exception
on 12 October 2012 - 07:09 AM
in
Ask a Pro
input = "top" output = "left" rs.setOutput(output, true) while true do if os.pullEvent() == "redstone" then -- <<THIS if rs.getInput(input) then rs.setOutput(output, false) sleep(8) rs.setOutput(output, true) end end end
edit: ninja!
#39313 Delete This.
Posted by
Fatal_Exception
on 12 October 2012 - 04:23 AM
in
General
#38924 The stack and you: How to not crash your program
Posted by
Fatal_Exception
on 11 October 2012 - 01:32 AM
in
Tutorials
The major take home point being, if you aren't careful to clean up after yourself, your program will crash eventually.
- ComputerCraft | Programmable Computers for Minecraft
- → Fatal_Exception's Content


