Jump to content




missing variable data


  • You cannot reply to this topic
4 replies to this topic

#1 ETHANATOR360

  • Members
  • 423 posts
  • Locationyour hardrive

Posted 06 August 2012 - 07:51 PM

client code:
rednet.open ("top")
rednet.broadcast ("iwannawatch")
while true do
local id, msg = rednet.receive()
if msg == "conf" then break
end
end
print "server authenticated testing streaming..."
sleep (2)
rednet.send (id, "stream.test")
while true do
local idc, test = rednet.receive()
if idc == id and test == test.correct then break
end
end
server code:
local side = "top"
rednet.open (side)
while true do
local id, msg = rednet.receive()
if msg == "iwannawatch" then break end
end
rednet.send (id,"conf")
print ("client authenticated waiting on stream test")
while true do
local idc, test = rednet.receive()
if idc == id and test == stream.test then break
else print ("wrong computer")
end
end
rednet.send ("test.correct")

in the second if statement of the server code it prints wrong computer i try printing id but it did nothing but leave an empty space were the value should be where is this variable data

#2 OmegaVest

  • Members
  • 436 posts

Posted 06 August 2012 - 08:01 PM

Quotations.
Strings need to be in quotes.
You are comparing a string to a non-existent variable. When you do, it counts the if as false, and sends it to the else.

I have no idea why the id value is coming up blank, but everything else is right (save I think rednet.send always needs an id, otherwise do broadcast). Try a tonumber, then term.write(numID). If it still has nothing. . . I don't know.

#3 ETHANATOR360

  • Members
  • 423 posts
  • Locationyour hardrive

Posted 06 August 2012 - 08:22 PM

but idc isnt a string its a variable

#4 OmegaVest

  • Members
  • 436 posts

Posted 06 August 2012 - 10:28 PM

idc == id and test == stream.test

stream.test is NOT a variable, as you have it written. So, it needs quotes.

idc == id and test == "stream.test"


#5 ETHANATOR360

  • Members
  • 423 posts
  • Locationyour hardrive

Posted 06 August 2012 - 10:36 PM

oh ok i thought you ment idc thanks :P/>





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users