Ruby/RGSSx questions that don't deserve their own thread

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
You don't explain what either of the problems actually are, so I have no idea where it might be going wrong.


What is distance_match? What are you trying to do? How many events do you have this code running in, and are they all using the same variable and array element? In your condition, I see you say "if it is equal to 11, change it to 7, otherwise increment it" - so, assuming it's LESS THAN 11 to begin with, it should count up to 11, then just keep going from 7 through to 11 all the time.


In fact, you've got something complicated enough going on here that I don't think it really belongs in "questions that don't deserve their own thread" anymore.
 
Last edited by a moderator:

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
EDIT: SOLVED The solution is at the bottom in case anyone was wondering.

I don't mention the other things only because I know they're working perfectly fine, I'm just trying to figure out how to make the value within the variable array play nice as a parameter.

distance_match is a method from a script I commissioned that checks the distance between two events. The parameters are as follows: event_or_player.distance_match(event_or_player, distance, facing)

There's only one event running this code, the one I'm showing on the screenie. The other pages are currently inactive so I can test this one, they're there only so I can have backups of different configurations I'm trying out.

There is an autorun event that starts it at 7. The reason I'm having it increment from 7 to 11 is because the events with ID's 7 up to 11 are on the map, which it checks its distance with.

So the first error I get is:

Script 'Game_Interpreter' line 450: NoMethodError occurred.

undefined method 'distance_match' for nil:NilClass

The method works perfectly fine If I replace "$game_variables[51][4]" with an integer, so I assume it thinks the parameter is different and looks for a nonexistent method that takes it.

The second error I get (after getting rid of the first one just for testing) is this:

Script 'Game_Interpreter' line 1411: NoMethodError occurred.

undefined method '[]=' for 0:fixnum

This seems to be because the game isn't interpreting "$game_variables[51][4]" as an entry within an array.

So I just need to find a way to change "$game_variables[51][4]" into something that plays nicely as a parameter.

Here's the image in case nobody feels like going back one page:



Again, the first error comes from the first Conditional Branch script.

The second error comes from the "$game_variables[51][4] += 1" increment. it seems to be the += operator that doesn't like the array entry.

edit: I added this snippet of code at the very top and looped the code from the first conditional to the bottom so it doesn't repeat:

$game_variables[51] = [0, 0]
$game_variables[51][4] = 7

This was previously in a different autorun. It seemed to work perfectly. I returned it to the autorun then added a 30 frame wait at the beginning of this event. It seems like the problem was that this event was started before the autorun, and the game wasn't told that $game_variables[51] is to be an array. I guess this is problem solved, but if anybody has a more economical solution that would be most welcome~
 
Last edited by a moderator:

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
How would you go about accessing the amount of a specific item in the player inventory via a script? I'm trying to show the number of items on a HUD.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,839
First Language
English
Game_Party, item_number
 
Last edited by a moderator:

seita

Donn_M
Veteran
Joined
Feb 6, 2013
Messages
2,254
Reaction score
611
First Language
English
Primarily Uses
Thanks so much~!
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
517
First Language
Javascript
Primarily Uses
RMMZ
hue_change(hue)

Changes the bitmap's hue within 360 degrees of displacement.

This process is time-consuming. Furthermore, due to conversion errors, repeated hue changes may result in color loss.
Is there any better way to change the Hue of a Bitmap? :unsure: The color loss is just unacceptable. :headshake:

Thanks for reading. :)
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,839
First Language
English
Just get a new copy of the image and do the hue change there instead of re-using an existing one.


It's not like it's changing the image stored on disk or anything.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
517
First Language
Javascript
Primarily Uses
RMMZ
Just get a new copy of the image and do the hue change there instead of re-using an existing one.
Thanks for the info; I'm not exactly sure how to do this though for the script I'm working on... everything I try just results in color loss.

