This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
FortuneSyn's profile picture

Code works in SSP, but not on SMP

Started by FortuneSyn, 17 November 2012 - 09:45 AM
FortuneSyn #1
Posted 17 November 2012 - 10:45 AM
Hello, I have a turtle that is suppose to spit out all except 2 items from his itemslot 9 (this is computercraft in the tekkit modpack). In single player it works fine, but in my server it is not working and i don't know why. I tried adding in sleep() before the item drop but it didnt help. code is below. Any ideas on why this is so and how to fix/go around it?


function itemdrop(data)
  z = turtle.getItemCount(data)
  if z > 0 then
   turtle.select(data)
   turtle.drop()
  end
end
itemdrop(1)
itemdrop(2)
itemdrop(3)
itemdrop(4)
itemdrop(5)
itemdrop(6)
itemdrop(7)
itemdrop(8)
z = turtle.getItemCount(9)
if z > 2 then
  turtle.select(9)
  sleep(1)
  turtle.drop(z-2)
end
Tiin57 #2
Posted 17 November 2012 - 10:45 AM
It would be nice to know what the problem is. "it is not working" is not a valid error. :)/>/>
remiX #3
Posted 17 November 2012 - 10:59 AM
How can it not work on the server but in single player? What exactly does it do?
FortuneSyn #4
Posted 17 November 2012 - 11:01 AM
My bad =P that was kind of silly.

No items will drop from slot 9. For example if it was 64x cobblestone on slot 9, then the turtle will drop items 1-8 just fine but slot 9 will remain with 64 cobblestones.

The turtle will select slot 9, so my only conclusion is that the turtle for some reason is not executing turtle.drop(z-2)
Sammich Lord #5
Posted 17 November 2012 - 11:01 AM
This may be a modification they have made on the server side of things to prevent certain parts of ComputerCraft. A lot of Tekkit servers seem to do that(Maybe because you can crash a server in about 5 lines of code.).
remiX #6
Posted 17 November 2012 - 11:05 AM

turtle.drop(z-2)
what happens if you remove the 'z-2'?
Tiin57 #7
Posted 17 November 2012 - 11:05 AM
This may be a modification they have made on the server side of things to prevent certain parts of ComputerCraft. A lot of Tekkit servers seem to do that(Maybe because you can crash a server in about 5 lines of code.).
Yeah, CC should be more server-friendly. I have no idea how to make it happen, but Cloudy and dan need to do it!
-.-
Don't ever say that. Ever.
Edit:
Does turtle.drop() actually accept arguments?
FortuneSyn #8
Posted 17 November 2012 - 11:07 AM
This may be a modification they have made on the server side of things to prevent certain parts of ComputerCraft. A lot of Tekkit servers seem to do that(Maybe because you can crash a server in about 5 lines of code.).

This code sits in a much larger code for a turtle, and the code for the turtle works just fine except for the turtle.drop(z-2).
FortuneSyn #9
Posted 17 November 2012 - 11:09 AM

turtle.drop(z-2)
what happens if you remove the 'z-2'?

then the turtle will spit everything that is in slot9, just tested it in server
FortuneSyn #10
Posted 17 November 2012 - 11:18 AM
OK I just recorded it on a video: http://www.twitch.tv/nevermann/b/340634731

This is me demonstrating z-2, then demonstrating removing it on my server
Cloudy #11
Posted 17 November 2012 - 11:33 AM
Yeah, CC should be more server-friendly. I have no idea how to make it happen, but Cloudy and dan need to do it.

We did. Tekkit never updated to it.
FortuneSyn #12
Posted 17 November 2012 - 11:38 AM
Yeah, CC should be more server-friendly. I have no idea how to make it happen, but Cloudy and dan need to do it.

We did. Tekkit never updated to it.

So is it the act of subtracting within a function that isn't supported on tekkit servers?
diegodan1893 #13
Posted 18 November 2012 - 12:45 AM
If you are doing turtle.drop() in a chest make sure that the user "[ComputerCraft]" has perms to open it. If the server uses LWC plugin do /cmodify [ComputerCraft] and it should work well.