52 posts
Location
Earth
Posted 25 September 2015 - 10:01 PM
Well, I went through the tedious course of trying to make ComputerCraft TV…
It worked, I added satellites and the final part was… channel encryption…
I coded the client and the server for it. All was good until…
The verification process won't exit after being told data has been verified on the client.
I don't get it. The code looks good so I don't really know what the problem is here
Pastebin (Client):
http://www.pastebin.com/DCdfdA6dPastebin (Server)
http://www.pastebin.com/qhcWVBXJPlease tell me what is wrong, I want this to work…
Also, PFP stands for pay for play. Using Essentials's Economy system, we can take In-Game money from players who have a disk that contains their "Subscription Key" and FTA stands for Free to Air, channels that don't need the subscription to be watched. FRB stands for FunRide Broadcastings, the company that brings this awesome TV service in CC to life.
2427 posts
Location
UK
Posted 26 September 2015 - 12:12 AM
My first guess is that you have a loop which doesn't exit after receiving the verified message.
Or the server doesn't send the verification message, get a program which prints all rednet messages to the screen while the client is connecting/verifying.
I'll look though your code now. Nothing has jumped out, and I'm not that good at reading other peoples code.
Edited on 25 September 2015 - 10:46 PM
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 01:36 AM
On a side note: Is this actual encryption or just encoding? I'll read it after I am done with Rainbow 6: Siege.
It is fun man! I have only played it for 6 hours today
Rainbow 6 crashed so I had a brief look. When you verify do you send any message before it and it works?
Edited on 25 September 2015 - 11:40 PM
52 posts
Location
Earth
Posted 26 September 2015 - 01:43 AM
On a side note: Is this actual encryption or just encoding? I'll read it after I am done with Rainbow 6: Siege.
It is fun man! I have only played it for 6 hours today
Rainbow 6 crashed so I had a brief look. When you verify do you send any message before it and it works?
Well, if you checked the code, you would probably notice the fact that I added messages for debug purposes. All works but it cannot quit the loop.
My first guess is that you have a loop which doesn't exit after receiving the verified message.
Or the server doesn't send the verification message, get a program which prints all rednet messages to the screen while the client is connecting/verifying.
I'll look though your code now. Nothing has jumped out, and I'm not that good at reading other peoples code.
I know, its meant to work but I don't know why it isn't working. Hopefully either Lyquid or Cranium will find this post…
7083 posts
Location
Tasmania (AU)
Posted 26 September 2015 - 01:44 AM
I'm not certain this is your only problem, but your use of sleep() is an issue.
That function works by
starting a timer, then
pulling all events and discarding them until the correct
timer event appears in the queue.
So what happens if a modem_message event occurs while sleep() is executing? It gets pulled and it gets discarded. You can't pull it again after that: it's gone.
Simply removing the sleep call on line 85 of your client may be sufficient to resolve things, but odds are you'll want to remove all of them from both scripts.
52 posts
Location
Earth
Posted 26 September 2015 - 01:45 AM
I'm not certain this is your only problem, but your use of sleep() is an issue.
That function works by
starting a timer, then
pulling all events and discarding them until the correct
timer event appears in the queue.
So what happens if a modem_message event occurs while sleep() is executing? It gets pulled and it gets discarded. You can't pull it again after that: it's gone.
Simply removing the sleep call on line 85 of your client may be sufficient to resolve things, but odds are you'll want to remove all of them from both scripts.
I did try to remove the sleep functions in the script but I found that all the receiving signals were getting interfered with which completley messed it up.
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 01:53 AM
chan = tonumber(e[5]:gsub("verify_sub_",""))
anyone?
52 posts
Location
Earth
Posted 26 September 2015 - 01:54 AM
chan = tonumber(e[5]:gsub("verify_sub_",""))
anyone?
WHAT! I thought I removed that from the code ages ago!!!
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 01:55 AM
WHAT! I thought I removed that from the code ages ago!!!
I cannot remember what gSub does because I don't use it, but you have
chan2 = e[5]:gsub("verify_sub_","")
chan = tonumber(chan2)
52 posts
Location
Earth
Posted 26 September 2015 - 01:57 AM
WHAT! I thought I removed that from the code ages ago!!!
I cannot remember what gSub does because I don't use it, but you have
chan2 = e[5]:gsub("verify_sub_","")
chan = tonumber(chan2)
Gsub lets you remove selected text from a string. Example: verify_sub_666. Gsub that with the code and you get 666. In the chan variable, chan2 shall be set to a number using tonumber making chan2 666.
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 02:00 AM
-snip-
Gsub lets you remove selected text from a string. Example: verify_sub_666. Gsub that with the code and you get 666. In the chan variable, chan2 shall be set to a number using tonumber making chan2 666.
Thanks. I tend not to need to remove a specific thing from a string.
When you mean data as been verified on the client… Well… Don't you verify the data on the server? Does the client or server not exit? I just realised I am not sure.
Edited on 26 September 2015 - 12:01 AM
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 02:19 AM
Done and Done2 should be true not 1 (or handled like true atleast) that way you can say until done instead of until done == 1
Also my computer had a heart attack. I think the OCD of your signiture nearly killed it.
Does the client prove that the verification was completed successfully? If not remove sleep on line 85 or set it to sleep(0) (Which is the minimum value otherthan 0.05)
1023 posts
Posted 26 September 2015 - 02:32 AM
The way you have set up PFP channels, done can never equal 1, so the repeat loop on line 67 repeats until a FTA channel is requested. Solution: Where you changed done2 to 1, change done to 1 as well, and it will exit the first repeat loop when it is verified.
52 posts
Location
Earth
Posted 26 September 2015 - 11:03 AM
The way you have set up PFP channels, done can never equal 1, so the repeat loop on line 67 repeats until a FTA channel is requested. Solution: Where you changed done2 to 1, change done to 1 as well, and it will exit the first repeat loop when it is verified.
I made some updates to the client yet apparently (according to the server I play on), we have hit maximum pastes for 24h I shall try to paste when I can :)/>
-snip-
Gsub lets you remove selected text from a string. Example: verify_sub_666. Gsub that with the code and you get 666. In the chan variable, chan2 shall be set to a number using tonumber making chan2 666.
Thanks. I tend not to need to remove a specific thing from a string.
When you mean data as been verified on the client… Well… Don't you verify the data on the server? Does the client or server not exit? I just realised I am not sure.
No problem! I know this post is Ask a pro yet I am not a pro but I don't really care. Also, yes, we verify the data on the server.
Done and Done2 should be true not 1 (or handled like true atleast) that way you can say until done instead of until done == 1
Also my computer had a heart attack. I think the OCD of your signiture nearly killed it.
Does the client prove that the verification was completed successfully? If not remove sleep on line 85 or set it to sleep(0) (Which is the minimum value otherthan 0.05)
I shall try setting the sleep on line 85 to 0. Thanks but the problem here is that the program cannot end the loop which in return won't initiate the real program.
Edited on 26 September 2015 - 09:05 AM
7083 posts
Location
Tasmania (AU)
Posted 26 September 2015 - 01:35 PM
(Which is the minimum value otherthan 0.05)
Actually, because of the way ComputerCraft's timers work (they always take
at least a server tick before appearing in the event queue), 0.05 is effectively the minimum.
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 02:41 PM
Actually, because of the way ComputerCraft's timers work (they always take at least a server tick before appearing in the event queue), 0.05 is effectively the minimum.
I could be wrong but isn't sleep(0) basically an interrupt if other computers take it?
1023 posts
Posted 26 September 2015 - 05:28 PM
Actually, because of the way ComputerCraft's timers work (they always take at least a server tick before appearing in the event queue), 0.05 is effectively the minimum.
I could be wrong but isn't sleep(0) basically an interrupt if other computers take it?
Sleep always pauses for a minimum of .05 seconds due to the fact it uses os.startTimer. os.startTimer always waits at least a minimum of 1 tick before its timer event is fired, so sleep always takes at least 1 tick.
Something like what you are talking about could be accomplished with this:
os.queueEvent("random event name here")
coroutine.yield()
This is actually the fastest way to "yield" the script in order to prevent the too long without yielding error.
Edited on 26 September 2015 - 03:30 PM
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 05:33 PM
-snip-
os.queueEvent("random event name here")
coroutine.yield()
This is actually the fastest way to "yield" the script in order to prevent the too long without yielding error.
1: Weird forum glitch. My quote has more words than your post.
2: Custom sleep function for all my programs coming right up!
212 posts
Location
Somewhere in this dimension... I think.
Posted 26 September 2015 - 05:44 PM
Do you mind me mutiliating your code on a livestream?
52 posts
Location
Earth
Posted 27 September 2015 - 06:14 PM
Do you mind me mutiliating your code on a livestream?
Sure
212 posts
Location
Somewhere in this dimension... I think.
Posted 29 September 2015 - 09:08 PM
Information was not collected yet but I have noticed a few issues.
If the first PFP channel is the right channel you keep checking. Add in Breaks for PFP and FTA checking.
Edit: Add the ability to close the program if no disk is found.
Edited on 29 September 2015 - 07:28 PM
212 posts
Location
Somewhere in this dimension... I think.
Posted 29 September 2015 - 09:29 PM
What is the problem again? I cannot seem to find an issue beyond minor ones.
Sometimes it is amazing how long it can take to solve simple problems.
Edited on 30 September 2015 - 01:11 AM