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

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[vx] Script Off

0 Members and 1 Guest are viewing this topic.

****
Rep:
Level 69
 If I'm having compatibility issues, is there any way to turn off certain scripts for a short period of time using a switch and small tweak in code?
Code: [Select]
#===============================================================================
#
# Cozziekuns Simple Sort Inventory
# Last Date Updated: 09/06/10
#
# Like in Tales of Phantasia, this inventory allows you to sort your items in
# the categories: All, Items, Weapons and Armours.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 06/01/10 - Created Script.
# o 06/01/10 - Updated with Modern Algebra's recommendations.
# o 06/01/10 - Once again updated with Modern Algebra's recommendations.
# o 08/27/10 - Updated with Scrolling support. Thanks kawagiri for the idea, and
# Modern Algebra for some help.
# o 09/06/10 - Updated with some bugfixing. Thanks Fizzly for finding that out.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Change the modules to your liking. The "hard" parts have instructions of their
# own.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozSimplSortInvent"] = true

module COZZIEKUNS
module SSI
CATEGORY_TEXT = "Category:"

#===============================================================================
# Extra Item Categories (Inspired by Modern Algebra)
# ------------------------------------------------------------------------------
# How should I go about explaining something like this? Well, basically, each
# item in the hash represents a certain category. For example, the first hash we
# see here is:
#
# 0 => [144, "All", false]
#
# The syntax of this is:
#
# Category ID => [Icon Number, Text, Prime]
#
# Probably the most important part, the category ID is the number you want to
# put into the notebox that the item contains. For example, if you wanted to
# make the item "World Map" into a key item, simply add the text:
#
# \item_category[4]
#
# into the notebox. Note that numbers 0, 1, 2, and 3 are special. They're prime
# categories. Sound special right? Not really, this just means you have to have
# them in the inventory for this script to work. I could've gotten rid of them,
# but that would've just given more work on your part (and mine), so bear with
# them, please. Icon Numbers and Text are pretty self explanatory.
#
# Last, but not least, is the "Prime" function (inspired by Kyraiki). Setting
# this to "true" means that anything in the prime category will not show up in
# the item, weapon or armour categories. You can set if you want it to show up
# in all.
#===============================================================================
MOD_ALG_ITEM_CATEGORIES = {

0 => [144, "All", false],
1 => [64, "Items", false],
2 => [26, "Weapons", false],
3 => [40, "Armours", false],
4 => [80, "Key Items", true],
5 => [90, "Filler", false],
6 => [92, "Scrolling", false],
7 => [32, "Scrolling", false],
}

MOD_ALG_ITEM_CATEGORY_WIDTH = 220 # How wide you want your text window.
KYRIAKI_ALL_CATEOGRY_PRIME = false # If you want prime key items to show up in the all window.
MAX_NUMBER = (544 - MOD_ALG_ITEM_CATEGORY_WIDTH) / 54 # The maximum number of icons that will fit.
end
end

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# The superclass of all states.
#==============================================================================

class RPG::BaseItem
#--------------------------------------------------------------------------
# * Cozziekuns Category Index
#--------------------------------------------------------------------------
def coz_modalg_category_index
@coz_modalg_category_index = 0
if self.note[/\\item_category\[(\d+)]/i] != nil
@coz_modalg_category_index = $1.to_i
end
return @coz_modalg_category_index
end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias coz_modalg_ssi_refresh refresh
def refresh(sort_index = 0)
@sort_index = sort_index
coz_modalg_ssi_refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
alias coz_modalg_ssi_include? include?
def include?(item)
val = coz_modalg_ssi_include?(item)
return false if !val
return case @sort_index
when 0
unless COZZIEKUNS::SSI::KYRIAKI_ALL_CATEOGRY_PRIME
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return true
end
else
return true
end
when 1
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Item)
end
when 2
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Weapon)
end
when 3
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Armor)
end
when 4..999
return item.coz_modalg_category_index == @sort_index
end
end
end

#==============================================================================
# ** Window_ItemCategory
#------------------------------------------------------------------------------
# This window displays what type of item is being displayed.
#==============================================================================

class Window_ItemCategory < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
@item_categories_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
@category_string = COZZIEKUNS::SSI::CATEGORY_TEXT
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, @item_categories_width - 40, WLH, @category_string, 0)
self.contents.font.color = normal_color
for i in 0...@item_categories.size
if @sort_index == i
self.contents.draw_text(4, 0, @item_categories_width - 40, WLH, @item_categories[i][1], 2)
end
end
end
end

#==============================================================================
# ** Window_ItemSort
#------------------------------------------------------------------------------
# This window displays what type of item is being displayed.
#==============================================================================

class Window_ItemSort < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
@ox = 0
if COZZIEKUNS::SSI::MAX_NUMBER < COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES.size
self.contents = Bitmap.new(self.width - 32 + ((COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES.size - COZZIEKUNS::SSI::MAX_NUMBER) * 54), self.height - 32)
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
@item_categories_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
self.contents.clear
for i in 0...@item_categories.size
@icon_x = 0 + (i * ((544 - @item_categories_width) / @item_categories.size))
if @item_categories.size < COZZIEKUNS::SSI::MAX_NUMBER
draw_item(i)
else
draw_items(i)
end
if @sort_index == i
if @item_categories.size < COZZIEKUNS::SSI::MAX_NUMBER
draw_icon(@item_categories[i][0], @icon_x, 0, true)
else
draw_icon(@item_categories[i][0], i * 54, 0, true)
end
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
icons_x = (544 - @item_categories_width) / @item_categories.size
draw_icon(@item_categories[index][0], index * icons_x, 0, false)
end
#--------------------------------------------------------------------------
# * Draw Items
# index : item number
#--------------------------------------------------------------------------
def draw_items(index)
draw_icon(@item_categories[index][0], index * 54, 0, false)
end
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 112, 544, 304)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@category_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
@category_window = Window_ItemCategory.new(544 - @category_width, 56, @category_width)
@sort_window = Window_ItemSort.new(0, 56, 544 - @category_width)
@target_window = Window_MenuStatus.new(0, 0)
@sort_index = 0
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias coz_ssi_terminate terminate
def terminate
super
coz_ssi_terminate
@sort_window.dispose
@category_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
alias coz_ssi_update update
def update
super
coz_ssi_update
@sort_window.update
@category_window.update
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::Y)
@sort_index += 1
@sort_index %= @item_categories.size
if @sort_index != 0
if @item_categories.size > COZZIEKUNS::SSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSI::MAX_NUMBER - 1
@sort_window.ox += 54
end
else
@sort_window.ox = 0end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@item_window.refresh(@sort_index)
@item_window.index = 0
Sound.play_cursor
elsif Input.trigger?(Input::A)
@sort_index -= 1
@sort_index %= @item_categories.size
if @sort_index + 1 == @item_categories.size
@sort_window.ox += 54 * (@item_categories.size - COZZIEKUNS::SSI::MAX_NUMBER)
else
if @item_categories.size > COZZIEKUNS::SSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSI::MAX_NUMBER - 2
@sort_window.ox -= 54
end
end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@item_window.refresh(@sort_index)
@item_window.index = 0
Sound.play_cursor
end
end
end


