To send information back and forth between computers you'll want to look into the
Modem API and the
Rednet API and choose which suits your need better. Since you have no code, I'm not sure what else you'll need help with, but the rest *should* be pretty self explanatory if you're reasonably familiar with CC Lua. If you have further questions, please post away and I or someone will help point you in the right direction.
A simple example with Rednet - this will change plot1 from "For rent" to "Rented" - no user interaction in this example…
Pocket Computer
local serverID = 7 --# this should be set to whatever the computer # is for the server (this can be found out by typing ID at the prompt)
for _, side in pairs(rs.getSides()) do --# find the modem
if perihperal.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(modemSide) --# initialize the modem for use with Rednet
break
end
local plot1 = "Rented"
rednet.send(serverID, plot1)
Server
local clientID = 5 --# this should be set to whatever the computer # is for the pocket computer (this can be found out by typing ID at the prompt)
local plot1 = "For Rent" --# initialize our plot1 variable with the string "For Rent"
for _, side in pairs(rs.getSides()) do --# find the modem
if perihperal.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(modemSide) --# initialize the modem for use with Rednet
break
end
local id, message = rednet.receive() --# wait for a Rednet message
if id == clientID then --# if the sender if our pocket computer
plot1 = message --# update plot1 with the new value
end
Clearly you'll need to change this to suit your need - for example, you'll probably want to use tables so you can track and transmit each plot and it's status more easily.
A simple table for holding your plots could look like this…
local plots = { [1] = "For Rent", [2] = "For Rent", [3] = "For Rent" }
The above table hold three plots, numbered 1, 2, 3 - each with the status for that plot. Then you would adjust the above example accordingly…
Pocket Computer
local serverID = 7 --# this should be set to whatever the computer # is for the server (this can be found out by typing ID at the prompt)
local plotSelected, plotStatus --# variables used to store user input for selected plot number and its status
for _, side in pairs(rs.getSides()) do --# find the modem
if perihperal.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(modemSide) --# initialize the modem for use with Rednet
break
end
local plots = { [1] = "For Rent", [2] = "For Rent", [3] = "For Rent" }
... user input here - we'll assume the user selected plot 1 and changed it to "Rented" ...
local message = { plotSelected, plotStatus } --# create a table with our selected plot as the first entry and the plot's status as the second entry
rednet.send(serverID, message)
Server
local clientID = 5 --# this should be set to whatever the computer # is for the pocket computer (this can be found out by typing ID at the prompt)
local plots = { [1] = "For Rent", [2] = "For Rent", [3] = "For Rent" }
local plot, status --# variables we'll use to hold the data from the table sent over rednet
for _, side in pairs(rs.getSides()) do --# find the modem
if perihperal.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(modemSide) --# initialize the modem for use with Rednet
break
end
local id, message = rednet.receive() --# wait for a Rednet message
if id == clientID then --# if the sender if our pocket computer
plot = message[1] --# take the first table entry as our plot number
status = message[2] --# take the second table entry as our status for that plot number
end
plots[plot] = status --# update our plots table with the new status
After the above example, the example table would look like this…
local plots = { [1] = "Rented", [2] = "For Rent", [3] = "For Rent" }