I'm new to CC don't hate
Search for a specific word?
Started by Imprivate, Dec 23 2013 07:35 PM
5 replies to this topic
#1
Posted 23 December 2013 - 07:35 PM
So I'm trying to make a system with 4 computers where there is a sender, two receivers and a 'server'. The sender rednet.send's a string to the 'server' containing one of the receiving computers ID's. Is there a way for the 'server' to check the string for certain text (in this case the receiving computers ID) and, say, store it in a variable(e.g: ReceivingID). Then the server could do: rednet.send(ReceivingID, "String"). This is just a guess, is there any way at all for me to do this? Thanks for reading, Imprivate
I'm new to CC don't hate
I'm new to CC don't hate
#2
Posted 23 December 2013 - 08:08 PM
Well if you're just sending the ID's then it is easy
--# The computer that sends local id = 101 rednet.send(<serverID>, id) --# Server Computer local id, receiverID = rednet.receive() receiverID = tonumber(receiverID) -- Converts receiverID to a number
#3
Posted 25 December 2013 - 05:22 PM
Hellkid98, on 23 December 2013 - 08:08 PM, said:
Well if you're just sending the ID's then it is easy
--# The computer that sends local id = 101 rednet.send(<serverID>, id) --# Server Computer local id, receiverID = rednet.receive() receiverID = tonumber(receiverID) -- Converts receiverID to a number
I wanted the ID in a string but oh well. I can always do read() and save that as the ID, I was just wondering if there was a way to check strings for certain text. Thanks anyway for you reply
P.S Checked out your Lasers game btw, +1'd
#4
Posted 25 December 2013 - 09:36 PM
Imprivate, on 25 December 2013 - 05:22 PM, said:
I wanted the ID in a string but oh well. I can always do read() and save that as the ID, I was just wondering if there was a way to check strings for certain text. Thanks anyway for you reply
P.S Checked out your Lasers game btw, +1'd
#5
Posted 26 December 2013 - 08:15 AM
Elgriton, on 25 December 2013 - 09:36 PM, said:
Imprivate, on 25 December 2013 - 05:22 PM, said:
I wanted the ID in a string but oh well. I can always do read() and save that as the ID, I was just wondering if there was a way to check strings for certain text. Thanks anyway for you reply 
P.S Checked out your Lasers game btw, +1'd
P.S Checked out your Lasers game btw, +1'd
Wouldn't that just check for the word "ID"? Oh well, this is still really useful, thanks!
#6
Posted 26 December 2013 - 11:05 AM
No, tostring() converts numbers to strings. tonumber() does the opposite, as long as the string represents a valid number.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











