- ComputerCraft | Programmable Computers for Minecraft
- → OmegaVest's Content
OmegaVest's Content
There have been 236 items by OmegaVest (Search limited from 10-February 22)
#143475 Using redstone signal to start program
Posted by
OmegaVest
on 04 September 2013 - 12:24 PM
in
Ask a Pro
ie
while true do
evt, arg1 = os.pullEvent("redstone")
if rs.getInput(side) then
-- Program
end
end
However, I get the sense that you also want this turtle to run other functions as well. Unfortunately, that is not so simple. And the above only works for up to six functions at a time (supposing no peripherals). But, this should give you a starting place, at least.
#140567 Where Should I Find Lists Of Different Api's?
Posted by
OmegaVest
on 18 August 2013 - 02:09 AM
in
Ask a Pro
And, for the wiki api list, it is complete except for the peripheral apis, which are linked to from the peripheral api page.
#140504 Help with Iron Tank Level showing on Monitor
Posted by
OmegaVest
on 17 August 2013 - 06:19 PM
in
Ask a Pro
m = peripheral.wrap(side or name) -- either the side of the computer, or the name of the remote peripheral, in this case "iron_tank_valve_0" for k, v in pairs(m) do print(k) end
And that will print out what the peripheral can do (if anything).
#139800 Computer Clock Speed
Posted by
OmegaVest
on 13 August 2013 - 01:39 PM
in
Ask a Pro
To shorten: it really depends on tick rate and how many computers you have running in one world.
#139335 Getting Sides On Which Peripherals Are
#138723 <Solved> Accessing Turtle Functions In _G
Posted by
OmegaVest
on 07 August 2013 - 03:39 PM
in
Ask a Pro
runCmd(cmd) -- Assuming that cmd is a valid function name, not an alias.
print("rc: ", cmd)
turtle[cmd]()
end
Should work, really. If you are set on using _G, it should still work this way, I think. I don't really deal with the Global Table directly, though, because, frankly, it's usually called for you anyway. Just typing out a variable name (so far as I know, which isn't all that far) should assume _G.<whatever you are calling>.
#133953 [Help/Questin] API calling a function outside itself
Posted by
OmegaVest
on 16 July 2013 - 04:46 PM
in
Ask a Pro
EDIT: At least, I think you can do this. It's been a while since I tried something this. . . complex.
#119832 Get turtle coords
Posted by
OmegaVest
on 22 May 2013 - 03:43 PM
in
Suggestions
EDIT: Damn, just too slow.
#118404 bios:338: [string "wood.txt"]:39: 'end' expected
Posted by
OmegaVest
on 17 May 2013 - 09:49 AM
in
Ask a Pro
function func(param) while true do if not true then -- Comment elseif blue then -- New Comment else -- Last Comment end end end
Make sure you have enough ends for the function, loop and if blocks you open. Presently you have just nested all of the following functions into fixaFuel.
#112815 Command block peripheral & iterator for loop
Posted by
OmegaVest
on 21 April 2013 - 05:25 PM
in
Ask a Pro
The second one, though, is the use of tostring.
This would be slightly better:
print(event, " " , param1, " " , param2, " ", param3)
Or just put it into writes.
#109499 I need some help, concerning tables.
Posted by
OmegaVest
on 13 April 2013 - 06:58 AM
in
Ask a Pro
Although, if you already have the data stored as a table, you can pass the table, whole, to a specific index, and it should work that way as well.
#109493 Wireless communication without modems?
Posted by
OmegaVest
on 13 April 2013 - 06:25 AM
in
Ask a Pro
Also, if you are using Misc. Peripherals (and I'm assuming you are, since you appear to be using the DW20 pack), I think the chunk loader turtles actually have modems on them. Wrap the loader peripheral and see what it brings ups when you
for k, v in pairs(peripheral.wrap(side)) do print(k) end
Actually, I know that the Misc. Peripherals chunk loader peripheral DOES work as a modem. It says so in the thread.
#108825 Simple Programs with Turtle
Posted by
OmegaVest
on 11 April 2013 - 09:02 AM
in
Ask a Pro
Also, though using modulous works, I find that using a boolean sometimes works more reliably, though that may just be too few samples. It might increase your code length, too.
#107193 Inverted Redstone signal
Posted by
OmegaVest
on 07 April 2013 - 11:26 AM
in
Ask a Pro
local on = false -- So we'll know whether to fire the pulse or not.'
local function doTime -- The pulse
rs.setOutput("right", true)
sleep(0.2)
rs.setOutput("right", false)
end
while true do
local tmr = os.startTimer(2.0) -- Make a timer for 2 seconds
local evt, arg1, arg2 = os.pullEvent() -- Catch-all for our functions
if evt == "redstone" then
if rs.getInput("left") then -- If left is on
on = true
else -- Or not.
on = false
end
elseif evt == "timer" and arg1 == tmr and on then
doTime()
end
end
And I did that in about a minute, give or take typing speed.
#106368 Graphical printers
Posted by
OmegaVest
on 05 April 2013 - 09:48 AM
in
Suggestions
And for color, guess what, my first printer had only one ink cartridge, and to make color my family had to swap out one cartridge for another and print in mattes. This was on a Windows 3.1.1 computer, as well.
#106353 Can someone help me out?
Posted by
OmegaVest
on 05 April 2013 - 09:33 AM
in
Ask a Pro
And, for new lines, yeah, setCursorPos is the only alternative. For whatever reason escape characters don't always work with term.write. Or any write, for that matter.
#100555 Creating a Call Elevator Function as part of an ElevatorAPI
Posted by
OmegaVest
on 23 March 2013 - 07:41 AM
in
Ask a Pro
ie.
thisFloor = 1
atFloor = 1
floorDiff = 4
while true do
evt, arg1, arg2, arg3 = os.pullEvent()
if evt == key and arg1 == keys.c then
if atFloor == thisFloor then
print("Already at this floor, cannot call.")
elseif atFloor > thisFloor then
targer = atFloor - thisFloor
targer = targer*floorDiff
for i = 1, targer do
moveDown()
end
elseif atFloor < thisFloor then
targer = thisFloor - atFloor
targer = targer*floorDiff
for i = 1, targer do
moveUp()
end
end
rednet.broadcast("elev "..tosrting(thisFloor)) -- I think the tostring works here, can't remember.
end
end
And, of course, you'd have to figure out how to tell if the elevator would know if it reached its floor. a torch would probably work, just make the computer look for the torch's signal to reach it.
Lastly, the above code is only an example. I have no idea if it would work, and I would suggest you only use it as an outline at best.
#100142 Turtle Upgrade - Fisher & Ender
Posted by
OmegaVest
on 22 March 2013 - 08:24 AM
in
Suggestions
Okay, so the fishing one I could see. I think RichardG's Misc. Peripherals has a fishing turtle. Or was that Aperture Science turtles? I can't remember right now.
As for ender chests: For the original mod version of the chest, it has been stated that will never happen. You can already carry a chest with you and have the turtle place it, drop everything else it's carrying into it, pick the chest back up and move on. As for the Mojang chest, there's no way to link the turtle's chest to any other, because each player has their own ender inventory. Unless the pipe interface in forge ever changes to allow for facading a turtle with a specific player's id, it will never happen. Even then, I don' t think Dan or Cloudy would do something so insecure and cheaty. I think they said they would not, actually, but I don't remember.
So in short, Fishing turtles yes, ender turtles no, because that would be ridiculous to work with, or there is a better way to do it, and a no has been shouted on it before.
- ComputerCraft | Programmable Computers for Minecraft
- → OmegaVest's Content