*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Put a line at the beginning of a script that reads
=begin
and one at the end that reads
=end
And if you want to turn it back on, just comment out those two lines with #s.
it's like a metaphor or something i don't know

****
Rep:
Level 69
Sorry I should have specified, what should I change in the code where I can turn it on and off with in-game switch?
 Basically I have a code that upgrades damage of weapons, but when I bring up the menu for it(when testing), the item sort menu prevents it from working.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Code: [Select]
if $game_switches[SWITCH_ID]
  script
end
Yeah.
it's like a metaphor or something i don't know

****
Rep:
Level 69

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Right, I know you understand scripts at least a little, so put a
Code: [Select]
if $game_switches[ID]
Inside every class, and an end before the end of the class.
it's like a metaphor or something i don't know

****
Rep:
Level 69
It's being mean again..

what did i mess up? all i know is that line 93 is the first part i put the switch lol
Code: [Select]
#===============================================================================
#
# Cozziekuns Simple Sort Inventory
# Last Date Updated: 09/06/10
#
# Like in Tales of Phantasia, this inventory allows you to sort your items in
# the categories: All, Items, Weapons and Armours.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 06/01/10 - Created Script.
# o 06/01/10 - Updated with Modern Algebra's recommendations.
# o 06/01/10 - Once again updated with Modern Algebra's recommendations.
# o 08/27/10 - Updated with Scrolling support. Thanks kawagiri for the idea, and
# Modern Algebra for some help.
# o 09/06/10 - Updated with some bugfixing. Thanks Fizzly for finding that out.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Change the modules to your liking. The "hard" parts have instructions of their
# own.
#===============================================================================
$imported = {} if $imported == nil
$imported["CozSimplSortInvent"] = true

module COZZIEKUNS
module SSI
CATEGORY_TEXT = "Category:"

#===============================================================================
# Extra Item Categories (Inspired by Modern Algebra)
# ------------------------------------------------------------------------------
# How should I go about explaining something like this? Well, basically, each
# item in the hash represents a certain category. For example, the first hash we
# see here is:
#
# 0 => [144, "All", false]
#
# The syntax of this is:
#
# Category ID => [Icon Number, Text, Prime]
#
# Probably the most important part, the category ID is the number you want to
# put into the notebox that the item contains. For example, if you wanted to
# make the item "World Map" into a key item, simply add the text:
#
# \item_category[4]
#
# into the notebox. Note that numbers 0, 1, 2, and 3 are special. They're prime
# categories. Sound special right? Not really, this just means you have to have
# them in the inventory for this script to work. I could've gotten rid of them,
# but that would've just given more work on your part (and mine), so bear with
# them, please. Icon Numbers and Text are pretty self explanatory.
#
# Last, but not least, is the "Prime" function (inspired by Kyraiki). Setting
# this to "true" means that anything in the prime category will not show up in
# the item, weapon or armour categories. You can set if you want it to show up
# in all.
#===============================================================================
MOD_ALG_ITEM_CATEGORIES = {

0 => [144, "All", false],
1 => [64, "Items", false],
2 => [26, "Weapons", false],
3 => [40, "Armours", false],
4 => [80, "Key Items", true],
5 => [90, "Filler", false],
6 => [92, "Scrolling", false],
7 => [32, "Scrolling", false],
}

MOD_ALG_ITEM_CATEGORY_WIDTH = 220 # How wide you want your text window.
KYRIAKI_ALL_CATEOGRY_PRIME = false # If you want prime key items to show up in the all window.
MAX_NUMBER = (544 - MOD_ALG_ITEM_CATEGORY_WIDTH) / 54 # The maximum number of icons that will fit.
end
end

#==============================================================================
# ** RPG::BaseItem
#------------------------------------------------------------------------------
# The superclass of all states.
#==============================================================================

class RPG::BaseItem
if $game_switches[0267]
#--------------------------------------------------------------------------
# * Cozziekuns Category Index
#--------------------------------------------------------------------------
def coz_modalg_category_index
@coz_modalg_category_index = 0
if self.note[/\\item_category\[(\d+)]/i] != nil
@coz_modalg_category_index = $1.to_i
end
return @coz_modalg_category_index
end
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
if $game_switches[0267]
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias coz_modalg_ssi_refresh refresh
def refresh(sort_index = 0)
@sort_index = sort_index
coz_modalg_ssi_refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
alias coz_modalg_ssi_include? include?
def include?(item)
val = coz_modalg_ssi_include?(item)
return false if !val
return case @sort_index
when 0
unless COZZIEKUNS::SSI::KYRIAKI_ALL_CATEOGRY_PRIME
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return true
end
else
return true
end
when 1
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Item)
end
when 2
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Weapon)
end
when 3
if COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES[item.coz_modalg_category_index][2]
return false
else
return item.is_a?(RPG::Armor)
end
when 4..999
return item.coz_modalg_category_index == @sort_index
end
end
end
end
#==============================================================================# ** Window_ItemCategory
#------------------------------------------------------------------------------
# This window displays what type of item is being displayed.
#==============================================================================

