Currently you can contact all computers with :
Computer 1:
local myLabel = os.getComputerLabel()
wlan.on("pong", function(data)
term.write(data)
end)
wlan.broadcast("ping", myLabel)
Other Computer:
wlan.on("ping", function(computerLabel)
wlan.emit(computerLabel, "pong", {
id = os.getComputerID(),
label = os.getComputerLabel()
})
end)
You can also use an autorun now:
wlan.onBuiltComputer(function(event)
term.write("wlan.onBuiltComputer", event)
event.autorun(function()
term.write("Hello World !")
end)
end)
Otherwise, I initially planned to identify computers by their ids, but so far I have not found a practical case of use. As a consequence I do not know exactly which function must be fulfilled by this id and that can not be done by a label.
NB: I have not planned either "remote control" of one computer by another (a computer modifying the label of another computer for example), because I think that it can have too many effects of unwanted edge in multiplayer. (If necessary, I can review my position)
After, the case of the "remote control" can be developed if necessary by wlan.emit
and wlan.on
. Example:
wlan.on("rename", function(newLabel)
os.setComputerLabel(newLabel)
end)
------
wlan.emit("aLabel", "rename", "new_label")