Slot Machine
GameBoy
22 Feb 2005, 10:44It's not fully completed, but it can be worked on if you want to. The only problem, is that it's very easy to win. There's probably an easier and better way to script what i've done, but you're welcome to work on it.

' "Slot Machine"
define game <Slot Machine>
asl-version <350>
gametype singleplayer
start <Casino>
game author <Ste Edwards>
game version <1.0>
game copyright <© 2005 Ste Edwards.>
startscript {
msg <|bWelcome to Slot Machine.|xb|nType |cr/slotmachine play|cb to gamble.|nGood Luck!>
}
afterturn msg <|bYou have %credits% remaining credits.|xb>
define variable <credits>
type numeric
value <25>
display <Credits: !>
onchange if ( %credits% <= 0 ) then do <gameover>
end define
end define
define room <Casino>
prefix <the>
command </slotmachine play> {
dec <credits; 1>
set numeric <result1; $rand(1; 3)$>
set numeric <result2; $rand(1; 3)$>
set numeric <result3; $rand(1; 3)$>
if ( %result1% = 1 ) then set string <dice1; Orange> else {if ( %result1% = 2 ) then set string <dice1; Apple> else set string <dice1; Pear>}
if ( %result2% = 1 ) then set string <dice2; Orange> else {if ( %result2% = 2 ) then set string <dice2; Apple> else set string <dice2; Pear>}
if ( %result3% = 1 ) then set string <dice3; Orange> else {if ( %result3% = 2 ) then set string <dice3; Apple> else set string <dice3; Pear>}
if ( #dice1# = Orange ) and ( #dice2# = Orange ) and ( #dice3# = Orange ) then {
msg <|n|b|crYOU HAVE WON 5 CREDITS!|xb|cb>
inc <credits; 5>
}
else
msg <|b#dice1#, #dice2#, #dice3#|xb>
}
end define
define procedure <gameover>
playerlose
end define
define text <lose>
|b|crGAME OVER|cb|xb
end define
paul_one
22 Feb 2005, 12:52Personally - I prefer having this:
and:
I'd also change it so 3 of the same game credit's, but different amounts, instead of the 1 in 81 chance that you'll get 3 oranges ((1/3*1/3*1/3)*1/3).
But a nice begining I think.
startscript {
msg <|bWelcome to Slot Machine.|xb|nType |cr/slotmachine play|cb to gamble.|nGood Luck!>
set string <result[1]; Orange>
set string <result[2]; Apple>
set string <result[3]; Pear>
}
and:
command </slotmachine play> {
dec <credits>
set numeric <result.1; $rand(1; 3)$ >
set numeric <result.2; $rand(1; 3)$ >
set numeric <result.3; $rand(1; 3)$ >
set string <dice.1; #result[result.1]# >
set string <dice.2; #result[result.2]# >
set string <dice.3; #result[result.3]# >
if ( #dice1# = Orange ) and ( #dice2# = Orange ) and ( #dice3# = Orange ) then {
msg <|n|b|crYOU HAVE WON 5 CREDITS!|xb|cb>
inc <credits; 5>
}
else msg <|b#dice1#, #dice2#, #dice3#|xb>
}
I'd also change it so 3 of the same game credit's, but different amounts, instead of the 1 in 81 chance that you'll get 3 oranges ((1/3*1/3*1/3)*1/3).
But a nice begining I think.
GameBoy
22 Feb 2005, 16:08ahh, looks alot better lol. I have no idea why i've been around for so long and haven't bothered to actually learn it. Got so much going on in life that have to stop for ages then i forget most of what i've learnt.
paul_one
22 Feb 2005, 17:28No, it makes sense.
At first I'd have a select case (or switch in C++). But ASL doesn't have this so a large IF replaces it at first thought.
It's just I've been doing arrays and stuff recently, so that just simplifies it for me.
And I know what you mean, going back to VB after over a year of not touching it has done the same to me - and it requires some thought, and half-well documented old stuff you've done.
At first I'd have a select case (or switch in C++). But ASL doesn't have this so a large IF replaces it at first thought.
It's just I've been doing arrays and stuff recently, so that just simplifies it for me.
And I know what you mean, going back to VB after over a year of not touching it has done the same to me - and it requires some thought, and half-well documented old stuff you've done.

GameBoy
22 Feb 2005, 19:24yeah, i went back to some old VB code i'd done and since i didn't comment it i found it hard to work on lol.
GameBoy
27 Feb 2005, 12:28Anybody interested in this kinda thing? I was thinking about doing a simple Blackjack game too.
Shadowalker
27 Feb 2005, 12:56Hmmm...I made a type of slot-machine game too...I had fun making it, but I'm not sure how fun these games are to play. I'll post the code for mine later, if anybody is interested in trying it out.
GameBoy
01 Mar 2005, 01:23well they can be used in games, perhaps part of a quest or something
paul_one
02 Mar 2005, 08:14I'd say make it different in some way, rather than just using the slot-machine idea.
In Lufia 2, they had slot machines (and in 1 too) but I only played them once, and that was to get the best items there... While in the final fantasy series (7, 8, 9, 10) they had good card games, and in 7 they had that arcade thingy.
I just think that the slot machine get's boring after 5 minutes (especially without all the sparkly lights) - and I'm a gamble-holic!
In Lufia 2, they had slot machines (and in 1 too) but I only played them once, and that was to get the best items there... While in the final fantasy series (7, 8, 9, 10) they had good card games, and in 7 they had that arcade thingy.
I just think that the slot machine get's boring after 5 minutes (especially without all the sparkly lights) - and I'm a gamble-holic!
007bond
03 Mar 2005, 02:18If anyone's played Knights of the Old Republic (KOTOR), you'd know about the things like Pazaak (a card game), swoop bike racing, and many other side-quests. KOTOR is an RPG for those who are wondering, and it's only on Xbox
Elexxorine
03 Mar 2005, 13:18actually its on pc too....