IonicWind Software

IWBasic => General Questions => Topic started by: hugh on June 07, 2008, 04:00:27 AM

Title: bingo game (freeware)
Post by: hugh on June 07, 2008, 04:00:27 AM
disregard the "Copy Folder" Computerised Bingo To Your Hard Drive C:/. that only applies to the program being on a CD
I have put it on a CD with instructions.txt,  & read me first.txt
With the url to download ebasic. I dont think i would be allowed to distribute ebasic setup on my CD
I have used it at local club as a test, paid out more money than the club, but donated to childrens/pensioners xmass party





/*sample program to simulate a bingo machine, it is freeware.
thanks for help from [http://www.ionicwind.com/]forums,much appreciated.
'just copy folder "computerised bingo" to your hard drive c:/
100% virus free. 100% malware free. does not attempt to connect to internet,does not install on you computer


line 8 if you want,it,s just a notepad instruction doc + credits + disclaimer
[By Hugh Mc Afee]
*/
'SYSTEM "notepad.exe" , "c:\\Computerised Bingo\\computerised bingo instructions.txt"

    WINDOW w1
    int screenW,screenH
    GETSCREENSIZE screenW,screenH
sw=screenW:sh=screenH
'...
'best run under 1024 x 768 or 800 x 600: if different then ask user to change control panel settings
'...
    if sw < 800 & sh < 600 or sw > 1024 & sh > 768 then messagebox w1,"Your Screen is "+str$(sw)+" x "+str$(sh)+"Click [Start],[Control Panel], double click [Display], click [settings] set screen size to 800 x 600 or 1024 x 768, click [apply], select [ok] or [yes], click [close], restart computerised bingo","YOUR SCREEN NEEDS ADJUSTING"
    if sw = 1280 & sh = 1024 then messagebox w1,"for optimum visual display, it would be better if you adjusted your display settings to 1024 x 768, Click Start, select Control Panel,select Display, double click Display,select Settings,move the slider until it = 1024 x 768, select apply,seleck OK, then restart computerised bingo","Your Screen Settings Are set to a very high resolution"
    'left=sw-sw:top=sh-sh:bot=sh:rite=sw:centcol=rite/2:centrow=bot/2
    'def  bd1$ as STRING
    'def bd2$ as string
'def bd3$ as string
string f$,ss$
    float bc,ct,tc,cb,cl,linepay,playw,housepay,totalpay,charge,zero
    int elasperun,starttime,stoptime,elapsetime
int mycount,r,c,x,y,z,rnum,gamenum,sn,en,bs,cc,numw,numl,equ,booksoldtot
int cashtot,paytot,totalprofit,wagetot,costofbooks,wages,bookscost,gametot
    int column[11],rownum[10],counter
if sw = 800 AND sh = 600 then cc = 30     '3 column gap between board #s
If sw > 800 AND sh > 600 THEN cc = 40     '4 row gap between board #s
if sw = 800 AND sh = 600 THEN numw=280    'width of numbers 1 to 10 step cc[30]
if sw = 800 AND sh = 600 THEN numl=270    'height of numbers 1 to 9
IF SW > 800 AND sh > 600 THEN numw=380    'same as lines 21 but cc=40
if sw > 800 AND sh > 600 THEN numl=350    'same as lines 22 but cc=40
'*********************************************************************************
'    this is for circling the called numbers on the board
'********************************************************************************
sc=(sw-numw)/2:sr=sh-sh+cc+20    'start column [sc] , row [sr]
col = sc 
for j = 1 TO 10
column[j]=col             'first column to circle the #1
col = col + cc            'bump column# by cc
NEXT j                    'do 9 more times, # 2 to 10
row = sr                     'first row number
for j = 1 to 9
rownum[j] = row              'if sw=800 then cc=30 else cc=40
row = row + cc
next j                       'last row = 8 rows x 10 columns pos to circle
'....................................................................................
'random number [picked] it is in the sub bingonumber() rnum = random # selected
'....................................................................................

int picked[91]               'set picked[1] to [90] to 0
for x = 1 to 90
picked[x]=0
next x
  '....................................................................................
  'set up al the variables, window etc
  '....................................................................................

    gamenum=1 : ticket=1 : charge = 0.20 : zero = 000000 : books=1200:flyers=1200
mycount=0 : gametot=1:counter=1
    wages = 48:bookscost = 0.09:booksoldtot=0
    cashtot=0:paytot=0:totalprofit=0:wagetot=0:costofbooks=0
    title$="..COMPUTERISED  BINGO.."
    title=len(title$):if sw=800 & sh=600 then fn=10 else fn = 12