Thanks again for reading. :)
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,839
First Language
English
Well the idea is that you would be calling Cache.picture or wherever the image is stored everytime (it should be fast cause..it's cached...) and then setting the hue of that image, and then replacing the current bitmap with the new one.


But I don't know what the performance implications are.


Is there noticeable color loss? I've never really paid attention to hue change.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
517
First Language
Javascript
Primarily Uses
RMMZ
Is there noticeable color loss? I've never really paid attention to hue change.
Yeah, it is pretty bad after a few changes.

Before:


After:

Well the idea is that you would be calling Cache.picture or wherever the image is stored everytime (it should be fast cause..it's cached...) and then setting the hue of that image, and then replacing the current bitmap with the new one.
Oh ok. Good, good. :) I was doing what you described... still get color loss though. :( I must be doing something way wrong. >_>

Here is the exact code used to produce the image above.

Code:
class Sprite_Properties  attr_accessor :frame_index  attr_accessor :frame_step  attr_accessor :hue_step  attr_accessor :hue_start  attr_accessor :hue_current  attr_accessor :hue_max  attr_accessor :change_sprite    def initialize(change_sprite, frame_step = 60, hue_step = 1, hue_start = 0, hue_max = 360)    @frame_index    = 0    @hue_current    = 0        change_sprite ? @change_sprite  = change_sprite : change_sprite = nil    frame_step    ? @frame_step     = frame_step    : frame_step    = 5    hue_step      ? @hue_step       = hue_step      : hue_step      = 5    hue_start     ? @hue_start      = hue_start     : hue_start     = 0    hue_max       ? @hue_max        = hue_max       : hue_max       = 360  endendclass Scene_Title < Scene_Base  attr_accessor :index  attr_accessor :sprite_property    alias :my_start :start  def start    my_start    @sprite_property = [Sprite_Properties.new(1)]    @index = 0    while index < @sprite_property.length      if @sprite_property[@index].hue_start > 0        case @sprite_property[@index].change_sprite        when 1          @sprite1.bitmap.hue_change(@sprite_property[@index].hue_start) unless !@sprite1        when 2          @sprite2.bitmap.hue_change(@sprite_property[@index].hue_start) unless !@sprite2        end        @sprite_property[@index].hue_current = @sprite_property[@index].hue_start      end            @index += 1    end  end  alias :my_update :update  def update    @index = 0    while index < @sprite_property.length      @sprite_property[@index].frame_index += 1      if @sprite_property[@index].frame_index == @sprite_property[@index].frame_step                @sprite_property[@index].frame_index = 0        @sprite_property[@index].hue_current += @sprite_property[@index].hue_step                if @sprite_property[@index].hue_current > @sprite_property[@index].hue_max          @sprite_property[@index].hue_current = @sprite_property[@index].hue_start        end                         case @sprite_property[@index].change_sprite        when 1          Cache.title1($data_system.title1_name).hue_change(@sprite_property[@index].hue_step) unless !@sprite1        when 2          #@sprite2.bitmap.hue_change(@sprite_property[@index].hue_current) unless !@sprite2        end              p @index.to_s + ". " + @sprite_property[@index].hue_current.to_s      end            @index += 1    end        my_update  endend
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,839
First Language
English
If you're doing that I think you're modifying the one that's loaded into cache.


Blt to a new bitmap and see what happens.


I'm looking at the update messages and it's really slow. And this is supposed to be every frame update as well..goes to show how expensive it is.
 
Last edited by a moderator:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
517
First Language
Javascript
Primarily Uses
RMMZ
If you're doing that I think you're modifying the one that's loaded into cache.
Yup that must have been exactly what I was doing wrong.

The following script works great now.

Script:

#==============================================================================# ** Title Add-On by CT_Bolt (v0.05)#==============================================================================class Sprite_Properties attr_accessor :frame_index attr_accessor :frame_step attr_accessor :hue_step attr_accessor :hue_start attr_accessor :hue_current attr_accessor :hue_max attr_accessor :change_sprite def initialize(change_sprite, frame_step = 5, hue_step = 1, hue_start = 0, hue_max = 360) @frame_index = 0 @hue_current = 0 change_sprite ? @change_sprite = change_sprite : change_sprite = nil frame_step ? @frame_step = frame_step : frame_step = 5 hue_step ? @hue_step = hue_step : hue_step = 5 hue_start ? @hue_start = hue_start : hue_start = 0 hue_max ? @hue_max = hue_max : hue_max = 360 endendclass Scene_Title < Scene_Base attr_accessor :index attr_accessor :sprite_property alias :my_start :start def start my_start @sprite_property = [Sprite_Properties.new(1)] @index = 0 while index < @sprite_property.length if @sprite_property[@index].hue_start > 0 case @sprite_property[@index].change_sprite when 1 @sprite1.bitmap.hue_change(@sprite_property[@index].hue_start) unless !@sprite1 when 2 @sprite2.bitmap.hue_change(@sprite_property[@index].hue_start) unless !@sprite2 end @sprite_property[@index].hue_current = @sprite_property[@index].hue_start end @index += 1 end end alias :my_update :update def update @index = 0 while index < @sprite_property.length @sprite_property[@index].frame_index += 1 if @sprite_property[@index].frame_index == @sprite_property[@index].frame_step @sprite_property[@index].frame_index = 0 @sprite_property[@index].hue_current += @sprite_property[@index].hue_step if @sprite_property[@index].hue_current > @sprite_property[@index].hue_max @sprite_property[@index].hue_current = @sprite_property[@index].hue_start end case @sprite_property[@index].change_sprite when 1 #@newbitmap = Cache.title1($data_system.title1_name).hue_change(@sprite_property[@index].hue_step) unless !@sprite1 @sprite1.bitmap = Cache.load_bitmap("Graphics/Titles1/", $data_system.title1_name, @sprite_property[@index].hue_current) when 2 #@sprite2.bitmap.hue_change(@sprite_property[@index].hue_current) unless !@sprite2 end p @index.to_s + ". " + @sprite_property[@index].hue_current.to_s end @index += 1 end my_update endend
Thanks again for all your help Tsukihime, you are so helpful. :rock-left: :D :rock-right:

I cannot express enough how appreciative I am of you. :)
 
Last edited by a moderator:

Hoffman65

The Epic Noob
Member
Joined
Jul 16, 2013
Messages
4
Reaction score
0
First Language
English
Primarily Uses
when you write your own scripts you create the variables, therefor you can name them anything you want...

for example...

class CRAP  attr_accessor :crap_variable  , :crap_vari_no  def initialize    @crap_variable = "CRAP"    @crap_vari_no  = 0    endend $this = CRAP.newp $this.crap_variablep $this.crap_vari_no $this.crap_variable = "More Crap"$this.crap_vari_no  = 9999p $this.crap_variablep $this.crap_vari_no pop that code into a script page and run your project with the console opened and you will understand better.
This is actually what I needed to know thank you. 

I don't know what you are trying to say, but the base scripts are everything you see when you create a new project, and everything you see in the help file.

You should give an example of what you are trying to accomplish so it is easier to understand. Your idea of "Variables" is likely based on someone else's own standards (like that mattie scripts for CS? I don't know what that is), seeing how you specifically capitalize the term "Variables" as if you are referring to a specific set of things.