class Window_ItemCategory < Window_Base
if $game_switches[0267]
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
@item_categories_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
@category_string = COZZIEKUNS::SSI::CATEGORY_TEXT
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, @item_categories_width - 40, WLH, @category_string, 0)
self.contents.font.color = normal_color
for i in 0...@item_categories.size
if @sort_index == i
self.contents.draw_text(4, 0, @item_categories_width - 40, WLH, @item_categories[i][1], 2)
end
end
end
end
end
#==============================================================================
# ** Window_ItemSort
#------------------------------------------------------------------------------
# This window displays what type of item is being displayed.
#==============================================================================

class Window_ItemSort < Window_Base
if $game_switches[0267]
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width)
super(x, y, width, WLH + 32)
@ox = 0
if COZZIEKUNS::SSI::MAX_NUMBER < COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES.size
self.contents = Bitmap.new(self.width - 32 + ((COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES.size - COZZIEKUNS::SSI::MAX_NUMBER) * 54), self.height - 32)
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(sort_index = 0)
@sort_index = sort_index
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
@item_categories_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
self.contents.clear
for i in 0...@item_categories.size
@icon_x = 0 + (i * ((544 - @item_categories_width) / @item_categories.size))
if @item_categories.size < COZZIEKUNS::SSI::MAX_NUMBER
draw_item(i)
else
draw_items(i)
end
if @sort_index == i
if @item_categories.size < COZZIEKUNS::SSI::MAX_NUMBER
draw_icon(@item_categories[i][0], @icon_x, 0, true)
else
draw_icon(@item_categories[i][0], i * 54, 0, true)
end
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
icons_x = (544 - @item_categories_width) / @item_categories.size
draw_icon(@item_categories[index][0], index * icons_x, 0, false)
end
#--------------------------------------------------------------------------
# * Draw Items
# index : item number
#--------------------------------------------------------------------------
def draw_items(index)
draw_icon(@item_categories[index][0], index * 54, 0, false)
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
if $game_switches[0267]
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 112, 544, 304)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@category_width = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORY_WIDTH
@category_window = Window_ItemCategory.new(544 - @category_width, 56, @category_width)
@sort_window = Window_ItemSort.new(0, 56, 544 - @category_width)
@target_window = Window_MenuStatus.new(0, 0)
@sort_index = 0
@item_categories = COZZIEKUNS::SSI::MOD_ALG_ITEM_CATEGORIES
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias coz_ssi_terminate terminate
def terminate
super
coz_ssi_terminate
@sort_window.dispose
@category_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
alias coz_ssi_update update
def update
super
coz_ssi_update
@sort_window.update
@category_window.update
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::Y)
@sort_index += 1
@sort_index %= @item_categories.size
if @sort_index != 0
if @item_categories.size > COZZIEKUNS::SSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSI::MAX_NUMBER - 1
@sort_window.ox += 54
end
else
@sort_window.ox = 0
end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@item_window.refresh(@sort_index)
@item_window.index = 0
Sound.play_cursor
elsif Input.trigger?(Input::A)
@sort_index -= 1
@sort_index %= @item_categories.size
if @sort_index + 1 == @item_categories.size
@sort_window.ox += 54 * (@item_categories.size - COZZIEKUNS::SSI::MAX_NUMBER)
else
if @item_categories.size > COZZIEKUNS::SSI::MAX_NUMBER and @sort_index > COZZIEKUNS::SSI::MAX_NUMBER - 2
@sort_window.ox -= 54
end
end
@category_window.refresh(@sort_index)
@sort_window.refresh(@sort_index)
@item_window.refresh(@sort_index)
@item_window.index = 0
Sound.play_cursor
end
end
end
end

*
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
That wouldn't work Pacman - (a) $game_switches wouldn't be initialized yet; and (b) even if it had been, that would just prevent the scripts from being interpreted at all.

He would need to go through every method and prevent the operation of each method with the switch check but let the aliased method still be called. However, there are also parts of that script where things have been redefined, so he would need a stronger knowledge of scripting to know what to do.

You probably need a scripter to do this for you Scalinger. I would, but I'm busy at the moment. Try posting in the script topic though - I'm sure cozzie would be willing to help.

I think the bigger problem is probably why you want to turn the script "off". When is it preferable to avoid having categories in a game where there are categories? If it's a script incompatibility, then the far better solution would be to address the incompatibility, rather than simply turning it off.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
MA's right; I'd be more than happy to fix something simple like an incompatability. What seems to be the problem?

****
Rep:
Level 69
http://www.rpgrevolution.com/forums/index.php?showtopic=19618&hl=OECS
im obsessed with trying to get the OECS script to work with everything xD
basically the problem is the easy sort inv script clashes when it comes to the OECS eq. upgrade system because normally, the weapons in inventory, enchant items needed, and price usualy show up but they dont with both scripts used. I bring up the upgrade menu with the script call in the code.
I made a new game and added scripts one by one so I'm sure it's that specific script. I basically wanted to turn off the sort menu just so the upgrade was accessible.

without inv sort

with

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
I can't access and download the script even when I'm logged in. Can you post the script?

****
Rep:
Level 69
Code: [Select]
#===============================================================================
#              *** Omega Equipment Customizations Scripts Main ***
#-------------------------------------------------------------------------------
=begin

  This script is required for all OECS scripts. This script changes the way you
  deal with your equipment by a bit. instead of buying 10 clubs at the same time,
  you must buy the clubs one by one(which is a small price to pay, since no one
  really buys equipment at large quantities). this is for the functionality of
  all OECS scripts.
 
  There are options below.
 
=end

#==============================================================================
# ** OECS
#------------------------------------------------------------------------------
#  a module for Omega Equipment Customization Scripts
#==============================================================================
module OECS
  #--------------------------------------------------------------------------
  # * The Only Options in main
  #--------------------------------------------------------------------------
  # asked when you buy a single item
  BuySingleItem = 'Buy Item?'
  # Confirm buy single equipment
  AgreeBuySingleItem = 'Buy'
  DisagreeBuySingleItem = 'No'

  # since all equipment are separated, this option removes the quantity indicator
  # ": 1" since it would always be like that.
  RemoveQuantityCountOnEquip = true