OPENWINDOW w1,0,0,sw,sh,@SIZE,0," ",&w1handler                                                                                                           
    SETWINDOWCOLOR w1, RGB(255,155,0)
if sw>800 & sh >600 then CONTROL w1,@STATIC,title$,sw/2-(title/2*10)+20,5,((title*9)-20),20,0,100
    if sw=800 & sh=600 then CONTROL w1,@STATIC,title$,sw/2-(title/2*10)+20,5,((title*9)-20),20,0,100
SETFONT w1, "Ariel", fn, 600,100
setcontrolcolor (w1,100,rgb(255,255,0),rgb(0,0,255))
'*******************************************************************************
        'draw the bingo board and display numbers 1 to 90
'....................................................................................

sc=sw/4+40:sr=sh-sh+60
SETLINESTYLE w1, @LSSOLID, 6
RECT w1,((sw-numw)/2)-cc,sh-sh+cc,numw+(cc*2),numl+cc,rgb(0,255,0),rgb(255,255,0)


setlinestyle w1, @lssolid, 3
rect w1, 5, 20, 140, 220, rgb(0,120,0)      'got to find calculation to auto fix this
rect w1, sw-175, 20, 160, 220, rgb(0,120,0)

sw=val(ltrim$(str$(screenW))):sh=val(ltrim$(str$(screenH)))
/*
***************************************************************************
   display 90 numbers within the rectangle 1 to 10  column[c] 1 to 8 row[r]
               column and row are incremented using [c]
   z = numbers from 1 to 90, its actually a control # from 1 to 90 as well
             [numw] is the width of the displayed numbers
             [numl] is the height of the displsyed numbers
'***************************************************************************
*/
r= cc+20           ' row start number                           
for y=1 to 90 step 10
c= (sw-numw)/2      ' column start number numw =width of displayed #,s                       
for x=1 to 10
z=x+y-1               
            SETLINESTYLE w1, @LSSOLID, 2
CONTROL w1,@STATIC,ltrim$(str$(z)),c,r,20,18,0, z   'from 20 to 30
            SETCONTROLCOLOR(w1,z,RGB(0,0,0),RGB(255,255,0))   
c=c+cc
next x
r=r+cc
next y
'*******************************************************************************
                    ' all the controls and  buttons
'....................................................................................
if sw=800 & sh = 600 then ts1 = 230 else ts1 =280
if sw=800 & sh = 600 then ts2=290 else ts2=340
    control w1,@static,time$,ts1,5,60,20,0,599 :           '(clock)
    control w1,@static,"00:00:00",sw-ts2,5,60,20,0,610 :'displays elapsed time from game start

'*******************************************************************************
CONTROL w1,@STATIC," ",sw/2-70,sh-220,140,130,1,101                'random #     
SETFONT w1, "Ariel", 80, 1000,@SFITALIC,101                        'to call
'*******************************************************************************                                                                               
CONTROL w1,@STATIC,"Total Called",sw-sw+10,sh-sh+30,90,20,0, 102      'counter
control w1, @static,"00",sw-sw+110,sh-sh+30,30,20,0|@CTEDITNUMBER,200 'mycount
'********************************************************************************
    CONTROL w1,@STATIC,"Book No",sw-sw+10,sh-sh+60,90,20,0, 103            'count
SETFONT w1, "Ariel", 10, 700,103                                       'game
control w1,@static,"01",sw-sw+110,sh-sh+60,30,20,0|@CTEDITNUMBER,210   '#1 to 99
'********************************************************************************
CONTROL w1,@STATIC,"Page number",sw-sw+10,sh-sh+90,90,20,0,104        'page
control w1,@static,"01",sw-sw+110,sh-sh+90,30,20,0|@CTEDITNUMBER,220  'counter
'********************************************************************************
CONTROL w1,@STATIC,"Cash Taken",sw-sw+10,sh-sh+120,130,15,1,105        'cash 
CONTROL w1,@STATIC,"0000.00",sw-sw+10,sh-sh+145,130,15,1|@CTEDITNUMBER,106         
'*********************************************************************************
CONTROL w1,@STATIC,"Books Start#",sw-170,sh-sh+30,90,20,0, 107      'book
SETFONT w1, "Ariel", 10, 500,107                                    'start
CONTROL w1,@Edit," ",sw-80,sh-sh+30,60,20,0|@CTEDITNUMBER,108      'number
SETCONTROLTEXT w1,108,str$(1200)
zz$=getcontroltext w1,108:zz=val(ltrim$(zz$))
'**********************************************************************************
CONTROL w1,@STATIC,"Books End#",sw-170,sh-sh+60,90,20,0, 109         'book                                 
CONTROL w1,@EDIT," ",sw-80,sh-sh+60,60,20,0|@CTEDITNUMBER,110        'end
SETCONTROLTEXT w1,110,str$(0000)                                      '#
    ben$=getcontroltext w1,110:ben=val(ltrim$(ben$))                   ' bookend#                                   
