View previous topic :: View next topic |
Author |
Message |
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Aug 14, 2002 3:35 am Post subject: Slot Machine... |
|
|
Nothing fancy...
You'll win at a fairly high percentage rate, since
there's only 3 pics on each "wheel". I think any
more would prolly slow it down too much. You
can see an incredible increase in "wheel" speed
as the first two stop.
Used buttons for pics (they don't flicker when
repositioned). Made it ONTOP to check for a
winner with @wintext().
Have fun...
__________________________________________________________________________________________________________________________
Code: |
rem -- Look for a sound file under 50k in size --
LIST CREATE, 1
LIST FILELIST, 1, @windir()\media\*.wav
if @greater(@count(1), 0)
REPEAT
if @greater(50000, @file(@item(1, %x), Z))
%%wavfile = @item(1, %x)
end
%x = @succ(%x)
UNTIL %%wavfile @equal(%x, @count(1))
end
LIST CLOSE, 1
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Slot Machine",-1,0,325,211,SMALLCAPS,ONTOP
DIALOG ADD,STYLE,Style1,Wingdings,36,B
DIALOG ADD,STYLE,Style2,Comic Sans MS,18,BC,RED,WHITE
DIALOG ADD,STYLE,Style3,MS Sans Serif,8,B
DIALOG ADD,TRACKBAR,Handle,5,270,40,180,0,100,,VER,BOTH,CLICK
rem -- Use buttons for flicker-free movement --
DIALOG ADD,BUTTON,B1A,0,6,80,60,"A",,Style1
DIALOG ADD,BUTTON,B1B,0,6,80,60,"B",,Style1
DIALOG ADD,BUTTON,B1C,0,6,80,60,"C",,Style1
DIALOG ADD,BUTTON,B2A,0,86,80,60,"B",,Style1
DIALOG ADD,BUTTON,B2B,0,86,80,60,"C",,Style1
DIALOG ADD,BUTTON,B2C,0,86,80,60,"A",,Style1
DIALOG ADD,BUTTON,B3A,0,166,80,60,"C",,Style1
DIALOG ADD,BUTTON,B3B,0,166,80,60,"A",,Style1
DIALOG ADD,BUTTON,B3C,0,166,80,60,"B",,Style1
DIALOG ADD,TEXT,BkGrnd1,0,0,252,190,,,Style2
DIALOG ADD,GROUP,Top,0,1,252,65
DIALOG ADD,TEXT,T1BkGrnd,1,2,250,63,"",,Style2
DIALOG ADD,TEXT,T1,13,2,250,40,"$ Mac's Casino $",,Style2,TRANSPARENT
DIALOG ADD,GROUP,Bottom,126,1,252,65
DIALOG ADD,TEXT,T2BkGrnd,127,2,250,63,"",,Style2
DIALOG ADD,TEXT,T2,139,2,250,40,"$ Slot Machine $",,Style2,TRANSPARENT
DIALOG ADD,STATUS,Stat,"Pull handle down to play...",Style3
DIALOG SHOW
:EVLOOP
%e = ""
WAIT EVENT
%e = @event()
rem -- Ignore button presses --
if @equal(%e, "CLOSE")@equal(%e, "HandleCLICK")
goto %e
end
goto EVLOOP
:HandleCLICK
rem -- Adjust for 100 at top handle pos --
%%delay = @diff(100, @dlgtext(Handle))
DIALOG SET, Handle, 100
%%delay = @format(@fmul(@fmul(%%delay, ".01"), 5), 1.0)
if @greater(1, %%delay)
goto EVLOOP
end
%x = 1
rem -- Reset all to zero pos --
REPEAT
DIALOG SETPOS, B%xA, 0
DIALOG SETPOS, B%xB, 0
DIALOG SETPOS, B%xC, 0
%x = @succ(%x)
UNTIL @greater(%x, 3)
%%stop = 0
%n = 0
%x = 0
%y = -60
%z = -120
%%old = @datetime(ss)
REPEAT
%%new = @datetime(ss)
%e = @event()
if @both(@equal(@mod(%%new, %%delay), 0), @not(@equal(%%old, %%new)))
%%old = %%new
if @greater(4, %%stop)
%%stop = @succ(%%stop)
end
end
if @greater(%%stop, 0)
if @equal(%n, 0)
GOSUB SetPos
end
else
DIALOG SETPOS, B1A, %x
DIALOG SETPOS, B1B, %y
DIALOG SETPOS, B1C, %z
end
if @greater(%%stop, 1)
if @equal(%n, 1)
GOSUB SetPos
end
else
DIALOG SETPOS, B2A, %x
DIALOG SETPOS, B2B, %y
DIALOG SETPOS, B2C, %z
end
if @greater(%%stop, 2)
if @equal(%n, 2)
GOSUB SetPos
%e = "EVLOOP"
end
else
DIALOG SETPOS, B3A, %x
DIALOG SETPOS, B3B, %y
DIALOG SETPOS, B3C, %z
end
%x = @succ(%x)
%y = @succ(%y)
%z = @succ(%z)
if @equal(%x, 60)
%y = 0
end
if @equal(%y, 60)
%z = 0
end
if @equal(%z, 60)
%x = 0
end
UNTIL @equal(%e, "CLOSE")@equal(%e, "EVLOOP")
rem -- Easy check for winner --
PARSE "%t;%l", @winpos("Slot Machine",TL)
%x = @wintext(@winatpoint(@sum(%l,40), @sum(%t, 116)))
%y = @wintext(@winatpoint(@sum(%l,120), @sum(%t, 116)))
%z = @wintext(@winatpoint(@sum(%l,200), @sum(%t, 116)))
if @both(@equal(%x, %y), @equal(%x, %z))
DIALOG SET,Stat, "You're a Winner!"
else
DIALOG SET,Stat, "You Lose - Pull handle to play again..."
end
goto %e
:CLOSE
EXIT
rem ---------------- GOSUB ------------------
:SetPos
if %%wavfile
PLAY %%wavfile
end
%n = @succ(%n)
rem -- Extra params in case @mod() trips before first pic has moved enough --
if @both(@greater(%x, 5), @greater(67, %x)) @both(@both(@greater(66, %x), @greater(66, %y)), @greater(66, %z))
DIALOG SETPOS, B%nA, 66
DIALOG SETPOS, B%nB, 0
DIALOG SETPOS, B%nC, 0
end
if @both(@greater(%y, 5), @greater(67, %y))
DIALOG SETPOS, B%nB, 66
DIALOG SETPOS, B%nA, 0
DIALOG SETPOS, B%nC, 0
end
if @both(@greater(%z, 5), @greater(67, %z))
DIALOG SETPOS, B%nC, 66
DIALOG SETPOS, B%nA, 0
DIALOG SETPOS, B%nB, 0
end
exit
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Wed Aug 14, 2002 3:50 am Post subject: |
|
|
Nice work Mac, after playing with that for 5 minutes I won a total of 0 times. Obviously I shouldn't think of going to vegas with those odds. |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Wed Aug 14, 2002 4:01 am Post subject: Re: Slot Machine... |
|
|
Mac wrote: | You'll win at a fairly high percentage rate, since
there's only 3 pics on each "wheel". |
Figures you'd bait us to take our money _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Aug 14, 2002 4:37 pm Post subject: |
|
|
Hmmmm.... Maybe I shoulda required a credit card
number from you guys... LOL
I should have also mentioned that the farther you pull
the handle down, the longer the "wheels" spin (from 1
second to 5 seconds for each wheel), although the first
wheel will always stop at various speeds depending on
where the computer clock (seconds) is when ya start.
Doesn't necessarily help your odds, but it should vary
them a little...
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Aug 14, 2002 6:36 pm Post subject: |
|
|
Hey PK, is that old monster truck slot game of yours still floating
around for people to download?
-Garrett |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Aug 14, 2002 7:53 pm Post subject: |
|
|
Lol Prakash, VERY nice.
If I'd known about that, I prolly wouldn't have posted this one...
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Wed Aug 14, 2002 9:43 pm Post subject: |
|
|
That monster truck game is very old. Infact I made it for the vds 3 contest when vds 3 first came out. I won a free copy of vds 3 with that little game
Anyway your example is pretty nice itself Mac. It's always great to see other people's examples, one way isn't always the best way so sharing your code is helpful for all. Plus I lost the source to that game that I made awhile back, now we all can benefit from yours |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Sep 22, 2002 5:55 pm Post subject: |
|
|
If you want the source back you might try to e-mailing S.A.D.E. and see if they can help you... _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|