Posted 15 November 2013 - 10:13 AM
I try to send and receive information to a computer and a server, but it's not quite right. If the computer is trying to send a message he does not well. He's trying to send the following: Tussenwater (Dutch), but the server receives a space.
Computer code:
Computer code:
local serverid = 64
--> local stationid = Tussenwater <--
local stationnaam = "Tussenwater"
--
for _, v in pairs(rs.getSides()) do
if peripheral.getType(v) == "modem" then rednet.open(v) present = true break end
end
term.clear()
term.setCursorPos( 1, 1 )
term.setBackgroundColor(colors.gray)
print("Opstarten ")
term.setBackgroundColor(colors.black)
print("It is not permitted to use the codes without ")
print("permissions! ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
sleep(3)
while true do
term.clear()
term.setCursorPos( 1, 1 )
term.setBackgroundColor(colors.gray)
print("* Start * Herladen - Start ")
term.setBackgroundColor(colors.black)
print("Welkom op ")
print("Maak uw keuze: ")
print("* Routebeschrijving ")
print("* Informatie borden ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
term.setCursorPos( 11, 2 )
print(stationnaam)
local event, button, X, Y = os.pullEvent("mouse_click")
XY = X..","..Y
if XY == "9,1" and button == 1 then
term.clear()
term.setCursorPos( 1, 1 )
term.setBackgroundColor(colors.gray)
print("Herladen ")
term.setBackgroundColor(colors.black)
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
sleep(0.30)
os.reboot()
end
if XY == "1,4" and button == 1 then
term.clear()
term.setCursorPos( 1, 1 )
term.setBackgroundColor(colors.gray)
print("Routebeschrijving ")
term.setBackgroundColor(colors.black)
print("Wachten op server ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
--> rednet.send(serverid, stationid) <--
rednet.receive(5)
if message == "route" then
rednet.receive()
print(message)
break
else
term.clear()
term.setCursorPos( 1, 1 )
term.setBackgroundColor(colors.gray)
print("Routebeschrijving ")
term.setBackgroundColor(colors.black)
print("Verbinden mislukt ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
print(" ")
sleep(3)
end
end
end
Server code:
local idspijk = 16
--
print("[LOG] Opstarten")
for _, v in pairs(rs.getSides()) do
if peripheral.getType(v) == "modem" then rednet.open(v) present = true break end
end
while true do
print("[LOG] Wachten op informatie")
id, message = rednet.receive()
print("[LOG] Informatie ontvangen")
--> if message == "Tussenwater" then <--
rednet.send(idspijk, "route")
print("[LOG] Reactie verzonden")
rednet.send(idspijk, "Test")
print("[LOG] Informatie verzonden")
else
print("[ERROR] Ongeldig waarden:")
print(message)
end
end
Who can help me?Edited on 16 November 2013 - 01:47 AM