Cant use rednet on startup or regularly starting code but can while edit running code?
Mylezz opened this issue ยท 5 comments
Minecraft Version
1.18.x
Version
1.100.6
Details
Its weird, I cant use rednet unless I am editing the program and running from edit, it refuses to work outside of this via startup or normal running the program via its name. I can recreate this via just this mod installed with nothing else along side it.
youtube video
2022-06-23-1.log
reinstalling the server seems to have fixed this issue, I suspect it was a version mismatch or something.
Can you post your code? From what I saw in the video, you're not using local variables so I'm suspecting that you are using something before it's defined which causes issues.
Sure thing, I also noticed every time I click the button my server log throws a lot of errors due to the disk drive?
This is the sender
os.loadAPI("BryButtonAPI")
rednet.open("back")
function credits()
monitor.setBackgroundColor(colors.black)
monitor.clear()
monitor.setTextScale(1)
monitor.setCursorPos(3, 3)
monitor.write("Mylez_ Spawner Control GUI")
monitor.setCursorPos(3, 6)
monitor.write("Excuse my bad code!")
monitor.setCursorPos(3, 9)
monitor.write("Version 1.4.7 ALPHA")
sleep(6)
monitor.setTextScale(1)
end
function fancontrol(state)
if state then
rednet.broadcast("bmgicfanoff")
else
rednet.broadcast("bmgicfanon")
end
end
fancontrol(true)
function spawners(state)
if state then
rednet.broadcast("bgmicspwnon")
else
rednet.broadcast("bmgicspwnoff")
end
end
spawners(true)
function grinder(state)
if state then
rs.setOutput("left", false)
else
rs.setOutput("left", true)
end
end
grinder(true)
function submenu()
exitSubmenuFlag = false
BryButtonAPI.drawButtons(monitor, submenuList)
while not exitSubmenuFlag do
BryButtonAPI.checkButtonsPressed(monitor, submenuList, 15, exitSubmenu)
end
end
function exitSubmenu()
exitSubmenuFlag = true
end
red = colors.red
green = colors.green
creditsButton = BryButtonAPI.createNewButton(2, 16, "App info ", red, green, false, credits)
spawnersButton = BryButtonAPI.createNewButton(2, 6, "Spawners", red, green, true, spawners)
grinderButton = BryButtonAPI.createNewButton(16, 6, "Grinder", red, green, true, grinder)
fancontrolButton = BryButtonAPI.createNewButton(2, 10, "Fan Control", red, green, true, fancontrol)
list = {creditsButton, fancontrolButton, spawnersButton, grinderButton}
monitor = peripheral.wrap("top")
monitor.setTextScale(1)
BryButtonAPI.drawButtons(monitor, list)
while true do
BryButtonAPI.checkButtonsPressed(monitor, list, 0, print)
end
this is the recipient's end
rednet.open("top")
while true do
local sender, message, protocol = rednet.receive()
if message == "bmgicfanon" then
rs.setOutput("bottom", true)
elseif message == "bmgicfanoff" then
rs.setOutput("bottom", false)
end
os.sleep(1)
end
both are set as startup but only work 100% reliably when ran while editing them.
Is it possible that you have a slightly outdated version in your disk drive, one that looks the same but communicates differently or at all over rednet.
Try running set allow_disk_startup false
in the shell to make sure it doesn't boot off the disk drive.
server log throws a lot of errors due to the disk drive
This should be fixed in 1.100.8.
As to the actual rednet issue, I'm afraid I can't reproduce this at all. It might be useful if you put some print
statements in the receiver to see what, if any, rednet messages are being received.