=begin

  IMPORTANT: when you edit the database for weapons/armors and then load a save
  file, the loaded file will be corrupted. when using this script please
  create a save file for your games only after either the game or just the
  equipment database is finished.
 
  the above applies to items if you have the materia system.
=end 

#==============================================================================#
################################################################################
#==============================================================================#
  #--------------------------------------------------------------------------
  # * The Main Creation of Equipment
  #--------------------------------------------------------------------------
  def self.create(item, has_prefix, has_suffix, prefix_manual = nil, suffix_manual = nil)
    temp_item = item.dup
    temp_item.id = temp_item.is_a?(RPG::Weapon) ? $data_weapons.size : $data_armors.size
    if OECS.constants.include?("EPSS")
      temp_item = OECS::EPSS.prefix_suffix(temp_item, has_prefix, has_suffix, prefix_manual, suffix_manual)
    end
    if OECS.constants.include?("SLOT")
      possible_slots = item.possible_slots
      if possible_slots.is_a?(Integer)
        temp_item.slots = possible_slots
      else
        slot_diff = rand(possible_slots[1] - possible_slots[0] + 1)
        temp_item.slots = possible_slots[1] - slot_diff
      end
    end
    temp_item.upgrade_level = 0 if OECS.constants.include?("Upgrade")
    if item.is_a?(RPG::Weapon)      index = $data_weapons.size
      $data_weapons.push(temp_item)
      for i in 1...$data_classes.size
        if $data_classes[i].weapon_set.include?(item.id)
          $data_classes[i].weapon_set.push(temp_item.id)
        end
      end
    else
      index = $data_armors.size
      $data_armors.push(temp_item)
      for i in 1...$data_classes.size
        if $data_classes[i].armor_set.include?(item.id)
          $data_classes[i].armor_set.push(temp_item.id)
        end
      end
    end

#~     temp_item.mother_item_id = item.id
    return temp_item.id
  end
  #--------------------------------------------------------------------------
  # * Item Version of the above
  #--------------------------------------------------------------------------
  def self.item_create(item, materia_birth = false)
    temp_item = item.dup
    temp_item.id = $data_items.size
    OECS::Materia.reset_materia(temp_item) if OECS.constants.include?("Materia")
    $data_items.push(temp_item)
    return temp_item.id
  end

end

$oz_script = {} if $oz_script == nil
$oz_script["OECS"] = true

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Display Gained Drop Items
  #--------------------------------------------------------------------------
  def display_drop_items
    drop_items = $game_troop.make_drop_items
    for item in drop_items
      if item.is_a?(RPG::Weapon)
        has_prefix, has_suffix = false, false
        if OECS.constants.include?("EPSS")
          has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
          has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
          has_prefix, has_suffix = false, false if item.note.include?("<unique>")
          has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
        end
        index = OECS.create(item, has_prefix, has_suffix)
        item = $data_weapons[index]
      elsif item.is_a?(RPG::Armor)
        has_prefix, has_suffix = false, false
        if OECS.constants.include?("EPSS")
          has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
          has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
          has_prefix, has_suffix = false, false if item.note.include?("<unique>")
          has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEnemy
        end
        index = OECS.create(item, has_prefix, has_suffix)
        item = $data_armors[index]
      end
      $game_party.gain_item(item, 1)
      text = sprintf(Vocab::ObtainItem, item.name)
      $game_message.texts.push(text)
    end
    wait_for_message
  end

end

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Change Weapons
  #--------------------------------------------------------------------------
  def command_127
    value = operate_value(@params[1], @params[2], @params[3])
    for i in 0...value
      has_prefix, has_suffix = false, false
      if OECS.constants.include?("EPSS")
        has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
        has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
        has_prefix = false if $data_weapons[@params[0]].note.include?("<unique>")
        has_suffix = false if $data_weapons[@params[0]].note.include?("<unique>")
        has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEvent
      end 
      index = OECS.create($data_weapons[@params[0]], has_prefix, has_suffix)
      $game_party.gain_item($data_weapons[index], 1, @params[4])
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Change Armors
  #--------------------------------------------------------------------------
  def command_128
    value = operate_value(@params[1], @params[2], @params[3])
    for i in 0...value
      has_prefix, has_suffix = false, false
      if OECS.constants.include?("EPSS")
        has_prefix = rand(100) < OECS::EPSS::HavePrefixChance
        has_suffix = rand(100) < OECS::EPSS::HaveSuffixChance
        has_prefix = false if $data_armors[@params[0]].note.include?("<unique>")
        has_suffix = false if $data_armors[@params[0]].note.include?("<unique>")
        has_prefix, has_suffix = false, false unless OECS::EPSS::GainWordedItemsFromEvent
      end 
      index = OECS.create($data_armors[@params[0]], has_prefix, has_suffix)
      $game_party.gain_item($data_armors[index], 1, @params[4])
    end
    return true
  end
 
end