'*********************************************************************************
CONTROL w1,@STATIC,"Books Sold",sw-170,sh-sh+90,90,20,0, 111         'total
CONTROL w1,@STATIC," ",sw-80,sh-sh+90,60,20,0,112                    'books
setcontroltext w1,112,str$(0000) 'sold
'**********************************************************************************
CONTROL w1,@STATIC,"Book cost",sw-170,sh-sh+120,90,20,0, 113        ' price                               
CONTROL w1,@EDIT," ",sw-80,sh-sh+120,60,20,0,114                     'charged
SETCONTROLTEXT w1,114,str$(0.20)                                    'per book
'***********************************************************************************
control w1, @static,"pay_line=",sw-170,sh-sh+180,80,15,0,115        'pay line
CONTROL W1,@STATIC,"ÂÃ,£000.00",SW-80,SH-SH+180,60,15,0,140            'amount
'***********************************************************************************
control w1, @static,"pay house=",sw-170,sh-sh+200,80,15,0,116       'pay house         
CONTROL w1, @static,"ÂÃ,£000.00",sw-80,sh-sh+200,60,15,0,150           'amount
'***********************************************************************************
control w1, @static,"Total pay=",sw-170,sh-sh+220,80,15,0,117       'total cash
CONTROL w1, @static,"ÂÃ,£000.00",sw-80,sh-sh+220,60,15,0,160           'paid out
'********************************************************************************
     'These controls keep totals for the bingo session and are calculated by
            'clicking ,[calculate flyer] and [calculate books]

control w1, @static,"Takings  = ÂÃ,£",sw-sw+10,sh-sh+180,130,15,0,500    'gross
control w1, @static,"Payout-  = ÂÃ,£",sw-sw+10,sh-sh+200,130,15,0,510    'amounts
control w1, @static,"Prof------  = ÂÃ,£",sw-sw+10,sh-sh+220,130,15,0,520
'*******************************************************************************
' these controls are hidden untill an error msg or instructions are to be displayed
'**********************************************************************************
control w1, @static ,"You MUST adjust your [START] and [END] Numbers, To Recalulate for payouts",sw/2-270 ,sh-250,540,20,0,740|@swhide
setcontrolcolor w1,740,rgb(255,0,0),rgb(0,0,0)
showwindow w1,@swhide,740
control w1, @static ," Checking Full House,  DONT click   [Next_Game]   until   HOUSE  is Correct",sw/2-250 ,sh-250,500,20,0,750|@swhide
setcontrolcolor w1,750,rgb(255,0,0),rgb(0,0,0)
showwindow w1,@swhide,750
control w1, @static ,"  Checking single line,  DONT click   [START]   until  LINE is  Correct",sw/2-225,sh-250,450,20,0,760|@swhide
showwindow w1,@swhide,760
setcontrolcolor w1,760,rgb(255,0,0),rgb(0,0,0)

for j=500 to 520 step 10
setfont w1,"Ariel",10,j:next j
for j = 500 to 520 step 10
SETCONTROLCOLOR (w1,j,rgb(255,255,0),rgb(0,0,255)):next j
control w1,@static,"Please click Calculate [Flyer or Book] ,then click [Start] to continue",sw/2-215,sh-250,430,20,0,780
setcontrolcolor w1,780,rgb(255,0,0),rgb(0,0,0)
showwindow w1,@swhide,780
'********************************************************************************
'      buttons for user to click on to control the bingo game
'********************************************************************************
    CONTROL w1,@Button,"<--Exit Game",sw-sw+40,sh-80,110,40,1,119           'disabled @ startup       
CONTROL w1,@Button,"Next Game-->",sw-150,sh-80,110,40,1,120             'disabled @ startup       
CONTROL w1,@Button,"< Start >", (sw/2)-55,sh-80,110,40,1,121            'select & display rnd #       
CONTROL w1,@BUTTON,"calculate Books",sw-160,sh-sh+300,140,20,0,122      'payout amount for 3 page book   
CONTROL w1,@BUTTON,"calculate Flyer",sw-sw+10,sh-sh+300,130,20,0,123    'payout amount for 1 single flyer ticket           
CONTROL w1,@BUTTON,"Line",sw-sw+220,sh-180,60,20,1,128                  'click to check line & instructions                   
CONTROL w1,@BUTTON,"House",sw-280,sh-180,50,20,1,129                    'click to check house f& instructions                     
control w1,@static,"flyer",sw-100,sh-sh+260,40,25,1,300                 'preset to flyer @ startup
control w1,@BUTTON,"Save",sw-sw+55,sh-sh+260,40,20,0,390                'save data to text file, seq
CONTROL w1,@BUTTON,"time start",sw-sw+10,sh-sh+400,130,20,0,660         'time the sessions
    CONTROL w1,@BUTTON,"time end",sw-160,sh-sh+400,140,20,0,670             'session ends
