- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
Zeldri
-
Content Count
3 -
Joined
-
Last visited
Posts posted by Zeldri
-
-
Is that possible to send multiple variables with comp.modem.send() ?
Because I want to send like that :
function sendMsg(type,data,data2,data3) m.open(118) m.send(address,118,type,data,data2,data3) end
And i call the function like that :
sendMsg("ReacteurInfo",pct(),cube.getEnergy(),cube.getMaxEnergy())
The problem is that the second variable isn't being send ( the third too ) same if i put cube.getEnergy() before, (in this case only cube.getEnergy() is being send and vise-versa) But when I want to send 2 or 3 string it's working perfectly
sendMsg("ReacteurInfo","test1","test2","test3")
-
I didn't find a way to replace those addresses, but if u want to get an address easily, you have the sender(s) and the server which receive the message, but the sender need an address, so at the beginning of the infinite loop I put a
component.modem.open(urport) _,_,address = event.pull("modem_message") function sendMsg(data,data2,data3) component.modem.send(address,port,data1,data2,data3) end
And in the server which receive, you put in the infinite loop :
component.modem.open(port) compoment.modem.broadcast(port)
Of course replace port by ur port ^^
It's not the best way because it send a broadcast message to everyone each loop but u can make something that when the address as been receive you can stop the broadcast
Sending multiple Variables in the network
in Programming
Posted
Ok so I dont know why but now I receive all the data but the problem is that I receive nil when I'm using it on my program
But On my program i got a nil value
There is my code