295 posts
Location
In the TARDIS at an unknown place in time.
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?
2217 posts
Location
3232235883
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
1604 posts
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)
2217 posts
Location
3232235883
Posted 15 October 2012 - 12:38 AM
why not just get the tardis to make code for you
295 posts
Location
In the TARDIS at an unknown place in time.
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.
295 posts
Location
In the TARDIS at an unknown place in time.
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)
2217 posts
Location
3232235883
Posted 15 October 2012 - 01:26 AM
your catching rednet signals in different coroutines, just make it one big loop
209 posts
Location
In your fridge.
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.
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 15 October 2012 - 01:42 AM
your catching rednet signals in different coroutines, just make it one big loop
What do you mean?
2217 posts
Location
3232235883
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
295 posts
Location
In the TARDIS at an unknown place in time.
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.
209 posts
Location
In your fridge.
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.
295 posts
Location
In the TARDIS at an unknown place in time.
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?
1688 posts
Location
'MURICA
Posted 15 October 2012 - 02:26 AM
Have you actually opened rednet?
209 posts
Location
In your fridge.
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.
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 15 October 2012 - 02:36 AM
Have you actually opened rednet?
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
I have failed so bad.
209 posts
Location
In your fridge.
Posted 15 October 2012 - 02:37 AM
You've gotta be kidding me…..
1688 posts
Location
'MURICA
Posted 15 October 2012 - 02:38 AM
I made the "error when rednet isn't open" suggestion for a reason, haha.
295 posts
Location
In the TARDIS at an unknown place in time.
Posted 15 October 2012 - 02:45 AM
Yeah, it works. I feel stupid now, probably the people that tried to help me too.. lol
2217 posts
Location
3232235883
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
295 posts
Location
In the TARDIS at an unknown place in time.
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??
2217 posts
Location
3232235883
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!
295 posts
Location
In the TARDIS at an unknown place in time.
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?!?
1688 posts
Location
'MURICA
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.
295 posts
Location
In the TARDIS at an unknown place in time.
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.
2088 posts
Location
South Africa
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/>/>
295 posts
Location
In the TARDIS at an unknown place in time.
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.
2217 posts
Location
3232235883
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
2088 posts
Location
South Africa
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/>/>
818 posts
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.
2217 posts
Location
3232235883
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
2447 posts
Posted 15 October 2012 - 08:01 PM
Stop with the spam. Topic closed.