Slot Machine ~Another Batch Game

3,871

10

5

Posted in TechnologyComputers

Introduction: Slot Machine ~Another Batch Game

About: I enjoy anything to do with computers. I have made some interesting scripts, and I am constantly improving my skill set. One day I hope to become a programmer, although in what category is still a mystery (...

Hello everyone, I have refrained from making any more instructables for the past couple of days, but now I'm making another one.

This one is featuring my newly concocted game, "Slot Machine".

Hopefully, the name is self-explanatory, and I have no need to explain the mechanics to you, but I must and I will.

Basically, it's a gambling type game with a poker machine. It works exactly like a slot machine, with three different difficulties. Try to win by gaining money, don't lose. Have fun!

If those instructions sounded mumbled and ill thought out, there is a help section in-game.

RELEASE THE CODE:

Step 1: Code

@echo off
setlocal enableextensions enabledelayedexpansion
color e0
title Slot Machine

:Intro
cls
echo Hello and welcome to Slot Machine by Prof. Pickle.
echo.
echo 1) Play
echo 2) Instructions
echo 3) Exit
choice /c 123 /n
if %errorlevel% equ 1 goto diff
if %errorlevel% equ 2 goto help
if %errorlevel% equ 3 goto exit

:help
cls
echo INSTRUCTIONS:
echo.
echo The aim of "Slot Machine" is to gain as much money as possible.
echo.
echo You do this by trying your luck with a slot machine.
echo If you get a combination of three or more, you gain money.
echo.
echo.
echo How much money you gain is dictated by your difficulty level (easy, medium
echo or hard).
echo.
echo To win, you need to reach a cash limit, once again, this is dependent on
echo your difficulty.
echo.
echo.
echo If you reach $0 then you lose, and can either start again or quit.
echo.
echo.
echo.
echo Press any key to go back
pause >nul
goto Intro

:diff
cls
echo Choose your difficulty
echo.
echo 1) Easy
echo 2) Medium
echo 3) Hard
choice /c 123 /n
if %errorlevel% equ 1 goto easy
if %errorlevel% equ 2 goto med
if %errorlevel% equ 3 goto hard

:easy
cls
set round=0
set diff=1
set num1=2
set num2=1
set money=500
goto Play
:med
cls
set round=0
set diff=2
set num1=4
set num2=1
set money=300
goto play
:hard
cls
set round=0
set diff=3
set num1=6
set num2=1
set money=200
goto play

:Play
set /a round=%round%+1
cls
echo Money: %money%
echo.
if %round% equ 1 if %diff% equ 1 echo        
if %round% equ 1 if %diff% equ 2 echo            
if %round% equ 1 if %diff% equ 3 echo                
if %round% gtr 1 if %diff% equ 1 echo    %char1%  %char2%  %char3%
if %round% gtr 1 if %diff% equ 2 echo    %char1%  %char2%  %char3%  %char4%  %char5%
if %round% gtr 1 if %diff% equ 3 echo    %char1%  %char2%  %char3%  %char4%  %char5%  %char6%  %char7%
echo.
if %round% gtr 1 echo   %msg%
if %round% gtr 1 echo   Money %factor% by %amount%
echo.
echo.
if %round% equ 1 echo Press any key to start spinning
if %round% gtr 1 echo Press any key to go again
pause >nul
goto spin