#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop
  alias oz_oecs_main_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------  def update
    oz_oecs_main_update
    if @buy_confirm_window != nil
      update_buy_confirm
    end
  end
  #--------------------------------------------------------------------------
  # * Update Buy Confirmation
  #--------------------------------------------------------------------------
  def update_buy_confirm
    @buy_confirm_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @buy_window.active = true
      @buy_window.visible = true
      @buy_confirm_window.dispose
      @buy_confirm_window = nil
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      if @buy_confirm_window.index == 1
        Sound.play_shop
        index = OECS.create(@item, false, false)
        @item = @item.is_a?(RPG::Weapon) ? $data_weapons[index] : $data_armors[index]
        $game_party.lose_gold(@item.price)
        $game_party.gain_item(@item, 1)
        @gold_window.refresh
        @buy_window.refresh
        @status_window.refresh
      end
      @buy_window.active = true
      @buy_window.visible = true
      @buy_confirm_window.dispose
      @buy_confirm_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Update Buy Item Selection
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or number == 99
        Sound.play_buzzer
      elsif @item.is_a?(RPG::Weapon) or @item.is_a?(RPG::Armor)
        Sound.play_decision
        @buy_confirm_window = Window_ShopConfirmBuy.new(0, 112, @item)
        @buy_confirm_window.active = true
        @buy_window.active = false
        @buy_window.visible = false
      else
        Sound.play_decision
        max = @item.price == 0 ? 99 : $game_party.gold / @item.price
        max = [max, 99 - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end

end


#==============================================================================
# ** Window_ShopConfirmBuy
#------------------------------------------------------------------------------
#  This window confirms if the player will buy an item.
#==============================================================================

class Window_ShopConfirmBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, item, prefix = nil, suffix = nil)
    @prefix = prefix
    @suffix = suffix
    row_max = 2
    super(x, y, 304, 304, 32)
    @commands = [OECS::AgreeBuySingleItem, OECS::DisagreeBuySingleItem]
    @item_max = 2
    @column_max = 2
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
    self.index = 0
    self.contents.draw_text(0, 50, width - 32, 24, OECS::BuySingleItem, 0)
    draw_item_name(item, 0, 100)
  end
  #--------------------------------------------------------------------------
  # * Get rectangle for displaying items
  #     index : item number
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = WLH
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * WLH + 160
    return rect
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 10
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, @commands[index], 1)
  end
  #--------------------------------------------------------------------------
  # * Draw Item Name
  #     item    : Item (skill, weapon, armor are also possible)
  #     x       : draw spot x-coordinate
  #     y       : draw spot y-coordinate
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true)
    if item != nil
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      prefix = @prefix == nil ? '' : @prefix + ' '
      suffix = @suffix == nil ? '' : ' ' + @suffix
      name = prefix + item.name + suffix
      self.contents.draw_text(x + 24, y, 172, WLH, name)
    end
  end
 
end

#==============================================================================
# ** OECS::EquipInclude
#------------------------------------------------------------------------------
#  a module for performing mix-ins in all types equipment
#==============================================================================

module OECS::EquipInclude
  attr_accessor :mother_item_id
  alias oecs_main_dup dup
  def dup
    duplicate = self.oecs_main_dup
    perform_duplication(duplicate)
    return duplicate
  end
  # separated for aliasing
  def perform_duplication(duplicate)
    duplicate.element_set = self.element_set.dup
    duplicate.state_set = self.state_set.dup
  end
end
#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#==============================================================================

module RPG
 
  #============================================================================  # ** RPG::Weapon
  #----------------------------------------------------------------------------
  #  Data class for Weapons.
  #============================================================================
 
  class Weapon
    #------------------------------------------------------------------------
    # * Perform mix-in
    #------------------------------------------------------------------------
    include OECS::EquipInclude
    def mother_item
      return $data_weapons[@mother_item_id]
    end
  end
 
  #============================================================================
  # ** RPG::Armor
  #----------------------------------------------------------------------------
  #  Data class for Armors.
  #============================================================================
  class Armor
    #------------------------------------------------------------------------
    # * Perform mix-in
    #------------------------------------------------------------------------
    include OECS::EquipInclude
    def mother_item
      return $data_armors[@mother_item_id]
    end
  end
 
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Alias List
  #--------------------------------------------------------------------------
  alias oz_oecs_main_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    oz_oecs_main_setup(actor_id)
    if @weapon_id != 0
      @weapon_id = OECS.create($data_weapons[@weapon_id], false, false)
      actor.weapon_id = @weapon_id
    end
    if @armor1_id != 0
      if two_swords_style
        @armor1_id = OECS.create($data_armors[@armor1_id], false, false)
      else
        @armor1_id = OECS.create($data_armors[@armor1_id], false, false)
      end
      actor.armor1_id = @armor1_id
    end
    if @armor2_id != 0
      @armor2_id = OECS.create($data_armors[@armor2_id], false, false)
      actor.armor2_id = @armor2_id
    end
    if @armor3_id != 0
      @armor3_id = OECS.create($data_armors[@armor3_id], false, false)
      actor.armor3_id = @armor3_id
    end
    if @armor4_id != 0
      @armor4_id = OECS.create($data_armors[@armor4_id], false, false)
      actor.armor4_id = @armor4_id
    end
  end
 
  def iterate_equips
    yield $data_weapons[@weapon_id] unless @weapon_id == 0 or @weapon_id == nil
    unless two_swords_style
      yield $data_armors[@armor1_id] unless @armor1_id == 0 or @armor1_id == nil
    else
      yield $data_weapons[@armor1_id] unless @armor1_id == 0 or @armor1_id == nil
    end
    yield $data_armors[@armor2_id] unless @armor2_id == 0 or @armor2_id == nil
    yield $data_armors[@armor3_id] unless @armor3_id == 0 or @armor3_id == nil
    yield $data_armors[@armor4_id] unless @armor4_id == 0 or @armor4_id == nil
  end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Alias List
  #--------------------------------------------------------------------------
  alias oz_oecs_main_start start
  alias oz_oecs_load_bt_database load_bt_database
  def load_bt_database
    oz_oecs_load_bt_database
    initialize_oecs
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    oz_oecs_main_start
    initialize_oecs
  end
  #--------------------------------------------------------------------------
  # * Initialize OECS script
  #--------------------------------------------------------------------------
  def initialize_oecs
    for equipment in ($data_weapons + $data_armors).compact
      equipment.mother_item_id = equipment.id
    end
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File
  #--------------------------------------------------------------------------
  # * Alias List
  #--------------------------------------------------------------------------
  alias oz_oecs_main_write_save_data write_save_data
  alias oz_oecs_main_read_save_data read_save_data
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    oz_oecs_main_write_save_data(file)
    Marshal.dump($data_weapons, file)
    Marshal.dump($data_armors,  file)
    Marshal.dump($data_classes, file)
  end
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    oz_oecs_main_read_save_data(file)
    $data_weapons = Marshal.load(file)
    $data_armors  = Marshal.load(file)
    $data_classes = Marshal.load(file)
  end
 
