1

I am developing a Yahtzee-type PC game. I would like the program to pause execution until the player has selected one, two, or all three checkboxes and clicked on "Clicked when done." (See below.) However, I have tried looking here and at Wolfram's various help resources without any success.

I would greatly appreciate any assistance I can get with this.

Thanks!

Joe

enter image description here

===================

I hope this does a better job of describing my desired outcome.

enter image description here

1 Answers1

3

I do not know if I understood you right. But this runs when you click the button and holds once you start the selection process

enter image description here

Manipulate[
 tick;

 If[state == "RUN",
  tick = Not[tick];
  c++;
  Pause[.1];
  Grid[{
    {" I am running now ", c}, 
    {"5", p5},{"2", p2},{"1", p1}}]
  ,
  c = 0;
  Row[{" I am not running, waiting for button...... "}]
  ],

 Grid[{
   {"Select die to hold"},
   {"5", Checkbox[
     Dynamic[p5, {p5 = #; state = "STOP"; tick = Not[tick]} &]]},
   {"2", Checkbox[
     Dynamic[p2, {p2 = #; state = "STOP"; tick = Not[tick]} &]]},
   {"1", Checkbox[
     Dynamic[p1, {p1 = #; state = "STOP"; tick = Not[tick]} &]]},
   {Button["Click when done", tick = Not[tick]; state = "RUN"]}
   }],

 {{tick, False}, None},
 {{state, "STOP"}, None},
 {{p5, False}, None},
 {{p2, False}, None},
 {{p1, False}, None},
 {{c, 0}, None},

 TrackedSymbols :> {tick}
 ]
Nasser
  • 143,286
  • 11
  • 154
  • 359
  • Nasser, I did not know how to provide additional information without "answering" my own question so I edited my original question with the question framed somewhat differently. Thanks! Joe – Joe Coletta Sep 10 '17 at 08:28
  • @JoeColetta Thanks for the update to your question. I am not clear how you want to use the i counter there. Are you planning to store all the results that is why you are using counter i? Or you just want the current result to show? If so, why do you need i? I think what I showed above you should be able to adopt to your code. Only difference is that you using images and random selection of dice. I do not have the images of dice to show. If something still not clear in the code I showed, feel free to ask. – Nasser Sep 10 '17 at 18:24
  • Nasser, your comments and questions have helped me understand the applicability of your program in my program. I'm going to think about this for a couple of hours and then I think my next reply will be to say I understand and to thank you for your help and answer your last few questions – Joe Coletta Sep 15 '17 at 18:44