Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] [Script] Picture Commander for Pokémon Essential

Notices
For all updates, view the main page.

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.



Reply
 
Thread Tools
  #1    
Old October 6th, 2010 (05:19 AM). Edited October 30th, 2010 by mattfriends.
mattfriends's Avatar
mattfriends mattfriends is offline
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
Posts: 105
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 Code:
# =========================================
# 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.
__________________
This signature has been disabled.
Exceeds signature height limit.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #2    
Old October 6th, 2010 (08:06 AM).
zingzags's Avatar
zingzags zingzags is offline
PokemonGDX creator
 
Join Date: Jan 2009
Location: Boston
Age: 21
Nature: Adamant
Posts: 560
So what does it do exactly (still nooby in ruby game scripting language)
__________________
Check out the Pokemon Game Engine I am working on:
https://github.com/sjosegarcia/Pokemon
Reply With Quote
  #3    
Old October 6th, 2010 (04:27 PM).
mattfriends's Avatar
mattfriends mattfriends is offline
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
Posts: 105
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.
__________________
This signature has been disabled.
Exceeds signature height limit.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
  #4    
Old October 30th, 2010 (02:32 AM).
mattfriends's Avatar
mattfriends mattfriends is offline
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
Posts: 105
Updated! Fix some bugs and yeah...
__________________
This signature has been disabled.
Exceeds signature height limit.
Please review and fix the issues by reading the signature rules.

You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
Reply With Quote
Reply
Quick Reply

Sponsored Links

You may also like.. (Beta)
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 UTC -8. The time now is 11:01 AM.