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

[1.31] [SMP] Rednet Crashing (The sender crashes this time)

Started by ComputerCraftFan11, 11 May 2012 - 03:11 AM
ComputerCraftFan11 #1
Posted 11 May 2012 - 05:11 AM
ComputerCraft Version Information: 1.31 Client / 1.31 Server

Description of Bug: I made this program that freezes when I run it, then the computer reboots and starts again

Steps to Reproduce Bug:
  • Type this code in your computer:
  • 
    local serverid = 173;
    local function sendEvent(event, p1, p2, p3, p4, p5)
    rednet.send(serverid, "EventMessage")
    rednet.send(serverid, event)
    for i = 1,5 do
      rednet.send(serverid, "p" ..i)
    end
    endos.pullEventRaw = function( _sFilter )
    local event, p1, p2, p3, p4, p5 = coroutine.yield( _sFilter )
    sendEvent(event, p1, p2, p3, p4, p5)
    
    return event, p1, p2, p3, p4, p5
    end
    term.clear()
    term.setCursorPos(1,1)
    print(os.version())
    
  • Now, the computer will not let you press anything then crash. I'm not sure if it's just my program.
BigSHinyToys #2
Posted 11 May 2012 - 06:10 AM
I think you need to look at where your sendEvent ends. as currently it goes right through the section that over writes the eventRaw function and will loop going deeper into a stack till it errors()

this is it how could i miss sutch a obvious probblem endos.pullEventRaw should be two lines

end
os.pullEventRaw
ComputerCraftFan11 #3
Posted 11 May 2012 - 06:13 AM
I think you need to look at where your sendEvent ends. as currently it goes right through the section that over writes the eventRaw function and will loop going deeper into a stack till it errors()

this is it how could i miss sutch a obvious probblem endos.pullEventRaw should be two lines

end
os.pullEventRaw

The forums messed up the format, and I noticed that right after I posted this
Cloudy #4
Posted 11 May 2012 - 11:32 AM
The first thing I'll point out is that your sendEvent function won't actually work, and you'll just send to the server the string "p1" upto the string "p5", not the params you think you're sending.

Also, why are you sending in total 7 separate messages for one event? Why not store everything in a table, serialize it, and send it over. That would make a LOT more sense.

I'm assuming you mean client as in the computer, and not the clients minecraft?
ComputerCraftFan11 #5
Posted 11 May 2012 - 06:34 PM
The first thing I'll point out is that your sendEvent function won't actually work, and you'll just send to the server the string "p1" upto the string "p5", not the params you think you're sending.

Also, why are you sending in total 7 separate messages for one event? Why not store everything in a table, serialize it, and send it over. That would make a LOT more sense.

I'm assuming you mean client as in the computer, and not the clients minecraft?

Yea, I'm not that good with tables.

I'm modifying my code to make it better (and soon add a way for the server to send events and make os.pullEvent return the message)