Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Database-type script!

Roulette Wheel Database
For: XP

I need a database for my roulette wheel minigame. Not a big one, but I'll provide it, obviously. It also needs one or two methods two it. I'll explain that after the database I need.

Index: Integer
Number: Integer
Red: Boolean
Code:
Index|Number|Red

0,    00,    null

1,    01,    true

2,    13,    false

3,    36,    true

4,    24,    false

5,    3,     true

6,    15,    false

7,    34,    true

8,    22,    false

9,    5,     true

10,   17,    false

11,   32,    true

12,   20,    false

13,   7,     true

14,   11,    false

15,   30,    true

16,   26,    false

17,   9,     true

18,   28,    true

19,   0,     null

20,   2,     true

21,   14,    false

22,   35,    true

23,   23,    false

24,   4,     true

25,   16,    false

26,   33,    true

27,   21,    false

28,   6,     true

29,   18,    false

30,   31,    true

31,   19,    false

32,   8,     true

33,   12,    false

34,   29,    true

35,   25,    false

36,   10,    true

37,   27,    false

Methods:
Set:
This method will take a number, which will compare that number to the index, and return number.

Colour:
Will take a number, number, and compare that to Red, and will return True or False. Don't worry about returning Null, this script will not be called if that is the case.

If anyone can do this for me, I will be most grateful. Thankyou very much!
 

Ares

Member

This is my first shot:

[rgss]#===============================================================================
# Roulette Database by Ares for BrunoTR
#-------------------------------------------------------------------------------
# To call the set method: Ares::Roulette.set
# To call the colour method: Ares::Roulette.colour
#'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
module Ares
 
  module Roulette
 
    def Roulette.set
      @index = [00,01,13,36,24,3,15,34,22,5,
               17,32,20,7,11,30,26,9,28,0,
               2,14,35,23,4,16,33,21,6,18,31,
               19,8,12,29,25,10,27]          
      return @index[rand(37)]
    end
   
    def Roulette.colour
      @index = [00,01,13,36,24,3,15,34,22,5,
               17,32,20,7,11,30,26,9,28,0,
               2,14,35,23,4,16,33,21,6,18,31,
               19,8,12,29,25,10,27]  
      @red = {00 => nil, 01 => true, 13 => false, 36 => true, 24 => false, 3 => true,
              15 => false, 34 => true, 22 => false, 5 => true, 17 => false, 32 => true,
              20 => false, 7 => true, 11 => false, 30 => true, 26 => false, 9 => true,
              28 => false, 0 => nil, 2 => true, 14 => false, 35 => true, 23 => false,
              4 => true, 16 => false, 33 => true, 21 => false, 6 => true, 18 => false,
              31 => true, 19 => false, 8 => true, 12 => false, 29 => true, 25 => false,
              10 => true, 27 => false}
      return @red[@index[rand(37)]]  
    end
   
  end
end
[/rgss]

To call the set method, use Ares::Roulette.set,
and for the colour method: use Ares::Roulette.colour.

I hope it works fine, i only tested it once.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top