end

class Window_CommandWithQuestion < Window_Command
  def initialize(width, question, commands)
    @question = question
    super(width, commands)
    create_contents
    self.height += WLH
    refresh
  end
 
  def question=(question)
    @question = question
    refresh
  end
 
  def refresh
    super
    self.contents.draw_text(0, 0, width - 32, WLH, @question, 1)
  end

  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = WLH
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * WLH + WLH
    return rect
  end
 
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32, [height - 32, (row_max + 1) * WLH].max)
  end
end

if OECS::RemoveQuantityCountOnEquip
  class Window_Item
    def draw_item(index)
      rect = item_rect(index)
      self.contents.clear_rect(rect)
      item = @data[index]
      if item != nil
        number = $game_party.item_number(item)
        enabled = enable?(item)
        rect.width -= 4
        draw_item_name(item, rect.x, rect.y, enabled)
        self.contents.draw_text(rect, sprintf(":%2d", number), 2) unless item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
      end
    end
  end
end

            

****
Rep:
Level 69
Code: [Select]
#===============================================================================
#  **OECS Equipment Upgrade System v1.1
#-------------------------------------------------------------------------------
#  This script allows you to have be able to upgrade equipment. giving it more
#  power each upgrade.
#
#  Put script above main, below OECS main
#===============================================================================
=begin
  Instructions:
  Set Options below
 
  To call the upgrade shop, type this in the script section
 
  $scene = Scene_EquipmentUpgradeShop.new
 
=end

#==============================================================================
# ** OECS::Upgrade
#------------------------------------------------------------------------------
#  A module for OECS Equipment Upgrade System Options
#==============================================================================

module OECS
module Upgrade
 
  # OPTIONS:
    # Max upgrade level for equipments
  MaxEqLevel = 7
  # upgrade price ratio in %
  UpgradePriceRatio = 10
  # besides the upgrade price ratio, this is added to the item's price
  # you may make upgradepriceratio to 0 to make a constant price for all.
  ConstantPricePlus = 100
  # multiply ratio by level, so that it would get more expensive each level
  MultiplyRatioByLevel = true
  # Growth of non-zero parameters of the equipment per plus in %
  ParameterGrowthRatio = 100
  # if an equipment parameter is not equal to 0 this is the minimum
  # value it can increase at an upgrade
  MinimumGrowth = 40
  # Show addition in name i.e. Club+7
  ShowAdditionInName = true
  # terms
  # when equipment is maxed
  EqMaxed = 'level maxed'
  # for those with <cannot_be_upgraded> tag
  CantBeUpgraded = "can't be upgraded"
  # at the top of the shop
  UpgradeShopTerm = 'Upgrade Shop'
  # At the requirements
  RequirementTerm = 'Requires:'
 # at the command window
  WeaponTerm = 'Weapon'
  ArmorTerm =  'Armor'
   # confirmation question
  UpgradeWeaponTerm = 'Upgrade Weapon?'
  UpgradeArmorTerm = 'Upgrade Armor?'
  # confirm choice
  AgreeUpgrade = 'Upgrade'
  DisagreeUpgrade = 'No'
=begin

EQUIPMENT TAGS:

Put these tags on the weapons/armors

  <upgrade_requires: id, id, id >
 
  id is the item id required for equipment to be upgraded.
  you may put as many as you want, and you may  also put duplicates.
 
   <upgrade_price+: val>   

   val is added to the price of the upgrade, besides the calculation from the
   options above.
   
   <upgrade_price*: val>   
   val is multiplied by the equipment's level, then added to the upgrade price
   
   <cant_be_upgraded>
   
   for items that cannot be upgraded.
   
=end
#==============================================================================#
################################################################################
#==============================================================================#
end
end

module RPG
  class Weapon
    alias oecs_upgrade_name name # Need to alias before mixin.
  end
  class Armor
    alias oecs_upgrade_name name
  end
end

#============================================================================
# ** OECS::EquipInclude
#----------------------------------------------------------------------------
#  a module for performing mix-ins in both equipment
#============================================================================
module OECS
module EquipInclude
  #------------------------------------------------------------------------
  # * Public Instance Variables
  #------------------------------------------------------------------------
  attr_accessor :upgrade_level

  def upgrade_plus
    text = self.note.scan(/\<upgrade\_price\+:\s*([0-9]+)\s*\>/)
    text = text[0]
    return 0 if text == nil    return text[0].to_i
  end
  def upgrade_exp    text = self.note.scan(/\<upgrade\_price\*:\s*([0-9]+)\s*\>/)
    text = text[0]
    return 0 if text == nil    return text[0].to_i
  end
 
  if OECS::Upgrade::ShowAdditionInName
    def name
      if @upgrade_level == 0
        return self.oecs_upgrade_name
      else
        temp_name = self.oecs_upgrade_name
        temp_name += ' +' + @upgrade_level.to_s
        return temp_name
      end
    end
  end
 
  def name_no_plus
    return self.oecs_upgrade_name
  end
 
  def upgrade_requires
    hash = {}
    text = self.note.scan(/\<upgrade\_requires:\s*(.+)\s*\>/)
    text = text[0]
    return hash if text == nil
    text = text[0]
    text.split(/[\,\s]/).each do |num|
      num = num.to_i
      hash.keys.include?(num) ? hash[num] += 1 : hash[num] = 1
    end
    return hash
  end
 
end

end


#==============================================================================
# ** Window_UpgradeConfirm
#------------------------------------------------------------------------------
#  This window confirms if the player will upgrade the item.
#==============================================================================