RM provides a scripting interface, and there are hundreds of variables (in the math/programming sense) defined in the default project.
Um, no I just do that sometimes out of habit. I have terrible grammar(Or would that be I'm terrible with grammar?). I have no idea if posting outside links to other websites is allowed but I'll try and give an example of what I mean. Things in color.  

es_set player_health event_var(es_userhealth or if (event_var(text) equalto "what's my name?") then es_xmsg Your name is: server_var(player_name)    (-Came from the eventscripts wiki itself). 

The variables in this case can only be used in contrast with the already made scripting interface(more like pulled from a set database within the server addon's folder) for the server on which you want to host from. But as seeing from what Dekita said you must make your own variables. Freedom much? I actually mean that, what is the limit to that of a script for an rpg maker game? 

Sorry for the long post, but hopefully it helps you understand what I meant now. I guess I can't get an untainted look at variables if you have to make them yourself, so now I'll go look through tutorials about adding them to the game. Thanks for the help. 
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,839
First Language
English
I actually mean that, what is the limit to that of a script for an rpg maker game?
There are basically no limits. You can do anything you want.


You can't modify the editor, but you can introduce your own external tools, so that shouldn't be an issue if you need a nice user interface for setting things up for your scripts. I mean just today I was looking at a script that implemented isometric maps


http://www.rgss-factory.net/ace-layy-meta-engine-editor-3d-isometric-maps/


 

Hoffman65

The Epic Noob
Member
Joined
Jul 16, 2013
Messages
4
Reaction score
0
First Language
English
Primarily Uses
I figured editing the Editor would be a no no, it does seem to be a common theme in terms of use amongst editors. No limits actually sounds rather fun. Thank you Tsukihime. I'll also take a look at the few suggestions you said before. Again sorry for bring something so trivial up. I was hoping I could get a non-objectivated view of "variable" that don't exist if I had known you had to create your own I wouldn't have asked. Also thanks again to Dekita for understand my broken thoughts. 
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
I want to ask a question. I want to remove the selected lists on the menu except for Items and a End Game option. But, for the items, I want to remove the Item, Weapon and Armor selections. I just want the Key items to be directly displayed on the item once I select it from pressing it on the menu. Is this possible? Could anyone help me how to script this or give me the script and explain some elements on it?
 

PsiioniicVII

Villager
Member
Joined
May 19, 2013
Messages
20
Reaction score
0
First Language
English
Primarily Uses
Okay, I have a bit of a problem with Yanfly's Menu Melody.

Here is the script:

#===============================================================================
#
# Yanfly Engine Melody - Main Menu Melody
# Last Date Updated: 2010.05.15
# Level: Normal, Hard, Lunatic
#
# This script allows for menu item reordering along with importing in custom
# script scenes with ease so that there becomes little need to change the base
# menu script in order to add in a few items. This is a YEM version of the
# popular KGC Custom Menu Command. No credits will be taken on part of my own
# behalf for the work KGC did. All I merely did was use it to extend the
# capabilities of adding in common events, imported commands, and beefed up
# engine efficiency.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 2010.05.15 - Conversion to Yanfly Engine Melody.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Considering the special
# nature of this script, it is highly recommended that you place this script
# above all non-core scripts. Remember to save.
#
# Scroll down and edit the module as you see fitting for your game.
#
# -----------------------------------------------------------------------------
# Debug Shortcuts - Only during $TEST and $BTEST mode
# -----------------------------------------------------------------------------
# During testplay mode, pressing F5 while the main menu is active will fill
# all party members' HP and MP to full.
#===============================================================================

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

module YEM
module MENU

#===========================================================================
# Section I. Menu Commands
# -------------------------------------------------------------------------
# Adjust the following hash to modify which commands will appear where. Use
# the following table to input in the commands as you see fit.
#
# :items ............Default Item Menu
# :skill ............Default Skill Menu
# :equip ............Default Equip menu
# :status ...........Default Status Menu
# :save .............Default Save Menu
# :system ...........Default Game End Menu
#
# For those that have imported KGC scripts.
#
# :kgc_largeparty ...Requires KGC's Large Party
# :kgc_apviewer .....Requires KGC's Equip Learn Skill
# :kgc_skillcp ......Requires KGC's Skill CP System
# :kgc_difficulty ...Requires KGC's Battle Difficulty
# :kgc_distribute ...Requires KGC's Distribute Parameter
# :kgc_enemyguide ...Requires KGC's Enemy Guide
# :kgc_outline ......Requires KGC's Outline
#
# For those who are still attached to the YERD scripts.
#
# :yerd_classchange .Requires YERD Subclass Selection System
# :yerd_learnskill ..Requires YERD Subclass Selection System
# :yerd_equipslots ..Requires YERD Equip Skill Slots
# :yerd_bestiary ....Requires YERD Bestiary + Scanned Enemy
#===========================================================================
MENU_COMMANDS =[ # Follow the instructions above.
:items, # Default Item Menu
:status, # Default Status Menu
:skill, # Default Skill Menu
:equip, # Default Equip menu
:event2, # Common Event
:save, # Default Save Menu
:system, # Default Game End Menu
] # Do not remove this.

# This will determine whether or not your menu uses icons.
USE_ICONS = true

# If you're using icons, adjust the following hash to bind the right icons
# to the right command.
MENU_ICONS ={ # If an icon is not present, it will use the unused icon.
:unused => 176,
:items => 144,
:skill => 159,
:equip => 44,
:status => 137,
:save => 149,
:system => 134,
} # Do not remove this.

# This is the maximum number of rows to be displayed before the command
# box will be cut off.
MAX_ROWS = 10

# Set the alignment for the text in your menu. By default, alignment is 0.
# 0..Left Align, 1..Center Align, 2..Right Align
ALIGN = 0

# Setting this to true will cause the menu to shift to the right side of
# the screen while moving the party status window over to the left side.
MENU_RIGHT_SIDE = true

# If this is set to true, the menu will not obscure the map until actor
# selection is required. Events on the map will be frozen in place.
ON_SCREEN_MENU = true

#===========================================================================
# Section II.A. Custom Menu Command - Lunatic Mode - Common Events
# -------------------------------------------------------------------------
# For those who would like to launch command events from the main menu,
# modify this hash here to fit your liking. Then, add in the newly added
# method to the MENU_COMMANDS array above.
#
# HideSw - This is the hide switch. Set to nil to not use a switch.
# DisbSw - This is the disable switch. Set to nil to not use a switch.
# Debug? - This item will only appear if it's $TEST mode.
# CEvent - This is the common event that will launch.
# Icon - This is the icon used if the option is given.
# Title - This is the text that will appear.
#===========================================================================
COMMON_EVENTS ={ # Follow the instructions above.
# Method => [HideSw, DisbSw, Debug?, CEvent, Icon, Title Name]
:event1 => [ nil, nil, true, 11, 101, "Debug"],

} # Do not remove this.

#===========================================================================
# Section II.B. Custom Menu Command - Lunatic Mode - Imported Commands
# -------------------------------------------------------------------------
# The following is what KGC originally was going to have in his script but
# was actually missing it in his publicized script. This will regain
# functionality and also lift the "limit" of only 100 extra commands. The
# following will explain how to set up the individual options.
#
# HideSw - Switch used to hide the command. Set to nil if not used.
# DisbSw - Switch used to disable the command. Set to nil if not used.
# Actor? - Does this select an actor. Set to true if it does.
# Icon - Determines what icon will be used for this item.
# Title - The title text that appears for the event.
# Scene - The scene used to launch the respective scene.
#
# Note that this does not automatically detect what will and will not
# disable the command ingame. You must understand and create a work
# around with them (if they do disable the commands) with switches.
# After binding your imported commands, go back to MENU_COMMANDS and
# insert the proper command ID at the proper location.
#===========================================================================
IMPORTED_COMMANDS ={ # Follow the instructions above.
# Method => [HideSw, DisbSw, Actor?, Icon, Title Name, Scene Name.new]
:quests => [ 8, 9, false, 99, "Quests", "Scene_Quest"],
:faction => [ 10, 11, false, 100, "Factions", "Scene_Factions"],
:row => [ nil, nil, false, 101, "Rows", "Scene_Row"],
:record => [ nil, nil, false, 102, "Records", "Scene_Record"],
:craft => [ nil, nil, false, 103, "Crafting", "Scene_Crafting"],
} # Do not remove this.

#===========================================================================
# Section III.A. Multi Variable Window
# -------------------------------------------------------------------------
# Imported straight from Scene Menu ReDux, this alters the gold window at
# the bottom to display variables, time, steps, etc. This window appears
# at the bottom of the screen.
#===========================================================================
USE_MULTI_VARIABLE_WINDOW = true

# Variables will be shown in this order. Use 0 to show gold. Adjust the
# following information as seen necessary.
VARIABLES_SHOWN = [-5, -1, -2, 0]
VARIABLES_ICONS = true
VARIABLES_HASH ={ # Note that value zero must exist.
# VarID => [icon, Text]
-5 => [ 153, "Map"],
-2 => [ 48, "Steps"],
-1 => [ 188, "Time"],
0 => [ 205, "Gold"],
1 => [ 200, "Jewels"],
}# Do not remove this.

end # MENU
end # YEM

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

#===============================================================================
# Scene_Menu
#===============================================================================

class Scene_Menu < Scene_Base

#--------------------------------------------------------------------------
# new method: create_command_list
#--------------------------------------------------------------------------
def create_command_list
vocab = []
commands = []
icons = []
index_list = {}
YEM::MENU::MENU_COMMANDS.each_with_index { |c,i|
case c
when :items
index_list[:items] = commands.size
vocab.push(Vocab.item)

when :skill # Skills
index_list[:skill] = commands.size
vocab.push(Vocab.skill)

when :equip # Equip
index_list[:equip] = commands.size
vocab.push(Vocab.equip)

when :status # Status
index_list[:status] = commands.size
vocab.push(Vocab.status)

when :save # Save
index_list[:save] = commands.size
vocab.push(Vocab.save)

when :system # System
index_list[:system] = commands.size
vocab.push(Vocab.game_end)

#----- KGC Imported Scripts -----

when :kgc_largeparty # KGC's Large Party
next unless $imported["LargeParty"]
index_list[:partyform] = commands.size
@__command_partyform_index = commands.size
vocab.push(Vocab.partyform)

when :kgc_apviewer # KGC's AP Viewer
next unless $imported["EquipLearnSkill"]
index_list[:ap_viewer] = commands.size
@__command_ap_viewer_index = commands.size
vocab.push(Vocab.ap_viewer)

when :kgc_skillcp # KGC's CP Skill System
next unless $imported["SkillCPSystem"]
index_list[:set_battle_skill] = commands.size
@__command_set_battle_skill_index = commands.size
vocab.push(Vocab.set_battle_skill)

when :kgc_difficulty # KGC's Battle Difficulty
next unless $imported["BattleDifficulty"]
index_list[:set_difficulty] = commands.size
@__command_set_difficulty_index = commands.size
vocab.push(KGC::BattleDifficulty.get[:name])

when :kgc_distribute # KGC's Distribute Parameter
next unless $imported["DistributeParameter"]
index_list[:distribute_parameter] = commands.size
@__command_distribute_parameter_index = commands.size
vocab.push(Vocab.distribute_parameter)

when :kgc_enemyguide # KGC's Enemy Guide
next unless $imported["EnemyGuide"]
index_list[:enemy_guide] = commands.size
@__command_enemy_guide_index = commands.size
vocab.push(Vocab.enemy_guide)

when :kgc_outline # KGC's Outline
next unless $imported["Outline"]
index_list[:outline] = commands.size
@__command_outline_index = commands.size
vocab.push(Vocab.outline)

#----- YERD Imported Scripts -----

when :yerd_classchange # Yanfly Subclass Class Change
next unless $imported["SubclassSelectionSystem"]
next unless YE::SUBCLASS::MENU_CLASS_CHANGE_OPTION
next unless $game_switches[YE::SUBCLASS::ENABLE_CLASS_CHANGE_SWITCH]
index_list[:classchange] = commands.size
@command_class_change = commands.size
vocab.push(YE::SUBCLASS::MENU_CLASS_CHANGE_TITLE)

when :yerd_learnskill # Yanfly Subclass Learn Skill
next unless $imported["SubclassSelectionSystem"]
next unless YE::SUBCLASS::USE_JP_SYSTEM and
YE::SUBCLASS::LEARN_SKILL_OPTION
next unless $game_switches[YE::SUBCLASS::ENABLE_LEARN_SKILLS_SWITCH]
index_list[:learnskill] = commands.size
@command_learn_skill = commands.size
vocab.push(YE::SUBCLASS::LEARN_SKILL_TITLE)

when :yerd_equipslots # Yanfly Equip Skill System
next unless $imported["EquipSkillSlots"]
next unless $game_switches[YE::EQUIPSKILL::ENABLE_SLOTS_SWITCH]
index_list[:equipskill] = commands.size
@command_equip_skill = commands.size
vocab.push(YE::EQUIPSKILL::MENU_TITLE)

when :yerd_bestiary # Yanfly Bestiary
next unless $imported["DisplayScannedEnemy"]
next unless $game_switches[YE::MENU::MONSTER::BESTIARY_SWITCH]
index_list[:bestiary] = commands.size
@command_bestiary = commands.size
vocab.push(YE::MENU::MONSTER::BESTIARY_TITLE)

else # ---- Custom Commands ----
if YEM::MENU::COMMON_EVENTS.include?©
common_event = YEM::MENU::COMMON_EVENTS[c]
next if !$TEST and common_event[2]
next if common_event[0] != nil and $game_switches[common_event[0]]
index_list[c] = commands.size
vocab.push(common_event[5])
elsif YEM::MENU::IMPORTED_COMMANDS.include?©
command_array = YEM::MENU::IMPORTED_COMMANDS[c]
next if command_array[0] != nil and $game_switches[command_array[0]]
index_list[c] = commands.size
vocab.push(command_array[4])
else; next
end

end
commands.push©
icons.push(menu_icon©)
} # YEM::MENU::MENU_COMMANDS.each_with_index
$game_temp.menu_command_index = index_list
@menu_array = [vocab, commands, icons]
end

#--------------------------------------------------------------------------
# new method: menu_icon
#--------------------------------------------------------------------------
def menu_icon(command)
if YEM::MENU::MENU_ICONS.include?(command)
return YEM::MENU::MENU_ICONS[command]
elsif YEM::MENU::COMMON_EVENTS.include?(command)
return YEM::MENU::COMMON_EVENTS[command][4]
elsif YEM::MENU::IMPORTED_COMMANDS.include?(command)
return YEM::MENU::IMPORTED_COMMANDS[command][3]
else
return YEM::MENU::MENU_ICONS[:unused]
end
end

#--------------------------------------------------------------------------
# overwrite method: create_command_window
#--------------------------------------------------------------------------
def create_command_window
create_command_list
@command_window = Window_MenuCommand.new(@menu_array)
@command_window.height = [@command_window.height,
YEM::MENU::MAX_ROWS * 24 + 32].min
@command_window.index = [@menu_index, @menu_array[0].size - 1].min
end

#--------------------------------------------------------------------------
# overwrite method: update_command_selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input:: B)
check_debug_enable
Sound.play_cancel
$scene = Scene_Map.new
elsif $TEST and Input.trigger?(Input::F5) # Debug Refresh Party
Sound.play_recovery
for member in $game_party.members
member.hp += member.maxhp
member.mp += member.maxmp
end
@status_window.refresh
elsif Input.trigger?(Input::C)
command = @command_window.method
case command
when :items # Item Command
Sound.play_decision
$scene = Scene_Item.new
when :skill, :equip, :status # Skill, Equip, and Status Commands
Sound.play_decision
start_actor_selection
when :save # Save Command
if $game_system.save_disabled
Sound.play_buzzer
else
Sound.play_decision
$game_temp.menu_command_index[:save]
$scene = Scene_File.new(true, false, false)
end
when :system # System Command
Sound.play_decision
$scene = Scene_End.new
else # Custom Commands
if YEM::MENU::COMMON_EVENTS.include?(command)
array = YEM::MENU::COMMON_EVENTS[command]
if array[1] != nil and $game_switches[array[1]]
Sound.play_buzzer
else
Sound.play_decision
$game_temp.common_event_id = array[3]
$scene = Scene_Map.new
end
elsif YEM::MENU::IMPORTED_COMMANDS.include?(command)
array = YEM::MENU::IMPORTED_COMMANDS[command]
if array[1] != nil and $game_switches[array[1]]
Sound.play_buzzer
else
Sound.play_decision
if array[2]
start_actor_selection
else
$scene = eval(array[5] + ".new")
end
end
end

end # if case check
end # end if
end # end update_command_selection

#--------------------------------------------------------------------------
# overwrite method: update_actor_selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input:: B)
Sound.play_cancel
end_actor_selection
@status_window.close if YEM::MENU::oN_SCREEN_MENU
elsif $TEST and Input.trigger?(Input::F5) # Debug Refresh Party
Sound.play_recovery
for member in $game_party.members
member.hp += member.maxhp
member.mp += member.maxmp
end
@status_window.refresh
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
command = @command_window.method
case command
when :skill # Skill Command
$scene = Scene_Skill.new(@status_window.index)
when :equip # Equip Command
$scene = Scene_Equip.new(@status_window.index)
when :status # Status Command
$scene = Scene_Status.new(@status_window.index)
else # Custom Commands
if YEM::MENU::IMPORTED_COMMANDS.include?(command)
array = YEM::MENU::IMPORTED_COMMANDS[command]
$scene = eval(array[5] + ".new(@status_window.index)")
end
end

end
end

#--------------------------------------------------------------------------
# overwrite method: start
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
if YEM::MENU::USE_MULTI_VARIABLE_WINDOW
@gold_window = Window_MultiVariableWindow.new
else
@gold_window = Window_Gold.new(0, 360)
end
@status_window = Window_MenuStatus.new(160, 0)
@right_side = YEM::MENU::MENU_RIGHT_SIDE
if YEM::MENU::oN_SCREEN_MENU
@gold_window.y = @command_window.height
@status_window.openness = 0
@right_side = true if $game_player.screen_x <= 176
@right_side = false if $game_player.screen_x >= 368
$game_temp.on_screen_menu = false
end
if @right_side
@status_window.x = 0
@command_window.x = 384
@gold_window.x = 384
end
end

#--------------------------------------------------------------------------
# alias method: start_actor_selection
#--------------------------------------------------------------------------
alias start_actor_selection_mmz start_actor_selection unless $@
def start_actor_selection
if YEM::MENU::oN_SCREEN_MENU
@status_window.open
end
start_actor_selection_mmz
end

#--------------------------------------------------------------------------
# new method: create_menu_background
#--------------------------------------------------------------------------
if YEM::MENU::oN_SCREEN_MENU
def create_menu_background
@menuback_sprite = Spriteset_Map.new
end
end

end # Scene_Menu

#==============================================================================
# Imported from KGC's Custom Menu Command
# to improve compatibility amongst KGC scripts
#==============================================================================
$imported["CustomMenuCommand"] = true
class Game_Temp
attr_accessor :menu_command_index
attr_accessor :next_scene_actor_index
attr_accessor :on_screen_menu

alias initialize_KGC_CustomMenuCommand initialize unless $@
def initialize
initialize_KGC_CustomMenuCommand
@menu_command_index = {}
@next_scene_actor_index = 0
end
end

module KGC
module Commands
module_function
def call_item
return if $game_temp.in_battle
$game_temp.next_scene = :menu_item
$game_temp.next_scene_actor_index = 0
$game_temp.menu_command_index = {}
end
def call_skill(actor_index = 0)
return if $game_temp.in_battle
$game_temp.next_scene = :menu_skill
$game_temp.next_scene_actor_index = actor_index
$game_temp.menu_command_index = {}
end
def call_equip(actor_index = 0)
return if $game_temp.in_battle
$game_temp.next_scene = :menu_equip
$game_temp.next_scene_actor_index = actor_index
$game_temp.menu_command_index = {}
end
def call_status(actor_index = 0)
return if $game_temp.in_battle
$game_temp.next_scene = :menu_status
$game_temp.next_scene_actor_index = actor_index
$game_temp.menu_command_index = {}
end
end
end

class Game_Interpreter
include KGC::Commands
end

class Scene_Map < Scene_Base
alias update_scene_change_KGC_CustomMenuCommand update_scene_change unless $@
def update_scene_change
return if $game_player.moving?
case $game_temp.next_scene
when :menu_item
call_menu_item
when :menu_skill
call_menu_skill
when :menu_equip
call_menu_equip
when :menu_status
call_menu_status
else
update_scene_change_KGC_CustomMenuCommand
end
end
alias call_menu_mmz call_menu unless $@
def call_menu
$game_temp.on_screen_menu = true if YEM::MENU::oN_SCREEN_MENU
call_menu_mmz
end
def call_menu_item
$game_temp.next_scene = nil
$scene = Scene_Item.new
end
def call_menu_skill
$game_temp.next_scene = nil
$scene = Scene_Skill.new($game_temp.next_scene_actor_index)
$game_temp.next_scene_actor_index = 0
end
def call_menu_equip
$game_temp.next_scene = nil
$scene = Scene_Equip.new($game_temp.next_scene_actor_index)
$game_temp.next_scene_actor_index = 0
end
def call_menu_status
$game_temp.next_scene = nil
$scene = Scene_Status.new($game_temp.next_scene_actor_index)
$game_temp.next_scene_actor_index = 0
end
end

class Scene_Menu < Scene_Base
def check_debug_enable
return unless Input.press?(Input::F5)
return unless Input.press?(Input::F9)
$TEST = true
end
end

class Scene_Item < Scene_Base
def return_scene
if $game_temp.menu_command_index.has_key?:)items)
$scene = Scene_Menu.new($game_temp.menu_command_index[:items])
else
$scene = Scene_Map.new
end
end
end

class Scene_Skill < Scene_Base
def return_scene
if $game_temp.menu_command_index.has_key?:)skill)
$scene = Scene_Menu.new($game_temp.menu_command_index[:skill])
else
$scene = Scene_Map.new
end
end
end