setcontrolcolor (w1,660,rgb(255,0,0),rgb(0,0,0))
    setcontrolcolor (w1,670,rgb(255,0,0),rgb(0,0,0))
    setcontrolcolor (w1,610,rgb(255,0,0),rgb(0,0,0))
    setcontrolcolor (w1,599,rgb(255,0,0),rgb(0,0,0))
'***********************************************************************************
for j = 101 to 500
setcontrolcolor (w1,j,rgb(255,255,0),rgb(0,0,255))
next j
for j = 101 to 500
setfont w1,"Ariel",10,500,j
next j
setcontrolcolor (w1,101,rgb(255,0,0),rgb(0,0,0))
setcontrolcolor (w1,118,rgb(0,0,0),rgb(255,0,0))
setcontrolcolor (w1,121,rgb(255,0,0),rgb(0,0,255))
setcontrolcolor (w1,122,rgb(255,255,0),rgb(255,0,0))
setcontrolcolor (w1,123,rgb(255,255,0),rgb(255,0,0))
setcontrolcolor (w1,128,rgb(255,255,0),rgb(255,0,0))
setcontrolcolor (w1,129,rgb(255,255,0),rgb(255,0,0))
SETCONTROLCOLOR (w1,125,rgb(255,155,0),rgb(255,155,0))
setfont w1,"Ariel",16,1000,118
'...............................................................................
'these buttons disabled at startup,cant be used untill start + end numbers
'are entered correctly and either calulate flyer or calculate house butons
'have been clicked, the line button=1 when > 5 numbers called
'the house button=1 when > 15 numbers have been called
'the next game button = 1 when >30 numbers called
'................................................................................
ENABLECONTROL w1,119,0
ENABLECONTROL w1,120,0
ENABLECONTROL w1,121,0
ENABLECONTROL w1,128,0
ENABLECONTROL w1,129,0
ENABLECONTROL w1,390,0
starttimer w1,1000
elasperun=0
WAITUNTIL w1 = 0
stoptimer w1
end
'                     main  w1handler routine
'**********************************************************************
SUB w1handler()
select @MESSAGE
case @idcreate
CENTERWINDOW w1
case @IDCLOSEWINDOW
CLOSEWINDOW w1
case @idcontrol
select @controlid
case 119         :'<--exit game
CLOSEWINDOW w1
case 120         :'next game->
                    enablecontrol w1,119,1
resetboard()
case 121         :'<start>   
if mycount < 90 then  bingonumber()
case 122
setcontroltext w1,300,"book"  'playing book of 3 tickets
calculate()     :             'Calculate Books payout

case 123   
setcontroltext w1,300,"flyer"  'playing flyer ticket
setcontroltext w1,210,str$(0)
setcontroltext w1,220,str$(0)
calculate()      :             'calculate flyer ticket payout

case 128                           'checking single line
if gamenum >99 then gamenum=1
linecall()
case 129                           'checking full house
if gamenum > 99 then gamenum=1
housecall()
case 390                           'write takings etc to file
rite_to_file()                 'simple text file

CASE 660                           'to start the timer
starttime=timer
elasperun=1
elaspetime=0
CASE 670
elasperun=0                     ' to stop the timer
endselect

case @IDTIMER
setcontroltext w1,599,time$()      :'updates displayed time every sec (a clock)   
if elasperun=1
endtime=timer
elaspetime=endtime-starttime
ss$=right$("00"+ltrim$(str$(elaspetime % 60)),2)
elaspetime=elaspetime/60
ss$=right$("00"+ltrim$(str$(elaspetime % 60)),2)+":"+ss$
elaspetime=elaspetime/24
ss$=right$("00"+ltrim$(str$(elaspetime % 24)),2)+":"+ss$
setcontroltext w1,610,ss$      :'updates displayed time every sec (a clock)   
endif
endselect
   RETURN
ENDSUB
'**********************************************************************
             'Calculate payout on a line and full house
'....................................................................................

