RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.
Warped Movement for Window_Selectable

0 Members and 1 Guest are viewing this topic.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Hey all
I was a bit bored and fiddled around with the movement of Window_Items. I found the way I represent here better. I decided to make it broader and have created a solution intended for subclasses of Window_Selectable
I will provide two versions. One if you want to only apply this on certain windows and not others. Another that just changes the functionality of Window_Selectable.

Here is the mix-in version for changing specific classes: (demo)
Code: [Select]
#==============================================================================
# ** Warped Movement mix-in for subclasses of Window Selectable
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2007-08-22 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
#   This is a mix-in module for windows subclassing designed to 'enhance' the
#   arrow-key movement system used to select the item by creating warping.
#   That is, if you are at the bottom and press down you will go up to the top
#   in the next column. Like-wise for down, left and right.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place the script anywhere above Main.
#   To give a subclass of Window_Selectable let it include the module
#
#   If you for example wanted to apply the module to Window_Item you should
#   write this code: (Must be below the original Window_Item
# ------------------------------------------
#   class Window_Item < Window_Selectable
#     include Window_Selectable_Type_2
#   end
# ------------------------------------------
#
#   Here is a version for Window_Skill. You get the idea.
# ------------------------------------------
#   class Window_Skill < Window_Selectable
#     include Window_Selectable_Type_2
#   end
# ------------------------------------------
#
#   Note: Don't include this module in Window_Selectable ~
#         May cause issues with Windows where the update method is used
#==============================================================================

#==============================================================================
# ** module Window_Selectable_Warped
#==============================================================================
module Window_Selectable_Warped
  #----------------------------------------------------------------------------
  # * Frame Update
  #----------------------------------------------------------------------------
  def update
    last_index = @index
    super
    if last_index == @index && active && @item_max > 1
      if Input.repeat?(Input::DOWN)
        # Move cursor down
        $game_system.se_play($data_system.cursor_se)
        @index = (@index % @column_max + 1) % @column_max
      end
      # If the up directional button was pressed
      if Input.repeat?(Input::UP)
        # Move cursor up
        $game_system.se_play($data_system.cursor_se)
      @index = (@index % @column_max + 1)
      @index = -@index % @item_max + @item_max % @column_max
      @index -= @column_max  if @index >= @item_max
      end
      # If the right directional button was pressed
      if Input.repeat?(Input::RIGHT)
        # Move cursor right
        $game_system.se_play($data_system.cursor_se)
        @index = (@index + 1) % @item_max
      end
      # If the left directional button was pressed
      if Input.repeat?(Input::LEFT)
        # Move cursor left
        $game_system.se_play($data_system.cursor_se)
        @index = (@index - 1) % @item_max
      end
    end
  end
end

Next we have the change for all Window_Selectable subclasses. This also requires less work. (demo)
Code: [Select]
#==============================================================================
# ** Warped Movement for Window Selectable
#------------------------------------------------------------------------------
# Zeriab
# Version 1.0
# 2007-08-22 (Year-Month-Day)
#------------------------------------------------------------------------------
# * Description :
#
#   This script is designed to 'enhance' the arrow-key movement system of
#   Window_Selectable used to select the item by allowing warping.
#   That is, if you are at the bottom and press down you will go up to the top
#   in the next column. Like-wise for down, left and right.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place the script below Window_Selectable and above Main.
#
#   Note: May cause issue with scripts that are depent on the index not
#         changing under certain circumstances
#==============================================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
  alias zeriab_warped_update update
  #----------------------------------------------------------------------------
  # * Frame Update
  #----------------------------------------------------------------------------
  def update
    last_index = @index
    # original update method is called
    zeriab_warped_update
    if last_index == @index && active && @item_max > 1
      if Input.repeat?(Input::DOWN)
        # Move cursor down
        $game_system.se_play($data_system.cursor_se)
        @index = (@index % @column_max + 1) % @column_max
      end
      # If the up directional button was pressed
      if Input.repeat?(Input::UP)
        # Move cursor up
        $game_system.se_play($data_system.cursor_se)
      @index = (@index % @column_max + 1)
      @index = -@index % @item_max + @item_max % @column_max
      @index -= @column_max  if @index >= @item_max
      end
      # If the right directional button was pressed
      if Input.repeat?(Input::RIGHT)
        # Move cursor right
        $game_system.se_play($data_system.cursor_se)
        @index = (@index + 1) % @item_max
      end
      # If the left directional button was pressed
      if Input.repeat?(Input::LEFT)
        # Move cursor left
        $game_system.se_play($data_system.cursor_se)
        @index = (@index - 1) % @item_max
      end
    end
  end
end
Instructions are in the script header. Enjoy ~

 - Zeriab
« Last Edit: August 23, 2007, 03:45:03 PM by Zeriab »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
This is a nice little enhancement. I like it.

*
A Random Custom Title
Rep:
Level 96
wah
I don't get what it does because I haven't tried it out yet :V

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
I'm using MOG's CMS,
so probably I won't be using it
But! I tried it, and....it's cool!

I don't get what it does because I haven't tried it out yet :V
Read the Description on the first script.
Be kind, everyone you meet is fighting a hard battle.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
I'm glad you all liked it ^_^

I have no idea whether it has any effect on MOG's CMS or not. Maybe it will have a bad effect? I do not know.
Maybe you could try the class version? Tell me what effect it have. Oh, and naturally remember to have a back-up

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Why the hell isn't this in the database!?

Nice script, like the idea :)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Nobody will think poorly of you if you move your own script into the database Zeriab. Do it for the children.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Oh, uhm.... This is just a little snippet. Didn't think it was good enough to put in the database :P
Maybe I underestimated its usefulness?

Anyway since you guys want it moved I'll move it ^_^

*
Rep: +0/-0Level 10
RMRK Junior
X-linked fkw.lwmy.rmrk.net.jlf.gc improved, ripe parrotbeaked propecia for sale online propecia rumalaya buy lasix viagra viagra generic cialis canada www.cialis.com retino-a cream soaked says gonadotrophins <a href="http://robots2doss.org/propecia-online/">buy propecia</a> <a href="http://telugustoday.com/rumalaya/">rumalaya forte for sale</a> <a href="http://robots2doss.org/lasix-no-prescription/">lasix without a prescription</a> <a href="http://detroitcoralfarms.com/viagra-pills/">buy viagra on line</a> <a href="http://ralstoncommunity.org/cialis/">tadalafil 20 mg</a> <a href="http://ivapelocal.com/cialis-generic/">www.cialis.com</a> cialis <a href="http://huekymigia.com/retino-a-cream/">retino-a cream lowest price</a> valproate; incompatible forgotten http://robots2doss.org/propecia-online/ buy propecia http://telugustoday.com/rumalaya/ cheapest rumalaya liniment http://robots2doss.org/lasix-no-prescription/ lasix without rx http://detroitcoralfarms.com/viagra-pills/ viagra pills http://ralstoncommunity.org/cialis/ cialis http://ivapelocal.com/cialis-generic/ 20mg cialis http://huekymigia.com/retino-a-cream/ retino-a cream equitably strip.