Create account / Log in

A complex dice rolling problem

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

A complex dice rolling problem

Postby caecus » November 9th, 2010, 11:11 pm

Hi all,

I'm currently designing a module in which a number of d6 are rolled (between 1 and 15 or so, depending on what is making the action), and any rolls of 4 or 5 score 1 point, and a 6 scores 2 points and roll again, the results of which are added to the previous score. Note that the dice rolled in the second round also get rolled again if you get another 6, and this can continue forever if you keep getting 6'es.

So for example, roll 6 dice, get a 2, 3, 3, 4, 6, 6 (currently 5 points) - roll again for each of the two 6'es, getting a 2 and a 6 (making the total 7 points) - roll again for the 6, getting a 4 (final total of 8 points).

So a couple of questions -
1) is the best way to store the running total as a global property, resetting it to 0 at the start of each time the main button is pressed?
2) how can I manage the individual dice results such that I can count the number of 6'es?
3) how can I roll a number of dice equal to the number of 6'es rolled?
4) can I use a trigger to keep rerolling until the value for the number of 6'es is equal to 0?

I realise that this is quite a complex process, and I'm somewhat afraid that I'll have to hand-code it. Any help would be appreciated.

Thanks,
caecus
caecus
 
Posts: 3
Joined: November 9th, 2010, 10:58 pm

Re: A complex dice rolling problem

Postby DrNostromo » November 10th, 2010, 3:50 am

Explaining how to do that may be difficult. But I could put together a sample mod that can probably do this. Probably won't have the time until Thursday, though.
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: A complex dice rolling problem

Postby caecus » November 10th, 2010, 8:55 am

If you could, I would be very appreciative. All the other bits of the module are pretty much done, I just can't get my head around how to do this.
Time's not really important, just whenever you can put something up basically.
caecus
 
Posts: 3
Joined: November 9th, 2010, 10:58 pm

Re: A complex dice rolling problem

Postby DrNostromo » November 12th, 2010, 4:04 am

I wasn't able to get to this today but I'll put something together as soon as I can.
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: A complex dice rolling problem

Postby DrNostromo » November 23rd, 2010, 2:23 pm

Sorry for the delay. I've got a working module for what you want. I just need to write up a few notes and I'll pass it along.
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: A complex dice rolling problem

Postby DrNostromo » November 23rd, 2010, 3:42 pm

Here's a sample mod which I believe performs the behavior you were looking for.

The zip file contains the vmod and some notes explaining what I did.
Attachments
Dice6Sample.zip
(11.07 KiB) Downloaded 153 times
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: A complex dice rolling problem

Postby caecus » November 26th, 2010, 8:10 am

whoa, there was no way I was going to be able to get that by myself...

Much appreciated. Also, seeing how you did it with the explanation has given me some ideas for the rest of the module to make it a bit more refined. To be honest I didn't think you could get this level of control with just the tools within vassal, and it's good to see that such things are possible.

Thank you very much for this.
caecus
 
Posts: 3
Joined: November 9th, 2010, 10:58 pm

Re: A complex dice rolling problem

Postby DrNostromo » November 26th, 2010, 12:49 pm

You're welcome. Enjoy!
User avatar
DrNostromo
 
Posts: 1061
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA


Return to Module Design

Who is online

Users browsing this forum: No registered users and 3 guests