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

Sending message to get variables

Started by Boss Nomad, 02 January 2013 - 12:57 AM
Boss Nomad #1
Posted 02 January 2013 - 01:57 AM
I am interested in making a program that when u send message over rednet to computer2. Computer2 sends back variables that are listed in computer2. Also way to send variables back to computer2 and list them with id in computer2. New update overwrites old.

I dont know where do i start making it, thats why im asking for help how should it go.
W00dyR #2
Posted 02 January 2013 - 02:00 AM
This wiki page should get you quite far on getting started:

http://computercraft.info/wiki/Rednet_Tutorial
remiX #3
Posted 02 January 2013 - 02:09 AM
Using tables could work, try this?

-- Table with the variables it must send back if it has the correct received one
t_table = {
    ["Var 1"] = "You sent me var 1!",
    ["Var 2"] = "You sent me var 2!",
    ["Var 3"] = "You sent me var 3!",
}

while true do
    senderID, msg = rednet.receive()
    if t_table[msg] then
        rednet.send(senderID, t_table[msg])
    else
        rednet.send(senderID, "That variable is not saved in my computer.")
    end
end