sub calculate()
'@HITWINDOW       control clicked                   '...........................
'@IDCONTROL                                         'for future reference
'@IDINITDIALOG                                      '...........................
'@CTEDITLEFT      left indented                     ' i am still learning
'@CTEDITRO        read only
'@ENKILLFOCUS     control looses focus
'ENABLECONTROL w1, ID,0      1 or 0 enable/disable
'SETFOCUS w1, ID   control id# gets the focus
'@ENSETFOCUS

   showwindow w1,@swhide,740
   showwindow w1,@swhide,780
    SETPRECISION 2
    f$ = getcontroltext w1,300                  'flag to check if playing books or flyer
    if f$="flyer" or f$="book" then ticket=1
    sn$ = GETCONTROLTEXT w1,108  'book start number
    en$ = GETCONTROLTEXT w1,110  'book end number
bc$ = GETCONTROLTEXT w1,114  'cost of 1 book of 3 tickets preset to 0.20 per 1
    en = VAL(en$)                'en book end number
    sn = VAL(sn$)                'sn book start number
    if sn < 1 & en < 1 then  messagebox(w1,"Please Enter your START and END numbers","ERROR") else if sn <1 and en > 1 then Messagebox(w1,"Enter Your START number, please" ,"ERROR")
    if sn > 1 & en > 1 and sn=en then messagebox(w1,"Cant Do That,Check Your, End or Start Number, This leaves a zero number","ERROR") 'start+end# r =
    if sn > 1 & en > 1 & en > sn then messagebox(w1,"Cant Calculate, Enter Your START No","End number is More than Start number")
    If sn <1 and en > 1  then en = 0
    if en > sn then en = 0

bc = VAL(bc$)              'charge per single book
    bs=sn-en                     'Total of books sold
tc=bc*bs                     'Total cash taken this session
profit=tc/5                  '20% profit for wages,book costs,per game
payout= tc-profit            'Total available as prize money
payline=payout/3.75           'prize money for 1 flyer single line
payhouse=payout-payline      'prize money for 1 flyer full house
    linepay=payline/3            'prize money per line on each of 3 tickets in book
housepay=payhouse/3          'prize money per house on each of 3 ticketsin book

   'got to check to find out if playing on flyer ticket or a book of 3 tickets

if f$="flyer" then setcontroltext w1,140,"ÂÃ,£"+str$(payline) else SETCONTROLTEXT w1,140,"ÂÃ,£"+str$(linepay)
if f$="flyer" then setcontroltext w1,150,"ÂÃ,£"+str$(payhouse) else SETCONTROLTEXT w1,150,"ÂÃ,£"+str$(housepay)
setcontroltext w1,160,"ÂÃ,£"+str$(payout)   'display Total amount paying out
    SETCONTROLTEXT w1,112,str$(bs)           'display total books sold       
SETCONTROLTEXT w1,106,"ÂÃ,£"+str$(tc)       'display Total cash taken

SETPRECISION 2
    cashtot=cashtot+tc                       'keep totals of cash taken
paytot=paytot+payout                     'keep total of cash paid out
totalprofit=totalprofit+profit           'keep total of profit
wagetot=wagetot+wages                    'keep total of wages
    booksoldtot=booksoldtot+bs
setcontroltext w1, 500,"Takings  = ÂÃ,£"+str$(cashtot)
    setcontroltext w1, 510,"Payout-  = ÂÃ,£"+str$(paytot)
    setcontroltext w1, 520,"Prof------  = ÂÃ,£"+str$(totalprofit)
ENABLECONTROL w1,121,1
ENABLECONTROL w1, 122,1         'calculate flyer
ENABLECONTROL w1, 123,1         'calculate books
RETURN
ENDSUB
'***********************************************************************
     ' select random number (1,90) + circle it to define its been called
'....................................................................................

sub bingonumber()

showwindow w1,@swhide,740
showwindow w1,@swhide,750
showwindow w1,@swhide,760
showwindow w1,@swhide,126
bd1$=getcontroltext w1,160               'total paid out
bs$=getcontroltext w1,108                'book start#
be$=getcontroltext w1,110                'book end#
bd1=val(mid$(bd1$,2,2))
bs=val(ltrim$(bs$))
be=val(ltrim$(be$))
if mycount > 5 & bd1 > 0 then ENABLECONTROL w1,128,1    'ok to check single line
if mycount > 15 & bd1 > 0 then ENABLECONTROL w1,129,1   'ok to check full house
if mycount > 29 & bd1 > 0 then ENABLECONTROL w1,120,1   'ok to click [next game]
if mycount > 29 & bd1 > 0 then ENABLECONTROL w1,390,1   'ok to save data to text file
IF cc = 30 then zz = 15  else zz = 20  '800x600 screen then cc=30 else cc = 40