class Window_UpgradeConfirm < Window_Selectable
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :item
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, item)
    row_max = 2
    super(x, y, 300, 304, 32)
    @commands = [OECS::Upgrade::AgreeUpgrade, OECS::Upgrade::DisagreeUpgrade]
    @item_max = 2
    @column_max = 1
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
    @item = item
    self.index = 0
    if @item.is_a?(RPG::Weapon)
      self.contents.draw_text(0, 50, width - 32, 24, OECS::Upgrade::UpgradeWeaponTerm, 0)
    else
      self.contents.draw_text(0, 50, width - 32, 24, OECS::Upgrade::UpgradeArmorTerm, 0)
    end
    draw_item_name(item, 0, 100)
  end  #--------------------------------------------------------------------------
  # * Get rectangle for displaying items
  #     index : item number
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = WLH
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * WLH + 160
    return rect
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index   : item number
  #     enabled : enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 10
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, @commands[index], 1)
  end
  alias oecs_upgrade_draw_item_name draw_item_name
  def draw_item_name(item, x, y, enabled = true)
    oecs_upgrade_draw_item_name(item, x, y, enabled)
    rect = Rect.new(x + 24, y, 245, WLH)
    self.contents.clear_rect(rect)
    self.contents.draw_text(x + 24, y, 240, WLH, item.name) if item != nil
  end
end

#==============================================================================
# ** Scene_EquipmentUpgradeShop
#------------------------------------------------------------------------------
#  This class performs equipment upgrade shop screen processing.
#==============================================================================

class Scene_EquipmentUpgradeShop < Scene_Base  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @help_window.set_text(OECS::Upgrade::UpgradeShopTerm)
    @weapon_window = Window_Upgradeable.new(0, 112, 300, 304, 'weapon')
    @details_window = Window_UpgradeDetails.new
    @details_window.visible = false
    @weapon_window.active = false
    @weapon_window.visible = false
    @weapon_window.help_window = @details_window
    @armor_window = Window_Upgradeable.new(0, 112, 300, 304, 'armor')
    @armor_window.active = false
    @armor_window.visible = false
    @armor_window.help_window = @details_window
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @gold_window.dispose
    @details_window.dispose
    @command_window.dispose
    @dummy_window.dispose
    @weapon_window.dispose
    @armor_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @dummy_window.update
    @gold_window.update
    @weapon_window.update
    @armor_window.update
    @command_window.update
    @details_window.update
    if @command_window.active
      update_command_window
    elsif @weapon_window.active
      update_weapon_window
    elsif @armor_window.active
      update_armor_window
    elsif @confirm_upgrade_window != nil
      update_confirm_upgrade
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_window
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @command_window.index
      when 0
        @weapon_window.active = true
        @weapon_window.visible = true
        @details_window.visible = true
        @dummy_window.visible = false
        @command_window.active = false
      when 1
        @armor_window.active = true
        @armor_window.visible = true
        @details_window.visible = true
        @dummy_window.visible = false
        @command_window.active = false
      when 2
        Sound.play_cancel
        $scene = Scene_Map.new
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Weapon Window
  #--------------------------------------------------------------------------
  def update_weapon_window
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @weapon_window.active = false
      @weapon_window.visible = false
      @details_window.visible = false
      @dummy_window.visible = true
      @command_window.active = true
    elsif Input.trigger?(Input::C)
      if @weapon_window.item == nil or not @weapon_window.enable?(@weapon_window.item)
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      @weapon_window.active = false
      @weapon_window.visible = false
      @confirm_upgrade_window = Window_UpgradeConfirm.new(0, 112, @weapon_window.item)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Armor Window
  #--------------------------------------------------------------------------
  def update_armor_window
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @armor_window.active = false
      @armor_window.visible = false
      @details_window.visible = false
      @dummy_window.visible = true
      @command_window.active = true
    elsif Input.trigger?(Input::C)
      if @armor_window.item == nil or not @armor_window.enable?(@armor_window.item)
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      @armor_window.active = false
      @armor_window.visible = false
      @confirm_upgrade_window = Window_UpgradeConfirm.new(0, 112, @armor_window.item)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Upgrade Decision
  #--------------------------------------------------------------------------
  def update_confirm_upgrade
    @confirm_upgrade_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      if @confirm_upgrade_window.item.is_a?(RPG::Weapon)
        @weapon_window.active = true
        @weapon_window.visible = true
      else
        @armor_window.active = true        @armor_window.visible = true
      end
      @confirm_upgrade_window.dispose
      @confirm_upgrade_window = nil
    elsif Input.trigger?(Input::C)
      if @confirm_upgrade_window.index == 0
        upgrade_item(@confirm_upgrade_window.item)
        if @confirm_upgrade_window.item.is_a?(RPG::Weapon) 
          @weapon_window.refresh
        else
          @armor_window.refresh
        end
        @details_window.refresh
      end
      if @confirm_upgrade_window.item.is_a?(RPG::Weapon)
        @weapon_window.active = true
        @weapon_window.visible = true
      else
        @armor_window.active = true        @armor_window.visible = true
      end
      @confirm_upgrade_window.dispose
      @confirm_upgrade_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Process Item Upgrade
  #--------------------------------------------------------------------------
  def upgrade_item(item)
    if item.is_a?(RPG::Weapon)
      $game_party.lose_gold(@weapon_window.upgrade_price(@weapon_window.item))
    else
      $game_party.lose_gold(@armor_window.upgrade_price(@armor_window.item))
    end
    for id in item.upgrade_requires.keys
      $game_party.lose_item($data_items[id], item.upgrade_requires[id])
    end
    item.upgrade_level += 1
    upgrade_params(item)
    @gold_window.refresh
    Sound.play_shop
  end
  #--------------------------------------------------------------------------
  # * Upgrade the item's parameters
  #--------------------------------------------------------------------------
  def upgrade_params(item)
    params_item = item
    unless item.mother_item_id == nil
      params_item = item.is_a?(RPG::Weapon) ? $data_weapons[item.mother_item_id] : $data_armors[item.mother_item_id]
    end
    param = (params_item.atk.to_f*OECS::Upgrade::ParameterGrowthRatio/100).to_i
    param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.atk != 0
    item.atk += param
    param = (params_item.def.to_f*OECS::Upgrade::ParameterGrowthRatio/100).to_i
    param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.def != 0
    item.def += param
    param = (params_item.spi.to_f*OECS::Upgrade::ParameterGrowthRatio/100).to_i
    param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.spi != 0
    item.spi += param
    param = (params_item.agi.to_f*OECS::Upgrade::ParameterGrowthRatio/100).to_i
    param = OECS::Upgrade::MinimumGrowth if param < OECS::Upgrade::MinimumGrowth and params_item.agi != 0
    item.agi += param
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = OECS::Upgrade::WeaponTerm
    s2 = OECS::Upgrade::ArmorTerm
    s3 = Vocab::ShopCancel
    @command_window = Window_Command.new(384, [s1, s2, s3], 3)
    @command_window.y = 56
  end
 
