iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Shanghai Simple Script - Pick Item Event Errors
Katlynnia
post Mar 29 2012, 01:22 AM
Post #1



Group Icon


Type: Writer




I am using the Shanghai Simple Script - Pick Item Event to allow my player to pick items without going to a menu. However, every time I call the script in an event marked parallel process it gives me this huge error and crashes like no tomorrow. Even in common events. On it's own it works fine when the player has to action button the script. Also if I have a parallel process event with a normal script call in an action button event it will crash as well.

How do I fix it? Any ideas?

My error message:


Original Script:
QUOTE
#===============================================================================
#
# Shanghai Simple Script - Pick Item Event
# Last Date Updated: 2010.05.25
# Level: Easy
#
# This script prompts open a window to allow the player to select an item,
# weapon, or armor from the inventory to give the NPC, show the NPC, or whatever
# floats your boat. Works only on the map.
#===============================================================================
# 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.
#
# These commands go into the script call event. Use any one of these.
# $game_variables[1] = pick_item_event
# $game_variables[1] = pick_weapon_event
# $game_variables[1] = pick_armor_event
#
# This will return the selected item's item ID, weapon ID, or armor ID to the
# game variable you stored. 0 is returned if the player cancels.
#
# <key item>
# Place this tagin the noteboxes of your items, weapons, or armors to make
# you unable to select those items for the pick item event.
#===============================================================================

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

module SSS
# This sets how many items will be shown by rows and columns.
PICK_ITEM_ROWS = 8
PICK_ITEM_COLS = 9
end

#==============================================================================
# RPG::BaseItem
#==============================================================================

class RPG::BaseItem
#--------------------------------------------------------------------------
# key_item
#--------------------------------------------------------------------------
def key_item
return @key_item if @key_item != nil
@key_item = false
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:KEY_ITEM|key item)>/i
@key_item = true
end
}
return @key_item
end
end

#==============================================================================
# ** Game_Interpreter
#==============================================================================

class Game_Interpreter
#--------------------------------------------------------------------------
# * Pick Item Event
#--------------------------------------------------------------------------
def pick_item_event
return 0 unless $scene.is_a?(Scene_Map)
return $scene.pick_item_event(:item)
end
#--------------------------------------------------------------------------
# * Pick Weapon Event
#--------------------------------------------------------------------------
def pick_weapon_event
return 0 unless $scene.is_a?(Scene_Map)
return $scene.pick_item_event(:weapon)
end
#--------------------------------------------------------------------------
# * Pick Armor Event
#--------------------------------------------------------------------------
def pick_armor_event
return 0 unless $scene.is_a?(Scene_Map)
return $scene.pick_item_event(:armor)
end
end

#==============================================================================
# ** Window_Pick_Item
#==============================================================================

class Window_Pick_Item < Window_Selectable
#--------------------------------------------------------------------------
# * initialize
#--------------------------------------------------------------------------
def initialize(type)
@type = type
w = SSS::PICK_ITEM_COLS * 24 + 32
x = Graphics.width - w
h = [SSS::PICK_ITEM_ROWS * 24 + 32, Graphics.height - 184].min
y = Graphics.height - h - 128
super(x, y, w, h)
self.index = 0
self.openness = 0
@column_max = SSS::PICK_ITEM_COLS
@spacing = 0
refresh
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
case @type
when :item, :items
for item in $game_party.items
next unless item.is_a?(RPG::Item)
@data.push(item) if include?(item)
end
when :weapon, :weapons
for item in $game_party.items
next unless item.is_a?(RPG::Weapon)
@data.push(item) if include?(item)
end
when :armor, :armors, :armour, :armours
for item in $game_party.items
next unless item.is_a?(RPG::Armor)
@data.push(item) if include?(item)
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Include?
#--------------------------------------------------------------------------
def include?(item)
return false if item.nil?
return true
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
unless item.nil?
icon = item.icon_index
draw_icon(icon, rect.x, rect.y, enabled?(item))
draw_item_amount(item, rect.clone)
end
end
#--------------------------------------------------------------------------
# * Enabled?
#--------------------------------------------------------------------------
def enabled?(item)
return false if item.nil?
return false if item.key_item
return true
end
#--------------------------------------------------------------------------
# * Draw Item Amount
#--------------------------------------------------------------------------
def draw_item_amount(item, rect)
self.contents.font.size = 12
number = $game_party.item_number(item)
self.contents.font.color.alpha = enabled?(item) ? 255 : 128
self.contents.draw_text(rect.x, rect.y + WLH/3, 24, WLH * 2/3, number, 2)
end
end