showwindow w1,@swrestore,125
do
for c= 1 to 90 step 10
for r = 1 to 9
rnum=RAND 1,c+r
    next r:next c
until picked[rnum]=0
picked[rnum]=1
SETCONTROLCOLOR(w1,rnum,RGB(0,0,0),RGB(255,255,0))
mycount++
SETCONTROLTEXT w1, 200, str$(mycount)         'total numbers called
SETCONTROLTEXT w1, 101, ltrim$(str$(rnum))    'random number to call         
    SETCONTROLTEXT w1, 210, STR$(gamenum)         'book number (3 books per session)
SETCONTROLTEXT w1, 220, STR$(ticket)          'tickets in book = 3
     num1$=(ltrim$(str$(rnum)))     
     l$=left$(num1$,1):r$=right$(num1$,1)
c = val(r$)
r = val(l$)+ 1 
if c = 0 then r = r - 1
l=len(num1$):if l<2 then r = 1
if c = 0 then c = 10
SETLINESTYLE w1, @LSSOLID, 2
     circle w1,column[c]+10,rownum[r]+10,zz,RGB(255,0,0),RGB(255,255,0)



return
endsub
'**********************************************************************
sub rite_to_file()

lc$=getcontroltext w1,106
lc = val(mid$(lc$,2,4))
if lc<1 then messagebox (w1,"You Have only made, ÂÃ,£000.00, insufficient","click, Calculate [Flyer] or [Books]")

bd1$=getcontroltext w1,500               'gross cash taken
'if bd1$=" " then CONTROL w1,@STATIC,"nothing to calculate you have not sold any tickets yet,enter Book End#",sw-sw,sh-250,800,20,0,125
'xx$=getcontroltext w1,600                '1st book start#
bd2$=getcontroltext w1,510               'gross amount paid out
bd3$=getcontroltext w1,520               'gross profit
a$=getcontroltext w1,210                 'total books+flyers played
bs$=getcontroltext w1,108                'book start#
be$=getcontroltext w1,110                'book end#
bss$=getcontroltext w1,112               'books sold
bd=val(ltrim$(bd2$))
cashcheck=booksoldtot*0.20
if lc < 1 then return else DEF myfile:file
         'open a file, if not open then create and store the data
'DEF myfile:FILE
IF(OPENFILE(myfile,"C:\\computerised bingo\\totals.TXT","W") = 0)
   WRITE myfile,"Date = "+mid$(date$,4,3)+left$(date$,3)+right$(date$,2)+"  "+"  end Time  = "+time$
   write myfile,"Total games played = "+a$
   write myfile,"Initial book startup = "+zz$+"  Initial book end# = " +ben$
   write myfile,chr$(13)
   write myfile,"..................this session statistics................."
   write myfile,"Book start ="+bs$         
   write myfile,"Book end   = "+be$
   write myfile,"Books Sold = "+bss$
   write myfile,chr$(13)
   write myfile,bd1$
   write myfile,bd2$
   write myfile,bd3$
   write myfile,chr$(13)
   write myfile,"Total books sold this session = "+str$(booksoldtot)
   write myfile,"This is a Cash check on Total books sold, it should = Takings"
   write myfile,chr$(13)
   write myfile,"total books sold "+str$(booksoldtot)+"  multiplied by 00.20  =  "+"ÂÃ,£"+str$(cashcheck)
   CLOSEFILE myfile
   SYSTEM "notepad.exe" , "c:\\computerised bingo\\totals.txt"

RETURN
ENDSUB

'**********************************************************************
'                   checking on full house
'....................................................................................

sub housecall()
showwindow w1,@swhide,760

lc$=getcontroltext w1,200
lc = val(lc$)
if lc>15 then showwindow w1,@swrestore,750 
if lc <1 then messagebox(w1,"No Numbers have Been called Yet","Click <Start>")
if lc >1 and lc<15 then messagebox(w1,"Not enough numbers called to check full house","        Hit <START> to continue")


RETURN
ENDSUB
'....................................................................................
'                    checking on single line
'....................................................................................


SUB linecall()
showwindow w1,@swhide,750
SETCONTROLCOLOR w1,125,rgb(255,155,0),rgb(255,155,0)
lc$=getcontroltext w1,200
lc = val(lc$)
if lc < 1 then messagebox(w1,"Click  <START> ,No Numbers have been Called Yet","       CLICK START To CONTINUE")
if lc > 5 then showwindow w1,@swrestore,760
setcontrolcolor (w1,760,rgb(255,0,0),rgb(0,0,0))
RETURN
ENDSUB
'***********************************************************************
   ' NEW GAME STARTS SO CLEAR THE BOARD OF CIRCLES,RESET COUNTERS ETC.