class Scene_Equip < Scene_Base
def return_scene
if $game_temp.menu_command_index.has_key?:)equip)
$scene = Scene_Menu.new($game_temp.menu_command_index[:equip])
else
$scene = Scene_Map.new
end
end
end

class Scene_Status < Scene_Base
def return_scene
if $game_temp.menu_command_index.has_key?:)status)
$scene = Scene_Menu.new($game_temp.menu_command_index[:status])
else
$scene = Scene_Map.new
end
end
end

class Scene_File < Scene_Base
alias return_scene_KGC_CustomMenuCommand return_scene unless $@
def return_scene
if @from_title || @from_event
return_scene_KGC_CustomMenuCommand
elsif $game_temp.menu_command_index.has_key?:)save)
$scene = Scene_Menu.new($game_temp.menu_command_index[:save])
else
$scene = Scene_Map.new
end
end
end

class Scene_End < Scene_Base
def return_scene
if $game_temp.menu_command_index.has_key?:)system)
$scene = Scene_Menu.new($game_temp.menu_command_index[:system])
else
$scene = Scene_Map.new
end
end
end

#===============================================================================
# Game_Map
#===============================================================================

class Game_Map

#--------------------------------------------------------------------------
# map name
#--------------------------------------------------------------------------
unless method_defined?:)map_name)
def map_name
data = load_data("Data/MapInfos.rvdata")
text = data[@map_id].name.gsub(/\[.*\]/) { "" }
return text
end
end