#==============================================================================
# ** Window_Pick_Item_Help
#==============================================================================

class Window_Pick_Item_Help < Window_Base
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(pick_item_window)
@pick_item_window = pick_item_window
y = @pick_item_window.y - 56
w = [@pick_item_window.width, 200].max
x = Graphics.width - w
super(x, y, w, 56)
self.openness = 0
refresh
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
refresh if @last_item != @pick_item_window.item
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
item = @last_item = @pick_item_window.item
draw_icon(item.icon_index, 0, 0)
self.contents.draw_text(24, 0, contents.width - 24, WLH, item.name)
end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias terminate_sss_pick_item_event terminate unless $@
def terminate
unless @pick_item_window.nil?
@pick_item_window.dispose
@pick_item_window = nil
@pick_item_help.dispose
@pick_item_help = nil
end
terminate_sss_pick_item_event
end
#--------------------------------------------------------------------------
# * Pick Item Event
#--------------------------------------------------------------------------
def pick_item_event(type = :item)
case type
when :item, :items, :weapon, :weapons, :armor, :armors, :armour, :armours
@pick_item_window = Window_Pick_Item.new(type)
@pick_item_help = Window_Pick_Item_Help.new(@pick_item_window)
else
return 0
end
value = 0
@pick_item_window.open
@pick_item_help.open
loop do
update_basic
@pick_item_window.update
@pick_item_help.update
if Input.trigger?(Input::cool.gif
Sound.play_cancel
value = 0
break
elsif Input.trigger?(Input::C)
item = @pick_item_window.item
if @pick_item_window.enabled?(item)
Sound.play_decision
value = item.id
break
else
Sound.play_buzzer
end
end
end
@pick_item_window.close
@pick_item_help.close
loop do
update_basic
@pick_item_window.update
@pick_item_help.update
break if @pick_item_window.openness == 0
end
@pick_item_window.dispose
@pick_item_window = nil
@pick_item_help.dispose
@pick_item_help = nil
return value
end
end

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


This post has been edited by Katlynnia: Mar 29 2012, 01:25 AM
Attached File(s)
Attached File  error_message.png ( 18.94K ) Number of downloads: 1
 


--------------------
"We end up looking for people who impacted our lives very deeply,
only to discover that they were never meant to play more then
a small time in our lives.” ~ Katlynnia
Go to the top of the page
 
+Quote Post
   
Philacus
post Mar 30 2012, 08:44 AM
Post #2



Group Icon


Type: Designer
Alignment: Lawful Neutral




Sorry, was a double post.

This post has been edited by Philacus: Apr 1 2012, 12:14 AM


--------------------
Buffet Bushi: I gain power with the belly slaps! *slaps belly*
Everyone else: ... Something is wrong with this guy.
Go to the top of the page
 
+Quote Post
   
Philacus
post Mar 30 2012, 08:53 AM
Post #3



Group Icon


Type: Designer
Alignment: Lawful Neutral




It seems to run itself over and over stuck in one of its own loops, during parallel. It obviously was something overlooked by the script maker. For the most part, its hitting a stop in the interpreter, that won't stop. Its obviously not an error with the interpreter itself, but a modification to a section using 355. From what it seems, it could be one out of place symbol, or a section of missing script.

If you follow it backwards, you will find a list of commands that are piled up as an event handler.

I'm not entirely sure whats causing the error, I don't have enough experience with interpreter.

Testing of this yielded, if you turn off the switch for the parallel process just before it starts this script... It will show the windows, but the script will not function normally. You will not error with the stack overflow, but its too late for me to continue trying this today. You will likely need to do an import fix, or alias another piece, or find the broken loop that i'm too tired to find.

I didn't really DO anything, but set up a basic demo and put in the eventing for the problem. Someone with more patience and experience with the interpreter can work with it hopefully.

4shared Link


--------------------
Buffet Bushi: I gain power with the belly slaps! *slaps belly*
Everyone else: ... Something is wrong with this guy.
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd August 2014 - 03:04 AM

RPGMakerVX.net is an Privacy Policy, Legal.