Sorry forgot to put versin at top it is for Dark Basic Pro.
I have been working on this game for about 6 months. It is bascially done and I have just been refining the code and adding new stuff to it when I think of it. It is for a 3 Reel Slot Machine game. I do have code for a 5 reel 9 Payline game as well. If you want it I will post that as well. I am only going to post the code and not all the images that go with it since there is a bunch of images as you will see from the code.
If you find anything that will help with the code feel free to post any changes to it. But as it is, It is working perfectly and I just need to do some better graphics for it. (I am more a coder than graphics person). It is commented about 90% so you should be able to understand it.
Enough Chatting here is the code...
REM Project: In The Money
REM Created: 6/29/2007 6:37:31 PM
REM
REM ***** Main Source File *****
REM
REM ************************Developed by Lord SilverStone & Air Force*******************
Dim HighName$(10)`Creates an Array to hold the High Score Names
Dim HighScore(10)`Creates and Array to hold the High Score Numbers
Global reel1y`Sets variable to Global
Global reel2y`Sets variable to Global
Global reel3y`Sets variable to Global
Global reel1y1`Sets variable to Global
Global reel2y1`Sets variable to Global
Global reel3y1`Sets variable to Global
Global moneybet`Sets variable to Global
Global currentmoney`Sets variable to Global
Global moneypaid`Sets variable to Global
Global reel1`Sets variable to Global
Global reel2`Sets variable to Global
Global reel3`Sets variable to Global
Global reel1holder`Sets variable to Global
Global reel2holder`Sets variable to Global
Global reel3holder`Sets variable to Global
Global reel1symbol
Global reel2symbol
Global reel3symbol
Global winner$
reel1y=0`Sets Coordinate for Reel 1
reel2y=0`Sets Coordinate for Reel 2
reel3y=0`Sets Coordinate for Reel 3
reel1y1=-1200`Sets Coordinate for Second Reel 1
reel2y1=-1200`Sets Coordinate for Second Reel 2
reel3y1=-1200`Sets Coordinate for Second Reel 3
reel1holder=-1`Sets the placeholder for Reel 1 to -1
reel2holder=-1`Sets the placeholder for Reel 2 to -1
reel3holder=-1`Sets the placeholder for Reel 3 to -1
currentmoney=1000`Sets the Money amount to 1000
moneybet=2`Sets the moneybet to 2
Initalizegame()`Start of Initalizing Game
Loadgraphics()`Loads up all the Graphics used in Game
Loadsounds()`Loads up all the sounds needed for Game
Loadmenu()`Loads up Main Menu and Main loop of the game
END
function Loadgraphics()
`Loads all the graphics used in the game all at once.
LOAD bitmap "background.PNG",0
get image 1,0,0,800,600
load bitmap "Reel_New.jpg",1
get image 2,0,0,100,1200
LOAD bitmap "Spin Button.jpg",4
get image 5,0,0,100,100
LOAD bitmap "Paytable Button.jpg",5
get image 6,0,0,100,100
LOAD bitmap "Bet One Button.jpg",6
get image 7,0,0,100,100
LOAD bitmap "Bet Max Button.jpg",7
get image 8,0,0,100,100
LOAD bitmap "Cashout Button.jpg",8
get image 9,0,0,100,100
LOAD bitmap "mousepointer.jpg",11
get image 12,0,0,1,1
LOAD bitmap "Paytable Screen.jpg",12
get image 13,0,0,700,500
load bitmap "Return Button.jpg",13
get image 14,0,0,72,48
load bitmap "Exit Button.jpg",14
get image 15,0,0,200,100
load bitmap "Main Menu.jpg",0
get image 18,0,0,800,600
load bitmap "Play Button.jpg",18
get image 19,0,0,200,100
load bitmap "High Score Button.jpg",19
get image 20,0,0,200,100
load bitmap "High Score Background.png",20
get image 21,0,0,800,600
endfunction
function Loadsounds()
Load sound "Spinning Reels.wav",1`Sound for when the reels are spinning
Load sound "money2.wav",2`Sound for when you win
endfunction
function Displaymachine()
paytablescreenx=50`Sets Paytable Screen above the view screen
paytablescreeny=-600`Sets Paytable Screen above the view screen
paytable$="false"`Flag to tell if paytable is showing or not
show all sprites`Displays all sprites
if sprite exist(21)=1 then hide sprite 21`Checks to see if the HIgh Score Background sprite is showing
repeat`Start of Loop
White = RGB(255,255,255)`Sets color white
Black = RGB(0,0,0)`Sets color black
cls Black`Clears screen with black background
if sprite exist(1)=0 then sprite 1,127,reel1y,2`Displays Reel 1
if sprite exist(2)=0 then sprite 2,308,reel2y,2`Displays Reel 2
if sprite exist(3)=0 then sprite 3,480,reel3y,2`Displays Reel 3
if sprite exist(4)=0 then sprite 4,127,reel1y1,2`Displays Reel 1
if sprite exist(5)=0 then sprite 5,308,reel2y1,2`Displays Reel 2
if sprite exist(6)=0 then sprite 6,480,reel3y1,2`Displays Reel 3
sprite 30,0,0,1`Displays Machine Face
sprite 7,525,400,5`Displays Spin Button
sprite 8,25,400,6`Displays Paytable Button
sprite 9,275,400,7`Displays Bet One Button
sprite 10,400,400,8`Displays Bet Max Button
sprite 11,150,400,9`Displays Cash Out Button
sprite 14,paytablescreenx,paytablescreeny,13`Displays the Paytable above playing field
sprite 28,paytablescreenx+37,paytablescreeny+414,14
sprite 29,mousex(),mousey(),12`Sets a sprite at the tip of the mouse
set sprite priority 30,1`Sets order in which sprites are displayed on screen
set sprite priority 7,2`Sets order in which sprites are displayed on screen
set sprite priority 8,3`Sets order in which sprites are displayed on screen
set sprite priority 9,4`Sets order in which sprites are displayed on screen
set sprite priority 10,5`Sets order in which sprites are displayed on screen
set sprite priority 11,6`Sets order in which sprites are displayed on screen
set sprite priority 14,8`Sets order in which sprites are displayed on screen
set sprite priority 28,9`Sets order in which sprites are displayed on screen
text 746,380,"$"+str$(moneybet)`Displays how much you are betting
text 728,412,"$"+str$(moneypaid)`Displays current money won
text 655,473,"$"+str$(currentmoney)`Displays your current bankroll
reel1symbol=rnd(127)`Picks random number from 0-127 this is the heart of the generator
reel2symbol=rnd(127)`Picks random number from 0-127 this is the heart of the generator
reel3symbol=rnd(127)`Picks random number from 0-127 this is the heart of the generator
sync`Sync the screen
lock backbuffer
` unlock backbuffer
if currentmoney<=0`Check to see if you run out of money and gives you $1k
outtamoney()`Calls the outta money function
show all sprites`Makes all sprites show again after clearing the outta money screen
endif
`Checks to see if you click on the Spin Button or if you hit keyboard equivilent (space bar)
if (mouseclick()=1 and sprite collision(29,7)=1) or keystate(57)=1
unlock backbuffer
SpinReels()
test1symbol=reel1symbol
endif
`Checks to see if you click on the Bet One Button
if (mouseclick()=1 and sprite collision(29,9)=1)
unlock backbuffer
moneybet=1
endif
`Checks to see if you click on the Max Bet Button and then Spins the reels
if (mouseclick()=1 and sprite collision(29,10)=1)
unlock backbuffer
moneybet=2
SpinReels()
endif
`Checks to see if you click on the Show Paytables button and then displays the paytable
if (mouseclick()=1 and sprite collision(29,8)=1 and paytable$="false")
unlock backbuffer
while paytablescreeny<0`Will move the paytable into view from top of screen
cls Black
paytable$="true"
paytablescreeny=paytablescreeny+1
sprite 14,paytablescreenx,paytablescreeny,13
text 746,380,"$"+str$(moneybet)
text 728,412,"$"+str$(moneypaid)
text 655,473,"$"+str$(currentmoney)
sync
endwhile
show sprite 28
endif
`Checks to see if you click on the Show Paytables button to hide the paytable
if (mouseclick()=1 and sprite collision(29,28)=1 and paytable$="true")
unlock backbuffer
while paytablescreeny>-600`Will hide paytable from view by moving it to area above screen
hide sprite 28
cls Black
paytable$="false"
paytablescreeny=paytablescreeny-1
sprite 14,paytablescreenx,paytablescreeny,13
text 746,380,"$"+str$(moneybet)
text 728,412,"$"+str$(moneypaid)
text 655,473,"$"+str$(currentmoney)
sync
endwhile
endif
until (mouseclick()=1 and sprite collision(29,11)=1)`Does a check to see if you click on the Cash Out button and then exits the loop
HighScore = CheckHighScore(Name$)`Checks to see if you Made it to the HIGH ROLLERS LIST
hide all sprites`Hides all sprites
IF HighScore`Checks if you are able to enter in your name to high score list
cls
White = RGB(255,255,255)
Black = RGB(0,0,0)
clear entry buffer
repeat
cls
ink White,Black
text 150,130,"Congradulations!!! You have made it into the HIGH ROLLERS List!!!"
text 150,140,"Please enter your name: "
if keystate(14)=0
Name$=Name$+entry$()
else
`Backsapce with entry$() and IT WORKS!!!!
if entry$()<>"" then Name$=left$(Name$,len(Name$)-1)
endif
text 350,140,Name$
clear entry buffer
sync
until keystate(28)=1
`Adds your name to the HIGH ROLLERS LIST
EnterHighScore(Name$)
ENDIF
endfunction
FUNCTION EnterHighScore(Name$) `Checks to see if hte file exists and if not makes the file and fills it with nothing
IF FILE EXIST("HIGHROLLERS.DAT") = 0
oPEN TO WRITE 1,"HIGHROLLERS.DAT"
WRITE STRING 1, LEFT$(Name$,20)
WRITE LONG 1,currentmoney
FOR X = 2 TO 10
WRITE STRING 1," "
WRITE LONG 1,0
NEXT X
CLOSE FILE 1
EXITFUNCTION
ENDIF
OPEN TO READ 1,"HIGHROLLERS.DAT" `Opens file and reads all data from it
FOR X = 1 TO 10
READ STRING 1,a$
HighName$(X) = a$
READ LONG 1, a
HighScore(X) = a
NEXT X
CLOSE FILE 1
strtoplace$ = Name$
numtoplace = currentmoney
FOR x = 1 TO 10 `Sorts the file and places new name and score into it
IF HighScore(x) <= numtoplace OR HighScore(x) = 0
tempstr$ = HighName$(x)
tempnum = HighScore(x)
HighName$(x) = strtoplace$
HighScore(x) = numtoplace
strtoplace$ = tempstr$
numtoplace = tempnum
ENDIF
NEXT X
DELETE FILE "HIGHROLLERS.DAT" `Deletes old file
OPEN TO WRITE 1, "HIGHROLLERS.DAT" `Creates file again to write names to it
FOR X = 1 TO 10
WRITE STRING 1, HighName$(X)
WRITE LONG 1, HighScore(X)
NEXT X
CLOSE FILE 1
ENDFUNCTION
FUNCTION CheckHighScore(Name$)
IF FILE EXIST("HIGHROLLERS.DAT") = 1 `Checkt o see if the file exists
EXITFUNCTION 1
ENDIF
OPEN TO READ 1,"HIGHROLLERS.DAT" `Opens and reads contents of file
FOR X = 1 TO 10
READ STRING 1,a$
HighName$(X) = a$
READ LONG 1, a
HighScore(X) = a
NEXT X
CLOSE FILE 1
Flag = 0
FOR X = 1 TO 10 `Checks to see if your score is higher than score in data file
IF HighScore(x) <= currentmoney OR HighScore(x) = 0
Flag = 1
ENDIF
NEXT X
ENDFUNCTION Flag
function outtamoney() `You ran outta money. Clears the screen and displays message and then gives you $1000 to play with
hide all sprites
cls
White = RGB(255,255,255)
Black = RGB(0,0,0)
repeat
text 100,130,"You ran outta money buddy!!!! But the casino has been nice and given you $1000."
text 100,140,"Press ENTER to continue gambling!!"
sync
until keystate(28)=1
currentmoney=1000
endfunction
function SpinReels()
randomize timer()
stop sound 2`Stops the winning sound
Loop sound 1`Loops the sound until the reels stop
moneypaid=0`Resets the paid amount to 0
reel1timer=0`Sets timer counter to 0
reel2timer=0`Sets timer counter to 0
reel3timer=0`Sets timer counter to 0
reel1timerstart=450`Sets timer counter to random number
reel2timerstart=450`Sets timer counter to random number
reel3timerstart=450`Sets timer counter to random number
currentmoney = currentmoney - moneybet`Removes bet amount from current money
repeat
cls Black
reel1timer=reel1timer+1`Increments counter
sprite 4,127,reel1y1,2`Displays reel 1
sprite 1,127,reel1y,2`Displays reel 1
if reel1y>=1200 then reel1y=-1200`Checks and resets reel off screen
if reel1y1>=1200 then reel1y1=-1200`Checks and resets reel off screen
sprite 5,308,reel2y1,2`Displays reel 2
sprite 2,308,reel2y,2`Displays reel 2
if reel2y>=1200 then reel2y=-1200`Checks and resets reel off screen
if reel2y1>=1200 then reel2y1=-1200`Checks and resets reel off screen
sprite 6,480,reel3y1,2`Displays reel 3
sprite 3,480,reel3y,2`Displays reel 3
if reel3y>=1200 then reel3y=-1200`Checks and resets reel off screen
if reel3y1>=1200 then reel3y1=-1200`Checks and resets reel off screen
reel1y=reel1y+25`Moves reel 1
reel2y=reel2y+25`Moves reel 2
reel3y=reel3y+25`Moves reel 3
reel1y1=reel1y1+25`Moves reel 1
reel2y1=reel2y1+25`Moves reel 2
reel3y1=reel3y1+25`Moves reel 3
text 746,380,"$"+str$(moneybet)`Displays Moneybet
text 728,412,"$"+str$(moneypaid)`Displays Money Paid
text 655,473,"$"+str$(currentmoney)`Displays Current money
sync
until reel1timer=reel1timerstart`Repeats until the counter reaches the counter max
if reel1y< 0 then reel1 = reel1y+1200`sets the Y Coordinate into a variable that is easier to use.
if reel1y1< 0 then reel1 = reel1y1+1200`sets the Y Coordinate into a variable that is easier to use.
if reel1y>=0 and reel1y<1200 then reel1=reel1y`sets the Y Coordinate into a variable that is easier to use.
if reel1y1>=0 and reel1y1<1200 then reel1=reel1y1`sets the Y Coordinate into a variable that is easier to use.
if reel1symbol<8 or (reel1symbol>116 and reel1symbol<=120)`Red $
if reel1<=400
reel1y=400
reel1y1=-800
reel1holder=1
endif
if reel1>400
reel1y=700
reel1y1=-500
reel1holder=1
endif
endif
if (reel1symbol>8 and reel1symbol<=17) or (reel1symbol>95 and reel1symbol<=112)`2 Bars
if reel1<=600
reel1y=600
reel1y1=-600
reel1holder=2
endif
if reel1>600
reel1y=1100
reel1y1=-100
reel1holder=2
endif
endif
if reel1symbol>17 and reel1symbol<=26`Blue $
if reel1<=100
reel1y=800
reel1y1=-400
reel1holder=3
endif
if reel1>100
reel1y=800
reel1y1=-400
reel1holder=3
endif
endif
if (reel1symbol>26 and reel1symbol<=35) or (reel1symbol>56 and reel1symbol<=84) or (reel1symbol>86 and reel1symbol<=95) or (reel1symbol>112 and reel1symbol<=116) or (reel1symbol>120 and reel1symbol<=127)`1 Bar
if reel1<=500
reel1y=500
reel1y1=-700
reel1holder=4
endif
if reel1>500
reel1y=1000
reel1y1=-200
reel1holder=4
endif
endif
if (reel1symbol>35 and reel1symbol<=56)`3 Bars
if reel1<=200
reel1y=200
reel1y1=-1000
reel1holder=5
endif
if reel1>200
reel1y=900
reel1y1=-300
reel1holder=5
endif
endif
if reel1symbol>84 and reel1symbol<=86`Green $
if reel1<=0
reel1y=0
reel1y1=1200
reel1holder=6
endif
if reel1>0
reel1y=300
reel1y1=-900
reel1holder=6
endif
endif
sprite 4,127,reel1y1,2`Displays reel 1
sprite 1,127,reel1y,2`Displays reel 1
repeat
cls Black
sprite 5,308,reel2y1,2`Displays Reel 2
sprite 2,308,reel2y,2`Displays Reel 2
if reel2y>=1200 then reel2y=-1200`Checks and resets reel off screen
if reel2y1>=1200 then reel2y1=-1200`Checks and resets reel off screen
sprite 6,480,reel3y1,2`Displays Reel 3
sprite 3,480,reel3y,2`Displays Reel 3
if reel3y>=1200 then reel3y=-1200`Checks and resets reel off screen
if reel3y1>=1200 then reel3y1=-1200`Checks and resets reel off screen
reel2timer=reel2timer+1`Increments Counter
reel2y=reel2y+25`Moves reel 2
reel3y=reel3y+25`Moves reel 3
reel2y1=reel2y1+25`Moves reel 2
reel3y1=reel3y1+25`Moves reel 3
text 746,380,"$"+str$(moneybet)`Displays Moneybet
text 728,412,"$"+str$(moneypaid)`Displays Money Paid
text 655,473,"$"+str$(currentmoney)`Displays Current money
sync
until reel2timer=reel2timerstart`Repeats until the counter reaches the counter max
if reel2y< 0`sets the Y Coordinate into a variable that is easier to use.
reel2 = reel2y+1200
endif
if reel2y1< 0`sets the Y Coordinate into a variable that is easier to use.
reel2 = reel2y1+1200
endif
if reel2y>=0 and reel2y<1200`sets the Y Coordinate into a variable that is easier to use.
reel2=reel2y
endif
if reel2y1>=0 and reel2y1<1200`sets the Y Coordinate into a variable that is easier to use.
reel2=reel2y1
endif
if reel2symbol<8 or (reel2symbol>116 and reel2symbol<=120)`Red $
if reel2<=400
reel2y=400
reel2y1=-800
reel2holder=1
endif
if reel2>400
reel2y=700
reel2y1=-500
reel2holder=1
endif
endif
if (reel2symbol>8 and reel2symbol<=17) or (reel2symbol>95 and reel2symbol<=112)`2 Bars
if reel2<=600
reel2y=600
reel2y1=-600
reel2holder=2
endif
if reel2>600
reel2y=1100
reel2y1=-100
reel2holder=2
endif
endif
if reel2symbol>17 and reel2symbol<=26`Blue $
if reel2<=100
reel2y=800
reel2y1=-400
reel2holder=3
endif
if reel2>100
reel2y=800
reel2y1=-400
reel2holder=3
endif
endif
if (reel2symbol>26 and reel2symbol<=35) or (reel2symbol>56 and reel2symbol<=84) or (reel2symbol>86 and reel2symbol<=95) or (reel2symbol>112 and reel2symbol<=116) or (reel2symbol>120 and reel2symbol<=127)`1 Bar
if reel2<=500
reel2y=500
reel2y1=-700
reel2holder=4
endif
if reel2>500
reel2y=1000
reel2y1=-200
reel2holder=4
endif
endif
if (reel2symbol>35 and reel2symbol<=56)`1 Bar
if reel2<=200
reel2y=200
reel2y1=-1000
reel2holder=5
endif
if reel2>200
reel2y=900
reel2y1=-300
reel2holder=5
endif
endif
if reel2symbol>84 and reel2symbol<=86`Green $
if reel2<=0
reel2y=0
reel2y1=1200
reel2holder=6
endif
if reel2>0
reel2y=300
reel2y1=-900
reel2holder=6
endif
endif
sprite 5,308,reel2y1,2`Displays Reel 2
sprite 2,308,reel2y,2`Displays Reel 2
repeat
cls Black
sprite 6,480,reel3y1,2`Displays Reel 3
sprite 3,480,reel3y,2`Displays Reel 3
if reel3y>=1200 then reel3y=-1200`Checks and resets reel off screen
if reel3y1>=1200 then reel3y1=-1200`Checks and resets reel off screen
reel3timer=reel3timer+1`Increments Counter
reel3y=reel3y+25`Moves reel 3
reel3y1=reel3y1+25`Moves reel 3
text 746,380,"$"+str$(moneybet)`Displays Moneybet
text 728,412,"$"+str$(moneypaid)`Displays Money Paid
text 655,473,"$"+str$(currentmoney)`Displays Current money
sync
until reel3timer=reel3timerstart`Repeats until the counter reaches the counter max
if reel3y<0`sets the Y Coordinate into a variable that is easier to use.
reel3 = reel3y+1200
endif
if reel3y1< 0`sets the Y Coordinate into a variable that is easier to use.
reel3 = reel3y1+1200
endif
if reel3y>=0 and reel3y<1200`sets the Y Coordinate into a variable that is easier to use.
reel3=reel3y
endif
if reel3y1>=0 and reel3y1<1200`sets the Y Coordinate into a variable that is easier to use.
reel3=reel3y1
endif
if reel3symbol<8 or (reel3symbol>116 and reel3symbol<=120)`Red $
if reel3<=400
reel3y=400
reel3y1=-800
reel3holder=1
endif
if reel3>400
reel3y=700
reel3y1=-500
reel3holder=1
endif
endif
if (reel3symbol>8 and reel3symbol<=17) or (reel3symbol>95 and reel3symbol<=112)`2 Bars
if reel3<=600
reel3y=600
reel3y1=-600
reel3holder=2
endif
if reel3>600
reel3y=1100
reel3y1=-100
reel3holder=2
endif
endif
if reel3symbol>17 and reel3symbol<=26`Blue $
if reel3<=100
reel3y=800
reel3y1=-400
reel3holder=3
endif
if reel3>100
reel3y=800
reel3y1=-400
reel3holder=3
endif
endif
if (reel3symbol>26 and reel3symbol<=35) or (reel3symbol>56 and reel3symbol<=84) or (reel3symbol>86 and reel3symbol<=95) or (reel3symbol>112 and reel3symbol<=116) or (reel3symbol>120 and reel3symbol<=127)`1 Bar
if reel3<=500
reel3y=500
reel3y1=-700
reel3holder=4
endif
if reel3>500
reel3y=1000
reel3y1=-200
reel3holder=4
endif
endif
if (reel3symbol>35 and reel3symbol<=56)`3 Bars
if reel3<=200
reel3y=200
reel3y1=-1000
reel3holder=5
endif
if reel3>200
reel3y=900
reel3y1=-300
reel3holder=5
endif
endif
if reel3symbol>84 and reel3symbol<=86`Green $
if reel3<=0
reel3y=0
reel3y1=1200
reel3holder=6
endif
if reel3>0
reel3y=300
reel3y1=-900
reel3holder=6
endif
endif
sprite 6,480,reel3y1,2`Displays Reel 3
sprite 3,480,reel3y,2`Displays Reel 3
stop sound 1
checkforwinner() `calls checkforwinner function
endfunction
function Initalizegame() `Initializes Game
Randomize Timer()`Initates the random number generator
set display mode 800,600,32 `Sets display to 800x600
show window`Makes it in windowed mode
set window on`Sets so the window is showing
set window size 800,600`Sets the size of the window
set window title "In The Money"`Sets the window title
set image colorkey 255,0,255`Sets it so that pink will be transparent
Sync ON
if file exist("HIGHROLLERS.DAT")=0 `Checks to see if the data file is there and if not makes it and fills with nothing
open to write 1,"HIGHROLLERS.DAT"
for x = 1 to 10
write string 1," "
write long 1,0
next x
close file 1
endif
endfunction
function LoadMenu() `loads up the menu
set current bitmap 0
cls
repeat
if sprite exist(17) then show sprite 17 `checking to see if sprites exist and if so displays them
if sprite exist(18) then show sprite 18 `checking to see if sprites exist and if so displays them
if sprite exist(16) then show sprite 16 `checking to see if sprites exist and if so displays them
paste image 18,0,0 `Puts background on screen
sprite 17,300,100,19`Play Button
sprite 18,300,215,20`High Scores Button
sprite 16,300,325,15`Exit Button
sprite 29,mousex(),mousey(),12`Sets a 1x1 pixel sprite to mouse
sync
if (mouseclick()=1 and sprite collision(29,17)=1) `Checks to see if you clicked on sprite
sprite 17,-300,150,19
sprite 18,-300,300,20
sprite 16,-300,450,15
Displaymachine()
endif
if (mouseclick()=1 and sprite collision(29,18)=1)
Displayhighscore() `Checks to see if you clicked on sprite
endif
until (mouseclick()=1 and sprite collision(29,16)=1) or keystate(1)=1 `Checks to see if you click on Sprite or hit ESC Key
endfunction
function Displayhighscore() `Displays HIgh scores
hide all sprites
set current bitmap 0
White =RGB(255,255,255)
Black =rgb(0,0,0)
cls
ink White,Black
sprite 21,0,0,21
show sprite 21
center text 300,150,"Name"
center text 600,150,"Score"
center text 300,168,"-------"
center text 600,168,"-------"
if file exist ("HIGHROLLERS.DAT")=0 then exitfunction `check to make sure file exists
open to read 1,"HIGHROLLERS.DAT" `opens and reads the file and displays it on screen
ypos=180
for x= 1 to 10
read string 1,Name$
read long 1,score
if score <> 0
center text 300,ypos,Name$
center text 600,ypos,str$(score)
endif
ypos=ypos+12
next x
close file 1
center text 450,500,"Press any key to continue.." `Waits for you to hit key then returns to main menu
sync
lock backbuffer
wait key
unlock backbuffer
hide sprite 21
endfunction
function checkforwinner()
winner$="false" `Set winner flag to false
if reel1holder=1 and reel2holder=1 and reel3holder=1 and winner$="false" then wehaveawinner3reels()
if reel1holder=2 and reel2holder=2 and reel3holder=2 and winner$="false" then wehaveawinner3reels()
if reel1holder=3 and reel2holder=3 and reel3holder=3 and winner$="false" then wehaveawinner3reels()
if reel1holder=4 and reel2holder=4 and reel3holder=4 and winner$="false" then wehaveawinner3reels()
if reel1holder=5 and reel2holder=5 and reel3holder=5 and winner$="false" then wehaveawinner3reels()
if reel1holder=6 and reel2holder=6 and reel3holder=6 and winner$="false" then wehaveawinner3reels()
if reel1holder=4 and reel2holder=4 and winner$="false" then wehaveawinner2reels()
if reel1holder=2 and reel2holder=2 and winner$="false" then wehaveawinner2reels()
if reel1holder=5 and reel2holder=5 and winner$="false" then wehaveawinner2reels()
endfunction
function wehaveawinner2reels()
play sound 2 `play winner sound
winner$="true" `YAY you won. Sets flag that you have won so it won't let you double win
if reel1holder=2 then moneypaid=10*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=4 then moneypaid=5*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=5 then moneypaid=15*moneybet`Checks the placeholder and sets to proper payout amount
currentmoney=currentmoney + moneypaid`Adds money won to current money
endfunction
function wehaveawinner3reels()
play sound 2 `Play winner sound
winner$="true" `Sets winner flag to true so you cannot in again on a 2 reel win
if reel1holder=1 then moneypaid= 200*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=2 then moneypaid= 75*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=4 then moneypaid= 50*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=5 then moneypaid= 100*moneybet`Checks the placeholder and sets to proper payout amount
if reel1holder=6 then moneypaid= 2000*moneybet`Checks the placeholder and sets to proper payout amount
currentmoney=currentmoney + moneypaid`Adds money won to current money
endfunction
Thomas Maine AKA Lord SilverStone