end # Game_Map

#===============================================================================
# Game_Actor
#===============================================================================

class Game_Actor < Game_Battler

#--------------------------------------------------------------------------
# new method: now_exp
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end

#--------------------------------------------------------------------------
# new method: next_exp
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end

end # Game_Actor

#===============================================================================
# Window_MultiVariableWindow
#===============================================================================

class Window_MultiVariableWindow < Window_Selectable

#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
dh = 32 + 24 * YEM::MENU::VARIABLES_SHOWN.size
dy = Graphics.height - dh
super(0, dy, 160, dh)
refresh
end

#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for i in YEM::MENU::VARIABLES_SHOWN
next unless YEM::MENU::VARIABLES_HASH.include?(i)
@time_index = @data.size if i == -1
@data.push(i)
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end

#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
sw = self.width - 32
dy = WLH * index
self.contents.clear_rect(rect)
i = @data[index]
case i
when -5 # Draw Map Name
self.contents.draw_text(0, dy, sw, WLH, $game_map.map_name, 1)

when -2 # Draw Steps
if YEM::MENU::VARIABLES_ICONS
text = $game_party.steps
self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
draw_icon(YEM::MENU::VARIABLES_HASH[-2][0], sw-24, dy)
else
text = YEM::MENU::VARIABLES_HASH[-2][1]
value = $game_party.steps
cx = contents.text_size(text).width
self.contents.font.color = normal_color
self.contents.draw_text(0, dy, sw-cx-2, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, dy, sw, WLH, text, 2)
end

