Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 39

Thread: Need Help With Coding

  1. #21
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    Thanks Pat, worked wonderfully. I also finally changed it to make it reset to 0 after each time (derp) and add in the Time: x part. This made it look a little better. I tried to get it to start by clicking on the text first (setting focus) like yours, but then whenever I hit the start button (aka any key) it would reset to 0 and double up, not putting a time down. That's the next thing I want to conquer

  2. #22
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    Bump

    Working on a different version of timer, and I have some problems (as expected), but I can't figure out how to solve them.

    Why the avgX(x) function isn't working on my timer? I've been trying to change approaches, but I've gotten no where

    How can I make it so that when I'm sorting the array, it will treat a DNF as the highest time (number)?

    Note: I want to keep it so it's just JavaScript, so please try and keep it that way if you can.

  3. #23
    Member maderito's Avatar
    Join Date
    Oct 2011
    Location
    New Haven, CT
    Posts
    21

    Default

    Quote Originally Posted by theZcuber View Post
    Bump

    Why the avgX(x) function isn't working on my timer? I've been trying to change approaches, but I've gotten no where
    I see at least 2 instances where "avgX()" is written "avgx()".
    Sub 45' and improving

  4. #24
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    Quote Originally Posted by maderito View Post
    I see at least 2 instances where "avgX()" is written "avgx()".
    I just used the find function in notepad, and it came up in one place (the penalty function). It still wouldn't make sense why it isn't working otherwise, since I wasn't even testing it with the penalties. I've fixed it though, and it still doesn't work

  5. #25
    Member maderito's Avatar
    Join Date
    Oct 2011
    Location
    New Haven, CT
    Posts
    21

    Default

    You have "avg5()" in your code. Do you mean "avgX(5)"?

    edit: Also, "total" is not defined in your avgX function.
    Last edited by maderito; 02-12-2012 at 10:23 AM.
    Sub 45' and improving

  6. #26
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    Quote Originally Posted by maderito View Post
    You have "avg5()" in your code. Do you mean "avgX(5)"?

    edit: Also, "total" is not defined in your avgX function.
    It was originally meant to be just an avg5 function, but then I realized I could easily alter it so it would be avg of anything. I guess I forgot to change a couple things.

    I've just defined total, but it still doesn't work

  7. #27
    Member maderito's Avatar
    Join Date
    Oct 2011
    Location
    New Haven, CT
    Posts
    21

    Default

    There are good developer tools for debugging in the Chrome web browser, including a Javascript Console. I'm not a Javascript programmer, but your code looks straightforward. You need a debugger if you're not using one.

    You have at least 2 average functions, average() and avgX(). "total" is still not defined in one of them (if I'm seeing your current code).
    Sub 45' and improving

  8. #28
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    The average function has total, and works perfectly. The avg function has total defined, but doesn't work. Are you viewing ztimer.tk's source? That is the most current version, and has it defined in both functions.

    Also, how did you know I was using chrome?

  9. #29
    Member maderito's Avatar
    Join Date
    Oct 2011
    Location
    New Haven, CT
    Posts
    21

    Default

    Quote Originally Posted by theZcuber View Post
    Also, how did you know I was using chrome?
    Doesn't everyone

    So you have chrome on your PC -- use the javascript console - it'll will point out some errors, especially un-initialized variables. I'll take another look at the code later today.
    Sub 45' and improving

  10. #30
    Premium Member theZcuber's Avatar
    Join Date
    May 2011
    Location
    Central NY, US
    WCA Profile
    2012PRAT02
    Posts
    1,974

    Default

    I got it to take the first 5 solves, but for some reason it won't change to take the last 5 solves. I tried reverse() for the array, but that doesn't fix it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •