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

No Response?

Started by brett122798, 14 October 2012 - 10:22 PM
brett122798 #1
Posted 15 October 2012 - 12:22 AM
Okay, I'm making testing EU measuring programs(so I know what I'm doing when I actually do it) and I'm not getting a response from the database when I ask for it. Here's the codes:

Database:


EU1 = 0
message = 0


function receiver()
id, message = rednet.receive()
if id == 11 then
EU1 = EU1 + 1
print(EU1)
message = "0"
end
end

function sender()
id, message = rednet.receive()

sleep(0.5)
EU2 = "this is a test"
rednet.send(5, EU2)
end


while true do
parallel.waitForAny(receiver, sender)
end

Master(receives the data from database):


rednet.send(15, "sendenergybill")
message = rednet.receive()
print(message)


Side Question: How do I convert an int to string?
PixelToast #2
Posted 15 October 2012 - 12:32 AM
use while true in the functions, not parallel

use textutils.serialize(data)
and textutils.unserialize(data) to change it back into its format
MysticT #3
Posted 15 October 2012 - 12:34 AM
parallel should be used with functions that run in a loop, not running it in a loop. So it should be like this:

local EU1 = 0
local message = 0

function receiver()
  while true do
    id, message = rednet.receive()
    if id == 11 then
      EU1 = EU1 + 1
      print(EU1)
      message = "0"
    end
  end
end

function sender()
  while true do
    id, message = rednet.receive()
    sleep(0.5)
    EU2 = "this is a test"
    rednet.send(5, EU2)
  end
end

parallel.waitForAny(receiver, sender)

Side Question: How do I convert an int to string?
use tostring:

local str = tostring(num)
PixelToast #4
Posted 15 October 2012 - 12:38 AM
why not just get the tardis to make code for you
brett122798 #5
Posted 15 October 2012 - 12:43 AM
why not just get the tardis to make code for you
It's broken because <Insert random reason>, like every other episode.
brett122798 #6
Posted 15 October 2012 - 12:52 AM
I'm still having the same problem even when I changed my code to this:


EU1raw = 0
message = 0


function receiver()
while true do
id, message = rednet.receive()
if id == 11 then
EU1raw = EU1raw + 1
print(EU1raw)
message = "0"
end
end
end

function sender()
while true do
id, message = rednet.receive()

sleep(0.5)
EU1 = tostring(EU1raw)
rednet.send(5, EU1)
end
end


parallel.waitForAny(receiver, sender)
PixelToast #7
Posted 15 October 2012 - 01:26 AM
your catching rednet signals in different coroutines, just make it one big loop
Lettuce #8
Posted 15 October 2012 - 01:31 AM
Try this: I've read that if you're having trouble receiving it helps to put a boolean at the end, meaning you want it to wait till the port is open. so that
rednet.send(5, EU1, true)
Might work.

Find it here.
brett122798 #9
Posted 15 October 2012 - 01:42 AM
your catching rednet signals in different coroutines, just make it one big loop
What do you mean?
PixelToast #10
Posted 15 October 2012 - 01:46 AM
your catching rednet signals in different coroutines, just make it one big loop
What do you mean?
its the way coroutines work, only one can receive at a time
brett122798 #11
Posted 15 October 2012 - 01:48 AM
your catching rednet signals in different coroutines, just make it one big loop
What do you mean?
its the way coroutines work, only one can receive at a time
I don't exactly know what you want me to do.
Lettuce #12
Posted 15 October 2012 - 02:20 AM
I think he means you are using rednet.receive() in both functions, he might not have seen that parallel.
brett122798 #13
Posted 15 October 2012 - 02:23 AM
I think he means you are using rednet.receive() in both functions, he might not have seen that parallel.
Hmm.. didn't think about that.. how can I resolve this problem?
Kingdaro #14
Posted 15 October 2012 - 02:26 AM
Have you actually opened rednet?
Lettuce #15
Posted 15 October 2012 - 02:30 AM
brett:

Well… first, you can try my last suggestion, it's four letters, and can't hurt. Next, I advise a quick test to ensure it's not a connection issue, or you're calling the right computer. In your function, have Computer A send a message to Computer B, like "Ping!" and then upon receiving that, Computer B would say "I'm here!" or something on that order. Just for troubleshooting purposes. In that code too, so you know if you set up the loops right.
brett122798 #16
Posted 15 October 2012 - 02:36 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
Lettuce #17
Posted 15 October 2012 - 02:37 AM
You've gotta be kidding me…..
Kingdaro #18
Posted 15 October 2012 - 02:38 AM
I made the "error when rednet isn't open" suggestion for a reason, haha.
brett122798 #19
Posted 15 October 2012 - 02:45 AM
Yeah, it works. I feel stupid now, probably the people that tried to help me too.. lol
PixelToast #20
Posted 15 October 2012 - 03:28 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulzations
brett122798 #21
Posted 15 October 2012 - 03:41 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
PixelToast #22
Posted 15 October 2012 - 03:50 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
brett122798 #23
Posted 15 October 2012 - 04:07 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Kingdaro #24
Posted 15 October 2012 - 04:15 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
brett122798 #25
Posted 15 October 2012 - 04:40 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.
remiX #26
Posted 15 October 2012 - 01:39 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
brett122798 #27
Posted 15 October 2012 - 03:33 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
Yes indeed.
PixelToast #28
Posted 15 October 2012 - 04:59 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
Yes indeed.
and threads with mistakes like this collect alot of off topic and non constructive posts :3
remiX #29
Posted 15 October 2012 - 05:10 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
Yes indeed.
and threads with mistakes like this collect alot of off topic and non constructive posts :3

Yep. Just wanted to add one more quote :P/>/>
Doyle3694 #30
Posted 15 October 2012 - 06:26 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
Yes indeed.
and threads with mistakes like this collect alot of off topic and non constructive posts :3

Yep. Just wanted to add one more quote :P/>/>

This is a quote just for the sake of quoting and making the quotepyramid bigger :P/>/>

But seriously, is't a bad thing that, sadly enough, happends to be almost everytime I use rednet.
PixelToast #31
Posted 15 October 2012 - 06:42 PM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I have failed so bad.
your comment managed to pass the edge of my screen, congradulations
Do I get a prize??
yes!
What?!?
Yay, quote pyramids.
Isn't it purty? No, I'm not from Texas.

A Quote within a quote within a quote within a quote within a quote within a quote within a quote.

Quoteception

But yeah, brett, worst mistake rofl :D/>/>
Yes indeed.
and threads with mistakes like this collect alot of off topic and non constructive posts :3

Yep. Just wanted to add one more quote :P/>/>

This is a quote just for the sake of quoting and making the quotepyramid bigger :P/>/>

But seriously, is't a bad thing that, sadly enough, happends to be almost everytime I use rednet.
i have only forgot to turn on rednet once, i dont know why i dont do it anymore, probably because my code is so massive that its impossible to forget to open rednet
Cloudy #32
Posted 15 October 2012 - 08:01 PM
Stop with the spam. Topic closed.