when -1 # Draw Time
if YEM::MENU::VARIABLES_ICONS
text = game_time
self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
draw_icon(YEM::MENU::VARIABLES_HASH[-1][0], sw-24, dy)
else
self.contents.font.color = normal_color
text = game_time
self.contents.draw_text(0, dy, sw, WLH, text, 1)
end

when 0 # Draw Gold
if YEM::MENU::VARIABLES_ICONS
text = $game_party.gold
self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
draw_icon(YEM::MENU::VARIABLES_HASH[0][0], sw-24, dy)
else
draw_currency_value($game_party.gold, 4, dy, 120)
end

else # Draw Variables
if YEM::MENU::VARIABLES_ICONS
text = $game_variables
self.contents.draw_text(0, dy, sw-24, WLH, text, 2)
draw_icon(YEM::MENU::VARIABLES_HASH[0], sw-24, dy)
else
text = YEM::MENU::VARIABLES_HASH[1]
value = $game_variables
cx = contents.text_size(text).width
self.contents.font.color = normal_color
self.contents.draw_text(0, dy, sw-cx-2, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, dy, sw, WLH, text, 2)
end
end
end

#--------------------------------------------------------------------------
# game_time
#--------------------------------------------------------------------------
def game_time
gametime = Graphics.frame_count / Graphics.frame_rate
hours = gametime / 3600
minutes = gametime / 60 % 60
seconds = gametime % 60
result = sprintf("%d:%02d:%02d", hours, minutes, seconds)
return result
end

