Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dice game type error

    everything in this dice rolling game is fine until line 69 where i get TypeError:actuals[i] undefined. Any help would be appreciated.

    http://pastebin.com/bVmgMcbB

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    I ran it twice,
    first I got an error "unable to get the value of property dblnum"
    second time "unable to get the value of property selection"

    FWIW I entered into the same sequence both times: 2players, first player bet selection 3 $20, second player bet selection 4 $20
    Allwisend bin ich nicht, doch viel ist mir bewursst
    -Goethe

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    To start, the line numbers from your pastebin are not the same as in your post, line69 has no mention of "actuals[i]". The following comments are based on the line numbers from the pastebin code at it's current state.

    You have called actuals[i] outside of your for loop.

    You start your loop on line69 and close your loop on line78, then you call actuals several more times in a series of conditional tests.

    Solution:
    Move the closing bracket on line78 to line100 to completely encapsulate all code that tests values on all elements in actuals

    Doing so has also eliminated the other error messages that I received while running your code.
    Allwisend bin ich nicht, doch viel ist mir bewursst
    -Goethe


  •  

    Posting Permissions

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