'....................................................................................

sub resetboard()

SETCONTROLCOLOR w1,125,rgb(255,155,0),rgb(255,155,0)
setcontrolcolor (w1,451,rgb(255,155,0),rgb(255,155,0))
setcontrolcolor (w1,127,rgb(255,155,0),rgb(255,155,0))
SETCONTROLTEXT w1, 125,""
bs=val(right$(time$,2)):bs++
for x=1 to 90
picked[x]=0
SETCONTROLCOLOR(w1,x,RGB(0,0,0),RGB(255,255,0))
next x
SETCONTROLTEXT w1, 101, ""      'random number [rnum]
SETCONTROLTEXT w1, 200, "00"    'total numbers called [mycount]
f$ = getcontroltext w1,300      'is it book or flyer,needed to gamenum+ticket
    bben$=getcontroltext w1,110:bben=val(ltrim$(bben$))
    mycount=0:ticket++:counter++
    if f$="book" and ticket>3 then gamenum++
if F$="flyer" then gamenum++
    If f$="flyer" then ticket = 1
    IF gamenum > 99 then gamenum = 1 & ticket = 1
    SETCONTROLTEXT w1, 210,STR$(gamenum)
SETCONTROLTEXT w1, 220,STR$(ticket)
    if f$="book" & bben >0 & ticket > 3 then setcontroltext w1,108,str$(bben)
    if f$="book" & bben > 0 & ticket > 3 then setcontroltext w1,110,str$(0)
    if f$="flyer" & bben >0  then setcontroltext w1,108,str$(bben)
    if f$="flyer" then  setcontroltext w1,110,str$(0)
if f$="book" & ticket > 3 then ticket = 1
    if f$="flyer" & ticket > 1 then ticket = 1
    SETLINESTYLE w1, @LSSOLID, 2
r=sh-sh+60                        '50                           
for y=1 to 90 step 10
c= ((sw/2)-155)           '350                     
for x=1 to 10
z=x+y-1               
          num1$=(ltrim$(str$(z)))     
     l$=left$(num1$,1):r$=right$(num1$,1)
c = val(r$)
r = val(l$)+ 1 
if c = 0 then r = r - 1
l=len(num1$):if l<2 then r = 1
if c = 0 then c = 10 
if cc=30 then zz=15
if cc=40 then zz=20
circle w1,column[c]+10,rownum[r]+10,zz,RGB(255,255,0),RGB(255,255,0)
c=c+30
next x
r=r+30
next y
showwindow w1,@swhide,125
showwindow w1,@swhide,750
showwindow w1,@swhide,760
showwindow w1,@swrestore,126
showwindow w1,@swrestore,740
'SETCONTROLCOLOR w1,126,rgb(255,155,0),rgb(0,0,255)
endif
ENABLECONTROL w1, 122,1
ENABLECONTROL w1, 123,1


return
endsub
Quote
Title: Re: bingo game (freeware)
Post by: Jerry Muelver on June 07, 2008, 06:53:13 PM
Hugh, why would anyone need EBasic setup to run your program? Just compile it, and distribute the EXE file instead of the source.
Title: Re: bingo game (freeware)
Post by: hugh on June 07, 2008, 07:48:20 PM
because i was thinking , If anyone wanted to start programming, then Emergence basic would be on the CD for them, I have mailed 43
Cd,s so far,each one has the source code included, and ionicwind  url address included in the Instruction.txt.
It was just a thought.

Regards
Hugh
Title: Re: bingo game (freeware)
Post by: Jerry Muelver on June 08, 2008, 03:55:07 AM
Ah! Okay, it's like a promotion for EBasic. Of course, your CDs have the Bingo EXE on them, so non-programmers can play with your program without having to compile it themselves. I get it!
Title: Re: bingo game (freeware)
Post by: Andre on June 08, 2008, 04:19:19 AM
Writing useful software code and distributing it with Ionic Wind URL so that the user has to download EBasic and compile the code himself is a great way of helping to mantain Ionic Wind without having to explain to your wife why did you donate money to a software company. The more popular Ebasic becomes, the more paid subscribers this site will have.

