The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: Ahnez67 on March 06, 2011, 03:01:15 AM

Title: Shop Input Expansion
Post by: Ahnez67 on March 06, 2011, 03:01:15 AM
Shop Input Expansion
Version: 1.0b
Author: Ahnez67
Date: 03.06.2011

Version History




Planned Future Versions


Description



This Script adds 4 new features to the Shop's Number Input. By default, you can buy up to 99 itens at the same time (100+ if you're using my Inventory: Breaking Limits (http://rmrk.net/index.php/topic,41732.0.html) Script).
You can select how many items you want to buy, adding ou subtracting 1/10 units per time. But, if your limit is 9,999, then it will take forever, knowing that you can only add 10 units at the same time.
With this script, you can Add/ Subtract 100 units at same time. Or even skiping all this work, pressing Left when the number of items is 1.

Features


Screenshots are useless here

Instructions

Paste it above Main, but below the Default Scripts. Then, if you're using the Breaking Limit Script, and the limit is 100 or highter, set the HUND_ITEM (line 28) to true.
And it's ready.
Read the Header for further information

Script




#############################################################################
#-------------------------------AHNEZ67-------------------------------------#
#-------------------------|SHOP INPUT EXPANSION|---------------------------#
#---------------------------------------------------------------------------#
#############################################################################
#------------------------------|Description|--------------------------------#
# You can change the Shop Input options (The number of itens you can buy at #
#the same time)-------------------------------------------------------------#
#By defaut, there are 4 inputs, Right and Left, that increases(or decreases)#
#the value by 1. And Up/Down, that increases/decreases the value by 10------#
#With this script, you can increase or decrease the value by 100 (if you're #
#using my "Inventory: Breaking Limits" Script), and, you can set it directly#
#to the max limit, or to the minimal (normally 1) pressing Right or Left    #
#when the value is equal to 1 or equal to the limit-------------------------#
#------------------------------|Instructions|-------------------------------#
#Paste this script above main, and below the Default Scripts----------------#
#Set the "HUND_ITEM" to true ONLY IF YOU'RE USING MY "INVENTORY: BREAKING   # 
#lIMITS" SCRIPT-------------------------------------------------------------#
#There are only 4 new functions to the Shop's number selection.
#Input X (Letter A [Keyboard]) = Add 100
#Input Y (Letter S [Keyboard]) = Subtracts 100
#Input Right (When number of itens = limit of itens) = Resets to 1
#Input Left (When number of itens = 1) = Set number of itens to max

##EDITABLE REGION##
module AHNEZVAR
  module HYAKU
  HUND_ITEM = false #If False, X and Y commands will not work
  end
end
##EDITABLE REGION##
 
class Window_ShopNumber < Window_Base
  def update
    super
    if self.active
      last_number = @number
      if Input.repeat?(Input::RIGHT) and @number < @max
        @number += 1
      elsif Input.repeat?(Input::RIGHT) and @number = @max
        @number = 1
      end
      if Input.repeat?(Input::LEFT) and @number > 1
        @number -= 1
      elsif Input.repeat?(Input::LEFT) and @number = 1
        @number = @max
      end
      if Input.repeat?(Input::UP) and @number < @max
        @number = [@number + 10, @max].min
      end
      if Input.repeat?(Input::DOWN) and @number > 1
        @number = [@number - 10, 1].max
      end
      if Input.repeat?(Input::X) and @number < @max and AHNEZVAR::HYAKU::HUND_ITEM
        @number = [@number + 100, @max].min
      end
      if Input.repeat?(Input::Y) and @number > 1 and AHNEZVAR::HYAKU::HUND_ITEM
        @number = [number - 100, @max].min
        if @number < 1
          @number = 1
        end
      end
      if @number != last_number
        Sound.play_cursor
        refresh
      end
    end
  end
end


Credit





Support



Post here if you encounter any problem with this script

Known Compatibility Issues

None know

Demo



There's no Demo version of this Script. It's not really necessary for such simple Script.

---------------------------------------------------------------------------------------
No credits needed. But it was made by me.
Commercial and non-Commercial games are all the same for me. You are free to use and edit it as you wish
Title: Re: Shop Input Expansion
Post by: modern algebra on March 07, 2011, 11:41:52 PM
Well, this goes well with your other script and I suppose it will be useful for any games that do have huge item capacities. Nice work!
Title: Re: Shop Input Expansion
Post by: Infinate X on March 17, 2011, 05:41:39 PM
nice script