- ComputerCraft | Programmable Computers for Minecraft
- → The_Cat's Content
The_Cat's Content
There have been 45 items by The_Cat (Search limited from 10-February 22)
#261970 Keep receiving, even after receiving a message
Posted by
The_Cat
on 19 November 2016 - 10:57 AM
in
Ask a Pro
#261914 Keep receiving, even after receiving a message
Posted by
The_Cat
on 17 November 2016 - 07:44 PM
in
Ask a Pro
On the pocket computer create a while loop and within that add rednet.receive(). After a message has been received print the info you want to, then the pocket computer will wait for the turtle to broadcast again and repeat.
#258408 turtle.getFuelLevel() confusion?
Posted by
The_Cat
on 25 August 2016 - 05:42 PM
in
Ask a Pro
Pro Tip: You can always debug your program by using print statements. Such as print("Current Fuel: "..turtle.getFuelLevel())
So in the first while loop you are comparing the current amount of fuel with 'i'. 'i' is the variable which is increased in the for loop for each iteration, by this I mean 'i' is increased by value of 1 every time it starts again.
So try changing the 'i' in the first for loop to the users input. (I think thats what you want)
#257737 Monitor resolution
Posted by
The_Cat
on 09 August 2016 - 01:10 PM
in
Ask a Pro
#257733 Monitor resolution
Posted by
The_Cat
on 09 August 2016 - 12:32 PM
in
Ask a Pro
mon = peripheral.wrap("top")
w, h = mon.getSize()
-- Amount the monitor can hold
hMonitor = {6, 7}
wMonitor = {9, 11}
mon.clear()
mon.setBackgroundColor(colors.black)
for i = 1, w do
mon.setCursorPos(i, 1)
mon.write("1")
end
for i = 1, h do
mon.setCursorPos(1, i)
mon.write("2")
end
You can figure out the resolution knowing the amount of pixel can fit where.
#257441 mining program not working
Posted by
The_Cat
on 03 August 2016 - 08:37 AM
in
Ask a Pro
supertrol, on 02 August 2016 - 09:17 PM, said:
#257158 mining program not working
Posted by
The_Cat
on 31 July 2016 - 05:18 PM
in
Ask a Pro
So you said you wrote a program which checks all 4 blocks around the turtle. This is incorrect, as you are using the 'compareTo' method this is ONLY for the inventory of the turtle. For example when turtle.compareTo(2) is called it gets the currently selected slot and compares that slot to slot 2, to see if they are the same, if so it will return true. You basically need to use inspect for what you are wanting to do.
Let me tell you what your 'check' function is doing:
function check(amount)
for i = 1,4 do --# Loop 4 times in order to turn right, this is fine.
for i = 1,amount do --# Looping to the amount (which is 6 in your program)
--# This is saying if slot 1 (current selected slot) is the same as slot 1 ( 2, 3, 4, 5, 6. as its in a loop) then it will be true. nothing is being got from what is in front of the turtle.
if turtle.compareTo(amount) == true then
is = is + toadd
print("hi")
end
end
turtle.turnRight()
end
#257149 mining program not working
Posted by
The_Cat
on 31 July 2016 - 10:03 AM
in
Ask a Pro
As in your code you are saying compare the current selected slot through slot 1 - 6. Click here for the wiki
You want to compare the block that is not in your inventory.
Check out the inspect method. Click here for the wiki
So when you inspect a block you can get its name.
Depending on what you want: The way I'd do it is make a table with all the ores (that you want) and every time the turtle inspects you can compare the name of the block inspected to this table.
#257000 Trying to reference another file/program as a table, getting "attempt to...
Posted by
The_Cat
on 28 July 2016 - 09:32 AM
in
Ask a Pro
KingofGamesYami, on 27 July 2016 - 10:17 PM, said:
#256684 Buttons from button API not appearing on monitor
Posted by
The_Cat
on 23 July 2016 - 07:09 AM
in
Ask a Pro
A much more versatile button API.
#255859 Access to 1.10 version
Posted by
The_Cat
on 09 July 2016 - 09:10 PM
in
Ask a Pro
http://www.computerc...-minecraft-194/
#255250 To people who can actually use computercraft, I need your skill
Posted by
The_Cat
on 01 July 2016 - 01:22 PM
in
Ask a Pro
if not found then
rs.setOutput("right", true)
print("No Food, setting output to true")
end
When you say there is no getInventorySize()? So you are not using an ender chest?
#255243 To people who can actually use computercraft, I need your skill
Posted by
The_Cat
on 01 July 2016 - 12:04 PM
in
Ask a Pro
chest = peripheral.wrap("back")
while true do
local found = false
for i=1,chest.getInventorySize() do
local slot = chest.getStackInSlot(i)
if slot then
--#print("There are "..slot.qty.. " " ..slot.name.." in slot "..i)
if slot.name == "cooked_beef" then
found = true
if slot.qty < 60 then
rs.setOutput("right", true)
else
rs.setOutput("right", false)
end
end
print("There are "..slot.qty.. " " ..slot.name.." in slot "..i)
end
end
if not found then
rs.setOutput("right", true)
end
os.sleep(0.1)
end
#255236 To people who can actually use computercraft, I need your skill
Posted by
The_Cat
on 01 July 2016 - 10:53 AM
in
Ask a Pro
chest = peripheral.wrap("back") --# Change this to whatever
for i=1,chest.getInventorySize() do
local slot = chest.getStackInSlot(i)
--# Basicly what lupus59 said, you need your logic so it knows when to put more in the chest
if slot then --# If something in the slot if you don't do this it will crash as slot.name won't exist
--# Add if slot.name equals to food then
--# And if the quantity is less than whatever emit a redstone signal?
print("There are "..slot.qty.. " " ..slot.name.." in slot "..i)
end
end
- ComputerCraft | Programmable Computers for Minecraft
- → The_Cat's Content


