Our support site has moved to https://support.intuiface.com

"Slot Machine" Sample


    This article will explain how to edit the different dynamic elements and values in the "Slot Machine" sample experience. It will not explain how to edit the overall design.


    How it works

    This sample uses rather complex logic and thus requires several interface assets to work. Here is a list of the interface assets used and their function:


    • Excel ("Result", "Slot Images"): Two spreadsheets are used. One lists the slot images, the other calculates a score value based on an Excel formula
    • Simple Counter ("Credit Counter"): Count the available credits
    • Simple Counter ("Gain Counter"): Count the gains won by the user
    • Global Variable ("Global Variable - Bet Amount"): Stores the bet value (1, 2 or 10)
    • Number Generator ("Number Generator - Slot Machine 1","Number Generator - Slot Machine 2","Number Generator - Slot Machine 3"): One for each of the three carousels in the slot machine
    • Three Value Comparison ("Comparison - Slot Machine"): Calculate if the three values selected by the three number generators are equal or not - i.e. if the user won or not

    By default, the bet amount is 1. Its corresponsing toggle button is set to "Checked" while the other two are unchecked. When a user presses another toggle button, like the x2 button, it will store this information in the Global Variable and update the “Result” Excel spreadsheet so that the "Multiplier" value is set to 2:


    When a user presses the lever, several actions are triggered:

    • Generate a value for each of the 3 number generators.
    • The three carousels then scroll to the index of the generated values. For each carousel, once the proper index is reached, a value is set for the Three Value Comparison interface asset.
    • The value of the bet is subtracted from the Credit Counter
    • Several animation actions occur
    • A hidden "Check Results" toggle button is set to "Checked".

    About the "Check Results" toggle button

    The "Check Results" toggle button uses conditional triggers to launch muliple processes.


    Two conditional triggers are used to check and react to the result:

    • If the result of the Three Value Comparison interface asset is “True” then the following is triggered:
      • Show the jackpot image
      • Apply brightness effects to that image to make it flash
      • Uncheck the toggle button for the next turn
      • Add the value of the gain calculated in the “Result” Excel spreadsheet to the Gain Counter.


    • If the result of the Three Value Comparison interface asset is "False" then the following is triggered
      • Display a “Spin Again” image
      • Uncheck the toggle button for the next turn


    Other conditional triggers on the "Check Results" button are used to calculate the amount the user would win. The user can win either 10, 30, 50 or 100 points, not including the multiplier. These conditionals update the "Result" spreadsheet whether or not the user gets three matching numbers. The two conditional triggers mentioned above determine whether to actually give winnings.


    For example, if "Value A" of the Three Value Comparison interface asset is 2 (the name of the image displayed a 7 is “2.png”), then update the cell value of the "Result" spreadsheet like so:


    We duplicate this trigger for each possible successful roll.


    Customizing the sample with your own values

    Modifying the slot machine images

    As explained above, the images are identified in an Excel spreadsheet. To change the images, open the folder containing the images by right-clicking on the “Slot Images” Excel interface asset and click “Open file location”.


    Then open the "Images" folder and add your own images. If you use the names of the images already in the "Images" folder then the project will update by itself. If you want to use different image names or a different number of images then you need to edit the Excel spreadsheet so it uses the new names.

    Currently, the Excel spreadsheet contains 30 different rows because there are 30 items in the carousel; however, you can modify this count to as many you wish. If you do this you will need to update the maximum values of the 3 Number Generator interface assets:


    Modifying the winning values

    In this sample the winning values are 10,30,50 and 100 points but you can choose to put whatever values you wish. The value for each spin is determined after the “Check Results" toggle button is checked. The 4 triggers encircled are the ones that you will need to modify:


    When you select one of these triggers you will see this:


    Replace the value in the conditions to your image name.

    And then replace to the new value you want to enter. Do this for as many different values as you have.


    Modifying credit values

    By default, a user will start with 50 credits in this sample. Let’s say you want to change this to 100. Select the “Credit Counter” in the Interface Assets panel and view its properties. Change the "Initial value" property from 50 to 100.