Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old November 19th, 2010 (9:31 PM). Edited November 30th, 2010 by KitsuneKouta.
KitsuneKouta's Avatar
KitsuneKouta KitsuneKouta is offline
狐 康太
     
    Join Date: Mar 2010
    Age: 26
    Gender: Male
    Posts: 441
    This slot machine script is modeled after the RSE version. You can alter it without too much trouble into whatever other version you want. All features found in the RSE slot machines are included in this script, except for the Reel Time feature. It has been started, but I'll get to that momentarily.

    To put this script into your game, simply paste this into a new script section:
    Code:
    ###################################################################
    # The one-armed bandit for the Casino ©Nintendo (Made by Itachihro)
    # Translated and improved by KitsuneKouta
    ###################################################################
    class Scene_Slots
      def initialize(usedcoins=0,slot1=nil,slot2=nil,slot3=nil,bolts=-1)
            
        #Initialization of the game
        
        @content1=slot1#Content of @Slot1
        @content2=slot2#Content of @Slot2
        @content3=slot3#Content of @Slot3
        @usedcoins=usedcoins
        
        #Initialization of variables
        
        @FrameCount=0
        @GameActive=false
        @RedSevenWin=[1,1,1]
        @BlueSevenWin=[2,2,2]
        @LotadWin=[5,5,5]
        @AzurillWin=[4,4,4]
        @PikachuWin=[7,7,7]
        @ReplayWin=[3,3,3]
        @PokeballWin=[6,6]
        @BigPokeballWin=[6,6,6]
        @SmallRedBonus=[1,1,2]
        @SmallBlueBonus=[2,2,1]
        @Payout=0
        @fastPayout=false
        @WinAnimationOver=false
        @bolts=bolts
        @ReelTime=false
        @ReelCount=0
        @time=0
        @Line1Flash=false
        @Line2aFlash=false
        @Line2bFlash=false
        @Line3aFlash=false
        @Line3bFlash=false
            
        #Graphics are defined here
        
        #Insert (thrown coins=0)
        
        @Insert_01=RPG::Cache.picture("Insert 1")
        @Insert_02=RPG::Cache.picture("Insert 2")
        
        #Insert (thrown coins=1-3)
        
        @Insert_03=RPG::Cache.picture("Insert 3")
        @Insert_04=RPG::Cache.picture("Insert 4")
        @Insert_05=RPG::Cache.picture("Insert 5")
        @Insert_06=RPG::Cache.picture("Insert 6")
        
        #Reel Time
        
        @ReelTime_0=RPG::Cache.picture("Reel Time 0")
        @ReelTime_1=RPG::Cache.picture("Reel Time 1")
        @ReelTime_2=RPG::Cache.picture("Reel Time 2")
        @ReelTime_3=RPG::Cache.picture("Reel Time 3")
        @ReelTime_4=RPG::Cache.picture("Reel Time 4")
        @ReelTime_5=RPG::Cache.picture("Reel Time 5")
        
        #Stop 
        
        @Stop_01=RPG::Cache.picture("Stop 1")
        @Stop_02=RPG::Cache.picture("Stop 2")
        @Stop_03=RPG::Cache.picture("Stop 3")
        @Stop_04=RPG::Cache.picture("Stop 4")
        @Stop_05=RPG::Cache.picture("Stop 5")
        @Stop_06=RPG::Cache.picture("Stop 6")
        
        #Win
        
        @Win_01=RPG::Cache.picture("Win 1")
        @Win_02=RPG::Cache.picture("Win 2")
        @Win_03=RPG::Cache.picture("Win 3")
        @Win_04=RPG::Cache.picture("Win 4")
        
        #Big Bonus
        
        @Big_B_01=RPG::Cache.picture("Big Bonus 1")
        @Big_B_02=RPG::Cache.picture("Big Bonus 2")
        @Big_B_03=RPG::Cache.picture("Big Bonus 3")
        @Big_B_04=RPG::Cache.picture("Big Bonus 4")
        
        #Reg Bonus
        
        @Reg_B_01=RPG::Cache.picture("Bonus 1")
        @Reg_B_02=RPG::Cache.picture("Bonus 2")
        @Reg_B_03=RPG::Cache.picture("Bonus 3")
        @Reg_B_04=RPG::Cache.picture("Bonus 4")
        
        #Flashing lights on win
        
        @Win_Light1=RPG::Cache.picture("Win Out")
        @Win_Light2=RPG::Cache.picture("Win Middle")
        @Win_Light3=RPG::Cache.picture("Win In")
        
        #Lose
        
        @Lose_01=RPG::Cache.picture("Lose 1")
        @Lose_02=RPG::Cache.picture("Lose 2")
        
        #Lighting Bolt
        
        @LBolt=RPG::Cache.picture("Bolt")
        
        #Background
        
        @BackgroundIMG=RPG::Cache.picture("Slots Layout")
        
        #Highlighted lines
        
        @Light_1=RPG::Cache.picture("Line 1")
        @Light_2_1=RPG::Cache.picture("Line 2")
        @Light_2_2=RPG::Cache.picture("Line 2")
        @Light_3_1=RPG::Cache.picture("Line 3-1")
        @Light_3_2=RPG::Cache.picture("Line 3-2")
        
        #Buttons
        
        @PushButton1=RPG::Cache.picture("Button Pressed")
        @PushButton2=RPG::Cache.picture("Button Pressed")
        @PushButton3=RPG::Cache.picture("Button Pressed")
        
        #Numbers
        
        @Credit0=RPG::Cache.picture("0")
        @Credit1=RPG::Cache.picture("1")
        @Credit2=RPG::Cache.picture("2")
        @Credit3=RPG::Cache.picture("3")
        @Credit4=RPG::Cache.picture("4")
        @Credit5=RPG::Cache.picture("5")
        @Credit6=RPG::Cache.picture("6")
        @Credit7=RPG::Cache.picture("7")
        @Credit8=RPG::Cache.picture("8")
        @Credit9=RPG::Cache.picture("9")
        
        #Array for the number images
        
        @Credit_Numbers=[@Credit0,@Credit1,@Credit2,@Credit3,@Credit4,@Credit5,@Credit6,
                         @Credit7,@Credit8,@Credit9]
                         
      end
      
      def main
        #============================ 
        #Creation of the sprites
        #==========================
        
        #Background
        
        @Background=Sprite.new
        @[email protected]
        
        #Black window on the right
        
        @SupportWindow=Sprite.new
        @[email protected]_01
        
        #Used for flashing lights
        
        @SupportWindow2=Sprite.new
    
        #Credit field
        
        @Creditfield1=Sprite.new
        @Creditfield1.x=358
        @Creditfield1.y=36
        @Creditfield2=Sprite.new
        @Creditfield2.x=372
        @Creditfield2.y=36
        @Creditfield3=Sprite.new
        @Creditfield3.x=386
        @Creditfield3.y=36
        @Creditfield4=Sprite.new
        @Creditfield4.x=400
        @Creditfield4.y=36
        
        #Payout field
        
        @Payoutfield1=Sprite.new
        @Payoutfield1.x=422
        @Payoutfield1.y=36
        @Payoutfield2=Sprite.new
        @Payoutfield2.x=436
        @Payoutfield2.y=36
        @Payoutfield3=Sprite.new
        @Payoutfield3.x=450
        @Payoutfield3.y=36
        @Payoutfield4=Sprite.new
        @Payoutfield4.x=464
        @Payoutfield4.y=36
        
        #Buttons
        
        @Button1=Sprite.new
        @Button1.x=84
        @Button1.y=246
        @Button2=Sprite.new
        @Button2.x=164
        @Button2.y=246
        @Button3=Sprite.new
        @Button3.x=244
        @Button3.y=246
                
        #Slots
        
        if @content1!=nil
          @Slot1=Slot.new(62,@content1[0],@content1[1],@content1[2])
        else
          @Slot1=Slot.new(62)
        end
        if @content2!=nil 
          @Slot2=Slot.new(142,@content2[0],@content2[1],@content2[2])
        else
        @Slot2=Slot.new(142)
        end
        if @content3!=nil
        @Slot3=Slot.new(222,@content3[0],@content3[1],@content3[2])
        else
        @Slot3=Slot.new(222)
      end
      
        #Highlighted lines created
        
        @Light=Sprite.new
        @Light2=Sprite.new
        @Light3=Sprite.new
        @Light4=Sprite.new
        @Light5=Sprite.new
        #Transition
        Graphics.transition
        
        #Updates lightning bolt graphics
        boltGraphics
        
        #Start Main Loop    
        loop do
        Graphics.update
        Input.update
        update
        #Loopbreak at scene change
        if $scene!=self
          break
        end
      end
        
      #Graphics freeze, delete objects
      Graphics.freeze
      @SupportWindow.dispose
      @SupportWindow2.dispose
      @Background.dispose
      @Creditfield1.dispose
      @Creditfield2.dispose
      @Creditfield3.dispose
      @Creditfield4.dispose
      @Payoutfield1.dispose
      @Payoutfield2.dispose
      @Payoutfield3.dispose
      @Payoutfield4.dispose
      @Slot1.dispose
      @Slot2.dispose
      @Slot3.dispose
      @Button1.dispose
      @Button2.dispose
      @Button3.dispose
      @Light.dispose
      @Light2.dispose
      @Light3.dispose
      @Light4.dispose
      @Light5.dispose
    end
    
    #============================================================
    #More or less everything worked, processed, and analyzed
    #============================================================
    def update
      @[email protected]+1
      if !(@GameActive)
        @evaluated=false
      end
    
    def coinCheck
      if $PokemonGlobal.coins<9999
        $PokemonGlobal.coins=$PokemonGlobal.coins+1
      elsif $PokemonGlobal.coins>=9999
        $PokemonGlobal.coins=9999
        @Payout=0
      end
    end
    
    if (@Payout==0)&&!(@Replay)&&!(@GameActive)&&($PokemonGlobal.coins==0)#&&!(@ReelTime)
      Kernel.pbMessage("You've run out of COINS.\nGame over!")
      $scene=Scene_Map.new
    end
        
      #=====================================================================
      #Handler for finished game (Win or Lose) 
      #Support Window and Coins
      #=====================================================================
      if (@GameActive) &&!(@Slot3.active)
        if !(@evaluated)
          self.evaluate
        end
        if @Win
          case @FrameCount
          when 4
            lineErase
            @[email protected]_Light1
            if @BigBonus
              @[email protected]_B_01
            elsif @RegBonus
              @[email protected]_B_01
            else
              @[email protected]_01
            end
          when 8
            lineFlash
            @[email protected]_Light2
            if @BigBonus
              @[email protected]_B_02
            elsif @RegBonus
              @[email protected]_B_02
            else
              @[email protected]_02
            end
          when 12
            lineErase
            @[email protected]_Light3
            if @BigBonus
              @[email protected]_B_03
            elsif @RegBonus
              @[email protected]_B_03
            else
              @[email protected]_03
            end
          when 16
            lineFlash
            @[email protected]_Light2
            if @BigBonus
              @[email protected]_B_04
            elsif @RegBonus
              @[email protected]_B_04
            else
              @[email protected]_04
            end
          when 20
            lineErase
            @[email protected]_Light1
            if @BigBonus
              @[email protected]_B_01
            elsif @RegBonus
              @[email protected]_B_01
            else
              @[email protected]_01
            end
          when 24
            lineFlash
            @[email protected]_Light2
            if @BigBonus
              @[email protected]_B_02
            elsif @RegBonus
              @[email protected]_B_02
            else
              @[email protected]_02
            end
          when 28
            lineErase
            @[email protected]_Light3
            if @BigBonus
              @[email protected]_B_03
            elsif @RegBonus
              @[email protected]_B_03
            else
              @[email protected]_03
            end
          when 32
            lineFlash
            @[email protected]_Light2
            if @BigBonus
              @[email protected]_B_04
            elsif @RegBonus
              @[email protected]_B_04
            else
              @[email protected]_04
            end
            @FrameCount=0
            @WinAnimationOver=true
          end
         
          def lineFlash
            if @Line1Flash
              @[email protected]_1
            end
            if @Line2aFlash
              @[email protected]_2_1
            end
            if @Line2bFlash
              @[email protected]_2_2
            end
            if @Line3aFlash
              @[email protected]_3_1
            end
            if @Line3bFlash
              @[email protected]_3_2
            end
          end
          
          def lineErase
            @Light.bitmap=nil
            @Light2.bitmap=nil
            @Light3.bitmap=nil
            @Light4.bitmap=nil
            @Light5.bitmap=nil
          end
          
          if ((@FrameCount%1)==0)&&@fastPayout&&@WinAnimationOver&&(@Payout>0)
            @[email protected]
            coinCheck
          elsif ((@FrameCount%2)==0)&&@WinAnimationOver&&(@Payout>0)
            @[email protected]
            coinCheck
          end
          
          if (Input.trigger?(Input::C))&&@Payout>0
            @fastPayout=true
          end
          
          if (@Payout==0)&&!(@Replay)#&&!(@ReelTime)
            if $PokemonGlobal.coins==9999
              Kernel.pbMessage("You've got 9,999 COINS.")
            elsif $PokemonGlobal.coins==0
              Kernel.pbMessage("You've run out of COINS./nGame over!")
            end
            @GameActive=false
            @FrameCount=0
            @Line2_Active=false
            @Line3_Active=false
            @Light.bitmap=nil
            @Light2.bitmap=nil
            @Light3.bitmap=nil
            @Light4.bitmap=nil
            @Light5.bitmap=nil
            @SupportWindow2.bitmap=nil
            @BigBonus=false
            @RegBonus=false
            @fastPayout=false
            @WinAnimationOver=false
            @Line1Flash=false
            @Line2aFlash=false
            @Line2bFlash=false
            @Line3aFlash=false
            @Line3bFlash=false
          end
          
          if (@Payout==0)&&(@Replay)#&&!(@ReelTime)
            @Slot1.active=true
            @Slot2.active=true
            @Slot3.active=true
            @Replay=false
            @SupportWindow2.bitmap=nil
            @FrameCount=0
            @BigBonus=false
            @RegBonus=false
            @fastPayout=false
            @WinAnimationOver=false
            @Line1Flash=false
            @Line2aFlash=false
            @Line2bFlash=false
            @Line3aFlash=false
            @Line3bFlash=false
          end
          
          if (@Payout==0)&&(@WinAnimationOver)#&&(@ReelCount>0)
            @Slot1.active=true
            @Slot2.active=true
            @Slot3.active=true
            #@ReelCount-=1
            @SupportWindow2.bitmap=nil
            @FrameCount=0
            @BigBonus=false
            @RegBonus=false
            @fastPayout=false
            @WinAnimationOver=false
            @Line1Flash=false
            @Line2aFlash=false
            @Line2bFlash=false
            @Line3aFlash=false
            @Line3bFlash=false
            #if @ReelCount==0
            #  @bolts=-1
            #end
          end
          
        else
          case @FrameCount
          when 10
            @[email protected]_02
          when 20
            @[email protected]_01
          when 30
            @[email protected]_02
          when 40
            @[email protected]_01
            @FrameCount=0
            @GameActive=false
            @Line2_Active=false
            @Line3_Active=false
            @Light.bitmap=nil
            @Light2.bitmap=nil
            @Light3.bitmap=nil
            @Light4.bitmap=nil
            @Light5.bitmap=nil
          end
        end
      end
    #================================================  
    #Input Processes
    #===============================================
    @content1=[@Slot1.TopVal,@Slot1.MidVal,@Slot1.DownVal]
    @content2=[@Slot2.TopVal,@Slot2.MidVal,@Slot2.DownVal]
    @content3=[@Slot3.TopVal,@Slot3.MidVal,@Slot3.DownVal]
    if (Input.trigger?(Input::C))&&(@GameActive)
      if @Slot1.active
        pbSEPlay("SlotsStop")
        @[email protected]
        @Slot1.active=false
      elsif @Slot2.active
        pbSEPlay("SlotsStop")
        @[email protected]
        @Slot2.active=false
      elsif @Slot3.active
        pbSEPlay("SlotsStop")
        @[email protected]
        @Slot3.active=false
      end
    end
    
    if @GameActive
      @time+=1
      if [email protected]
        if @time>=10
          @Button3.bitmap=nil
          @Button2.bitmap=nil
          @Button1.bitmap=nil
          @time=0
        end
      elsif [email protected]
        if @time>=10
          @Button3.bitmap=nil
          @Button2.bitmap=nil
          @Button1.bitmap=nil
          @time=0
        end
      else
        if @time>=10
          @Button3.bitmap=nil
          @Button2.bitmap=nil
          @Button1.bitmap=nil
          @time=0
        end
      end
    end
    
    if (Input.trigger?(Input::CTRL))&&(@usedcoins<1)&&!(@GameActive)&&(@Payout==0)
        $scene=Scene_Slots_Help.new(@usedcoins,@content1,@content2,@content3,@bolts)
      end
      
      if (Input.trigger?(Input::DOWN))&&!(@GameActive)&&$PokemonGlobal.coins>0
        pbSEPlay("SlotsSelect")
        @[email protected]+1
        $PokemonGlobal.coins=$PokemonGlobal.coins-1
        if @usedcoins==1
          @[email protected]_1
          @Light.y=138
          @Light.x=2
        end
        if @usedcoins==2
          @Line2_Active=true
          @[email protected]_1
          @Light.y=138
          @Light.x=2
          @[email protected]_2_1
          @Light2.y=90
          @Light2.x=2
          @[email protected]_2_2
          @Light3.y=186
          @Light3.x=2
        end
        if @usedcoins==3
          @[email protected]_1
          @Light.y=138
          @Light.x=2
          @[email protected]_2_1
          @Light2.y=90
          @Light2.x=2
          @[email protected]_2_2
          @Light3.y=186
          @Light3.x=2
          @[email protected]_3_1
          @Light4.y=50
          @Light4.x=2
          @[email protected]_3_2
          @Light5.y=50
          @Light5.x=2
          @Line3_Active=true
          @GameActive=true
          @Slot1.active=true
          @Slot2.active=true
          @Slot3.active=true
          @FrameCount=0
        end
        #rnd=rand(20)
        #if rnd==1
        #  @ReelTime=true
        #  rnd2=rand(5)
        #end
        #@ReelCount=rnd2#left off
        #if @ReelCount==0
        #  @ReelTime=false
        #else
        #  @ReelTime=true
        #end
      end
      
      if (Input.trigger?(Input::B))&&!(@GameActive)
        if Kernel.pbConfirmMessage("Quit the game?")
          [email protected]
          @bolts=-1
          boltGraphics
          $scene=Scene_Map.new
        end
      end
      
      if (Input.trigger?(Input::C))&&!(@GameActive)&&(@usedcoins>0)
        @GameActive=true
        @Slot1.active=true
        @Slot2.active=true
        @Slot3.active=true
        @FrameCount=0
      end
    
    #=================================================
    #@SupportWindow update
    #=================================================
    # Case: No coins thrown
      if @usedcoins==0&&!(@GameActive)
       if @FrameCount==16
        @[email protected]_01
       end
      if @FrameCount==32
        @[email protected]_02
        @FrameCount=0
      end  
    end
    
    # One or more coins thrown (and the game is not yet active)
     if (@usedcoins > 0) && !(@GameActive)
       case @FrameCount
       when 16
         @[email protected]_03
       when 24
         @[email protected]_04
       when 32
         @[email protected]_05
       when 40
         @[email protected]_06
         @FrameCount=0
       end
     end
    
    # Game running and Reel Time active
    
      if (@GameActive)&&(@ReelTime)
       Graphics.update
       case @FrameCount
       when 40
         @[email protected]_0
       when 80
         @[email protected]_5
       when 120
         @[email protected]_4
       when 160
         @[email protected]_3
       when 200
         @[email protected]_2
       when 240
         @[email protected]_1
         @ReelTime=false
         @bolts= -1
         @FrameCount=0
         boltGraphics
       end
     end
    
    
    # Game running
     if (@GameActive)&&(@Slot3.active)#&&!(@ReelTime)
       case @FrameCount
       when 8
         @[email protected]_01
       when 16
         @[email protected]_02
       when 24
         @[email protected]_03
       when 32
         @[email protected]_02
       when 40
         @[email protected]_04
       when 48
         @[email protected]_05
       when 56
         @[email protected]_06
       when 64
         @[email protected]_05
         @FrameCount=0
       end
     end
    
    #==================================================
    #Credit update
    #==================================================
    @[email protected]_Numbers[$PokemonGlobal.coins/1000]
    @[email protected]_Numbers[($PokemonGlobal.coins%1000)/100]
    @[email protected]_Numbers[(($PokemonGlobal.coins%1000)%100)/10]
    @[email protected]_Numbers[(($PokemonGlobal.coins%1000)%100)%10]
    #==========================================================
    #Payout update
    #==========================================================
    @[email protected]_Numbers[@Payout/1000]
    @[email protected]_Numbers[(@Payout%1000)/100]
    @[email protected]_Numbers[((@Payout%1000)%100)/10]
    @[email protected]_Numbers[((@Payout%1000)%100)%10]
    #=================================================
    #Slots run
    #=================================================
    if @GameActive&&(@FrameCount%2)==0
    if @Slot1.active
      @Slot1.run
    end#of if
    if @Slot2.active
      @Slot2.run
    end#of if
    if @Slot3.active
      @Slot3.run
    end#of if
    end#of if @GameActive
    end#of Method
    
    #=================================
    #Payout Check and Pikachu Bonus
    #=================================
    def boost
      if @bolts<15
        @bolts+=1
      end
      boltGraphics
    end
    
    def boltGraphics
      @sprites={}
      @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height)
      x=48
      [email protected]["overlay"].bitmap
      overlay.clear
      boltPositions=[]
        for i in 0...16
          if @bolts>=i
            boltPositions[boltPositions.length]=[
              "Graphics/Pictures/bolts",x,34,i*16,0,16,16]
          end
          x+=16
        end
        pbDrawImagePositions(overlay,boltPositions)
        Graphics.update
    end
    
    def evaluate
      boltGraphics
      @evaluated=true
      @FrameCount=0
      @Payout=0
      @Line1=[@Slot1.MidVal,@Slot2.MidVal,@Slot3.MidVal]
      @Line2a=[@Slot1.TopVal,@Slot2.TopVal,@Slot3.TopVal]
      @Line2b=[@Slot1.DownVal,@Slot2.DownVal,@Slot3.DownVal]
      @Line3a=[@Slot1.TopVal,@Slot2.MidVal,@Slot3.DownVal]
      @Line3b=[@Slot1.DownVal,@Slot2.MidVal,@Slot3.TopVal]
      @usedcoins=0
      #Payout Check Line 1
      @Replay=false
      case @Line1
      when @RedSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line1Flash=true
      when @BlueSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line1Flash=true
      when @SmallRedBonus
        @[email protected]+90
        @RegBonus=true
        @Line1Flash=true
      when @SmallBlueBonus
        @[email protected]+90
        @RegBonus=true
        @Line1Flash=true
      when @BigPokeballWin
        @[email protected]+4
        @Line1Flash=true
      when @AzurillWin
        @[email protected]+12
        @Line1Flash=true
      when @PikachuWin
        @[email protected]+3
        boost
        @Line1Flash=true
      when @LotadWin
        @[email protected]+6
        @Line1Flash=true
      when @ReplayWin
        @Replay=true
        @Line1Flash=true
      else
        if @PokeballWin==[@Line1[0],@Line1[1]]
          @[email protected]+2
          @Line1Flash=true
        end
      end
      #Payout Check Line 2
      if @Line2_Active
      case @Line2a
      when @RedSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line2aFlash=true
      when @BlueSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line2aFlash=true
      when @SmallRedBonus
        @[email protected]+90
        @RegBonus=true
        @Line2aFlash=true
      when @SmallBlueBonus
        @[email protected]+90
        @RegBonus=true
        @Line2aFlash=true
      when @BigPokeballWin
        @[email protected]+4
        @Line2aFlash=true
      when @AzurillWin
        @[email protected]+12
        @Line2aFlash=true
      when @PikachuWin
        @[email protected]+3
        boost
        @Line2aFlash=true
      when @LotadWin
        @[email protected]+6
        @Line2aFlash=true
      when @ReplayWin
        @Replay=true
        @Line2aFlash=true
      else
        if @PokeballWin==[@Line2a[0],@Line2a[1]]
          @[email protected]+2
          @Line2aFlash=true
        end
      end
      
      case @Line2b 
      when @RedSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line2bFlash=true
      when @BlueSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line2bFlash=true
      when @SmallRedBonus
        @[email protected]+90
        @RegBonus=true
        @Line2bFlash=true
      when @SmallBlueBonus
        @[email protected]+90
        @RegBonus=true
        @Line2bFlash=true
      when @BigPokeballWin
        @[email protected]+4
        @Line2bFlash=true
      when @AzurillWin
        @[email protected]+12
        @Line2bFlash=true
      when @PikachuWin
        @[email protected]+3
        boost
        @Line2bFlash=true
      when @LotadWin
        @[email protected]+6
        @Line2bFlash=true
      when @ReplayWin
        @Replay=true
        @Line2bFlash=true
      else
        if @PokeballWin==[@Line2b[0],@Line2b[1]]
          @[email protected]+2
          @Line2bFlash=true
        end
      end
    end
      #Payout Check Line 3
      if @Line3_Active
      case @Line3a
      when @RedSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line3aFlash=true
      when @BlueSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line3aFlash=true
      when @SmallRedBonus
        @[email protected]+90
        @RegBonus=true
        @Line3aFlash=true
      when @SmallBlueBonus
        @[email protected]+90
        @RegBonus=true
        @Line3aFlash=true
      when @BigPokeballWin
        @[email protected]+4
        @Line3aFlash=true
      when @AzurillWin
        @[email protected]+12
        @Line3aFlash=true
      when @PikachuWin
        @[email protected]+3
        boost
        @Line3aFlash=true
      when @LotadWin
        @[email protected]+6
        @Line3aFlash=true
      when @ReplayWin
        @Replay=true
        @Line3aFlash=true
      else
        if @PokeballWin==[@Line3a[0],@Line3a[1]]
          @[email protected]+2
          @Line3aFlash=true
        end
      end
      
      case @Line3b
      when @RedSevenWin
        @[email protected]ut+300
        @BigBonus=true
        @Line3bFlash=true
      when @BlueSevenWin
        @[email protected]+300
        @BigBonus=true
        @Line3bFlash=true
      when @SmallRedBonus
        @[email protected]+90
        @RegBonus=true
        @Line3bFlash=true
      when @SmallBlueBonus
        @[email protected]+90
        @RegBonus=true
        @Line3bFlash=true
      when @BigPokeballWin
        @[email protected]+4
        @Line3bFlash=true
      when @AzurillWin
        @[email protected]+12
        @Line3bFlash=true
      when @PikachuWin
        @[email protected]+3
        boost
        @Line3bFlash=true
      when @LotadWin
        @[email protected]+6
        @Line3bFlash=true
      when @ReplayWin
        @Replay=true
        @Line3bFlash=true
      else
        if @PokeballWin==[@Line3b[0],@Line3b[1]]
          @[email protected]+2
          @Line3bFlash=true
        end
      end
    end
    @Win= (@Payout>0)||(@Replay)
    if @BigBonus||@RegBonus
      pbMEPlay("SlotsBigWin")
    elsif @Win
      pbMEPlay("SlotsWin")
    end
    end
    end
      
    class Scene_Slots_Help
      def initialize(usedcoins,content1,content2,content3,bolts)
        #Parameters to pass variables (when returning to Scene_Slots)
        @usedcoins=usedcoins
        @content1=content1
        @content2=content2
        @content3=content3
        @bolts=bolts
        #Numbers
        @Credit0=RPG::Cache.picture("0")
        @Credit1=RPG::Cache.picture("1")
        @Credit2=RPG::Cache.picture("2")
        @Credit3=RPG::Cache.picture("3")
        @Credit4=RPG::Cache.picture("4")
        @Credit5=RPG::Cache.picture("5")
        @Credit6=RPG::Cache.picture("6")
        @Credit7=RPG::Cache.picture("7")
        @Credit8=RPG::Cache.picture("8")
        @Credit9=RPG::Cache.picture("9")
        @Credit_Numbers=[@Credit0,@Credit1,@Credit2,@Credit3,@Credit4,@Credit5,@Credit6,
                         @Credit7,@Credit8,@Credit9]
      end
      
      def main
        #Background
        @Background=Sprite.new
        @Background.bitmap=RPG::Cache.picture("Slots Info.png")
        #Credits field
        @Creditfield1=Sprite.new
        @Creditfield1.x=358
        @Creditfield1.y=36
        @Creditfield2=Sprite.new
        @Creditfield2.x=372
        @Creditfield2.y=36
        @Creditfield3=Sprite.new
        @Creditfield3.x=386
        @Creditfield3.y=36
        @Creditfield4=Sprite.new
        @Creditfield4.x=400
        @Creditfield4.y=36
        
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene!=self
            break
          end
        end
        Graphics.freeze
        @Background.dispose
        @Creditfield1.dispose
        @Creditfield2.dispose
        @Creditfield3.dispose
        @Creditfield4.dispose  
      end
      
      def update
        if Input.trigger?(Input::CTRL)
          $scene=Scene_Slots.new(@usedcoins,@content1,@content2,@content3,@bolts)
        end
        if Input.trigger?(Input::B)
          #Exit the game; returns coins that were input but not used
          [email protected]
          $scene=Scene_Map.new
        end
        #Credit field update
        @[email protected]_Numbers[$PokemonGlobal.coins/1000]
        @[email protected]_Numbers[($PokemonGlobal.coins%1000)/100]
        @[email protected]_Numbers[(($PokemonGlobal.coins%1000)%100)/10]
        @[email protected]_Numbers[(($PokemonGlobal.coins%1000)%100)%10]
      end
    end
    
    class Slot
      attr_accessor :TopVal
      attr_accessor :MidVal
      attr_accessor :DownVal
      attr_accessor :active
      def initialize(x, topValue=nil,midValue=nil, downValue=nil)
        #Slot images
        @Pokeball_Down=RPG::Cache.picture("Pokeballs Bottom")
        @Pokeball_Middle=RPG::Cache.picture("Pokeballs Middle")
        @Pokeball_Top=RPG::Cache.picture("Pokeballs Top")
        @AzurillDown=RPG::Cache.picture("Azurill Bottom")
        @AzurillMiddle=RPG::Cache.picture("Azurill Middle")
        @AzurillTop=RPG::Cache.picture("Azurill Top")
        @PikachuDown=RPG::Cache.picture("Pikachu Bottom")
        @PikachuMiddle=RPG::Cache.picture("Pikachu Middle")
        @PikachuTop=RPG::Cache.picture("Pikachu Top")
        @BlueSeven_Top=RPG::Cache.picture("Blue Seven Top")
        @BlueSeven_Middle=RPG::Cache.picture("Blue Seven Middle")
        @BlueSeven_Down=RPG::Cache.picture("Blue Seven Bottom")
        @Lotad_Down=RPG::Cache.picture("Lotad Bottom")
        @Lotad_Middle=RPG::Cache.picture("Lotad Middle")
        @Lotad_Top=RPG::Cache.picture("Lotad Top")
        @RedSeven_Down=RPG::Cache.picture("Red Seven Bottom")
        @RedSeven_Middle=RPG::Cache.picture("Red Seven Middle")
        @RedSeven_Top=RPG::Cache.picture("Red Seven Top")
        @Replay_Down=RPG::Cache.picture("Replay Bottom")
        @Replay_Middle=RPG::Cache.picture("Replay Middle")
        @Replay_Top=RPG::Cache.picture("Replay Top")
        #Y Coordinates of the images
        @y1=78
        @y2=127
        @y3=176
        #Image Position
        @Top=Sprite.new
        @Top.x=x
        @[email protected]
        @Middle=Sprite.new
        @Middle.x=x
        @[email protected]
        @Down=Sprite.new
        @Down.x=x
        @[email protected]
        #Rarity of slot elements is determined here. The more the number appears, the
            #more common that element will be. Note that 1 (the Red 7) only occurs once
            #and is rare, but 6 (the Pokeballs) occurs 4 times, being very common.
            #Newly added elements must be placed here to appear.
        #SlotInhalt set (1= Red 7, 2= Blue 7, 3= Replay, 4= Azurill, 5= Lotad, 
            #6= Pokeballs, 7= Pikachu)
        @SlotInhalt=[1,6,6,4,3,7,4,5,2,5,6,4,5,7]
        #@SlotInhalt=[1,1,1,1,1,1]#  this is for testing the Big Bonus
        #@SlotInhalt=[7,7,7,7,7,7]#  this is for testing reel time, and the lighting bolts
        #If the values are passed to the slots via parameters, use this
        #Otherwise, choose randomly
        if topValue!=nil
          self.TopVal=topValue
          self.MidVal=midValue
          self.DownVal=downValue
        else
          self.setValues
        end
        #Active to false
        self.active=false
        #Graphs represent
        @i=0
        @j=1
        @k=2
        update
      end
      
      def setValues
        @RndNr=rand(@SlotInhalt.size)
        [email protected][@RndNr]
        if @RndNr==(@SlotInhalt.size-1)
           @RndNr=0
        else
           @[email protected]+1
        end     
        [email protected][@RndNr]
        if @RndNr==(@SlotInhalt.size-1)
           @RndNr=0
        else
           @[email protected]+1
         end
        [email protected][@RndNr] 
      end
      
      def update
        case self.TopVal
        when 1
          @[email protected]_Top
        when 2
          @[email protected]_Top
        when 3
          @[email protected]_Top
        when 4
          @[email protected]
        when 5
          @[email protected]_Top
        when 6
          @[email protected]_Top
        when 7
          @[email protected]
        end
        case self.MidVal
        when 1
          @[email protected]_Middle
        when 2
          @[email protected]_Middle
        when 3
          @[email protected]_Middle
        when 4
          @[email protected]
        when 5
          @[email protected]_Middle
        when 6
          @[email protected]_Middle
        when 7
          @[email protected]
        end
        case self.DownVal
        when 1
          @[email protected]_Down
        when 2
          @[email protected]_Down
        when 3
          @[email protected]_Down
        when 4
          @[email protected]
        when 5
          @[email protected]_Down
        when 6
          @[email protected]_Down
        when 7
          @[email protected]
        end
      end
    
      def run
        [email protected][@i]
        [email protected][@j]
        [email protected][@k]
        @[email protected]+1
        @[email protected]+1
        @[email protected]+1
        if @[email protected]
           @i=0
        end
        if @[email protected]
           @j=0
        end
        if @[email protected]
           @k=0
        end
        update
       end
     
      def dispose
        @Top.dispose
        @Middle.dispose
        @Down.dispose
      end
      
    end
    To call the script, use $scene=Scene_Slots.new.
    The global variable for coins is already implemented in Essentials, so I simply adapted the script to work with it. To add coins to the players coin bag, use $PokemonGlobal.coins+=XXXX.

    You must download the images and audio and copy/paste the contents into the Graphics/Pictures and Audio/ME or Audio/SE directories (indicated by the folder names for audio).

    If you don't like the speed of any of the animations (such as the flashing lines or the win animation), look for the portion of code that corresponds to the animation and change the frame numbers. It'll be under a "case @FrameCount" line with several checks for the frame number (such as "when 2" "when 4" etc.). It's best to keep them in a pattern though so that the animation is smooth (i.e. count by 2s, 5s, 10s, etc.).

    If you want to implement the Reel Time feature, you have to script in a function that performs a replay several times, and sums the payouts at the end. I was working on it, but lost interest after a few failed attempts. All of the variables necessary to implement it should still be present, and in the appropriate areas. The related code has been commented out, so you can pick up where I left off or try something else. The necessary graphics have also been included for the Pikachu animation, just not formatted and arranged.

    The script was initially created by Itachihro, and the original can be found on YouTube by searching for "RPGXP Casino Slots Script." I built the script using his as the core, and added/edited tons of things. Also, I translated the comments and variable names into English to make it easier to understand and modify. Although some of the stuff I named may be odd sounding, since it was off the top of my head.
    The graphics were ripped by Guille-kun (the large image, which I broke into the smaller pieces).
    The sound effects were ripped by me.

    If there are any problems, or if there is anything you don't understand about the script, let me know. And if anyone has the patience to implement the Reel Time feature and the accompanying animation, I'll add it to this and give you appropriate credit for your contribution.
    __________________
    Creator of the Harvest Moon Tool Kit (HMTK).

    Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
    Reply With Quote

    Relevant Advertising!

      #2    
    Old November 26th, 2010 (11:10 PM).
    thepsynergist's Avatar
    thepsynergist thepsynergist is online now
    A Gym Leader, Kyushu Region
       
      Join Date: Mar 2009
      Location: California, USA
      Age: 27
      Gender: Male
      Nature: Adamant
      Posts: 758
      This is amazing, its just what I've been looking for. Only one problem is the extreme lag after a game... Is there a way to fix it? It plays at like 4-6 fps when you lose.
      __________________




      Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
      Reply With Quote
        #3    
      Old November 26th, 2010 (11:40 PM).
      Cilerba Cilerba is offline
      the hearts of lonely people
      • Silver Tier
       
      Join Date: Feb 2010
      Location: Massachusetts
      Age: 21
      Gender: Male
      Nature: Quiet
      Posts: 1,171
      Quote:
      Originally Posted by thepsynergist View Post
      This is amazing, its just what I've been looking for. Only one problem is the extreme lag after a game... Is there a way to fix it? It plays at like 4-6 fps when you lose.
      The script actually lagged during the game for me. It seemed pretty great, so excellent job, Kitsune. It just lags a bit too much. ):
      __________________
      Reply With Quote
        #4    
      Old November 27th, 2010 (5:58 AM). Edited November 27th, 2010 by KitsuneKouta.
      KitsuneKouta's Avatar
      KitsuneKouta KitsuneKouta is offline
      狐 康太
         
        Join Date: Mar 2010
        Age: 26
        Gender: Male
        Posts: 441
        Quote:
        Originally Posted by Cilerba View Post


        The script actually lagged during the game for me. It seemed pretty great, so excellent job, Kitsune. It just lags a bit too much. ):
        I had issues with lag off and on too. The problem is with the various things being checked in the main processing area, especially the endgame handler, which checks which endgame animation to display (3 different win animations, the flashing lines and 1 lose animation). It also checks if you have too many coins, or not enough, the payout, replays, etc. I had the lag reduced at one point, but I think it was after adding something that I started having the lag issue. I'll see if I can speed it up a bit.

        EDIT: I also forgot a couple of the sound effects that are supposed to be there. I changed the link to the complete version. Also, there wasn't supposed to be an ME after losing, so I updated the code.
        __________________
        Creator of the Harvest Moon Tool Kit (HMTK).

        Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
        Reply With Quote
          #5    
        Old November 27th, 2010 (10:05 AM).
        thepsynergist's Avatar
        thepsynergist thepsynergist is online now
        A Gym Leader, Kyushu Region
           
          Join Date: Mar 2009
          Location: California, USA
          Age: 27
          Gender: Male
          Nature: Adamant
          Posts: 758
          I noticed that if you left the map that you were on when you did the scripts, the lag goes away. Maybe if you teleport the player to a blank map when you enter the slot event the lag would be less. Then teleport back when you're done. That still doesn't fix the lag during the slots though...
          __________________




          Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
          Reply With Quote
            #6    
          Old November 27th, 2010 (11:28 AM).
          KitsuneKouta's Avatar
          KitsuneKouta KitsuneKouta is offline
          狐 康太
             
            Join Date: Mar 2010
            Age: 26
            Gender: Male
            Posts: 441
            Quote:
            Originally Posted by thepsynergist View Post
            I noticed that if you left the map that you were on when you did the scripts, the lag goes away. Maybe if you teleport the player to a blank map when you enter the slot event the lag would be less. Then teleport back when you're done. That still doesn't fix the lag during the slots though...
            Do you mean it fixes lag that lingers after you finish playing? I've noticed that most of the problem with lag is because it's doing so much in a row, and hitting the stop button fast makes it a little worse. It's especially bad after winning as it plays a little tune right after the SE for the stop buttons are finishing, while also trying to update the graphics every few frames. Waiting a second or two generally reduces the lag a bit as it has time to finish processing before doing it all over again. Using some well-placed pbWait commands might help, so I'll try it out and see what happens.
            __________________
            Creator of the Harvest Moon Tool Kit (HMTK).

            Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
            Reply With Quote
              #7    
            Old November 27th, 2010 (11:32 AM).
            thepsynergist's Avatar
            thepsynergist thepsynergist is online now
            A Gym Leader, Kyushu Region
               
              Join Date: Mar 2009
              Location: California, USA
              Age: 27
              Gender: Male
              Nature: Adamant
              Posts: 758
              That'd be great. You did a really good job importing this to Pokemon Essentials.
              __________________




              Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
              Reply With Quote
                #8    
              Old November 28th, 2010 (1:57 PM). Edited November 28th, 2010 by KitsuneKouta.
              KitsuneKouta's Avatar
              KitsuneKouta KitsuneKouta is offline
              狐 康太
                 
                Join Date: Mar 2010
                Age: 26
                Gender: Male
                Posts: 441
                I haven't quite pinned down the problem yet, but I think I'm on the right track. It doesn't seem to be any action in particular that causes the lag, but rather a time based thing. Every several seconds it suddenly lags, and then corrects itself. So I need to find whatever's being processed at that moment to see if I can fix it.

                Another issue is that my computer is a bit above average, so I can't really tell how badly it may lag for others even if it works just fine on mine. Would any of you be able to try it out? Just let the reels run without inputting anything (the reels should be spinning), and see if the lag is on a cycle like I mentioned above. If it lags all the way through, and not on a cycle, then I may have to write a less resource intensive version for computers that aren't as powerful.
                __________________
                Creator of the Harvest Moon Tool Kit (HMTK).

                Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                Reply With Quote
                  #9    
                Old November 28th, 2010 (3:58 PM).
                zingzags's Avatar
                zingzags zingzags is offline
                PokemonGDX creator
                   
                  Join Date: Jan 2009
                  Location: Boston
                  Age: 23
                  Nature: Adamant
                  Posts: 562
                  Speechless lol
                  Looks like you are not one of those people who back down from there word
                  Good one.
                  __________________
                  Check out the Pokemon Game Engine I am working on:
                  https://github.com/sjosegarcia/Pokemon
                  Reply With Quote
                    #10    
                  Old November 28th, 2010 (4:02 PM).
                  thepsynergist's Avatar
                  thepsynergist thepsynergist is online now
                  A Gym Leader, Kyushu Region
                     
                    Join Date: Mar 2009
                    Location: California, USA
                    Age: 27
                    Gender: Male
                    Nature: Adamant
                    Posts: 758
                    I've tested it and it only begins to lag for me after at least one game is played. If I let the slots do their thing and leave them alone it doesn't lag.
                    __________________




                    Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                    Reply With Quote
                      #11    
                    Old November 28th, 2010 (4:19 PM).
                    Dragonite Ernston's Avatar
                    Dragonite Ernston Dragonite Ernston is offline
                    I rival Lance's.
                       
                      Join Date: May 2010
                      Gender: Male
                      Posts: 149
                      Do you think you can actually analyze the algorithm and create a pseudocode version? Because that would be awesome in determining the algorithms used to play the game.
                      Reply With Quote
                        #12    
                      Old November 28th, 2010 (4:23 PM).
                      thepsynergist's Avatar
                      thepsynergist thepsynergist is online now
                      A Gym Leader, Kyushu Region
                         
                        Join Date: Mar 2009
                        Location: California, USA
                        Age: 27
                        Gender: Male
                        Nature: Adamant
                        Posts: 758
                        I can't code at all. But I trust KitsuneKouta to come up with something.
                        __________________




                        Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                        Reply With Quote
                          #13    
                        Old November 28th, 2010 (4:51 PM).
                        KitsuneKouta's Avatar
                        KitsuneKouta KitsuneKouta is offline
                        狐 康太
                           
                          Join Date: Mar 2010
                          Age: 26
                          Gender: Male
                          Posts: 441
                          Quote:
                          Originally Posted by zingzags View Post
                          Speechless lol
                          Looks like you are not one of those people who back down from there word
                          Good one.
                          Are you referring to how I mentioned it in my sig a long time ago? I had actually had this sitting around for a while, but I wanted to make it a little better first. Then I ended up putting it off for a couple months and figured I'd post it. I also have the secret base system done, but it is the most user (un)friendly thing I have ever worked with, so I'm not sure if it's worth posting.

                          @thepsynergist: ok, thanks for letting me know.

                          @Dragonite Ernston: I suppose I could put one together. I'll try to work on the lag problem first though before my mind wanders and I forget about it.
                          __________________
                          Creator of the Harvest Moon Tool Kit (HMTK).

                          Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                          Reply With Quote
                            #14    
                          Old November 28th, 2010 (4:55 PM).
                          thepsynergist's Avatar
                          thepsynergist thepsynergist is online now
                          A Gym Leader, Kyushu Region
                             
                            Join Date: Mar 2009
                            Location: California, USA
                            Age: 27
                            Gender: Male
                            Nature: Adamant
                            Posts: 758
                            I can't wait, KitsuneKouta. If you checked out my Pokemon Pyrite thread, you'd notice that I have a slot machine Pokemon. I plan on having him pose as a slot machine in the game corner. With this script, he'll finally make sense.
                            __________________




                            Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                            Reply With Quote
                              #15    
                            Old November 28th, 2010 (5:44 PM).
                            KitsuneKouta's Avatar
                            KitsuneKouta KitsuneKouta is offline
                            狐 康太
                               
                              Join Date: Mar 2010
                              Age: 26
                              Gender: Male
                              Posts: 441
                              I solved the lag issue. I overlooked a nifty little comment I left for myself when I left off working on it a couple months ago. There's a line that reads "boltGraphics" (a method name), which updates the little lightning bolts that appear if you get 3 pikachus in a row. Since Reel Time is not implemented, it's purely for looks. For whatever reason, I felt it was a good idea to put it in the main loop at the time. I updated the script in the first post. It runs like lightning now.
                              __________________
                              Creator of the Harvest Moon Tool Kit (HMTK).

                              Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                              Reply With Quote
                                #16    
                              Old November 28th, 2010 (5:48 PM).
                              thepsynergist's Avatar
                              thepsynergist thepsynergist is online now
                              A Gym Leader, Kyushu Region
                                 
                                Join Date: Mar 2009
                                Location: California, USA
                                Age: 27
                                Gender: Male
                                Nature: Adamant
                                Posts: 758
                                I told you I had faith in you. :D I'll put this in once I'm done with my final. Thanks a bunch dude. You are so in my credits.
                                __________________




                                Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                                Reply With Quote
                                  #17    
                                Old November 28th, 2010 (7:07 PM).
                                KitsuneKouta's Avatar
                                KitsuneKouta KitsuneKouta is offline
                                狐 康太
                                   
                                  Join Date: Mar 2010
                                  Age: 26
                                  Gender: Male
                                  Posts: 441
                                  Quote:
                                  Originally Posted by thepsynergist View Post
                                  I told you I had faith in you. :D I'll put this in once I'm done with my final. Thanks a bunch dude. You are so in my credits.
                                  You're welcome. I don't generally like to commit to anything in the event that I forget/lose interest/fail to accomplish it, but I still try to help out wherever I can. That's why I didn't release this sooner: I wasn't sure if I'd have the motivation to follow through.

                                  @Dragonite Ernston: I put together the pseudocode. I don't do it very often, so I'm not sure if it's quite what you're looking for. I tried to indent to make it more readable.
                                  Code:
                                  initialize variables
                                  define graphics
                                  create sprites
                                  position contents of the 3 reels (contents are read from corresponding variables, which determines the images to use)
                                  transition
                                  update lighting bolt graphics (otherwise the disappear after viewing the info screen)
                                  main Loop
                                   update graphics
                                   update input
                                   update game
                                     add 1 to frame count
                                     check if game is active (reels spinning)
                                       -determines if game has been evaluated
                                     check if player has any coins to keep playing
                                       -return to map if they don't
                                     check if game is active but the slots have been stopped
                                       evaluates game results (if game hasn't been evaluated yet)
                                         update lighting bolt graphics
                                         restore variables to default values (such as payout, frame count, coins input)
                                         determine payout by line, and which lines should flash
                                           Line1
                                           Line2a
                                           Line2b
                                           Line3a
                                           Line3b
                                         determine if the round was a win
                                         play ME depending on type of win
                                       check if round was a win
                                           -if true, display appropriate win animation w/ lines being erased and created (alternating)
                                           -reset frame count
                                         check frame count and payout speed
                                           reduce payout by 1
                                           check if player has max coins
                                             -reduce payout to 0 if true
                                         check if player presses "C"
                                           -if true, increase payout speed
                                         check if payout is 0 (the round is over) and ensure there's not a replay round
                                           check players coins to see if they can continue playing
                                           restore variables do default values
                                         check if payout is 0 and if there IS a replay round
                                           restore variables do default values, except the slots remain active
                                         ***an extra check is added that is supposed to work with Reel Time. at present, it's useless code***
                                       if round was not a win:
                                         display lose animation
                                         restore variables to default values
                                     determine contents of slots (3 values per reel)
                                     check if "C" was pressed
                                       -if true, set the first active slot to inactive (false), play an SE, and display an image (for the button)
                                     check if game is active (reels moving)
                                       -if true, increase time variable by 1
                                         -check if a slot is inactive
                                           -check if time variable is greater than or equal to 10
                                             -erase button images and set time variable to 0
                                     check if "CTRL" button was pressed (no coins can be inserted, payout must be 0, and game must be inactive)
                                       -if true, change to slots help scene
                                     check if "DOWN" was pressed (game must be inactive, and coins must be > 0)
                                       Play SE
                                       increase value of inserted coins by 1
                                       decrease players coins by 1
                                       check value of inserted coins
                                       display appropriate line graphics (for the "light up" effect)
                                       set game and slots to active status
                                       set frame count to 0
                                     check if "B" was pressed
                                       -if true, prompt player to end game (return to map and restore any coins that were inserted but not used)
                                     check if "C" was pressed (game must be inactive and inserted coins > 0)
                                       -if true, set game and slots to active status, and set frame count to 0
                                     check the number of inserted coins, and display the corresponding "Insert" animation
                                     check if Reel Time is active and display the corresponding animation
                                     check if game is active, and display the "Stop" animation
                                     update credit field
                                     update payout field
                                     run active slots
                                   ####End of game update####
                                   check if scene has changed
                                    -if true, break loop
                                  freeze graphics and delete objects
                                  __________________
                                  Creator of the Harvest Moon Tool Kit (HMTK).

                                  Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                                  Reply With Quote
                                    #18    
                                  Old November 28th, 2010 (7:18 PM).
                                  Dragonite Ernston's Avatar
                                  Dragonite Ernston Dragonite Ernston is offline
                                  I rival Lance's.
                                     
                                    Join Date: May 2010
                                    Gender: Male
                                    Posts: 149
                                    Alright, now come the questions. What does "the game has been evaluated" mean? I don't understand that terminology.

                                    Also, this is RGSS? (If it is, I am dumb. I thought it was translated ASM.)
                                    Reply With Quote
                                      #19    
                                    Old November 28th, 2010 (7:43 PM).
                                    KitsuneKouta's Avatar
                                    KitsuneKouta KitsuneKouta is offline
                                    狐 康太
                                       
                                      Join Date: Mar 2010
                                      Age: 26
                                      Gender: Male
                                      Posts: 441
                                      Quote:
                                      Originally Posted by Dragonite Ernston View Post
                                      Alright, now come the questions. What does "the game has been evaluated" mean? I don't understand that terminology.

                                      Also, this is RGSS? (If it is, I am dumb. I thought it was translated ASM.)
                                      Maybe you could substitute it with "checked" or "processed," but it basically means that the results of the game (which I interchanged with the term "round" occasionally) have been looked at and the appropriate action taken in response to the results. And it is in fact RGSS; the only thing I translated it from was German.
                                      __________________
                                      Creator of the Harvest Moon Tool Kit (HMTK).

                                      Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                                      Reply With Quote
                                        #20    
                                      Old November 30th, 2010 (12:34 AM).
                                      thepsynergist's Avatar
                                      thepsynergist thepsynergist is online now
                                      A Gym Leader, Kyushu Region
                                         
                                        Join Date: Mar 2009
                                        Location: California, USA
                                        Age: 27
                                        Gender: Male
                                        Nature: Adamant
                                        Posts: 758
                                        One minor error in the code I just found out from having fun with the slots, is that when you get a pikachu in the reel, you get a lightning bolt icon. That's fine, but when you exit the slot game, it doesn't remove the picture. It stays there even when you change maps. I'm sure I could remove it with one line of code, but I suck with coding.
                                        __________________




                                        Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                                        Reply With Quote
                                          #21    
                                        Old November 30th, 2010 (8:47 AM).
                                        KitsuneKouta's Avatar
                                        KitsuneKouta KitsuneKouta is offline
                                        狐 康太
                                           
                                          Join Date: Mar 2010
                                          Age: 26
                                          Gender: Male
                                          Posts: 441
                                          Quote:
                                          Originally Posted by thepsynergist View Post
                                          One minor error in the code I just found out from having fun with the slots, is that when you get a pikachu in the reel, you get a lightning bolt icon. That's fine, but when you exit the slot game, it doesn't remove the picture. It stays there even when you change maps. I'm sure I could remove it with one line of code, but I suck with coding.
                                          That's strange. I just tested it out again and I didn't have that problem. Find this portion of code (line 629):
                                          Code:
                                            if (Input.trigger?(Input::B))&&!(@GameActive)
                                              if Kernel.pbConfirmMessage("Quit the game?")
                                                [email protected]
                                                $scene=Scene_Map.new
                                              end
                                            end
                                          and modify it to look like this:
                                          Code:
                                            if (Input.trigger?(Input::B))&&!(@GameActive)
                                              if Kernel.pbConfirmMessage("Quit the game?")
                                                [email protected]
                                                @bolts=0
                                                boltGraphics
                                                $scene=Scene_Map.new
                                              end
                                            end
                                          That should add a redundant measure to erase the bolts before changing the scene.
                                          __________________
                                          Creator of the Harvest Moon Tool Kit (HMTK).

                                          Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                                          Reply With Quote
                                            #22    
                                          Old November 30th, 2010 (9:02 AM).
                                          zingzags's Avatar
                                          zingzags zingzags is offline
                                          PokemonGDX creator
                                             
                                            Join Date: Jan 2009
                                            Location: Boston
                                            Age: 23
                                            Nature: Adamant
                                            Posts: 562
                                            Tested it the yellow bolts stay with you. even with the mini change
                                            __________________
                                            Check out the Pokemon Game Engine I am working on:
                                            https://github.com/sjosegarcia/Pokemon
                                            Reply With Quote
                                              #23    
                                            Old November 30th, 2010 (11:53 AM).
                                            thepsynergist's Avatar
                                            thepsynergist thepsynergist is online now
                                            A Gym Leader, Kyushu Region
                                               
                                              Join Date: Mar 2009
                                              Location: California, USA
                                              Age: 27
                                              Gender: Male
                                              Nature: Adamant
                                              Posts: 758
                                              And you only see it when the screen is black on the left side. The game covers it up. Kinda like its on Layer 0.
                                              __________________




                                              Pokemon Pyrite is now complete, check out the trailer/download link here: https://www.youtube.com/watch?v=X6g5pXPXyV4
                                              Reply With Quote
                                                #24    
                                              Old November 30th, 2010 (2:51 PM). Edited November 30th, 2010 by KitsuneKouta.
                                              KitsuneKouta's Avatar
                                              KitsuneKouta KitsuneKouta is offline
                                              狐 康太
                                                 
                                                Join Date: Mar 2010
                                                Age: 26
                                                Gender: Male
                                                Posts: 441
                                                Sorry, I forgot that since I set it up the same way as the badge display on the trainer card you have to use -1 instead of 0. So @bolts=-1 should fix it. I'll update the script in the first post too.
                                                __________________
                                                Creator of the Harvest Moon Tool Kit (HMTK).

                                                Anime/Manga fans can find me on MyAnimeList.net, as KitsuneKouta.
                                                Reply With Quote
                                                  #25    
                                                Old December 5th, 2010 (9:42 PM).
                                                Dragonite Ernston's Avatar
                                                Dragonite Ernston Dragonite Ernston is offline
                                                I rival Lance's.
                                                   
                                                  Join Date: May 2010
                                                  Gender: Male
                                                  Posts: 149
                                                  Also, does this script follow the Japanese slot machine style of the games, or is it entirely a script from scratch?

                                                  Because the reels slip in the actual games, and I can't find any code in your pseudocode that accounts for these slipping reels.
                                                  Reply With Quote
                                                  Reply

                                                  Quick Reply

                                                  Join the conversation!

                                                  Create an account to post a reply in this thread, participate in other discussions, and more!

                                                  Create a PokéCommunity Account

                                                  Sponsored Links
                                                  Thread Tools

                                                  Posting Rules
                                                  You may not post new threads
                                                  You may not post replies
                                                  You may not post attachments
                                                  You may not edit your posts

                                                  BB code is On
                                                  Smilies are On
                                                  [IMG] code is On
                                                  HTML code is Off

                                                  Forum Jump


                                                  All times are GMT -8. The time now is 6:58 PM.