#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
if YEM::MENU::VARIABLES_SHOWN.include?(-1)
def update
if game_time != (Graphics.frame_count / Graphics.frame_rate)
draw_item(@time_index)
end
super
end
end

end # Window_MultiVariableWindow

#===============================================================================
# Window_MenuCommand
#===============================================================================

class Window_MenuCommand < Window_Command

#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(array)
@data = array[1]
@icons = array[2]
super(160, array[0])
end

#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
create_contents
for i in 0...@item_max
draw_item(i)
end
end

#--------------------------------------------------------------------------
# method
#--------------------------------------------------------------------------
def method; return @data[self.index]; end

#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
#---
text = @commands[index]
icon = @icons[index]
case @data[index]
when :items, :skill, :equip, :status, :kgc_apviewer, :kgc_skillcp,
:kgc_distribute, :yerd_classchange, :yerd_learnskill, :yerd_equipslots
enabled = ($game_party.members.size == 0 ? false : true)
when :save
enabled = !$game_system.save_disabled
when :kgc_largeparty
enabled = ($game_party.members.size == 0 ? false : true)
enabled = false if !$game_party.partyform_enable?
else
if YEM::MENU::COMMON_EVENTS.include?(@data[index])
if YEM::MENU::COMMON_EVENTS[@data[index]][1] != nil
enabled = !YEM::MENU::COMMON_EVENTS[@data[index]][1]
end
elsif YEM::MENU::IMPORTED_COMMANDS.include?(@data[index])
if YEM::MENU::IMPORTED_COMMANDS[@data[index]][1] != nil
enabled = !YEM::MENU::IMPORTED_COMMANDS[@data[index]][1]
end
end
end
#---
self.contents.font.color.alpha = enabled ? 255 : 128
dx = rect.x; dy = rect.y; dw = rect.width
if YEM::MENU::USE_ICONS and icon.is_a?(Integer)
draw_icon(icon, 0, dy, enabled)
dx += 20; dw -= 20
end
self.contents.draw_text(dx, dy, dw, WLH, text, YEM::MENU::ALIGN)
end

