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

Issue in making a random code system

Started by Reinified, 06 May 2017 - 05:50 PM
Reinified #1
Posted 06 May 2017 - 07:50 PM
EDITED VERSION!

I decided that I would like to add an extra level of security by making sure that the PC does not leave the offices of the place the PC was intended to be used.

I decided that I would do this with a type of proximity detector, using RedNet.

This is the HOST computer's view. The computer would be run by a network admin.

It will produce an error "expected number".
Why is this?!

Here is the code I have:
https://pastebin.com/ZMxDVT62

Help, please!
Edited on 07 May 2017 - 03:40 PM
KingofGamesYami #2
Posted 06 May 2017 - 08:45 PM
Considering you don't have any loops, I don't see how that 'break' could possibly work.
Dog #3
Posted 06 May 2017 - 09:09 PM
Also, note that 'decode' is a number and read() returns a string - you'll probably want to tonumber() your read call.
Reinified #4
Posted 07 May 2017 - 06:04 AM
Thanks both of you! I found that the correct way is

tonumber(read("*"))

:D/>
Reinified #5
Posted 07 May 2017 - 05:41 PM
I edited it to be a different question related to the same topic. Any answers?
KingofGamesYami #6
Posted 07 May 2017 - 05:59 PM
Which line does the error occur on?
Anavrins #7
Posted 08 May 2017 - 12:41 AM
Line 3, you didn't specify an ID for rednet.send
Dog #8
Posted 08 May 2017 - 01:09 AM
You can also remove the tonumber(id) since rednet returns a number for the id and you aren't capturing the output of tonumber() for use anyway.