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

[cc 1.65][mc 1.7.10] "turnOn" not working on smp server

Started by infinitebrainspace, 26 December 2014 - 11:17 PM
infinitebrainspace #1
Posted 27 December 2014 - 12:17 AM
Hi again… this is related to the problem with startup code not executing on chunk load. I am trying to come up with a
work-around for my non-OP users.

my non-op users can not click on a turtle in the world spawn chunk, so I placed a turtle outside the chunk, and programmed it to travel to the one inside the chunk and execute the turnOn method. It doesn't work.

I perform a shutdown on the target turtle inside the world spawn chunk, and go to the turtle outside the world spawn chunk
and run the following code

code:
–[
missing code just moves the turtle to the desired location inside the world spawn chunk
(approximately 20 blocks)
–]

if peripheral.isPresent("top") then
print("peripheral found on top")
T = peripheral.wrap("top")
sleep(1)
T.turnOn() – try this method and it fails,
peripheral.call("top","turnOn") – so I try this method, and it also fails
id = T.getID() – this is just to see if it can get any info from the target
print(id) – the ID should be 13
end
–[
missing code returns turtle to origin outside WSC.
–]
end of code:

output:
peripheral found on top
113

problem is, the target turtle is not turned on, and its ID is 13, not the reported 113.

LastID file shows 112 (the ID of the moving turtle), so it appears the getID method is returning the next ID, because
(assuming) it can't get the ID from the target.

I try it with the target already turned on (manually) and still the getID method returns 113.

I can physically see the turtle come up under the target, and pause for a second, then it leaves.

The startup code on the target turtle functions properly when I click on it (tells a command block to send a message to all users),
but not when I use the turnOn method from another turtle.

I'm thinking that the WSC is protected from non-OPed players, and recognizes the turtle as such.
valithor #2
Posted 27 December 2014 - 05:18 AM
-snip

I have no solution/reason why it is not working, but I do have something that may work.

If the thing in the spawn chunk does not have to be a turtle then you could get around using a turtle to move into the spawn chunk all together. Seeing as you said the turtle is just running a command through a commandblock a computer could take its place and do the same thing. If you have a computer there you can use wired modems and computercraft cables to connect to another computer just outside the spawn protection. This would work better to accomplish the same thing, and might work where the turtle is not.

I tested your code exactly as is and it worked perfectly fine for me, so you may be correct. Hopefully by using a computer instead of a turtle will work.

edit: tested on a cauldron server.
Edited on 27 December 2014 - 04:19 AM
infinitebrainspace #3
Posted 28 December 2014 - 04:39 PM
the problem with wireless, or netcables is that when the chunk unloads, the computer / turtle will not be ON to monitor the rednet signals when the chunk does load.

I don't think you understand the whole picture.
A> all players are logged off the server for 5 minutes or more, and the world spawn chunk unloads.
B> as an OP player, I can log in and rightclick the turtle /computer, and it immediately starts up.
C> I log off, and 5 minutes later the world spawn chunk unloads.
D> a non-OP player logs in, and can't rightclick the turtle / computer (cant affect anything in the WSC at all - not even to open a door, or trigger a pressure plate).
E> The non-OP player goes outside the WSC and rightclicks on a second turtle (Runner) which moves into the WSC, and attempts to "turnOn" the computer inside.

The problem originates from the turtle NOT executing the startup code when the WSC loads in the first place (which it should do).
On a single player client world, the problem does not exist, and everything works as expected.

Refer to the following link for details on the original problem:
http://www.computercraft.info/forums2/index.php?/topic/21090-mc-1710cc-165-startup-script-not-executing-on-chunk-load/page__fromsearch__1
Edited on 28 December 2014 - 03:42 PM
valithor #4
Posted 28 December 2014 - 04:49 PM
-snip

Actually you did not understand what i meant. By using computercraft cables you would not be using rednet. You can wrap peripherals through wired modems / computercraft cables, which means you do not have to be right beside them.

I am well aware of the bug, as I run a cauldron CC server.

What I am saying to do is
1: replace the turtle in the spawn chunk to a computer
2: put a wired modem on it
3: run a cable out of the spawn chunk
4: set up a computer outside of the chunk with a wired modem
5: write a short program on the computer outside the chunk to wrap the computer inside as a peripheral (Does not use rednet)

This DOES NOT require rednet, and hence does not require the computer to be on to receive any messages.
Edited on 28 December 2014 - 03:49 PM
infinitebrainspace #5
Posted 28 December 2014 - 04:55 PM
Sorry, I was unaware that a cable and wired modem eliminated the need for rednet.send / receive. So what you are saying is that I can treat the remote device as a peripheral through the wired modem. I will try that. I can swap the inside turtle for a computer with no problem. Thanks for the help. Lets see if it works.
infinitebrainspace #6
Posted 28 December 2014 - 05:17 PM
I did what you said. It works for me, but I need to test it with a non-OP player. I expect it to work, but I'm not holding my breath.
infinitebrainspace #7
Posted 28 December 2014 - 05:59 PM
Cool, works great. Thanks. It would still be nice if the startup script would execute on chunk load. :)/>