err no, should be DBPro unless it the IanM's plugin that I've used without knowing it.
random seed timer() should have been randomize timer()and the box command shoud of had the other three rgb's added
I post updated code for those who have not installed the Matrix1 Utility Plug-ins.
let me know if still does not work.
Rem Project: dicefruitsa1
Rem Created: Tuesday, July 20, 2010
rem by Howdo
Rem ***** Main Source File *****
sync on
sync rate 60
`random seed timer()
randomize timer()
rem open a bitmap to grab some text
create bitmap 1,256,256
`box 0,0,256,256,rgb(255,255,0)
`box 5,5,251,251,rgb(0,0,0)
box 0,0,256,256,rgb(255,255,0),rgb(255,255,0),rgb(255,255,0),rgb(255,255,0)
box 5,5,251,251,rgb(0,0,0),rgb(0,0,0),rgb(0,0,0),rgb(0,0,0)
get image 1,0,0,256,256,1
cls rgb(128,128,0)
text 0,0,"HOLD"
get image 2,0,0,text width("HOLD"),text height("H"),1
cls rgb(128,128,0)
text 0,0,"HELD"
get image 3,0,0,text width("HELD"),text height("H"),1
cls rgb(0,150,255)
text 0,0,"START"
get image 4,0,0,text width("START"),text height("H"),1
cls rgb(255,150,255)
text 0,0,"CANCEL"
get image 5,0,0,text width("CANCEL"),text height("H"),1
rem close bitmap
delete bitmap 1
set current bitmap 0
rem set font
set text font "Aril"
set text size 24
rem set up dims
dim wc(36) as string
dim wcs(36) as string
dim face(9,2)
for i=0 to 9
face(i,1)=i
next i
autocam off
position camera 0,5,-140
point camera 0,0,0
rem load dice object
load object "r_dice1.x",1
rem position and clone object
position object 1,-40,40,0
clone object 2,1
position object 2,0,40,0
clone object 3,1
position object 3,40,40,0
clone object 4,1
position object 4,-40,0,0
clone object 5,1
position object 5,0,0,0
clone object 6,1
position object 6,40,0,0
clone object 7,1
position object 7,-40,-40,0
clone object 8,1
position object 8,0,-40,0
clone object 9,1
position object 9,40,-40,0
rem place hold buttons
make object plain 10,25,10
SET OBJECT DIFFUSE 10, rgb(128,128,0)
position object 10,80,40,0
rotate object 10,180,0,-90
clone object 11,10
position object 11,80,0,0
clone object 12,10
position object 12,80,-40,0
make object plain 13,25,10
SET OBJECT DIFFUSE 13, rgb(128,128,0)
position object 13,-40,-80,0
clone object 14,13
position object 14,0,-80,0
clone object 15,13
position object 15,40,-80,0
rem put hold text on the objects
for tt=10 to 15
texture object tt,2
next tt
rem make cancel button
make object plain 16,25,25
position object 16,80,-75,0
texture object 16,5
rem held lines boxes
make object plain 17,120,30
clone object 18,17
clone object 19,17
make object plain 20,30,120
clone object 21,20
clone object 22,20
position object 17,0,40,-10
position object 18,0,0,-10
position object 19,0,-40,-10
position object 20,-40,0,-10
position object 21,0,0,-10
position object 22,40,0,-10
make object plain 23,25,25
position object 23,-80,-75,0
texture object 23,4
rem add yellow box image
for t= 17 to 22
SET OBJECT TRANSPARENCY t, 1
texture object t,1
hide object t
next t
rem set up globals and start values
global time delay row money win done holdon t1$ t2$ t3$ r t4$ wins
money=100
time=timer()
delay=1500
spindice()
t1$="Your Money"
t2$="You Won"
rem ready to loop
do
showmoney()
if (mouseclick()<>0 and pick object(mousex(),mousey(),23,23)>0 and money<>0 ) or (spacekey()<>0 and money<>0 )
money=money-1
wins=0
showmoney()
time=timer()
spindice()
checkforwin()
if holdon=0
for tt=10 to 15
texture object tt,2
SET OBJECT EMISSIVE tt, rgb(0,0,0)
next tt
endif
row=rnd(6)
if row=0
holdon=1 :holdheld()
else
for i=1 to 9
face(i,2)=0
next i
endif
endif
sync
loop
function holdheld()
local time2
local delay2
delay2=500
if holdon=1
time2=timer()
while holdon=1
`if (mouseclick()<>0 and pick object(mousex(),mousey(),23,23)>0 ) and spacekey()<>0 then exitfunction
showmoney()
if timer()>time2+delay2
on=1-on
time2=timer()
endif
for h=10 to 15
if on=1
SET OBJECT DIFFUSE h, rgb(128,128,0)
else
SET OBJECT diffuse h, rgb(255,255,0)
endif
next h
if mouseclick()=1
cursorobj=(pick object(mousex(),mousey(),10,16)) or (pick object(mousex(),mousey(),23,23))
if cursorobj=10
SET OBJECT EMISSIVE 10, rgb(255,255,0)
show object 17
texture object 10,3
face(1,2)=1
face(2,2)=1
face(3,2)=1
endif
if cursorobj=11
show object 18
texture object 11,3
SET OBJECT EMISSIVE 11, rgb(255,255,0)
face(4,2)=1
face(5,2)=1
face(6,2)=1
endif
if cursorobj=12
SET OBJECT EMISSIVE 12, rgb(255,255,0)
show object 19
texture object 12,3
face(7,2)=1
face(8,2)=1
face(9,2)=1
endif
if cursorobj=13
SET OBJECT EMISSIVE 13, rgb(255,255,0)
show object 20
texture object 13,3
face(1,2)=1
face(4,2)=1
face(7,2)=1
endif
if cursorobj=14
SET OBJECT EMISSIVE 14, rgb(255,255,0)
show object 21
texture object 14,3
face(2,2)=1
face(5,2)=1
face(8,2)=1
endif
if cursorobj=15
SET OBJECT EMISSIVE 15, rgb(255,255,0)
show object 22
texture object 15,3
face(3,2)=1
face(6,2)=1
face(9,2)=1
endif
if cursorobj=16
for c=1 to 9
face(c,2)=0
next c
for y=10 to 15
SET OBJECT DIFFUSE y, rgb(128,128,0)
SET OBJECT EMISSIVE y, rgb(0,0,0)
texture object y,2
next y
for h=17 to 22
hide object h
next h
endif
if cursorobj=23
holdon=0
spindice()
endif
if cursorobj=0
for i=10 to 15
SET OBJECT DIFFUSE i, rgb(128,128,0)
SET OBJECT EMISSIVE i, rgb(0,0,0)
texture object i,2
next i
endif
endif
sync
endwhile
endif
endfunction
function showmoney()
center text text width(t1$)/2,0,t1$
center text text width(t1$)/2-text width("£"+str$(money))/2,text height("I"),"£"+str$(money)
center text screen width()/2,5,"DICE FRUITS"
center text text width(t2$)/2,(text height("I")*2),t2$
center text text width(str$(wins))/2,(text height("I")*3),str$(wins)
rem test results print what the six possable lines look like
`text 0,40,t3$
`text 0,55,t4$
`g=1
`for j= 1 to 36
`text 0, 60+(14*j),str$(g)+"wcs="+wcs(j)+" ="+wcs(j)
`if j mod 3 =0 then inc g
`if g>6 then g=1
`next j
`text 250,40,str$(r)
endfunction
function checkforwin()
wins=0
showmoney()
rem clear last values
for o=1 to 36
wc(o)=""
wcs(o)=""
next o
stepcount=0
rem set up check and make win line
d=1
for k= 1 to 6
for p= 1 to 9
if mid$(t3$,p)=str$(k) then wc(k)=wc(k)+"1" else wc(k)=wc(k)+"0"
if mid$(t4$,p)=str$(k) then wc(k+6)=wc(k+6)+"1" else wc(k+6)=wc(k+6)+"0"
next p
next k
d=1
for y = 1 to 36 step 3
wcs(y)=left$(wc(d),3)
wcs(y+1)=left$(right$(wc(d),6),3)
wcs(y+2)=right$(wc(d),3)
inc d
next y
rem find winning line
r=0
for l= 1 to 36
rem rows a columns
if wcs(l)="111"
inc r
select l
case 1,4,7,10,13,16: drawinline(1,3):endcase
case 2,5,8,11,14,17: drawinline(4,6):endcase
case 3,6,9,12,15,18: drawinline(7,9):endcase
case 19,22,25,28,31,34: drawinline(1,7):endcase
case 20,23,26,29,32,35: drawinline(2,8):endcase
case 21,24,27,30,33,36 :drawinline(3,9):endcase
endselect
sync
wait 1000
endif
next l
`text 100,220,str$( r)
if r=6 then wins=50
if r=5 then wins=25
if r=4 then wins=20
if r=3 then wins=15
if r=2 then wins=5
if r=1 then wins=1
money=money+wins
done=0
holdon=0
rem hide hold bars
for h=17 to 22
hide object h
next h
endfunction
function drawinline(a,b)
line object screen x (a),object screen y(a),object screen x(b),object screen y(b)
endfunction
function spindice()
while timer()<time+delay
showmoney()
t3$=""
t4$=""
if count>=9 then count =0
inc count
if face(count,2)<>1
face=rnd(5)+1
if face=6
rotate object face(count,1),0,0,0
face(count,0)=6
endif
if face=5
rotate object face(count,1),90,0,0
face(count,0)=5
endif
if face=4
rotate object face(count,1),0,90,0
face(count,0)=4
endif
if face=3
rotate object face(count,1),0,-90,0
face(count,0)=3
endif
if face=2
rotate object face(count,1),-90,0,0
face(count,0)=2
endif
if face=1
rotate object face(count,1),180,0,0
face(count,0)=1
endif
endif
for u=1 to 9
t3$=t3$+str$(face(u,0))
next u
t4$=mid$(t3$,1)+mid$(t3$,4)+mid$(t3$,7)+mid$(t3$,2)+mid$(t3$,5)+mid$(t3$,8)+mid$(t3$,3)+mid$(t3$,6)+mid$(t3$,9)
sync
endwhile
endfunction
Dark Physics makes any hot drink go cold.