- ComputerCraft | Programmable Computers for Minecraft
- → jerimo's Content
jerimo's Content
There have been 73 items by jerimo (Search limited from 10-February 22)
#228142 Crafting pure certus quartz with a turtle
Posted by
jerimo
on 29 July 2015 - 06:59 AM
in
Ask a Pro
When you begin your program you launch a timer using is.syartTimer which will push an event into the stack after the determined amount of time, you then start checking for the timer event you created. If you receive that before any turtle_inventory events you know that there has been no additional items added to the turtle
Edit: just to be clear, if you receive a inventory event first you can use is.cancelTimer to stop it then starts new one and start looking for inventory events again
#228140 Fair Game War
Posted by
jerimo
on 29 July 2015 - 06:51 AM
in
Ask a Pro
KingofGamesYami, on 29 July 2015 - 12:22 AM, said:
*CC computers (by default) do not interact with other computers, unless additional code is added to them. This means you have to modify the computers' files at some point to gain access.
#227581 Shell.run help
Posted by
jerimo
on 25 July 2015 - 11:31 PM
in
Ask a Pro
Logic seems okay, assuming the door lock program does not use is.pullEventRaw which would stop you from ever running your malicious disk.
So what is it doing or not doing that you need help with?
#227580 Auto Updater
Posted by
jerimo
on 25 July 2015 - 11:24 PM
in
Ask a Pro
#227503 Turtle Tweaks
Posted by
jerimo
on 25 July 2015 - 07:09 AM
in
Suggestions
#227498 Executing a string as a Command
Posted by
jerimo
on 25 July 2015 - 06:27 AM
in
Ask a Pro
Bomb Bloke, on 25 July 2015 - 02:39 AM, said:
jerimo, on 24 July 2015 - 09:42 PM, said:
I wouldn't say it's "easier" - and I wouldn't say Dragon said that, either.
I mean, yeah, the code ends up shorter on the turtle's side, but as a result you need to send a lot more data over rednet to get the job done. Would you rather you just sent a "go forward" command and the turtle went forward, or would you rather that you had to send a "go forward" command, check on the result, send another command to make the turtle dig / attack if the movement failed, send another "go forward" command, etc, etc, etc...?
It's "easier" to handle such things locally, on the turtle itself. Granted, having both options (which is what Dragon is suggesting) is better again, but if I were going to choose between the two methods, I'd do the same as MKlegoman357.
#227453 Executing a string as a Command
Posted by
jerimo
on 24 July 2015 - 09:42 PM
in
Ask a Pro
MKlegoman357, on 23 July 2015 - 05:17 PM, said:
jerimo, on 23 July 2015 - 03:29 PM, said:
turtle[input]()
Which would run any turtle cmand you sent it, without the need for expansive if statements
My example code does pretty much the same thing, except rather than calling functions of the turtle API directly, letting you create your own commands and functions.
If you wanted to add.more APIs you could also do
Function run(APIName, funcName) if _G[APIName][funcName] then _G[APIName][funcName]() End EndWhich would allow you to use any function in any loaded API
#227271 Executing a string as a Command
#227265 Improved Turtle API
Posted by
jerimo
on 23 July 2015 - 03:04 PM
in
APIs and Utilities
_zircon_, on 23 July 2015 - 03:01 PM, said:
Those of you who have downloaded it using my method (the downloader), will always have the latest version and it will stay updated.
#226904 Help with sending a table over rednet
#226830 More coroutine questions
Posted by
jerimo
on 21 July 2015 - 04:24 PM
in
Ask a Pro
This doesn't mean it will always run, it means that it will only run when it gets what it asked for.
The way this system works also means that if you let a single computer go in for say a whole second, then all other computers are unable to do anything for that whole second either, which is why it is highly desirable for programs to yield when not in critical need of processing time
#226816 How do I check for text at a specific position.
Posted by
jerimo
on 21 July 2015 - 03:52 PM
in
Ask a Pro
Say we use a table, as tht makes it incredibly easy, and the movement is locked onto the grid due to technical limitations.
Within that table, we'll create more tables to set up the full map, this part I will leave to you, but keep in mind that a character will indicate a wall,leave undefined those you wish to be traversable.
Now the player will begin somewhere, and you can move them around that map much more easily, and simply check if a text character exists in the location where the player is wishing to go, if not then the player may move there.
Once that is done, you may move on to rendering the map itself, but before I go on there are a few things which you can work on, and you only asked about the collision map itself so I'll let you begin on that and attempt this part, if you need more help ask away
#226303 Turtle Tweaks (API)
Posted by
jerimo
on 19 July 2015 - 12:00 AM
in
Turtle Programs
HPWebcamAble, on 18 July 2015 - 11:30 PM, said:
The API doesn't change the function of the default functions,
so it won't break existing scripts! (Yes I know that's awkward wording)
Other than that seems nice and to the point
#226289 Turtle Tweaks
Posted by
jerimo
on 18 July 2015 - 10:46 PM
in
Suggestions
Let's compare;
The current way you call the function it does its thing and its done.
The way you are proposing you call a function, which then needs to compare strings, followed by assigning a few more variables to determine which block needs to be checked based on the strong and finally do its thing.
If the turtles and computers did not have to share a single thread it would not matter but due to the way that the system is made any acceleration is good
On a server I played in we had over three hundred computers running at all times, around fifty of those being turtles that were not assigned to a farm, such as the wither boss farm
#226106 Help with the Modem API
Posted by
jerimo
on 17 July 2015 - 06:22 PM
in
Ask a Pro
Also you are locking/unlocking the door if there is a player event, without checking anything then pulling a new event and seeing if its a modem event, without checking the distance at all.
Not your exact problem but imagine what would happen if you had a modem message followed by a player message. Your code would take the modem message see its not a player event and take the player event see its not a modem message and discard it.
To solve this simply change your if in line 51 to an elseif
#226105 Creating Bridge Program
Posted by
jerimo
on 17 July 2015 - 06:11 PM
in
Ask a Pro
HPWebcamAble, on 17 July 2015 - 06:01 PM, said:
BowWhalley, on 17 July 2015 - 02:09 PM, said:
if turtle.detect() ~= "minecraft:air" then turtle.dig() end turtle.attack() turtle.forward() turtle.placeDown() X1 = false while true do --Turn back, In other words it is a U-Turn if turtle.inspectDown() ~= "minecraft:air" and turtle.inspectDown() ~= "minecraft:stone" and X1 == false then turtle.turnRight() if turtle.detect() ~= "minecraft:air" then turtle.dig() end turtle.attack() turtle.forward() if turtle.detect() ~= "minecraft:air" then turtle.dig() end turtle.attack() turtle.forward() turtle.placeDown() turtle.turnRight() X1 = true end --Dig Process if turtle.detect() ~= "minecraft:air" then turtle.dig() end turtle.attack() turtle.forward() --End Process if turtle.inspectDown() ~= "minecraft:air" and turtle.inspectDown() ~= "minecraft:stone" and X1 == true then turtle.turnRight() turtle.turnRight() return end end
You still didn't fix everything Bomb suggested.
turtle.detect() will ONLY return 'true' or 'false', if there is, or isn't, a block in front of the turtle.
jerimo, on 17 July 2015 - 05:56 PM, said:
turtle.forward()//or bomb blokes go forward
Lua comments start with two dashes ( -- )
On the forums, you might want to add a # ( --# )
Also, your ending code tag has the wrong slash, that's why it isn't formatted correctly.
#226099 Creating Bridge Program
Posted by
jerimo
on 17 July 2015 - 05:56 PM
in
Ask a Pro
bridgeLength = 0 turtle.forward() while not turtle.detectDown() do turtle.placeDown() turtle.forward() --# or bomb blokes go forward bridgeLength = bridgeLength + 1 end turtle.turnRight() turtle.forward() turtle.turnRight() for i=1, bridgeLength do turtle.forward() turtle.placeDown() end
Essentially you are making it until you find ground, then turn around and make it the same length to the right of the original one
Obviously there is no inventory management nor refueling, I'll leave that up to you
#225924 Lower Variable number value
Posted by
jerimo
on 16 July 2015 - 06:19 PM
in
Ask a Pro
BowWhalley, on 16 July 2015 - 06:04 AM, said:
Also to your last statement BombBloke, I needed this information to also create the second program for a second turtle that was placing down blocks for the rail to go onto
Alternatively you could also make it go up the hills it could run into
#225923 Help with table switching
Posted by
jerimo
on 16 July 2015 - 06:11 PM
in
Ask a Pro
MrPepsi, on 16 July 2015 - 12:23 AM, said:
Grim Reaper, on 15 July 2015 - 11:15 PM, said:
MrPepsi, on 15 July 2015 - 10:33 PM, said:
What you've done here makes things more difficult than they need to be. Lyqyd's suggestion makes it easy to index the proper row table, so you can make the updates you want with ease as opposed to writing a long if-else chain to select the proper table.
Alrighty, I'll give it a try, thank you both for the help!
_G[string name] to get to a table by string name in the global table
Best of luck in your program though
#225753 Get the printed output of a program from within another program
Posted by
jerimo
on 15 July 2015 - 04:26 PM
in
Ask a Pro
KnightMiner, on 14 July 2015 - 09:19 PM, said:
jerimo, on 14 July 2015 - 04:23 PM, said:
Best of luck
- ComputerCraft | Programmable Computers for Minecraft
- → jerimo's Content


