non-unique array generation and element count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ryzzix
    New Member
    • Oct 2012
    • 1

    non-unique array generation and element count

    I am currently building a tool for a friend that runs a live action rpg that has a downtime system between games.

    Basically the intended result is for her to be able to enter numbers into some form fields to get a total number of dice to be rolled.

    this field would then dictate the size of the random non-unique array with numbers between 1 and 10, to be generated.

    we also have a difficulty threshold in the form.

    I need to not only be able to generate the array, but get a total count of all elements with a value greater than difficulty form id.

    for example: total dice used: 230 , difficulty: 4, output x where x= total number of elements greater than 4.

    keep in mind that tdu and dif will be changing every time.

    I currently have a form field that displays total dice used (var totalDice = document.genera tor.txtTotalDic e;) and difficulty (var totalDif = document.genera tor.txtTotalDif ficulty;)

    need the final output to go to a form field -- Total Successes (var totalSuccess = document.genera tor.txtTotalSuc cess;)

    any help would be appreciated...
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What do you have so far? Or is all you have the assignment of those variables? If that's as far as you've gotten so far, you should probably take a class or work through a tutorial before taking on a project of this size. But if you have more code than that, it would help to see it so we can diagnose what's gone wrong.

    I will say this though, if all you need is what you describe above and you don't actually need the individual results, there's no need for a dynamic array. All you really need is a counter and a loop.

    Comment

    Working...