
-----------------------------------
asdfasdf123
Wed Dec 17, 2014 11:48 am

Need help with slot machine
-----------------------------------
What is it you are trying to achieve?
I'm trying to make a slot machine for a school project.


What is the problem you are having?
I can't make all 3 reels on the slot machine spin at once.


Describe what you have tried to solve this problem
I've checked other forum threads, but I didn't find any answers.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




var left, middle, right, left2, middle2, right2 : int
                % The above variables determine the shapes and help determine the prize
                for i : 1 .. 10
                    left := Rand.Int (1, 100)
                    middle := Rand.Int (1, 100)
                    right := Rand.Int (1, 100)
                    if i not= 10 then
                        % Left reel
                        if left < 50 then
                            include "BarLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "BarLeftMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "BarLeftBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                        elsif left < 80 then
                            include "LemonLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "LemonLeftMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "LemonLeftBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                        elsif left < 99 then
                            include "PlumLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "PlumLeftMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "PlumLeftBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                        elsif left = 100 then
                            include "CherryLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "CherryLeftMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "CherryLeftBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                        end if
                        % Middle reel
                        if middle < 50 then
                            include "LemonMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "LemonMiddleMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "LemonMiddleBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                        elsif middle < 80 then
                            include "PlumMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "PlumMiddleMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "PlumMiddleBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                        elsif middle < 99 then
                            include "BarMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "BarMiddleMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "BarMiddleBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                        elsif middle = 100 then
                            include "CherryMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "CherryMiddleMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "CherryMiddleBottom.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                        end if
                        % Right reel
                        if right < 50 then
                            include "PlumRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "PlumRightMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "PlumRightBottom.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                        elsif right < 80 then
                            include "BarRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "BarRightMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "BarRightBottom.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                        elsif right < 99 then
                            include "LemonRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "LemonRightMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "LemonRightBottom.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                        elsif right = 100 then
                            include "CherryRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "CherryRightMiddle.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "CherryRightBottom.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                        end if
                        % When the machine stops spinning
                    elsif i = 10 then
                        % Left reel
                        if left < 50 then
                            left2 := 50
                            include "BarLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "BarLeftMiddle.t"
                        elsif left < 80 then
                            left2 := 80
                            include "LemonLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "LemonLeftMiddle.t"
                        elsif left < 99 then
                            left2 := 99
                            include "PlumLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "PlumLeftMiddle.t"
                        elsif left = 100 then
                            left2 := 100
                            include "CherryLeftTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 150, CENTREY - 70, CENTREX - 60, CENTREY + 70, white)
                            include "CherryLeftMiddle.t"
                        end if
                        % Middle reel
                        if middle < 50 then
                            middle2 := 80
                            include "LemonMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "LemonMiddleMiddle.t"
                        elsif middle < 80 then
                            middle2 := 99
                            include "PlumMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "PlumMiddleMiddle.t"
                        elsif middle < 99 then
                            middle2 := 50
                            include "BarMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "BarMiddleMiddle.t"
                        elsif middle = 100 then
                            middle2 := 100
                            include "CherryMiddleTop.t"
                            delay (50)
                            drawfillbox (CENTREX - 40, CENTREY - 70, CENTREX + 40, CENTREY + 70, white)
                            include "CherryMiddleMiddle.t"
                        end if
                        % Right reel
                        if right < 50 then
                            right2 := 99
                            include "PlumRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "PlumRightMiddle.t"
                        elsif right < 80 then
                            right2 := 50
                            include "BarRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "BarRightMiddle.t"
                        elsif right < 99 then
                            right2 := 80
                            include "LemonRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "LemonRightMiddle.t"
                        elsif right = 100 then
                            right2 := 100
                            include "CherryRightTop.t"
                            delay (50)
                            drawfillbox (CENTREX + 60, CENTREY - 70, CENTREX + 150, CENTREY + 70, white)
                            include "CherryRightMiddle.t"
                        end if
                    end if
                end for


The code runs properly, but I just don't know how to make it simultaneously display all 3 images.


Please specify what version of Turing you are using
4.1 1.0.1
