lottery game

Created by Marfisa and explained by Rahenna. Please credit In the Cards if you use this script.

Many TCGs have lottery type games, but it can get tedious to update, especially when you're calling numbers every update or trying to verify lottery tickets when a member wins a prize. There's an easy way to use JavaScript to run an automatic lottery.

This is an updated/improved version of the original lottery game from In the Cards. The best part about this improved lottery game is... YOU DON'T HAVE TO UPDATE ANYTHING. Just plop the code into your website template, upload, and GO.

This is a JavaScript game.
Your host must support JavaScript in order for you to use this game in your TCG.


To see the lottery in action, try the Moonlight Legend lottery game.

There are three magic numbers that make the lottery work:
- the number of values that exist (as checkboxes)
- the number of correct values (if you check them and press submit, they count toward a prize)
- the number of checkboxes you are allowed to select at one time

This version of the lottery is set to the following:
- 15 checkboxes
- 4 correct values
- 4 checkboxes allowed

Unfortunately, this version of the lottery is NOT flexible. The numbers are set and cannot be changed (unless you want to spend a lot of time messing with the code). However, you don't have to do ANYTHING to update this game, so I think it's a pretty good tradeoff. :p


How to use:
- Simply copy and paste the code into your game page template.
- Be sure to add your headers and footers as needed.
- Change all instances of the text *** PRIZE INSTRUCTIONS HERE *** to your custom reward information.
- Add the code for any prize options (random cards, coupons, etc) you want to hand out.

JavaScript Lottery game - click to download