- ComputerCraft | Programmable Computers for Minecraft
- → spdkils's Content
spdkils's Content
There have been 49 items by spdkils (Search limited from 30-March 23)
#152328 Turtle Head Lights...
Posted by spdkils on 08 November 2013 - 02:47 PM in Suggestions
So is the challenge having the light of a turtle control by an internal state, as opposed to globally? Clearly lights in game (forge mods, and otherwise) can be controlled by other states than just redstone. (IC2 has lights in it as well, I thought they checked power, and redstone?)
I don't understand the build of the game well enough to even understand why this is a problem, and if it would be hard/simple.
I just want me some turtles with headlights! (Mostly because my turtles are mining turtles, and being able to see them sure would be nice!)
#152327 Adding Lines for Fully Automated Tree Turtle
Posted by spdkils on 08 November 2013 - 02:27 PM in Ask a Pro
The tree chopper goes around in a circle, end to end, and chops trees.... Every 30 seconds it sweeps past, and chops any trees.
So really, at the pause, at the start of the loop, every time that runs, it will be on each end of the loop its making...
1st pause it at one end, then it moves to the other end, and pauses, then it moves back. So, you have to double chest. (One at each end.) Or only drop/suck at one end... every other pause.
#152122 Wireless modem transmit help
Posted by spdkils on 06 November 2013 - 11:20 PM in Ask a Pro
why pull the event, and pull the front, and do one with a loop and the other without?
function execute() if redstone.getInput("front") == true then listen() end while true do r = os.pullEvent() if r == "Redstone" then if redstone.getInput("front") == true then listen() end end end end
Simplify
function execute() while true do if redstone.getInput("front") == true then listen() end end end
or just do it with an event
function execute() while true do r = os.pullEvent('redstone') --@ note the lack of a capital R! if r then if redstone.getInput("front") == true then listen() end end end end
Also, I'm not really sure why have have listen broken out at all. it's only doing 1 thing. I would have both those in 1 loop. and while we're at it? Why not handle the break too?
function execute() while true do tEvent = {os.pullEvent()} if tEvent[1] == 'redstone' then if redstone.getInput("front") == true then -- nothing we ALWAYS listening. end elseif tEvent[1] == 'modem_message' then modem.transmit(1, 1, "Display") if tEvent[5] == 0 then redstone.setOutput("left", true) os.sleep(0.5) redstone.setOutput("left", false) end elseif tEvent[1] == 'key' and tEvent[2] ~= 1 then return true end end end
Now I didn't check my code, but it seems far easier to just have a single event loop, and do what you need in response to any of the events, just using elseIf.
#151901 Commandblock Api Addition
Posted by spdkils on 04 November 2013 - 08:07 PM in Suggestions
This would enable you to get the block type directly using the command block without doing any sort of a loop.
it prints out 'false' got type block.name grass block.
So if you can get those results, then you can use a command block, to replace replicate an aweful lot of the sensor addon.
Use GPS to tell the command block computer where you're at... Ask it to test the block, get the results as text, and now you know it's grass, or what have you, dig or not dig based on that return. Now you have actual sensors capability on your turtle, just using modems, and command block.
#151878 I need help with ComputerCraft (and reading sticky posts)
Posted by spdkils on 04 November 2013 - 04:39 PM in Ask a Pro
http://pastebin/Pf3w7ZdZ
I didn't write the command block commands nessisary, as you will have to craft the water tank, the lava pit, and the free fall tunnel before you teleport them to their death. I also didn't check to ensure they stayed on the menu, etc etc. Just sloppy, but it outlines how it can work.
#151487 How To Use Arrow Keys To Scroll Through Menu?
Posted by spdkils on 31 October 2013 - 11:46 PM in Ask a Pro
This you have to react to each and every keystroke. I just had one IF that pulled chars, and another for key events, so you can capture the arrow keys, and react...
So, for the password stuff. You're going to need to prompt, assume any keystrokes are for that, check, then draw your menu, then redraw on arrow keystroks... etc.
#151419 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 31 October 2013 - 10:27 AM in Ask a Pro
1) record what row you're on. (Change for loop to while loop, with manual counter)
2) record what hole you're on. (Duplicate the array, remove each command as they are executed.)
3) upon startup check those values, to see if it's a resume. (That is why we have to use a while loop.)
4) if you finish, delete the files that save that state.
Not TOO hard. But you may get stuck in strange places if you don't account for turning. So you would have to also record facing... So maybe change the computer label every turn, so you relable, and then turn. OR fire those methods at the same time. IF you're really paranoid about losing state.
^^ Or that API, that looks pretty cool, and you just override the turtle, and refuel functions... maybe easier!
#151370 String.find() Return Single Number
#151342 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 05:57 PM in Ask a Pro
If you were to cut every 3rd layer, and turtle compare top/bottom at the same time, you would need 1/2 the selects, but more moves. Calling the drop, and how it works out, it isn't the fastest thing I've ever worked on, but it works completly.
I never thought of using the enderchest addon, to give the turtle infinite storage. I always just speed things up by making MORE turtles!!!! (I have 16 of them that I run in mass with wireless controlling to do my "big" jobs.)
You could speed it up by 'sewing' dig down, move across dig up, move dig down, move dig up. etc.... So you could cut up and down thru the job to prevent a lot of wasted movements. 40 down, 40 up (wasted), 40 down, 40 up (wasted).
There are lots of patterns to use.
I just think it's fun to write code, and solve problems. So I'll probably tweak this some more. See if I can come up with a faster way of doing the compares. (I typically just dig, and discard, but that leaves a BIG hole)
#151335 Help With Write
Posted by spdkils on 30 October 2013 - 05:31 PM in Ask a Pro
So, keystrokes can be caught and handled, or you can just take 'normal' textual input, and move the program along based on input strings.
#151328 Turtle Head Lights...
Posted by spdkils on 30 October 2013 - 05:03 PM in Suggestions
The other option, seems to be a new turtle type, that is a turtle mod, not a periprial, that would be a turtle with addtional methods. Even a new block ID. However, I don't really understand the workings of Turtles forge, the api, or any of it... I'm clueless. Another one was suggested already, skinning turtles, so you can color/badge them, and add lighting to that. (But again, I have NO CLUE how the blocks are built, how the light is controled, skinning, meta, any of that stuff.)
So, anything that gets lights on turtles == GOOD!
Now that colored glass is in 1.7.2, create monitors with color screens, (back to skinning) anyway, I don't want to go too far off topic. LIGHTS ON TURTLES FTW!
#151317 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 03:37 PM in Ask a Pro
#151309 Topic Hijack Rednet Question
Posted by spdkils on 30 October 2013 - 02:59 PM in Ask a Pro
If you're talking a turtle... modem is on the right.
local modem = periphrial.wrap('right')
modem.open(channel)
modem.transmit(channel,rchannel,message)
http://computercraft...heral_%28API%29
http://computercraft...Modem_%28API%29
#151308 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 02:55 PM in Ask a Pro
Added a check for bed rock, functioned the search...
Still need to discard cobble, and a few other things, and optimize code for speed!
I'd rewrite a lot of this, because it's grown organically it makes it hard to hack in new code. Also, I'd function so much stuff, so the loop would be insanely clean.
#151304 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 02:06 PM in Ask a Pro
So I would check all the time. Also unless you're digging "flat" ground, you're going ot run into the issue of not being tall enough. So, there are still some assumptions we make while running this code.
If you cut thru a hill, then you've got that issue. But we can just swiss cheeze the hill, and cut forward every turtle forward, to ensure it's clean. at least it will be a flat plane of empty.
The program still ends far corner because we're doing 25 wide, if we move it 26 it will at least end on the same side as the start. (even cuts, I almost always use them.)
Let me hack in a few more things.
Same pastebin as always.
#151294 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 01:26 PM in Ask a Pro
Also the dig down, isn't bias, it just digs down... So when you loop the inventory slots of 1-4, you should discard anything above 1, so that you don't fill on dirt/cobble on accident.
#151293 How To Code This Grid Into A Mining Turtle.
Posted by spdkils on 30 October 2013 - 01:20 PM in Ask a Pro
http://pastebin.com/CwTEk33r
- ComputerCraft | Programmable Computers for Minecraft
- → spdkils's Content