• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "events not always processed in correct order"

Collapse

  • mudskipper
    replied
    Cheers all - am happy it's "good enough" now (the 'clicked' check seemed to do the trick) and is super simple so we'll see how we go...

    Leave a comment:


  • NotAllThere
    replied
    Originally posted by eek View Post

    Which was my suggestion in post 2 - record the timestamps and use that to display who won.
    Yes. I know. I was just giving complete information.

    Leave a comment:


  • pr1
    replied
    Originally posted by eek View Post

    Which was my suggestion in post 2 - record the timestamps and use that to display who won.
    you're so smart, well done you

    Leave a comment:


  • mudskipper
    replied
    actually I think it's good enough now - back to one page but the 'clicked' variable seems to do the trick to stop it processing the other click - will do some testing. Thanks all!

    Leave a comment:


  • eek
    replied
    Originally posted by NotAllThere View Post

    To be exact, the scenario you need to address is that the VAR can't ever see the difference. It's always going to be possible for the "wrong" person to get it - even if you need ultra-high speed video cameras to spot it!

    My son adds these comments:




    woody1 Thanks for the explanation.
    Which was my suggestion in post 2 - record the timestamps and use that to display who won.

    Leave a comment:


  • NotAllThere
    replied
    Originally posted by mudskipper View Post

    Yeah this is the scenario I need to address - with the top countdown players most conundrum solves are pretty much instant. Thanks for checking!
    To be exact, the scenario you need to address is that the VAR can't ever see the difference. It's always going to be possible for the "wrong" person to get it - even if you need ultra-high speed video cameras to spot it!

    My son adds these comments:


    A better solution to using the clean would be to use timestamps + IDs, so you know the time when each person buzzed.

    Even better: The click function should know nothing of the state of the buzzer. That should be handled by a separate class. The 'clicked' function informs the game of the click and the game handles what to do with it.
    woody1 Thanks for the explanation.

    Leave a comment:


  • woody1
    replied
    OK, I got it to work locally on my laptop, as follows:

    (NB. this was with Opera; other browsers may be different)

    1. Created a folder TEMP on the desktop
    2. Opened http://topffl.co.uk/fiona/buzzer.html
    3. Saved "complete webpage" in TEMP as buzzer (.html)
    4. Pressed Player 1
    5. Saved "complete webpage" in TEMP as player1 (.html)
    6. Pressed Reset
    7. Pressed Player 2
    8. Saved "complete webpage" in TEMP as player2 (.html)

    Now, if I go to TEMP, and double-click buzzer, it runs with the network disconnected.
    Last edited by woody1; 3 July 2024, 11:47.

    Leave a comment:


  • woody1
    replied
    Originally posted by mudskipper View Post

    Yeah it redirects - I needed to stop it processing further messages - originally I had it on the same page but would sometimes get the first then second message. But the code is dead simple. I think it is better now that I added the 'clicked' check, but still not perfect.
    I tried saving the page to my machine, as a "complete webpage", and running it locally, but the page didn't work.

    If you could get it to run on the phone/tablet, with the network disabled, then it might solve the problem.
    Last edited by woody1; 3 July 2024, 11:00.

    Leave a comment:


  • mudskipper
    replied
    Originally posted by woody1 View Post

    If the webpage was hosted on the phone, yes. But not so sure if it's on a remote internet site. Any network latency would certainly explain discrepancies, especially over slower mobile internet.

    I opened http://topffl.co.uk/fiona/buzzer.html in my browser, and then switched off my router. When I press the button, I get a "no internet" error. That suggests there's communication taking place with the remote server.
    Yeah it redirects - I needed to stop it processing further messages - originally I had it on the same page but would sometimes get the first then second message. But the code is dead simple. I think it is better now that I added the 'clicked' check, but still not perfect.

    Thanks all - probably gonna be more hassle than it's worth.

    NLUK - happy to take 10%

    Leave a comment:


  • northernladuk
    replied
    This is great. You should release it on an app and call it Contractor Cash Generator. I just spent an hour playing this and earned 100's of pounds.

    I found it a bit complex at first but great fun when I got the hang of it.

    Leave a comment:


  • woody1
    replied
    Originally posted by NotAllThere View Post

    Are the players using a single smartphone between them? If that's the case, I can't understand how you'd be able to get a noticeable discrepancy. The code is running on the phone. Maybe you need to upgrade your phone.
    If the webpage was hosted on the phone, yes. But not so sure if it's on a remote internet site. Any network latency would certainly explain discrepancies, especially over slower mobile internet.

    I opened http://topffl.co.uk/fiona/buzzer.html in my browser, and then switched off my router. When I press the button, I get a "no internet" error. That suggests there's communication taking place with the remote server.
    Last edited by woody1; 3 July 2024, 10:20.

    Leave a comment:


  • mudskipper
    replied
    Originally posted by NotAllThere View Post
    It's possible for someone to press very shortly before someone else, but not get the buzz.
    Yeah this is the scenario I need to address - with the top countdown players most conundrum solves are pretty much instant. Thanks for checking!

    Leave a comment:


  • NotAllThere
    replied
    I got an answer from my son. The program polls each buzzer in turn to see if its pressed. If it is, it lights up that buzzer and cause it to buzz and tell the others to stop. It's possible for someone to press very shortly before someone else, but not get the buzz.

    Relevant source code below.

    Code:
    var clicked = false;
    function clicked1()
      {
        if (!clicked)
        {
           // disablebutton;
           clicked = true;
          window.location.replace("player1.html");
        }
    }
    
    function clicked2()
    {
      if (!clicked)
      {
        // disablebutton1
        clicked = true;
        window.location.replace("player2.html");
      }
    }
    Are the players using a single smartphone between them? If that's the case, I can't understand how you'd be able to get a noticeable discrepancy. The code is running on the phone. Maybe you need to upgrade your phone.

    Leave a comment:


  • mudskipper
    replied
    yeah I suspect timestamps are the way to go if you can't be sure one button press will be processed before the other but sounds like more effort than I wanted to expend

    Leave a comment:


  • woody1
    replied
    Are you running it on this website topffl? Via 4/5G? If so, latency (round-trip time) won't be helping.

    Try pinging topffl.co.uk to see how many milliseconds it takes.

    It might be better if you could run the webpage on the device (phone/tablet) itself. (But don't ask me how you do that)

    Thinking outside the box, I was also wondering if you could do something with a native application running on the device. Does Excel have buttons?

    Leave a comment:

Working...
X