• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script] Picture Commander for Pokémon Essential

mattfriends

Inactive... :(
105
Posts
13
Years
    • Age 27
    • Seen Nov 16, 2015
    Here is my first (very first) public script for Pokémon Essential. ^^/
    I want to share this script to you guys because I'm happy with my Game Developing (Pokémon NJA - Look at my signature for a link). I created this script while I was scripting for my game. (I didn't use this script yet but I'm sure it works fine.)

    Here is the script:
    HTML:
    # =========================================
    # Picture Commander for Pokémon Essential
    # =========================================
    # Scripted by Storm
    # Check the main script threat at Pokecommunity for informations.
    # =========================================
    class Window_PicCMD# < SpriteWindow_Base
      def initialize(scroll,loop,menuPic)
        @scroll = scroll
        #0 - Horizontal
        #1 - Vertical
        @loop = loop
        if @scroll != 0 and @scroll != 1
          @scroll = 0
        end
        #@menu = []
        @menu = menuPic
        @index = 0 #Default
        @lg = @menu.size - 1
        @e = []
        for i in 0..@lg
          @e[i] = true
        end
        @m=IconSprite.new(0,0)
        m = @menu[@index]
        @m.setBitmap(m)
        @way = 0
        @press = false
        update
      end
      def update
        if @scroll = 0
          scroll_l = Input::LEFT
          scroll_r = Input::RIGHT
        elsif @scroll = 1
          scroll_l = Input::UP
          scroll_r = Input::DOWN
        end
        
        if Input.trigger?(scroll_l)
          @index -= 1
          if @loop == true
            @index = @lg if @index == -1
          else
            @index = 0 if @index == -1
          end
          @way = 0
          @press = true
        elsif Input.trigger?(scroll_r)
          @index += 1
          if @loop == true
            @index = 0 if @index == @menu.size
          else
            @index = @lg if @index == @menu.size
          end
          @way = 1
          @press = true
        end
        
        if @press == true
          loop do
            if @e[@index] == false
              if @way == 0
                @index -= 1
              else
                @index += 1
              end
            end
            break if @e[@index] == true
          end
          if @loop == true
            if @way == 0
              @index = @lg if @index == -1
            else
              @index = 0 if @index == @menu.size
            end
          else
            if @way == 0
              @index = 0 if @index == -1
            else
              @index = @lg if @index == @menu.size
            end
          end
          @press = false
        end
        
        m = @menu[@index]
        @m.setBitmap(m)
        
      end
      def enable(index)
        @e[index] = true
      end
      def disable(index)
        @e[index] = false
      end
      def index=(index)
        @index = index
      end
      def index
        return @index
      end
      def dispose
        @m.opacity = 0
      end
      def visible=(b)
        if b
          @m.opacity = 255
        else
          @m.opacity = 0
        end
      end
      def opacity=(i)
        @m.opacity = i
      end
    end

    HOW TO USE:
    Use @[name] = Window_PicCMD.new(1,2,3) to call the command in the script editor.
    1 - Scrolling type. (0 - Horizontal, 1 - Vertical)
    2 - Looping. (Loop to the last picture when the index is equal to -1 or to the first picture when index is equal to last picture's index +1)
    3 - Array of pictures. (Example: ["Graphics/Pictures/cmd1","Graphics/Pictures/cmd2","Graphics/Pictures/cmd3"]

    Use @[name].update in the update section.

    To enable / disable the command use @[name].enable(index) or @[name].disable(index).

    To get / set the index use @[name].index = new_index and get the index by the variable of @[name].index.
     
    Last edited:

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • So what does it do exactly (still nooby in ruby game scripting language)
     

    mattfriends

    Inactive... :(
    105
    Posts
    13
    Years
    • Age 27
    • Seen Nov 16, 2015
    It does like the command menu but it use pictures instead.
    I made this because I got bored so it is a bit simple and don't blame. ^^
     
    Back
    Top