Well done.
Title: Re: bingo game (freeware)
Post by: hugh on June 08, 2008, 07:35:08 PM
Its OK,Ive told the missus, i have  donated $10.00 to the ,"save Aurora appeal", The reason i put the the source on the cd was to get people interested in programming, especially, (some) of  the younger generation, who,(some), can sit at an Xbox 24/7, play games, and complain about the game, and say, if I had made this game, i would have done "this", or done "that", "Just because he or she cant beat the boss man", I say to them, "Why dont you do some reading, as to how the game was made?, why dont you try and understand the programmers, what was he/she thinking about? , even before he/she made the game?. And i tell them, He or she, sits down with pen and paper, A Page here, a page there, then when he/she  gets to  page #####, he/she starts looking for page ##, or some other page###. I call my daughter  Bernadette,s boyfriend, Mr Spectator, because, every time i walk into the sitting room, He moans and groans about the game, i just look at the t.v. screen, and see the words,"You Are now a Spectator", and he is the biggest moaner i have ever heard in my whole life. I told him a story about a game, which was installed on the VIC20,(my first computer), it was called,"Blue Meanies", I said,"I wanted to know how it worked, i said to myself, I would have changed this, and i would have changed that, I said, i, took the proper option, i went to the library and read as many books as could, just on the "BASIC" language.
Then i started to write simple little things, But i was proud of those things, because, i wrote them. well enough said, i still need a bit of help. In my bingo program i have the following code.

468   ENABLECONTROL w1,121,0
469 PLAYWAVE"c:\\computerised bingo\\"+num1$+".wav",@SNDCSYC
470 ENABLECONTROL W1,121,1


num1$ is the LTRIM$ of rnum, the actual random number which has been selected and circled on the bingo board
I have named each wave, from 1 to 90 when i recorded them, so if rnum = 66 then num1$ is the wave file to play, it works perfectly. But what i am trying to figure out is, if CONTROL 121 is disabled, why does it still accept clicks?.
CONTROL 121 is the <Start> button, which is the one that w1handler receives and routes  sub bingonumber()

Title: Re: bingo game (freeware)
Post by: LarryMc on June 08, 2008, 08:33:22 PM
Hugh
Dont know where you got @SNDCSYC from ???

replace it with @SNDSYNC and your program will do what you want it to do.

Larry
Title: Re: bingo game (freeware)
Post by: hugh on June 09, 2008, 05:19:36 AM
ooooOps, tried to remember it, so i spelt it wrong.

Here is the little routine that i use

num1$=(ltrim$(str$(rnum))):out[mycount]=rnum
     l$=left$(num1$,1):r$=right$(num1$,1)
c = val(r$)
r = val(l$)+ 1 
if c = 0 then r = r - 1
l=len(num1$):if l<2 then r = 1
if c = 0 then c = 10
SETLINESTYLE w1, @LSSOLID, 2
     circle w1,column[c]+10,rownum[r]+10,zz,RGB(0,0,0),RGB(255,0,0)
ENABLECONTROL w1,121,0
PLAYWAVE "c:\\computerised bingo\\sounds\\"+(num1$)+".wav",@SNDSYNC
ENABLECONTROL w1,121,1

return
endsub


with the above code , although 121[start] button looks disabled, if i click it before it becomes re-enabled, another number is called.
Title: Re: bingo game (freeware)
Post by: LarryMc on June 09, 2008, 12:15:54 PM
Hugh
change this:ENABLECONTROL w1,121,0
PLAYWAVE "c:\\computerised bingo\\sounds\\"+(num1$)+".wav",@SNDSYNC
ENABLECONTROL w1,121,1

to this:ENABLECONTROL w1,121,0
wait 1
wait 1
PLAYWAVE "c:\\computerised bingo\\sounds\\"+(num1$)+".wav",@SNDSYNC
ENABLECONTROL w1,121,1

and see it that takes care of it for you.

Larry
Title: Re: bingo game (freeware)
Post by: hugh on June 09, 2008, 07:43:05 PM
thanks Larry, I will try that a.m., and let you know if it solves the problem.

Hugh
Title: Re: bingo game (freeware)
Post by: hugh on June 10, 2008, 02:21:27 AM
It did'nt work larry, but i change it to;

ENABLECONTROL w1,121,0
PLAYWAVE "c:\\computerised bingo\\sounds\\"+(num1$)+".wav",@SNDSYNC
WAIT 1
WAIT 1
ENABLECONTROL w1,121,1


Now it works, But i cant understand, if a control is disabled, why does it accept a , click?

Thank you.

Hugh
Title: Re: bingo game (freeware)
Post by: LarryMc on June 10, 2008, 08:40:13 AM
It all has to due with the processing of messages by your message handler and the windows default message handler.
When the command to disable a control is executed a message is sent to the handler.  It has to wait its turn to be processed.

I don't know enough to explain it any better than that.

Larry
Title: Re: bingo game (freeware)
Post by: hugh on June 11, 2008, 07:03:12 AM
o.k. Larry, and Thanks.
I thought it was a bug in the command.

regards

hugh