Jump to content


The_Cat's Content

There have been 45 items by The_Cat (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#261972 ME peripheral problems

Posted by The_Cat on 19 November 2016 - 11:02 AM in Ask a Pro

Look at the example on the ccwiki: http://computercraft...e.getItemDetail - But it can only get in info of blocks in the turtles inventory. (I'm not sure the ME peripheral does so..)



#261970 Keep receiving, even after receiving a message

Posted by The_Cat on 19 November 2016 - 10:57 AM in Ask a Pro

View PostKingofGamesYami, on 17 November 2016 - 11:46 PM, said:

View PostThe_Cat, on 17 November 2016 - 07:44 PM, said:

You shouldn't really use broadcast. There is a rednet.send() function to send a message directly to a certain computer.

I disagree. All computers receive the message either way.

Depends on his setup. I was just thinking that if he had multi setups the broadcast would interfere with each of the recieveing computers. But then again I guess you could sort it through the rednet.recieve sender id.



#261914 Keep receiving, even after receiving a message

Posted by The_Cat on 17 November 2016 - 07:44 PM in Ask a Pro

You shouldn't really use broadcast. There is a rednet.send() function to send a message directly to a certain computer.

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.



#261709 How would you make a calculator with multiple numbers

Posted by The_Cat on 11 November 2016 - 09:55 PM in Ask a Pro

In the while loop you are adding args[i] to args[i+1] try adding just the args[i] to res:
res = res + args[i].



#258408 turtle.getFuelLevel() confusion?

Posted by The_Cat on 25 August 2016 - 05:42 PM in Ask a Pro

turtle.getFuelLevel() returns and integer (Whole Number).
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)



#257813 Todolist - Can't find the error

Posted by The_Cat on 10 August 2016 - 09:44 PM in Ask a Pro

My guess is that tasks[p3-1+line].checked doesnt exist in the table as it expected index but got a nil value.



#257737 Monitor resolution

Posted by The_Cat on 09 August 2016 - 01:10 PM in Ask a Pro

Well if you know 1 screen width for the edges and non edges you can work it out... For example 3 horizontal 2x9 (edge monitors) = 18 + 11 (1 non edge) == 29 mean the width of 3 monitors is 29... I wrote that program to find out these values.



#257733 Monitor resolution

Posted by The_Cat on 09 August 2016 - 12:32 PM in Ask a Pro

I did this test:
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.



#257730 Monitor resolution

Posted by The_Cat on 09 August 2016 - 12:08 PM in Ask a Pro

So you want to get the resolution based off how many monitors there are? which is kinda pointless as you can do what Lupus590 said..



#257441 mining program not working

Posted by The_Cat on 03 August 2016 - 08:37 AM in Ask a Pro

View Postsupertrol, on 02 August 2016 - 09:17 PM, said:

looks like my use of the compareTo function was very incorrect but anyways i got it working (thank you for that) and btw how do i make a variable that can be used in any other program without first specifying what program it is from?
A way of achieving this would be to write in to a file then read from the file in the program. Click here for the wiki



#257158 mining program not working

Posted by The_Cat on 31 July 2016 - 05:18 PM in Ask a Pro

Ok, let me re-write what i said.
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

So you are using the compareTo predefined function. I don't think this is what you want.
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

View PostKingofGamesYami, on 27 July 2016 - 10:17 PM, said:

The .nhuicfg file doesn't contain a serialized table, therefor unserialize returned nil.
Not related to OP. But in the serialized wiki, the first code example has an error. (Unsure how/if I can edit it.)



#256797 Buttons from button API not appearing on monitor

Posted by The_Cat on 24 July 2016 - 09:18 PM in Ask a Pro

As for the original code, I can't see any errors with it. To be sure i'd double check the name of the monitor, maybe even put to next to the computer? Does the text appear that you are writing?



#256684 Buttons from button API not appearing on monitor

Posted by The_Cat on 23 July 2016 - 07:09 AM in Ask a Pro

Would recommend: http://www.computerc...touchpoint-api/
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

I believe you can use 1.9.4 Version of CC as there are not significant changes between 1.9.4 to 1.10 (not 100% sure) I haven't tested it.
http://www.computerc...-minecraft-194/



#255347 attempt to call nil

Posted by The_Cat on 02 July 2016 - 07:41 PM in Ask a Pro

You could always upload it to pastebin ;)



#255341 attempt to call nil

Posted by The_Cat on 02 July 2016 - 06:16 PM in Ask a Pro

View PostTheRockettek, on 02 July 2016 - 12:43 PM, said:

ya i found out why. I had a table called window ;-;

Thats why you should give all the code to begin with :P



#255320 attempt to call nil

Posted by The_Cat on 02 July 2016 - 09:02 AM in Ask a Pro

Is that all your code?
It works ok for me.



#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 there are non it will set the right side redstone to true as found == false, if you want it to write somthing to the screen, in the:
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?



#255246 To people who can actually use computercraft, I need your skill

Posted by The_Cat on 01 July 2016 - 01:08 PM in Ask a Pro

It should work with none. Works for me.



#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

This is crude but it works, so the chest is behind the computer and I have it emit a redstone signal if the beef is below 60. (64 causes a bug I can't be bothered to fix) Which is connected to an enderio item conduit which is only active on a redstone signal and connected to a different chest with lots of steak.
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



#255240 To people who can actually use computercraft, I need your skill

Posted by The_Cat on 01 July 2016 - 11:35 AM in Ask a Pro

legoatoom, Do you want to learn to code for CC? or someone to make it for you?



#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



#255207 To people who can actually use computercraft, I need your skill

Posted by The_Cat on 30 June 2016 - 09:57 PM in Ask a Pro

What mod pack are you using? You don't have to use CC.