The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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
mattfriends's Avatar
mattfriends
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
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.

Last edited by mattfriends; October 30th, 2010 at 02:30 AM.
Reply With Quote
  #2    
Old October 6th, 2010, 08:06 AM
zingzags's Avatar
zingzags
Creator or Pokemon Serenity
 
Join Date: Jan 2009
Location: Boston
Age: 20
Nature: Adamant
So what does it do exactly (still nooby in ruby game scripting language)
__________________
Pokemon Serenity is my fangame name.
name decided 12/15/09
Currently helping:
Pokemon ebony
and
Xenotime:
Reply With Quote
  #3    
Old October 6th, 2010, 04:27 PM
mattfriends's Avatar
mattfriends
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
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
Inactive... :(
 
Join Date: Jul 2010
Age: 18
Gender: Male
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
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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 09:55 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.