- ComputerCraft | Programmable Computers for Minecraft
- → Henness's Content
Henness's Content
There have been 39 items by Henness (Search limited from 10-February 22)
#189603 Problems with openperipherals
Posted by
Henness
on 30 July 2014 - 09:41 PM
in
Ask a Pro
#189582 Problems with openperipherals
Posted by
Henness
on 30 July 2014 - 05:20 PM
in
Ask a Pro
http://pastebin.com/ytFz7qtS
can anyone tell be where i went wrong?
#161646 Custom Error's Using pcall()
Posted by
Henness
on 22 January 2014 - 09:16 PM
in
Ask a Pro
Because when you run a program with shell.run it adds the program to a new spot at the end of a table with tProgramStack[#tProgramStack + 1] = sPath then when you call shell.getRunningProgram() it just returns the last variable in the table
Unless your talking about os.run()
#161636 Custom Error's Using pcall()
Posted by
Henness
on 22 January 2014 - 07:32 PM
in
Ask a Pro
bError, sError = pcall(os.run({}, "advancedorefinder", "orefinder.save"))
Loadfile() seems to work too but if I use it then The program that it runs cant use shell.getRunningProgram()
#161602 Custom Error's Using pcall()
Posted by
Henness
on 22 January 2014 - 05:15 PM
in
Ask a Pro
Bomb Bloke, on 22 January 2014 - 04:54 AM, said:
Edit: I've not played with them, so I'm not even sure they're available within ComputerCraft, but I suspect you want something along the lines of dofile() or loadfile().
Thanks Bomb, that works first time I have ever seen dofile and loadfile there isn't much info on them either. I think that the shell.run should be modified to return values :/
#161555 Crashing program
Posted by
Henness
on 22 January 2014 - 03:03 PM
in
Ask a Pro
while true do local event, button, x, y = os.pullEventRaw() if event == "mouse_click" then if x>23 and x<26 and y==13 then -- code here break end end end
#161481 Custom Error's Using pcall()
Posted by
Henness
on 22 January 2014 - 04:35 AM
in
Ask a Pro
#161465 [Forum] Code Snippet Section
Posted by
Henness
on 22 January 2014 - 12:28 AM
in
Forum Discussion
local function forward()
while not turtle.forward() do
if turtle.detect() then
if not turtle.dig() then
return false
end
else
turtle.attack()
end
end
return true
end
Personally I like the snippet idea
#161450 is it possible to execute a redstone signal when something is said in chat
Posted by
Henness
on 21 January 2014 - 07:53 PM
in
Ask a Pro
http://www.computerc...peripherals-33/
#161449 is it possible to execute a redstone signal when something is said in chat
Posted by
Henness
on 21 January 2014 - 07:48 PM
in
Ask a Pro
http://www.computerc...urtle-upgrades/
Immibis's Peripheral can make it so if you have a key card in your inventory it will open the door when you get close, it might be better for your situation.
http://www.computerc...ss-peripherals/
#161416 Custom Error's Using pcall()
Posted by
Henness
on 21 January 2014 - 03:46 PM
in
Ask a Pro
But this does not seem to be working, it doesnt print the error.
Main program:
bError, sError = pcall(shell.run, "testprogram", "variable") if not bError then print(sError) else -- continue end
Test program:
error("This is an Error")
#161396 Custom Error's Using pcall()
Posted by
Henness
on 21 January 2014 - 01:15 PM
in
Ask a Pro
I cant seem to make a custom error message for if the program is being used wrong. I don't really know how to use pcall() can you even return a custom error message back to it?
http://pastebin.com/QpfucDe1
GUI program:
bError, sError = pcall(shell.run, "program name", "variable") if not bError then menustate = "error menu" else menustate = "main menu" end
Program ran by GUI program:
if turtle.getFuelLevel() > 0 then return false, "Error, there must be fuel in the turtle!" endalso tryed
if turtle.getFuelLevel() > 0 then return "Error, there must be fuel in the turtle!" end
#161360 Advanced Programs: Orefinder, Tunnel.
Posted by
Henness
on 21 January 2014 - 05:14 AM
in
Turtle Programs
#161040 Advanced Programs: Orefinder, Tunnel.
Posted by
Henness
on 18 January 2014 - 11:40 AM
in
Turtle Programs
- ComputerCraft | Programmable Computers for Minecraft
- → Henness's Content



