|
|
Play
Java Games











|
|
When running this applet for the first time, some sound glitches
may arise; that is just how Java 1.0.2. works.
|
 |
In brief:
The above applet is set to win after exactly
three tries, and is provided here only for
demonstration purposes, mainly to showcase this
feature in itself. However, the applet can be
specified to be random each time. Click on the
applet to get redirected to your prize when you
win, but it could have just been set to
automatically take you to the winning page
without the extra click. Notice the code at the
bottom of the applet when you win; unique every
time, and check-out how it gets passed along to
the winning page from the applet's "link"
parameter which can be hidden for extra security
in a special file. Many other of the applet's
options can also be placed in this file. An
encryption scheme for the contents of the special
file is also supported.
Registered users get access to information
regarding the applet's inner-works, and tools to
assist them in deciphering the codes produced by
the applet. Unregistered users get a fully
operational applet, but all the applet's setup
information has to be placed in the hosting HTML
file. You can easily become a registered user
though! Intrigued? Read on... |
|
What
is it?
A little game applet (slot machine) designed to
be placed next to banners, or to give away quick prizes
to users. Even though the applet operates like a real
slot machine, its main purpose is not to simulate one i.e.
calculate payouts and bets, but instead, will let you
play until you reach a certain limit. When you reach that
limit, you're confronted with a winning picture or taken
to a specified link. In addition, a uniquely generated
code is shown to verify that user has really won. So,
taking these features into consideration, the applet can
be used just for fun (See "Examples"), but can
also be taken seriously (See "Ready to gamble?").
Instructions
Simply click anywhere upon the applet to start
playing. At the bottom of the applet is your credit
followed by the amount you must reach in order to win. On
the right, is the virtual representation of your score.
Parameters
| |
Name |
Value |
Description/Comments |
| width |
number |
e.g. <applet
code="VideoSlot.class" width="160"
height="90">
When the "width" is set to 160,
coins stack-up on top of each other infinently.
If the value is larger than 160, the coins span
the area of the applet. Note that the width of
the applet without the coin panel is 124 pixels
wide. In "match4" mode (see bellow) the
numbers are 200 and 165 respectively i.e. 200
coin stack-up and 165 no coins panel.
|
| height |
number |
e.g. <applet
code="VideoSlot.class" width="160"
height="90">
The
height parameter can be either 90 or 80.
|
| credits |
number |
e.g. <param name="credits"
value="3">
The credit the user gets to start
with. Default is 5.
|
| limit |
number |
e.g. <param name="limit"
value="10">
The amount of credits required to win.
Default is 10.
|
| value |
number |
e.g. <param name="value"
value="100">
A multiplier for the credits. Default is
1.
|
| sound |
boolean |
e.g. <param name="sound"
value="on">
Turns the sound on/off. Default is on.
|
| verify |
boolean |
e.g. <param name="verify"
value="on">
Makes the applet display a unique code,
every time a user wins. Default is off.
|
| speed |
number |
e.g. <param name="speed"
value="10">
Performance factor. If the applet is
running too fast or too slow, adjust this
parameter. 1 is fastest. Default is 5.
|
| autolink |
boolean |
e.g. <param name="autolink"
value="on">
Makes the applet automatically go to the
link specified in the "link" parameter.
Default is off, meaning that the user must click
upon the applet to go to the winning link. Note
that with this parameter set on, you can't see
the winning picture because it is pointless.
|
| link |
URL |
e.g. <param name="link"
value="http://your.link.com">
The applet's destination link upon
winning. Note however, that with the unregistered
version the user will be able to see this link by
viewing the source of the page. You can also
insert the {getExtendedCode()} macro anywhere in
the link. e.g. <param name="link"
value="mailto:youremail@com?subject=User
with code {getExtendedCode()} is indeed a winner.">
Again, you will need the register the applet to
decipher the code, but, to offer you something,
the last 3 numbers of the code (separated with
"-") is the user's current score, limit
and spin count. Default setting is no link.
|
| victory |
URL or
relative dir. |
e.g. <param name="victory"
value="Images/victory1.gif">
Lets you specify the winning picture.
Default is "Images/victory.gif".
|
| defeat |
URL or
relative dir. |
e.g.
<param name="defeat" value="Images/tryagain.gif">
Lets you specify the losing picture.
Default is "Images/defeat.gif"
|
| bkcolor |
hexadecimal |
e.g. <param name="bkcolor"
value="#FF00000">
Lets you specify the coins panel
background color. Default is red.
|
| bkimage |
URL or
relative dir. |
e.g. <param name="bkimage"
value="Images/backdrop.gif">
Lets you specify the coins panel
background image. Default is no image.
|
| coins |
boolean |
e.g. <param name="coins"
value="off">
Display the coins in the coins panel.
Default is on.
|
| 3D |
enumerated |
e.g. <param name="3D"
value="low">
Display the applet in a 3D
perspective. Valid values are "high",
"low" and "off". Default is
off.
|
| match4 |
boolean |
e.g. <param name="match4"
value="on">
Display four slot-columns instead of
three. In this mode, you must match four of a
kind to win. Very hard. Default is off.
|
| target |
text |
e.g. <param name="target"
value="_blank">
Specifies the frame in which the
"link" parameter will be opened.
Default is "_top". |
JavaScript
| |
Method |
Returns |
Description/Comments |
| roll() |
void |
e.g. document.applets[0].roll()
Spins the reels if possible i.e. if you
haven't already lost first.
|
| getScore() |
int |
e.g. if (document.applets[0].getScore()
< 0) alert("You lose, I win!");
Returns
the current amout of credits multiplied by the
applet's "value" parameter.
|
| getLimit() |
int |
e.g. if (document.applets[0].getScore()
>= document.applets[0].getLimit()) alert("You
win, I lose!");
Returns the amount of credits you
must reach in order to win in the applet. This is
set by the applet's "limit" parameter.
|
| getCode() |
String |
e.g. alert("My
winning code is " + document.applet[0].getCode());
Returns a uniquely generated code every
time the applet wins. You need to be a registered user to
decipher it though. Additionally, you must have
first reached the applet's winning limit for this
method to return a correct value.
|
| getSpinCount() |
int |
e.g. if (document.applets[0].getSpinCount()
== 100) alert("This might be a bad time to
mention this, but you can press CTRL and click on
the applet at the same time for it to
automatically spin the reels for you.");
Returns the total number of reel spins
and through as many instances of the applet
currently loaded. In other words, it accesses a
static var.
|
| getExtendedCode() |
String |
e.g. document.applets[0].setLink(
"http:/eg.com/check.cgi?code={getExtendedCode()}&test=123");
Returns getCode() + getScore() +
getLimit() + getSpinCount() all numbers separated
by the minus symbol "-". Notice also
how the function is called from within the string
value in the example above. When the user wins,
the applet will attempt to go to a URL like this:
http:/eg.com/check.cgi?code=72474347E-50-50-30&test=123
This feature is provided because, calling the
getExtendedCode() method directly at the wrong
time i.e. when you haven't won, will produce an
erroneuous value. So, if you where to do
something like this:
e.g. document.applets[0].setLink(
"http:/eg.com/check.cgi?code=" +
document.applets[0].getExtendedCode() + "&test=123");
and if the above snippet was called
before the applet is in a winning state, the URL
would be for example:
http:/eg.com/check.cgi?code=-50-50-0&test=123
which is of coarse, wrong.
|
| setLink() |
void |
e.g. document.applets[0].setLink("http:\\example.com/youwin.html");
Set the applet's destination upon
winning. This is similar to specifying the "link"
parameter. You can if you wish, embed the
getExtendedCode() method in the link (See
getExtendedCode() above).
|
| Fields |
Type |
Description/Comments |
| sound |
boolean |
e.g. document.applets[0].sound
= false;
Turns sound on or off.
|
| speed |
int |
e.g. document.applets[0].speed
= 1;
Makes the applet spin fast or slow. The
value 1 is the fastest.
|
| autospin |
boolean |
e.g. document.applets[0].autospin
= true;
Allows the applet to spin the reels
automatically, whithout the need of clicking upon
the applet itself.
|
| loaded |
boolean |
e.g.
if (document.applets[0].loaded) alert("Are
you ready?");
Is "true" when the applet
is finished loading its graphics.
|
| showCoins |
boolean |
e.g.
document.applets[0].showCoins = true;
If "true" displays coin
graphics in the applet's coin panel. This is
similar to setting the applet's "coins"
parameter. |
| target |
String |
e.g.
document.applets[0].target = "_top";
When the applet attempts to go to a
winning link, you can specify in which frame you
would like this to happen. This is similar to
setting the applet's "target" parameter. |
Examples
Applet Visual
Variations Demo.
Multiple Instances and JavaScript
Demo.
Download
You can download the Video Slot Machine applet here.
Registration
The applet is free to use, but should you use it
commercially, a fee of $10 is required. In addition,
registered users get a verification checker (and other
tools) which is used to check the unique winning code
generated by the applet. Please contact me for registration
info.
Ready to gamble?
To practice what I preach, click here to win a free
registration code! But hurry, this offer will expire soon.
Conclusion
The Video Slot Machine applet is not intended to
compete with a client/server based casino game (Video
Slot Machine 2 will!). Instead, its main purpose is to
entertain and to allow for an adequate prize give-away
system by sprucing up your web pages at the same time.
The class file is only about 18K in size, so go for it!
vsid@netscape.net
Enjoy!
|
|
|
|