:spin
set count=0
set char1=
set char2=
set char3=
set char4=
set char5=
set char6=
set char7=
set char8=
set char9=
set char10=
goto spin%diff%
:spin1
set /a slot=%random% %% %num1% + %num2%
set /a count=%count%+1
if %slot% equ 1 set char%count%=
if %slot% equ 2 set char%count%=
if %slot% equ 3 set char%count%=
if %count% equ 3 goto check%diff%
goto spin1
:spin2
set /a slot=%random% %% %num1% + %num2%
set /a count=%count%+1
if %slot% equ 1 set char%count%=
if %slot% equ 2 set char%count%=
if %slot% equ 3 set char%count%=
if %slot% equ 4 set char%count%=
if %slot% equ 5 set char%count%=
if %count% equ 5 goto check%diff%
goto spin2
:spin3
set /a slot=%random% %% %num1% + %num2%
set /a count=%count%+1
if %slot% equ 1 set char%count%=
if %slot% equ 2 set char%count%=
if %slot% equ 3 set char%count%=
if %slot% equ 4 set char%count%=
if %slot% equ 5 set char%count%=
if %slot% equ 6 set char%count%=
if %slot% equ 7 set char%count%=
if %count% equ 7 goto check%diff%
goto spin3
:check1
set win=0
if %char1% equ %char2% if %char2% equ %char3% (
set factor=increased
set msg=WIN!
set amount=$100
set /a money=%money%+100
set win=1
)
if %win% equ 0 (
set factor=decreased
set msg=LOSE!
set amount=10
set /a money=%money%-10
)
if %money% geq 5000 goto win
if %money% leq 0 goto lose
goto play
:check2
set win=0
if %char1% equ %char2% if %char2% equ %char3% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% (
set factor=increased
set msg=WIN!
set amount=$75
set /a money=%money%+75
set win=1
goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$75
set /a money=%money%+75
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$100
set /a money=%money%+100
set win=1
goto check3n
)
:check3n
if %win% equ 0 (
set factor=decreased
set msg=LOSE!
set amount=20
set /a money=%money%-20
)
if %money% geq 1000 goto win
if %money% leq 0 goto lose
goto play
:check3
set win=0
if %char1% equ %char2% if %char2% equ %char3% (
set factor=increased
set msg=WIN!
set amount=$25
set /a money=%money%+25
set win=1goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% (
set factor=increased
set msg=WIN!
set amount=$25
set /a money=%money%+25
set win=1
goto check3n
)
if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$25
set /a money=%money%+25
set win=1
goto check3n
)
if %char4% equ %char5% if %char5% equ %char6% (
set factor=increased
set msg=WIN!
set amount=$25
set /a money=%money%+25
set win=1
goto check3n
)
if %char5% equ %char6% if %char6% equ %char7% (
set factor=increased
set msg=WIN!
set amount=$25
set /a money=%money%+25
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char4% equ %char5% if %char5% equ %char6% if %char6% equ %char7% (
set factor=increased
set msg=WIN!
set amount=$50
set /a money=%money%+50
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% (
set factor=increased
set msg=WIN!
set amount=$75
set /a money=%money%+75
set win=1
goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% (
set factor=increased
set msg=WIN!
set amount=$75
set /a money=%money%+75
set win=1
goto check3n
)
if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% if %char6% equ %char7% (
set factor=increased
set msg=WIN!
set amount=$75
set /a money=%money%+75
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% (
set factor=increased
set msg=WIN!
set amount=$100
set /a money=%money%+100
set win=1
goto check3n
)
if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% if %char6% equ %char7% (
set factor=increased
set msg=WIN!
set amount=$100
set /a money=%money%+100
set win=1
goto check3n
)
if %char1% equ %char2% if %char2% equ %char3% if %char3% equ %char4% if %char4% equ %char5% if %char5% equ %char6% if %char6% equ %char7% (
set factor=increased
set msg=WIN!
set amount=$200
set /a money=%money%+200
set win=1
goto check3n
)
:check3n
if %win% equ 0 (
set factor=decreased
set msg=LOSE!
set amount=20
set /a money=%money%-20
)
if %money% geq 500 goto win
if %money% leq 0 goto lose
goto play

:win
cls
echo Congratulations!
echo.
echo You won!
echo.
echo It took you %round% rounds to acheive a total of $%money%.
echo.
echo Do you want to play again? (Y/N)
choice /c yn /n
if %errorlevel% equ 1 goto diff
exit

:lose
cls
echo You lost!
echo.
echo You only survived %round% rounds.
echo.
echo Hint: Try playing on an easier difficulty.
echo.
echo Do you want to play again? (Y/N)
choice /c yn /n
if %errorlevel% equ 1 goto diff
exit

:exit
cls
echo Going so soon? (Y/N)
choice /c yn /n
if %errorlevel% equ 1 exit
goto Intro

Step 2: Note From the Author

So, what now? Well, I've made heaps of batch files over the period of time where my internet connection was cut.

Eventually, all the decent ones will be published, but I'm taking it slow so that they don't run out.

I have some semi-exciting news:
I am working on an empire game (like Caesary or Ebony, but single-player) called Batch Villa.
Now, I have good and bad news...

Good:
It's going to be like a proper game, with soo many features and awesome stuff.

Bad:
I'm probably going to stop working on it out of boredom, lack of effort, frustration or some other reason. That is why I am asking for somebody to help me make this. To share the load, if you will. It would help me a tonne, and make sure this game gets finished.

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Woodworking Contest

      Woodworking Contest
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    5 Comments

    Hey professor, what's wrong with my code?

    @echo off

    :load
    echo loading \
    cls
    echo loading !
    cls
    echo loading /
    cls
    FOR /L %%G IN (1,1,1,5) DO call :load
    pause

    Good instructable!
    Your every instructable is very inspiring and new to me...
    Keep it up! and best wishes for your new instructables...

    1 reply

    Thank you again kind sir. I strive to be original. Although I have more games and the like that I am still withholding, is there anything you'd like to see made (I assume you know my abilities)?