end

#==============================================================================
# ** Window_Upgradeable
#------------------------------------------------------------------------------
#  This window displays a list of inventory items depending on the type
#==============================================================================

class Window_Upgradeable < Window_Item
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x      : window x-coordinate
  #     y      : window y-coordinate
  #     width  : window width
  #     height : window height
  #     type   : item type (weapon or armor)
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, type)
    @type = type
    super(x, y, width, height)
    @column_max = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      enabled = enable?(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enabled)
    end
  end
  #--------------------------------------------------------------------------
  # * Whether or not to display in enabled state
  #     item : item
  #--------------------------------------------------------------------------
  def enable?(item)
    return false if item.note.include?("<cant_be_upgraded>")
    return false if upgrade_price(item) > $game_party.gold
    return false if item.upgrade_level >= OECS::Upgrade::MaxEqLevel
    return evaluate_item_requirements(item)
  end
 
  def evaluate_item_requirements(item)
    for id in item.upgrade_requires.keys
      next if id == 0
      unless $game_party.items.include?($data_items[id]) and $game_party.item_number($data_items[id]) >= item.upgrade_requires[id]
        return false
      end
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Return the price of the upgrade of the item
  #--------------------------------------------------------------------------
  def upgrade_price(item)
    price = item.price.to_f * (OECS::Upgrade::UpgradePriceRatio.to_f/100)
    price *= (item.upgrade_level + 1) if OECS::Upgrade::MultiplyRatioByLevel
    price += OECS::Upgrade::ConstantPricePlus
    price += item.upgrade_plus
    price += item.upgrade_exp*(item.upgrade_level + 1)
    price = price.to_i
    return price
  end
  alias oecs_upgrade_draw_item_name draw_item_name
  def draw_item_name(item, x, y, enabled = true)
    oecs_upgrade_draw_item_name(item, x, y, enabled)
    rect = Rect.new(x + 24, y, 240, WLH)
    self.contents.clear_rect(rect)
    self.contents.draw_text(x + 24, y, 240, WLH, item.name) if item != nil
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      if @type == 'weapon'
        next unless item.is_a?(RPG::Weapon)
      else
        next unless item.is_a?(RPG::Armor)
      end
      @data.push(item)
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def update_help
    return if self.item == nil or @help_window == nil
    @help_window.set_data(self.item, upgrade_price(self.item))
  end
end

class Window_UpgradeDetails < Window_Base
  def initialize
    super(300, 112, 244, 304)  end
  def set_data(item, price, refresh = false)
    return if item == @item unless refresh
    @item = item
    @price = price
    self.contents.clear
    draw_item_name(item, 0, 0)
    if item.note.include?("<cant_be_upgraded>")
      self.contents.draw_text(0, WLH, 212, WLH, OECS::Upgrade::CantBeUpgraded, 1)
      return
    elsif item.upgrade_level < OECS::Upgrade::MaxEqLevel
      self.contents.draw_text(0, WLH, 212, WLH, '+ ' + item.upgrade_level.to_s + '  ', 2)
    else
      self.contents.draw_text(0, WLH, 212, WLH, OECS::Upgrade::EqMaxed, 1)
      return
    end
    self.contents.draw_text(0, WLH*2, 212, WLH, OECS::Upgrade::RequirementTerm)
    draw_currency_value(price, 4, WLH*3, 204)
    item.upgrade_requires.keys.each_with_index do |id, index|
      draw_item_name($data_items[id], 0, WLH*(index + 4))
    end
  end
 
  def refresh
    set_data(@item, @price, true)
  end
 
  def draw_item_name(item, x, y, enabled = true)
    if item != nil
      draw_icon(item.icon_index, x, y, enabled)
      self.contents.font.color = normal_color
      self.contents.font.color.alpha = enabled ? 255 : 128
      if item.is_a?(RPG::Item)
        self.contents.draw_text(x + 24, y, 180, WLH, item.name)
      else
        self.contents.draw_text(x + 24, y, 180, WLH, item.name_no_plus)
      end
    end
  end
  def draw_currency_value(value, x, y, width)
    cx = contents.text_size(value.to_s).width
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, width, WLH, value, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(x+cx+2, y, width, WLH, Vocab::gold, 0)
  end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Alias List
  #--------------------------------------------------------------------------
  alias oz_oecs_equpgrade_initialize_oecs initialize_oecs
  #--------------------------------------------------------------------------
  # * Initialize all nil upgrade levels to 0
  #--------------------------------------------------------------------------
  def initialize_oecs
    oz_oecs_equpgrade_initialize_oecs
    for weapon in $data_weapons
      next if weapon == nil
      weapon.upgrade_level = 0 if weapon.upgrade_level == nil
    end
    for armor in $data_armors
      next if armor == nil
      armor.upgrade_level = 0 if armor.upgrade_level == nil
    end
  end
end
            
            

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Lazy fix:

Code: [Select]
if Object.constants.include?("Window_Upgradeable")
 
  #==============================================================================
  # ** Window_Upgradeable
  #==============================================================================
 
  class Window_Upgradeable < Window_Item
   
    def include?(item)
      return false if item == nil
      if $game_temp.in_battle
        return false unless item.is_a?(RPG::Item)
      end
      return true
    end
  end
 
end

****
Rep:
Level 69
omg your so awesome xD

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
That wouldn't work Pacman - (a) $game_switches wouldn't be initialized yet; and (b) even if it had been, that would just prevent the scripts from being interpreted at all.
I realised that; lazy fix.
it's like a metaphor or something i don't know