end # Window_MenuCommand

#===============================================================================
#
# END OF FILE
#
#===============================================================================
 

And then it says: line 198: TypeError occured. superclass mismatch for Scene_Menu.

If someone can help me with this, then thanks so much. There is another problem I will add, but I need this to be solved first.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
@PsiioniicVII, that script was written in 2010. Therefore it's a VX script, not an Ace script. Next time you need help with someone else's script, please post your question in its own thread. And when you post a script, as well as using spoiler tags, use code tags to keep the formatting and indenting to make the script easier to read.

@SoulPour77, use this - both in new slots at bottom of materials list:

Menu Change:

I have just commented out, from the menu scene and window, the options that you no longer want to have visible.

#==============================================================================# ** Window_MenuCommand#------------------------------------------------------------------------------# This command window appears on the menu screen.#==============================================================================class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_main_commands add_game_end_command end #-------------------------------------------------------------------------- # * Add Main Commands to List #-------------------------------------------------------------------------- def add_main_commands add_command(Vocab::item, :item, main_commands_enabled) endend#==============================================================================# ** Scene_Menu#------------------------------------------------------------------------------# This class performs the menu screen processing.#==============================================================================class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_MenuCommand.new @command_window.set_handler:)item, method:)command_item)) @command_window.set_handler:)game_end, method:)command_game_end)) @command_window.set_handler:)cancel, method:)return_scene)) endend
Items Change:

I have bypassed the Item Category window and resized the Item List window, and defaulted the item category to key items.

Code:
#==============================================================================# ** Scene_Item#------------------------------------------------------------------------------#  This class performs the item screen processing.#==============================================================================class Scene_Item < Scene_ItemBase  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    create_help_window    #create_category_window    create_item_window  end  #--------------------------------------------------------------------------  # * Create Item Window  #--------------------------------------------------------------------------  def create_item_window    wy = @help_window.height    wh = Graphics.height - wy    @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)    @item_window.viewport = @viewport    @item_window.help_window = @help_window    @item_window.set_handler(:ok,     method(:on_item_ok))    @item_window.set_handler(:cancel, method(:return_scene))    @item_window.category = :key_item    @item_window.select_last    @item_window.activate  endend
 
Last edited by a moderator:

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
@Shaz - thanks! I do have a slight problem with the script change. When I choose the items, it doesn't cancel or dispose when I press X.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
Oops. I forgot to activate the item window. And I also should have defaulted the selection.


Just copy that second script again. Should be better this time.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

Asked my kids if they wanted me to draw something for them to color. One of them asked for one of the 101 Dalmatians... :kaoswt2:
Yesterday I made my first step towards eating more healthily.
I saw candy on discount and did not buy it.
"They yearn for what they fear for."
I always told my DA fans how much I hate slot machines. They're fine in games as a risk-and-reward system. But when you're spending REAL MONEY in a Vegas casino to try and hit the jackpot (which very, very few people will), it can really hurt your budget. Gambling is a bad habit, and I don't like wasting my money on a slim chance. Go to Vegas for the experience, not the jackpot.

Forum statistics

Threads
104,403
Messages
1,006,127
Members
135,932
Latest member
Sylwuu
Top