After the 2.4 version, I will be including an update log into the documentation. I plan on going back and checking each version and what was updated. I should have done this from the start, so that is my mistake.
Blizzard, I would, but everyone seemed to get confused when it was in multiple parts. Installation was just a pain in my ass, mainly because we tried to make it so everyone could choose their own installation. Personally, I don't think pointing to a line with an error is a big concern, as I have tried to make it so there isn't any errors in the SDK, and any errors that do occur will hopefully be found outside the SDK. It may not open and point to your line with the error when you open the editor, but I do believe it errors and gives you the code line in the debug window. I might split it back into X parts, or I might just keep it in complete, but I am not doing both again (seemed to confuse a lot of people).
Robot, this is the RMXP SDK. I do plan to work on one for RMVX, mainly just adding the same method splits we already have in the RMXP SDK, but they did convert quite a bit of RMVX after the SDK (they probably just won't admit to it lol).
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Sometimes one can get an error in the SDK that involves another script entirely, ex. a script tries to alias a non-existant function and the engine spits out an error in the SDK because the SDK added functionality to alias and it points to the line where that function tries to call the original, which returns the error. That probably didn't make any sense...
Yeah, I got that, but... I don't know. I am trying to keep it standard. I could divide it back up, but that may just confuse people again, and I really don't want that. I will just have to see what everyone else thinks.
Split it into:
SDK Part 1 - Setup, Documentation, and SDK Part 1 SDK Part 2 SDK Part 5 SDK Part 4 SDK Patch
or
SDK Complete
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Why not split it up, but not even imply that the different slots would work independant of each other? I'm not quite familiar with the installation problems you say people had when it was split up before, but it seems like that might absolve any confusion.
Although personally, I'd like a package available which separates each individual class and module into its own slot, like the default scripts.
(Wow, I guess I'm getting pseudo active here again...next thing you know I'll be posting outside of the scripts section!)
Yeah, I was kinda thinking of just splitting it into 2 parts and leaving it at that.
And it is good to see you posting around here again. :)
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Seph, I haven't heard from you since I sent you the Scene_Base stuff. By the way I added a couple of things related to the @active variable (Scene_Base is now 469 instead of 468 lines), the files are in the same place I linked you to. I just want to know how everything's coming. Getting involved in your greatness has excited me, even though non-scripters probably wouldn't understand what's so exciting about a layering Scene_Base and a MACL that adapts to the scripts that use it to trim itself down.
Ok good to here. I will be updating both this week. I'll be pming you here soon as I still need a few details. The big thing is the MACL Needed function. But its pretty fun to write (more logging than anything). I am going to try and find a way to read the rxdata from the MACL to main and check that code (I haven't reallly tried yet). All else fails, you just put every script in 1 text file. Simple enough.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Robot, this is the RMXP SDK. I do plan to work on one for RMVX, mainly just adding the same method splits we already have in the RMXP SDK, but they did convert quite a bit of RMVX after the SDK (they probably just won't admit to it lol).
Sorry, my boyfriend was logged into my account and didn't read the first post (he's Ultima2876), I haven't even introduced myself here yet!
I've broken down the entire processing of Window_Message, especially for my Message System, but figured it would be useful to the SDK. Yes, this still functions exactly like the origional Window_Message, so if somebody decides to delete their default Window_Message then, in theory, everything should still work the same.
Window_Message+ : Script
Ignore Quick Positions, and scroll down to the Window_Message
#=============================================================================== # ** Window_Base - Quick Position #------------------------------------------------------------------------------- # This is my submitted MACL method for quickly setting window positions, I # use it in this script to set the position of the Gold window. #===============================================================================
class Window_Base < Window #----------------------------------------------------------------------------- # * Set Quick Position #----------------------------------------------------------------------------- def position(edge = 0, offset = 0) if edge.is_a?(Integer) if edge == 5 || edge == -5 || edge > 9 || edge < -9 edge = 0 end else ; return end o = offset.is_a?(Integer) ? offset : 0 case edge when 0 # Center self.x, self.y = (320 - (self.width / 2)) , (240 - (self.height / 2)) when 2 # Center Bottom self.x, self.y = (320 - (self.width / 2)) , (480 - (self.height)) unless o.zero? ; self.y -= o ; end when 4 # Center Left self.x, self.y = 0 , (240 - (self.height / 2)) unless o.zero? ; self.x += o ; end when 6 # Center Right self.x, self.y = (640 - self.width) , (240 - (self.height / 2)) unless o.zero? ; self.x -= o ; end when 8 # Center Top self.x, self.y = (320 - (self.width / 2)) , 0 unless o.zero? ; self.y += o ; end when 1 # Lower Left self.x, self.y = (0) , (480 - self.height) unless o.zero? ; self.x += o ; self.y -= o ; end when 3 # Lower Right self.x, self.y = (640 - self.width) , (480 - self.height) unless o.zero? ; self.x -= o ; self.y -= o ; end when 7 # Upper Left self.x, self.y = 0 , 0 unless o.zero? ; self.x += o ; self.y += o ; end when 9 # Upper Right self.x, self.y = 640 - self.width , 0 unless o.zero? ; self.x -= o ; self.y += o ; end when -2 # Center Bottom Outside self.x, self.y = (320 - (self.width / 2)) , 480 when -4 # Center Left Outside self.x, self.y = (0 - self.width) , (240 - (self.height / 2)) when -6 # Center Right Outside self.x, self.y = (640 + self.width) , (240 - (self.height / 2)) when -8 # Center Top Outside self.x, self.y = (320 - (self.width / 2)) , (0 - self.height) when -1 # Lower Left Outside self.x, self.y = (0 - self.width) , (480 + self.height) when -3 # Lower Right Outside self.x, self.y = (640 + self.width) , (480 + self.height) when -7 # Upper Right Outside self.x, self.y = (0 - self.width) , (0 - self.height) when -9 # Upper Left Outside self.x, self.y = (640 - self.width) , (0 - self.height) end end end
#=============================================================================== # ** Window_Message #------------------------------------------------------------------------------- # This class and all of it's functions have been broken down and re-written # entirely to make scripting in general easier. You can use this with or without # the Xtreme Message system, and Window_Message will still function normally. # However, don't remove this script because it is the base of the Xtreme Msg # System's laws of coding, and will break the script without it. #=============================================================================== class Window_Message < Window_Selectable #----------------------------------------------------------------------------- # * Customizable Constants #----------------------------------------------------------------------------- Default_Width = 480 Default_Height = 160 #----------------------------------------------------------------------------- # * Object Initialization #----------------------------------------------------------------------------- def initialize super(80, 304, Default_Width, Default_Height) self.contents = Bitmap.new(width - 32, height - 32) self.visible = false self.z = 9998 self.active = false self.index = -1 initialize_variables update_settings_text end #----------------------------------------------------------------------------- # * Initialize Variables #----------------------------------------------------------------------------- def initialize_variables @fade_in = false @fade_out = false @contents_showing = false @cursor_width = 0 end #----------------------------------------------------------------------------- # * Update Settings Text #----------------------------------------------------------------------------- def update_settings_text self.contents.font.name = Font.default_name self.contents.font.size = Font.default_size self.contents.font.bold = Font.default_bold self.contents.font.italic = Font.default_italic self.contents.font.color = Font.default_color end #----------------------------------------------------------------------------- # * Dispose #----------------------------------------------------------------------------- def dispose terminate_message $game_temp.message_window_showing = false dispose_input_number super end #----------------------------------------------------------------------------- # * Dispose Input Number Window #----------------------------------------------------------------------------- def dispose_input_number unless @input_number_window.nil? @input_number_window.dispose end end #----------------------------------------------------------------------------- # * Dispose Gold Window #----------------------------------------------------------------------------- def dispose_gold unless @gold_window.nil? @gold_window.dispose @gold_window = nil end end #----------------------------------------------------------------------------- # * Clear Game Temp #----------------------------------------------------------------------------- def clear_game_temp $game_temp.message_text = nil $game_temp.message_proc = nil $game_temp.choice_start = 99 $game_temp.choice_max = 0 $game_temp.choice_cancel_type = 0 $game_temp.choice_proc = nil $game_temp.num_input_start = 99 $game_temp.num_input_variable_id = 0 $game_temp.num_input_digits_max = 0 end #----------------------------------------------------------------------------- # * Refresh #----------------------------------------------------------------------------- def refresh self.contents.clear @x = $game_temp.choice_start.zero? ? 8 : 0 @y = 0 @cursor_width = 0 unless $game_temp.message_text.nil? @text = $game_temp.message_text begin last_text = @text.clone end until @text == last_text convert_message_codes while ((c = @text.slice!(/./m)) != nil) interpret_message_codes(c) write_message(c) end end refresh_choices refresh_input_number end #----------------------------------------------------------------------------- # * Refresh Choices #----------------------------------------------------------------------------- def refresh_choices unless $game_temp.choice_max.zero? || $game_temp.choice_max < 0 @item_max = $game_temp.choice_max self.active = true self.index = 0 end end #----------------------------------------------------------------------------- # * Refresh Input Number #----------------------------------------------------------------------------- def refresh_input_number if $game_temp.num_input_variable_id > 0 digits_max = $game_temp.num_input_digits_max number = $game_variables[$game_temp.num_input_variable_id] @input_number_window = Window_InputNumber.new(digits_max) @input_number_window.number = number @input_number_window.x = self.x + 8 @input_number_window.y = self.y + $game_temp.num_input_start * 32 end end #----------------------------------------------------------------------------- # * Terminate Message #----------------------------------------------------------------------------- def terminate_message self.active = false self.pause = false self.index = -1 self.contents.clear @contents_showing = false unless $game_temp.message_proc.nil? $game_temp.message_proc.call end clear_game_temp dispose_gold end #----------------------------------------------------------------------------- # * Convert Message Codes #----------------------------------------------------------------------------- def convert_message_codes # Convert Variable @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } # Convert Game Actor Name @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do !$game_actors[$1.to_i].nil? ? $game_actors[$1.to_i].name : "" end # Change \\\\ to \000 @text.gsub!(/\\\\/) { "\000" } # Change \C[#] to Color @text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } # Show Gold Window @text.gsub!(/\\[Gg]/) { "\002" } end #----------------------------------------------------------------------------- # * Interpret Message Codes #----------------------------------------------------------------------------- def interpret_message_codes(c) # If \\ case c when "\000" ; c = "\\" when "\001" ; change_text_color ; return when "\002" ; create_gold_window ; return when "\n" if @y >= $game_temp.choice_start @cursor_width = [@cursor_width, @x].max end @y += 1 @x = 0 if @y >= $game_temp.choice_start @x = 8 end return end end #----------------------------------------------------------------------------- # * Write Message #----------------------------------------------------------------------------- def write_message(c) self.contents.draw_text(4 + @x, 32 * @y, 40, 32, c) @x += self.contents.text_size(c.to_s).width end #----------------------------------------------------------------------------- # * Change Text Color #----------------------------------------------------------------------------- def change_text_color @text.sub!(/\[([0-9]+)\]/, "") color = $1.to_i if color >= 0 and color <= 7 self.contents.font.color = text_color(color) end end #----------------------------------------------------------------------------- # * Create Gold Window #----------------------------------------------------------------------------- def create_gold_window if @gold_window.nil? @gold_window = Window_Gold.new @gold_window.z = 9998 @gold_window.opacity = self.opacity @gold_window.back_opacity = self.back_opacity if $game_temp.in_battle ; @gold_window.position(3, 16) else ; @gold_window.position(9, 16) end end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # Step 1 : Create Message if @fade_in create_message return end # Step 2 : Proccess Input Number (if applicable) unless @input_number_window.nil? update_input_number return end # Step 3 : Process Show Choices (if applicable) if @contents_showing update_show_choices return end # Step 4 : Update Message Waiting if !@fade_out && !$game_temp.message_text.nil? #if @fade_out == false and $game_temp.message_text != nil update_message_idle return end # Step 5 : Clear Message if self.visible clear_message return end end #----------------------------------------------------------------------------- # * Update Fade In #----------------------------------------------------------------------------- def create_message self.contents_opacity += 24 unless @input_number_window.nil? @input_number_window.contents_opacity += 24 end if self.contents_opacity == 255 @fade_in = false end end #----------------------------------------------------------------------------- # * Update Input Number #----------------------------------------------------------------------------- def update_input_number @input_number_window.update if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $game_variables[$game_temp.num_input_variable_id] = @input_number_window.number $game_map.need_refresh = true @input_number_window.dispose @input_number_window = nil terminate_message end end #----------------------------------------------------------------------------- # * Update Show Choices #----------------------------------------------------------------------------- def update_show_choices # If choice isn't being displayed, show pause sign if $game_temp.choice_max.zero? ; self.pause = true end # Cancel if Input.trigger?(Input::B) if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0 $game_system.se_play($data_system.cancel_se) $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1) terminate_message end end # Confirm if Input.trigger?(Input::C) if $game_temp.choice_max > 0 $game_system.se_play($data_system.decision_se) $game_temp.choice_proc.call(self.index) end terminate_message end end #----------------------------------------------------------------------------- # * Update Message Waiting #----------------------------------------------------------------------------- def update_message_idle @contents_showing = true $game_temp.message_window_showing = true reset_window refresh Graphics.frame_reset self.visible = true self.contents_opacity = 0 if @input_number_window != nil @input_number_window.contents_opacity = 0 end @fade_in = true end #----------------------------------------------------------------------------- # * Close Message #----------------------------------------------------------------------------- def clear_message @fade_out = true self.opacity -= 48 if self.opacity == 0 self.visible = false @fade_out = false $game_temp.message_window_showing = false end update_settings_text end #----------------------------------------------------------------------------- # * Reset Window #----------------------------------------------------------------------------- def reset_window if $game_temp.in_battle ; self.y = 16 else case $game_system.message_position when 0 ; self.y = 16 when 1 ; self.y = 160 when 2 ; self.y = 304 end end if $game_system.message_frame.zero? ; self.opacity = 255 else ; self.opacity = 0 end self.back_opacity = 160 end #-------------------------------------------------------------------------- # * Update Cursor Rect #-------------------------------------------------------------------------- def update_cursor_rect if @index >= 0 n = $game_temp.choice_start + @index self.cursor_rect.set(8, n * 32, @cursor_width, 32) else self.cursor_rect.empty end end end
Expand to see the code.
Window_Message+ : Methods List
# Initialize # Initalize # Initalize_Variables # Update Settings Text # Dispose # Dispose Input Number # Dispose Gold # Clear Game Temp # Refresh # Refresh Choices # Refresh Input Number # Terminate Message # Convert Message Codes # Interpret Message Codes # Write Message # Change Text Color # Create Gold Window # Create Message # Update Show Choices # Update Input Number # Update Message Idle # Clear Message # Reset Window # Update Cursor Rect
Xtreme Message System (Early) - Based off new Window_Message
#=============================================================================== # ~** Xtreme Message System **~ #------------------------------------------------------------------------------- # Written by : Kain Nobel # Version : 0.0 # Last Update : 08/20/2008 # Created On : 08/20/2008 #------------------------------------------------------------------------------- # * Description : # # This script is supposed to clean up and combine features of many popular # message systems, such as Dubealex's AMS and Ccoa's UMS. Unlike other # systems of the same nature, everything is actually set through a simple # module known as the "Message" module, can you dig it? #------------------------------------------------------------------------------- # * Instructions : Call Script Codes # # Message.window_mode(number/constant) # Toggle Window Modes # Message.set_bold(true/false) # Toggle Text Bold # Message.set_italics(true/false) # Toggle Text Italics # Message.set_font(name, size) # Change Text Font Name & Font Size # Message.set_color(Color.new()) # Change Text Font Color # Message.set_faces(true/false) # Toggle Facesets on or off # Message.justify_window(number/string) # Justify Window Left, Center or Right # Message.justify_text(number/string) # Justify Text Left, Center or Right #------------------------------------------------------------------------------- # * Compatibility : # # This script redefines & overwrites Window_Message's refresh method entirely. #=============================================================================== SDK.enable('Xtreme Message System') #------------------------------------------------------------------------------- # * SDK Log #------------------------------------------------------------------------------- SDK.log('[KN]::Message System', 'Kain Nobel', 0.1, '2008-20-08') #------------------------------------------------------------------------------- # * SDK Enabled Test - BEGIN #------------------------------------------------------------------------------- if SDK.enabled?('Xtreme Message System')
#=============================================================================== # ** Message #------------------------------------------------------------------------------- # This module is the data & control structure of Kain Nobel's Message System. #=============================================================================== module Message #----------------------------------------------------------------------------- # * Constants #----------------------------------------------------------------------------- Default_H = 160 Default_W = 480 #----------------------------------------------------------------------------- # * Message.set_font(name, -size) #----------------------------------------------------------------------------- def self.set_font(name = Font.default_name, size = Font.default_size) return if !name.is_a?(String) || !size.is_a?(Numeric) @font_name, @font_size = name, size end #----------------------------------------------------------------------------- # * Message.set_bold(-boolean) #----------------------------------------------------------------------------- def self.set_bold(boolean = nil) if boolean.nil? ; @bold = !@bold else ; @bold = boolean end end #----------------------------------------------------------------------------- # * Message.set_italic(-boolean) #----------------------------------------------------------------------------- def self.set_italic(boolean = nil) if boolean.nil? ; @italic = !@italic else ; @italic = boolean end end #----------------------------------------------------------------------------- # * Message.set_color(r, g, b, a) #----------------------------------------------------------------------------- def self.set_color(r = nil, g = nil, b = nil, a = 255) new_color = r.nil? ? nil : Color.new(r, g, b, a) if new_color.nil? ; @font_color = Font.default_color else ; @font_color = new_color end end #----------------------------------------------------------------------------- # * Message.set_align(align) #----------------------------------------------------------------------------- def self.set_align(align) if align.is_a?(String) case align.upcase! when 'LEFT' ; align = 0 when 'CENTER' ; align = 1 when 'RIGHT' ; align = 2 end end if align.is_a?(Numeric) && align.between?(0, 2) @align = align end end #----------------------------------------------------------------------------- # * Message.reset #----------------------------------------------------------------------------- def self.reset @bold = Font.default_bold @italic = Font.default_italic @font_name = Font.default_name @font_size = Font.default_size @font_color = Font.default_color end #----------------------------------------------------------------------------- # * Message.set_mode(boolean) #----------------------------------------------------------------------------- def self.set_mode_text(boolean = false) @mode_text = boolean == false ? 'Normal' : 'Custom' end #----------------------------------------------------------------------------- # * Message.set_width(-width) #----------------------------------------------------------------------------- def self.set_width(width = nil) @width = width.is_a?(Numeric) ? width : Default_W end #----------------------------------------------------------------------------- # * Message.set_height(height) #----------------------------------------------------------------------------- def self.set_height(height = nil) @height = height.is_a?(Numeric) ? height : Default_H end #----------------------------------------------------------------------------- # * Message.mode_text #----------------------------------------------------------------------------- def self.mode_text @mode_text = @mode_text.nil? ? 'Normal' : @mode_text end #----------------------------------------------------------------------------- # * Message.bold #----------------------------------------------------------------------------- def self.bold @bold = @bold.nil? ? Font.default_bold : @bold return @bold end #----------------------------------------------------------------------------- # * Message.italic #----------------------------------------------------------------------------- def self.italic @italic = @italic.nil? ? Font.default_italic : @italic return @italic end #----------------------------------------------------------------------------- # * Message.font_name #----------------------------------------------------------------------------- def self.font_name @font_name = @font_name.nil? ? Font.default_name : @font_name return @font_name end #----------------------------------------------------------------------------- # * Message.font_size #----------------------------------------------------------------------------- def self.font_size @font_size = @font_size.nil? ? Font.default_size : @font_size return @font_size end #----------------------------------------------------------------------------- # * Message.width #----------------------------------------------------------------------------- def self.width @width = @width.is_a?(Numeric) ? @width : Default_W return @width end #----------------------------------------------------------------------------- # * Message.height #----------------------------------------------------------------------------- def self.height @height = @height.is_a?(Numeric) ? @height : Default_H end #----------------------------------------------------------------------------- # * Message.align #----------------------------------------------------------------------------- def self.align @align = !@align.is_a?(Fixnum) ? 0 : @align return @align end #----------------------------------------------------------------------------- # * Message.font_color #----------------------------------------------------------------------------- def self.font_color @font_color = !@font_color.is_a?(Color) ? Font.default_color : @font_color return @font_color end end
#=============================================================================== # ** Window_Message #------------------------------------------------------------------------------- # This is defined based on the Window_Message+ listed above this one (which # was broken down to script with easier, yet maintain normal function.) This # aliases all the broken down methods and allows you easier access to setting # your own defined codes without going crosseyed @_@ ! #=============================================================================== class Window_Message < Window_Selectable #----------------------------------------------------------------------------- # * Customizable Constants #----------------------------------------------------------------------------- Default_Width = Message::Default_W Default_Height = Message::Default_H #----------------------------------------------------------------------------- # * Alias Methods #----------------------------------------------------------------------------- alias_method :xms_win_msg_refresh, :refresh alias_method :xms_win_msg_update_settings_text, :update_settings_text alias_method :xms_win_msg_convert_msg_codes, :convert_message_codes alias_method :xms_win_msg_interpret_msg_codes, :interpret_message_codes alias_method :xms_win_msg_write_message, :write_message #----------------------------------------------------------------------------- # * Object Update (*Aliased*) #----------------------------------------------------------------------------- def refresh update_settings_text xms_win_msg_refresh update_settings_text end #----------------------------------------------------------------------------- # * Update Settings Font (*Aliased*) #----------------------------------------------------------------------------- def update_settings_text self.width = Message.width if self.width != Message.width self.height = Message.height if self.height != Message.height case Message.mode_text.upcase! when 'NORMAL' ; xms_win_msg_update_settings_text when 'CUSTOM' self.contents.font.bold = Message.bold self.contents.font.italic = Message.italic self.contents.font.name = Message.font_name self.contents.font.size = Message.font_size self.contents.font.color = Message.font_color if defined?(CMS) && CMS.is_a?(Module) self.windowskin = CMS.apply_windowskin end end end #----------------------------------------------------------------------------- # * Convert Message Codes (*Aliased*) #----------------------------------------------------------------------------- def convert_message_codes xms_win_msg_convert_msg_codes # Convert Party Actor Name @text.gsub!(/\\[Pp][Nn]\[([0-9]+)\]/) do !$game_party.actors[$1.to_i].nil? ? $game_party.actors[$1.to_i].name : "N/A" end # Set Bold @text.gsub!(/\\[Bb]/) { "\003" } @text.gsub!(/\\[+][Bb]/) { "\004" } @text.gsub!(/\\[-][Bb]/) { "\005" } # Set Italic @text.gsub!(/\\[Ii]/) { "\006" } @text.gsub!(/\\[+][Ii]/) { "\007" } @text.gsub!(/\\[-][Ii]/) { "\010" } # Text Justification @text.gsub!(/\\[Tt][Jj][Ll]/) { "\011" } @text.gsub!(/\\[Tt][Jj][Cc]/) { "\012" } @text.gsub!(/\\[Tt][Jj][Rr]/) { "\013" } # Window Justification @text.gsub!(/\\[Ww][Jj][Ll]/) { "\014" } @text.gsub!(/\\[Ww][Jj][Cc]/) { "\015" } @text.gsub!(/\\[Ww][Jj][Rr]/) { "\016" } # Set Window Width @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\017[#{$1}]" } # Set Window Height @text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\020[#{$1}]" } # Default Window Width @text.gsub!(/\\[-][Ww]/) { "\021" } # Default Window Height @text.gsub!(/\\[-][Hh]/) { "\022" } # Set Font Name (\fn[""], \-fn @text.gsub!(/\\[Ff][Nn]\[(.*?)\]/) { "\023[#{$1}]" } @text.gsub!(/\\[-][Ff][Nn]/) { "\024" } # Set Font Size (\fs[#], \-fs) @text.gsub!(/\\[Ff][Ss]\[([0-9]+)\]/) { "\025[#{$1}]" } @text.gsub!(/\\[-][Ff][Ss]/) { "\026" } # Set Message Position (\wp0, \wp1, \wp2) @text.gsub!(/\\[Ww][Pp][0]/) { "\027" } @text.gsub!(/\\[Ww][Pp][1]/) { "\030" } @text.gsub!(/\\[Ww][Pp][2]/) { "\031" } # Set Message Transparent (\show) @text.gsub!(/\\[Hh][Ii][Dd][Ee]/) { "\032" } # Unset Message Transparent (\hide) @text.gsub!(/\\[Ss][Hh][Oo][Ww]/) { "\033" } end #----------------------------------------------------------------------------- # * Interpret Message Codes (*Aliased*) #----------------------------------------------------------------------------- def interpret_message_codes(c) xms_win_msg_interpret_msg_codes(c) case c # (\B) : Bold Toggle when "\003" self.contents.font.bold = !self.contents.font.bold return # (\+B) : Bold ON when "\004" self.contents.font.bold = true return # (\-B) : Bold OFF when "\005" self.contents.font.bold = false return # (\I) : Toggle Italics when "\006" self.contents.font.italic = !self.contents.font.italic return # (\+I) : Italics ON when "\007" self.contents.font.italic = true return # (\-I) : Italics OFF when "\010" self.contents.font.italic = false return # (\TJL) : Text Justify Left when "\011" Message.set_align(0) return # (\TJC) : Text Justify Center when "\012" Message.set_align(1) return # (\TJR) : Text Justify Right when "\013" Message.set_align(2) return # (\WJL) : Window Justification Left when "\014" self.x = 8 return # (\WJC) : Window Justification Center when "\015" self.x = 320 - (self.width / 2) return # (\WJR) : Window Justification Right when "\016" self.x = 640 - (self.width + 8) return # (\W[#]) : Default Window Width when "\017" @text.sub!(/\[([0-9]+)\]/, "") Message.set_width($1.to_i) return # (\H[#]) : Default Window Height when "\020" @text.sub!(/\[([0-9]+)\]/, "") Message.set_height($1.to_i) return # (\-W) : Set Default Width when "\021" self.width = Default_Width return # (\-H) : Set Default Height when "\022" self.height = Default_Height return # (\FN[font]) : Set Font Name when "\023" @text.sub!(/\[(.*?)\]/, "") font = $1.to_s if font == "" ; self.contents.font.name = Font.default_name else ; self.contents.font.name = font end return # (\-FN) : Default Font Name when "\024" self.contents.font.name = Font.default_name return # (\FS[size] : Set Font Size when "\025" @text.sub!(/\[([0-9]+)\]/, "") self.contents.font.size = $1.to_i return # (\-FS) : Default Font Size when "\026" self.contents.font.size = Font.default_size return # (\WP0) : Window Position Top when "\027" $game_system.message_position = 0 return # (\WP1) : Window Position Middle when "\030" $game_system.message_position = 1 return # (\WP2) : Window Position Bottom when "\031" $game_system.message_position = 2 return # Set Transparent ON when "\032" $game_system.message_frame = 1 return # Set Transparent OFF when "\033" $game_system.message_frame = 0 return end end #----------------------------------------------------------------------------- # * Write Message (*Aliased*) #----------------------------------------------------------------------------- #def write_message(c) # self.contents.draw_text(4 + @x, 32 * @y, 40, 32, c, Message.align) # @x += self.contents.text_size(c.to_s).width #end end #------------------------------------------------------------------------------- # * SDK Enabled Test - END #------------------------------------------------------------------------------- end
Expand to see the code.
If you decide to use it, or especially if you use it and change some of the coding please let me know so that my message system will be compliant with the updates. Hope you like it, enjoy!
EDIT: I updated actor.level_up and actor.level_down. Now skills will be added/removed when you level up/down and also theres a bug if you level up outside of the 1...99 range so I added a small conditional "unless @level == #" to prevent that.
class Game_Actor #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- def level_up(override = false) @level += 1 unless @level == 99 # Learn Skill for skill in $data_classes[@class_id].learnings if skill.level <= @level && !@skills.include?(skill.skill_id) #if skill.level == @level learn_skill(skill.skill_id) end end end #-------------------------------------------------------------------------- # * Level Down #-------------------------------------------------------------------------- def level_down @level -= 1 unless @level == 1 # Forget Skill for skill in $data_classes[@class_id].learnings if skill.level > @level && @skills.include?(skill.skill_id) forget_skill(skill.skill_id) end end end end
Expand to see the code.
Interpreter Fix (easier to alias/overwrite condition branch types)
#============================================================================= # *** Aleworks Input Module Compability Patch 1(AIM CP1) #============================================================================= # Created by Aleworks # Version: 1.00 # Last Update: 29/03/2007 (day/month/year) #============================================================================= #==== Description ==== # This patch, is for making AIM, compatible with the default interpreter script # of RPG Maker XP, when using the Conditional Branch and Button Input Processing # commands. #============================================================================= #==== Requeriments ==== # * Aleworks Input Module # - Version: 1.00 or superior #============================================================================= #==== Classes & Methods ==== # ** Class Interpreter (SDK) # * Overwrite Methods: condition_input #============================================================================= #----------------------------------------------------------------------------- # * SDK Log #----------------------------------------------------------------------------- SDK.log('Aleworks Input Interpreter', 'vgvgf+Kain Nobel', 1.01, '2007-27-08') SDK.log_overwrite(Interpreter, :condition_input) #----------------------------------------------------------------------------- # * SDK Enabled Test - BEGIN #----------------------------------------------------------------------------- if SDK.enabled?('Aleworks Input Interpreter') #============================================================================= # ** Interpreter #============================================================================= class Interpreter #--------------------------------------------------------------------------- # * Input Button #--------------------------------------------------------------------------- def input_button n = 1 if Input.trigger?(Input::LOWER_LEFT) n = 3 if Input.trigger?(Input::LOWER_RIGHT) n = 7 if Input.trigger?(Input::UPPER_LEFT) n = 9 if Input.trigger?(Input::UPPER_RIGHT) n = 2 if Input.trigger?(Input::DOWN) n = 4 if Input.trigger?(Input::LEFT) n = 6 if Input.trigger?(Input::RIGHT) n = 8 if Input.trigger?(Input::UP) n = 11 if Input.trigger?(Input::A) n = 12 if Input.trigger?(Input::B) n = 13 if Input.trigger?(Input::C) n = 14 if Input.trigger?(Input::X) n = 15 if Input.trigger?(Input::Y) n = 16 if Input.trigger?(Input::Z) n = 17 if Input.trigger?(Input::L) n = 18 if Input.trigger?(Input::R) if !n.nil? $game_variables[@button_input_variable_id] = n $game_map.need_refresh = true @button_input_variable_id = 0 end end #----------------------------------------------------------------------------- # * Condition Input #----------------------------------------------------------------------------- def condition_input n = Input::DOWN if @parameters[1] == 2 n = Input::LEFT if @parameters[1] == 4 n = Input::RIGHT if @parameters[1] == 6 n = Input::UP if @parameters[1] == 8 n = Input::A if @parameters[1] == 11 n = Input::B if @parameters[1] == 12 n = Input::C if @parameters[1] == 13 n = Input::X if @parameters[1] == 14 n = Input::Y if @parameters[1] == 15 n = Input::Z if @parameters[1] == 16 n = Input::L if @parameters[1] == 17 n = Input::R if @parameters[1] == 18 return (Input.press?(n)) end end #------------------------------------------------------------------------------- # * SDK Enabled Test - END #------------------------------------------------------------------------------- end
You can find any scripts I've submitted within the past year upto the date specified above. If you happen to find something else that is either not on the list or just doesn't have a URL that I had posted officially or otherwise, please PM me the link and I'll be sure to add it to the list.
Last edited by Kain Nobel on Wed Aug 27, 2008 11:59 pm, edited 1 time in total.
Hey guys, im new here and to RMXP, i am currently using side viewer battle system and it came with SDK 2.2 (I really dont understand scripts at all) if you could please tell me how to update to the 2.4 version that would be great. Do i just delete the 2.2 script info and put in the 2.4 script? If so, can you please post the script of it all together, nothing missing that i have to add because it really makes no sense to me. Sorry for the hastle...i am trying to get better at this :P
I have been considering breaking down Window_Message for message systems as that refresh method is way over complex. I'll take a look at what you have done and put something together for the 2.5 version.
@Xaitan: Just click on the text document in the first post, copy and paste over the 2.4 version. That should be it.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
#============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs title screen processing. #============================================================================== class Scene_Title
#-------------------------------------------------------------------------- # * Main Processing : Database Initialization #-------------------------------------------------------------------------- alias alexanderpas_sdksuggestion_scenetitle_maindatabase main_database
def main_database $data_map_infos = load_data("Data/MapInfos.rxdata") alexanderpas_sdksuggestion_scenetitle_maindatabase end end
#============================================================================== # ** Game_Map #------------------------------------------------------------------------------ # This class handles the map. It includes scrolling and passable determining # functions. Refer to "$game_map" for the instance of this class. #============================================================================== class Game_Map
#-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :map_name
#-------------------------------------------------------------------------- # * Setup Map Name #-------------------------------------------------------------------------- def setup_map_name @map_name = $data_map_infos[@map_id].name end
#-------------------------------------------------------------------------- # * Setup # map_id : map ID #-------------------------------------------------------------------------- alias alexanderpas_sdksuggestion_gamemap_setup setup
def setup(map_id) alexanderpas_sdksuggestion_gamemap_setup(map_id) setup_map_name end end
Expand to see the code.
To split the X-axis and the Y-axis of the display centering
#============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. Its functions include event starting # determinants and map scrolling. Refer to "$game_player" for the one # instance of this class. #============================================================================== class Game_Player
#-------------------------------------------------------------------------- # * Set Map Display Position to Center of Screen #-------------------------------------------------------------------------- SDK.log_branch(:Game_Player, :center, :center_x, :center_y)
def center(x, y) center_x(x) center_y(y) end
#-------------------------------------------------------------------------- # * Set Map Display Position to Center of Screen (X-axis) #-------------------------------------------------------------------------- def center_x(x) max_x = ($game_map.width - 20) * 128 $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max end
#-------------------------------------------------------------------------- # * Set Map Display Position to Center of Screen (Y-axis) #-------------------------------------------------------------------------- def center_y(y) max_y = ($game_map.height - 15) * 128 $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max end end
#============================================================================== # ** Game_Player #------------------------------------------------------------------------------ # This class handles the player. Its functions include event starting # determinants and map scrolling. Refer to "$game_player" for the one # instance of this class. #============================================================================== class Game_Player
#-------------------------------------------------------------------------- # * Front Event Starting Determinant #-------------------------------------------------------------------------- def check_event_trigger_there(triggers) # If no event is running unless $game_system.map_interpreter.running? # Activate events in front of the player if events_front_start?(triggers, 1) return true end # If only a counter is found in front of the player if in_front_of_counter? # Activate events in front of the player, behind the counter if events_front_start?(triggers, 2) return true end end end return false end
#-------------------------------------------------------------------------- # * Front Event Starting Determinant #-------------------------------------------------------------------------- def events_front_start?(triggers, distance, x = @x, y = @y) x += (@direction == 6 ? distance : @direction == 4 ? -distance : 0) y += (@direction == 2 ? distance : @direction == 8 ? -distance : 0) # we only need to return after all events have been checked result = false # All event loops for event in $game_map.events.values # If event coordinates and triggers are consistent if event.x == x and event.y == y and triggers.include?(event.trigger) # If starting determinant is front event (other than jumping) unless event.jumping? or event.over_trigger? event.start # we need to check for more events, so we don't return here yet. result = true end end end return result end end
#============================================================================== # ** Game_Character #------------------------------------------------------------------------------ # This class deals with characters. It's used as a superclass for the # Game_Player and Game_Event classes. #============================================================================== class Game_Character
#-------------------------------------------------------------------------- # * Is the event in front of a counter # x : optional parameter, defaults to current event location (X-axis) # y : optional parameter, defaults to current event location (Y-axis) # These parameters are to be used when extending this method #-------------------------------------------------------------------------- def in_front_of_counter?(x = @x, y = @y) x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) return $game_map.counter?(x, y) end end
#============================================================================== # ** Game_Screen #------------------------------------------------------------------------------ # This class handles screen maintenance data, such as change in color tone, # flashing, etc. Refer to "$game_screen" for the instance of this class. #==============================================================================
class Game_Screen #-------------------------------------------------------------------------- # * Set Weather # type : type # power : strength # duration : time #-------------------------------------------------------------------------- SDK.log_overwrite(:Game_Screen, :weather)
def weather(type, power, duration) @weather_type_target = type if @weather_type_target != 0 @weather_type = @weather_type_target @weather_max_target = (power + 1) * 4.0 else @weather_max_target = 0.0 end @weather_duration = duration if @weather_duration == 0 @weather_type = @weather_type_target @weather_max = @weather_max_target end end end
#============================================================================== # ** Game_Screen #------------------------------------------------------------------------------ # This class handles screen maintenance data, such as change in color tone, # flashing, etc. Refer to "$game_screen" for the instance of this class. #==============================================================================
def update update_tone update_flash update_shake update_weather update_pictures end
#-------------------------------------------------------------------------- # * Frame Update - Tone #-------------------------------------------------------------------------- def update_tone if @tone_duration >= 1 d = @tone_duration @tone.red = (@tone.red * (d - 1) + @tone_target.red) / d @tone.green = (@tone.green * (d - 1) + @tone_target.green) / d @tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d @tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d @tone_duration -= 1 end end
#-------------------------------------------------------------------------- # * Frame Update - Flash #-------------------------------------------------------------------------- def update_flash if @flash_duration >= 1 d = @flash_duration @flash_color.alpha = @flash_color.alpha * (d - 1) / d @flash_duration -= 1 end end
#-------------------------------------------------------------------------- # * Frame Update - Shake #-------------------------------------------------------------------------- def update_shake if @shake_duration >= 1 or @shake != 0 delta = (@shake_power * @shake_speed * @shake_direction) / 10.0 if @shake_duration <= 1 and @shake * (@shake + delta) < 0 @shake = 0 else @shake += delta end if @shake > @shake_power * 2 @shake_direction = -1 end if @shake < - @shake_power * 2 @shake_direction = 1 end if @shake_duration >= 1 @shake_duration -= 1 end end end
#-------------------------------------------------------------------------- # * Frame Update - Weather #-------------------------------------------------------------------------- def update_weather if @weather_duration >= 1 d = @weather_duration @weather_max = (@weather_max * (d - 1) + @weather_max_target) / d @weather_duration -= 1 if @weather_duration == 0 @weather_type = @weather_type_target end end end
#-------------------------------------------------------------------------- # * Frame Update - Pictures #-------------------------------------------------------------------------- def update_pictures if $game_temp.in_battle for i in 51..100 @pictures[i].update end else for i in 1..50 @pictures[i].update end end end end
#============================================================================== # ** Game_Picture #------------------------------------------------------------------------------ # This class handles the picture. It's used within the Game_Screen class # ($game_screen). #============================================================================== class Game_Picture
#============================================================================== # ** Game_Battler #------------------------------------------------------------------------------ # This class deals with battlers. It's used as a superclass for the Game_Actor # and Game_Enemy classes. #============================================================================== class Game_Battler
def skill_can_use?(skill_id) # Only if you have enough SP, the skill can be used. if skill_enough_sp?(skill_id) # Unusable if incapacitated if not dead? # check if you're silenced weither the skill is physical. unless skill_silenced?(skill_id) return skill_right_occasion?(skill_id) end end end return false end
#-------------------------------------------------------------------------- # * Determine enough SP for Skills # skill_id : skill ID #-------------------------------------------------------------------------- def skill_enough_sp?(skill_id) return ($data_skills[skill_id].sp_cost <= self.sp) end
#-------------------------------------------------------------------------- # * Determine weither Skills are silenced # skill_id : skill ID #-------------------------------------------------------------------------- def skill_silenced?(skill_id) return ($data_skills[skill_id].atk_f == 0 and self.restriction == 1) end
#-------------------------------------------------------------------------- # * Determine Usable Skills # skill_id : skill ID #-------------------------------------------------------------------------- def skill_right_occasion?(skill_id) # Get usable time occasion = $data_skills[skill_id].occasion case occasion when 0 # [Normal] return true when 1 # [Only Battle] return $game_temp.in_battle when 2 # [Only Menu] return (not $game_temp.in_battle) end end end
Expand to see the code.
(request to mods: please remove all post that are asking on how the SDK works and also the "I'm having a problem with the SDK" posts.)
I have moved and changed the map infos. Now, map infos loads as an instance in $game_map. Then Game_Map has a method name, that just returns the name. Nothing else is vital of the RPG::MapInfo object really. But I am however putting this into the MACL, as it is an addition, not a re-write.
Why would the center method need to be split? You can really just alias the center method itself, and work from there. Unless you have some reason it needs to be split...
I like the trigger alteration. I will rename the methods (to fit a more specific format) and alter the code slightly and add that in.
I'll add the weather fix. Silly EB.
I will add the update method splits, because I am branching quite a few of the method in the game and sprite classes.
I don't see the point of the skill_can_use? branch. I have aliased this method in nearly 60 scripts, and never had a means to split it up.
@KN: As I said above, I am planning on breaking down the Window_Message refresh method. I will look into some of the bigger interpreter methods.
If I haven't said it before, like with the MACL, I am working on a compiler, that once your project is finalized, it generates the SDK code for you, removing un-need methods. I am working on these updates now.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Why would the center method need to be split? You can really just alias the center method itself, and work from there. Unless you have some reason it needs to be split...
Wrapping (looping) maps ;) or more precisely, single direction wrapping maps. best explained with a pseudo-code example!
if WRAP X wrap X code Copy of original Y code else if WRAP Y Copy of original X code wrap Y code else if WRAP Both Copy of wrap X code Copy of wrap Y code else original X+Y code end
if <exp> return false end if <exp> return false end ... return true
Expand to see the code.
There is no stacked expressions or stacked blocks that would require you split this method.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Well, I'm purposely putting all development on my XMS on hold until you've SDK-ized Window_Message, so its all in your hands now. The one I submitted should have most of the elbow work out of the way, except for theres a bug where it won't go away during battle you could probably chase down. Hopefully its not going to be too different from what I've submitted (unless its for the greater good) because I've already got alot of the XMS done so far (but yes, its awaiting your SDK version of the message window.)
Also, in SDK::Scene_Base, you need to include your Graphics.freeze in main_dispose instead of in the actual 'main' method. I move the windows outside of the screen in all of my menu scenes, so I moved Graphics.freeze into 'main_dispose' and super call it after windows are all exited. Its a small change, but it makes it possible rather than the other way around the graphics are already frozen.
#-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main main_variable # Main Variable Initialization main_spriteset # Main Spriteset Initialization main_sprite # Main Sprite Initialization main_window # Main Window Initialization main_audio # Main Audio Initialization main_transition # Main Transition Initialization loop do # Scene Loop main_loop # Main Loop break if main_break? # Break If Breakloop Test end # End Scene Loop # Graphics.freeze #<--Moved into main_dispose main_dispose # Main Dispose main_end # Main End end #-------------------------------------------------------------------------- # * Main Processing : Disposal #-------------------------------------------------------------------------- def main_dispose # Prepare for transition Graphics.freeze # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Pass Object To Auto Dispose auto_dispose(object) end end
class Scene_Menu < SDK::Scene_Base #----------------------------------------------------------------------------- # * Main Dispose #----------------------------------------------------------------------------- def main_dispose exit_scene # a method created that moves windows if windows_disposed? # checks if windows are at their end coords super end end end
You can find any scripts I've submitted within the past year upto the date specified above. If you happen to find something else that is either not on the list or just doesn't have a URL that I had posted officially or otherwise, please PM me the link and I'll be sure to add it to the list.
Last edited by Kain Nobel on Wed Sep 10, 2008 11:29 am, edited 1 time in total.
Your windows that are exiting should be in the main loop, not in the disposal method. Your main_break? method is prematurely causing the main loop to break, so Input, Graphics and everything else that the Scene_Base main loop is not being updated.
I do agree that Graphics.freeze should be in the main_dispose method.
However, could you share your code? I would like to see what you are doing. Right now, its running a straight execution from the loop ending to the end of your scene, so your windows stop getting updated and won't be disposed.
------------------------------------
I am considering making a Spriteset_Base class that like the Scene_Base, will handle updating/disposal all the individual sprites. This will prevent whenever we add a object to a Spriteset, we won't need to also alias the dispose and update methods, just to update and dispose our objects.
Likewise, I am trying to add a double-update prevention. Something like this:
module SDK::Has_Updated def has_updated? return false if @last_update == nil return Graphics.frame_count == @last_update end end
Expand to see the code.
Now, above Main, the idea is to auto-alias the child-class of every class that has the method :update (we don't want to alias the parent classes and end up double aliasing everything), include the has_updated? method and create this new format.
class <Name> include SDK::Has_Updated # we don't use alias_method, so it doesn't get logged alias sdk_<name>_update update def update return if has_updated? @last_update = Graphics.frame_count sdk_<name>_update end end
Expand to see the code.
This is just a bug prevention and can be optionally added in. I was thinking of adding even an error catcher, that uses that caller method or whatever (never used it before, so I could be wrong), so when has_updated? returns true (saying we are double-updating), it tells us where it was called. I could be just thinking above and beyond here than what is actually capable, but I am going to try to see what I can't do. ;)
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
If Sephiroth is planning on using my modifications to the Scene_Base class which make it layerable, the migration of Graphics.freeze has already occured. It's in a new method, main_out_transition. The structure of my new version of the class has changed the class somewhat, such that it has a dispose class. This is what that looks like:
#-------------------------------------------------------------------------- # * Disposal #-------------------------------------------------------------------------- def dispose main_out_transition # Prepare for transition main_dispose # Main Dispose main_end # Main End @parent.layers.delete(self) if @parent != nil @disposed = true end #-------------------------------------------------------------------------- # * Main Processing : Transition #-------------------------------------------------------------------------- def main_out_transition Graphics.freeze end #-------------------------------------------------------------------------- # * Main Processing : Disposal #-------------------------------------------------------------------------- def main_dispose # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Pass Object To Auto Dispose auto_dispose(object) end # Dispose each of @layers if it exists and hasn't been disposed # This is because the layers have disabled dispose, so that this doesn't # affect the @newlayers or the @parent @layers.each do |layer| layer.dispose if layer.kind_of?(SDK::Scene_Base) && !layer.disposed? end end #-------------------------------------------------------------------------- # * Main Processing : Ending #-------------------------------------------------------------------------- def main_end Graphics.transition if @parent != nil end
#-------------------------------------------------------------------------- # * Out animation loop #-------------------------------------------------------------------------- def main_out_animation_loop if main_out_animation_done? dispose @newlayers.each do |layer| @parent.layers.push(layer) if layer.kind_of?(SDK::Scene_Base) end @newlayers.clear @break_loop = true end end
Expand to see the code.
The main_out_animation_loop method is called as such:
#-------------------------------------------------------------------------- # * Main Processing : Loop #-------------------------------------------------------------------------- def main_loop if @parent == nil Graphics.update # Update game screen Input.update # Update input information Resolution.update # Update end main_update # Update scene objects if disposing? # Animation loops main_out_animation_loop # Make the out animation return elsif animating? main_animation_loop # Make the introductory animation return end update_background # Update background processes update if !has_layers? and self.active # Update Processing end
Here is what is left to do: ~ Add mewsterus's layer additions ~ Add has_updated? methods ~ finish compiler ~ finish all documentation
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
module SDK::Auto #-------------------------------------------------------------------------- # * Instance Disposal #-------------------------------------------------------------------------- def main_dispose # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Pass Object To Auto Dispose auto_dispose(object) end end #-------------------------------------------------------------------------- # * Instance Update #-------------------------------------------------------------------------- def main_update # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Pass Object To Auto Update auto_update(object) end end #-------------------------------------------------------------------------- # * Auto Dispose #-------------------------------------------------------------------------- def auto_dispose(object) # Return If Object isn't a Hash, Array or Respond to Dispose return unless object.is_a?(Hash) || object.is_a?(Array) || object.respond_to?(:dispose) # If Hash Object if object.is_a?(Hash) object.each do |key, value| # Pass Key & Value to Auto Dispose auto_dispose(key) ; auto_dispose(value) end return end # If Array Object if object.is_a?(Array) # Pass All Object to Auto Dispose object.each {|obj| auto_dispose(obj)} return end # If Responds to Dispose if object.respond_to?(:dispose) # If Responds to Disposed? && is Disposed or Responds to Disable # Dispose and dispose is disabled if (object.respond_to?(:disposed?) && object.disposed?) || (object.respond_to?(:disable_dispose?) && object.disable_dispose?) # Return return end # Dispose Object object.dispose end end #-------------------------------------------------------------------------- # * Auto Update #-------------------------------------------------------------------------- def auto_update(object) # Return If Object isn't a Hash, Array or Respond to Update return unless object.is_a?(Hash) || object.is_a?(Array) || object.respond_to?(:update) # If Hash Object if object.is_a?(Hash) object.each do |key, value| # Pass Key & Value to Auto Update auto_update(key) ; auto_update(value) end return end # If Array Object if object.is_a?(Array) # Pass All Object to Auto Update object.each {|obj| auto_update(obj)} return end # If Responds to Dispose if object.respond_to?(:dispose) # If Responds to Disposed? && is Disposed or Responds to Disable # Dispose and dispose is disabled if (object.respond_to?(:disposed?) && object.disposed?) || (object.respond_to?(:disable_dispose?) && object.disable_dispose?) # Return return end end # If Responds to Update if object.respond_to?(:update) # If Responds to Disable Update & Update Disabled if object.respond_to?(:disable_update?) && object.disable_update? # Return return end # Update Object object.update end end end
Expand to see the code.
Now here is the current Scene_Base with some modifications to what you had.
#============================================================================== # ** SDK::Scene Base #==============================================================================
class SDK::Scene_Base #-------------------------------------------------------------------------- # * Include SDK::Auto methods #-------------------------------------------------------------------------- include SDK::Auto #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @previous_scene = $scene.class end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main main_begin main_variable # Main Variable Initialization main_spriteset # Main Spriteset Initialization main_sprite # Main Sprite Initialization main_window # Main Window Initialization main_audio # Main Audio Initialization main_transition # Main Transition Initialization loop do # Scene Loop main_loop # Main Loop break if main_break? # Break If Breakloop Test end # End Scene Loop main_out_transition # Main Out Transition main_dispose # Main Dispose main_end # Main End end #-------------------------------------------------------------------------- # * Main Processing : Begin #-------------------------------------------------------------------------- def main_begin ; end #-------------------------------------------------------------------------- # * Main Processing : Variable Initialization #-------------------------------------------------------------------------- def main_variable ; end #-------------------------------------------------------------------------- # * Main Processing : Spriteset Initialization #-------------------------------------------------------------------------- def main_spriteset ; end #-------------------------------------------------------------------------- # * Main Processing : Sprite Initialization #-------------------------------------------------------------------------- def main_sprite ; end #-------------------------------------------------------------------------- # * Main Processing : Window Initialization #-------------------------------------------------------------------------- def main_window ; end #-------------------------------------------------------------------------- # * Main Processing : Audio Initialization #-------------------------------------------------------------------------- def main_audio ; end #-------------------------------------------------------------------------- # * Main Processing : Transition #-------------------------------------------------------------------------- def main_transition ; Graphics.transition ; end #-------------------------------------------------------------------------- # * Main Processing : Loop #-------------------------------------------------------------------------- def main_loop update_modules # Update modules main_update # Update scene objects update_background # Update background systems update # Update Processing end #-------------------------------------------------------------------------- # * Main Processing : Update Modules #-------------------------------------------------------------------------- def update_modules Graphics.update # Update game screen Input.update # Update input information end #-------------------------------------------------------------------------- # * Update functions #-------------------------------------------------------------------------- def update_background ; end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update ; end #-------------------------------------------------------------------------- # * Main Processing : Break Loop Test #-------------------------------------------------------------------------- def main_break? ; return $scene != self ; end #-------------------------------------------------------------------------- # * Main Processing : Out Transition #-------------------------------------------------------------------------- def main_out_transition ; Graphics.freeze ; end #-------------------------------------------------------------------------- # * Main Processing : Ending #-------------------------------------------------------------------------- def main_end ; end
#============================================================================ # * Scene_Base (Layered) Additions #============================================================================ if Enable_Layered_Base
#-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :parent # Parent scene. Scene_ or nil attr_accessor :layers # An array of layers on top of this scene attr_accessor :active # Activity determines parent updates #-------------------------------------------------------------------------- # * Initialize : Start the scene if it is layered on top of another, since # def main will not be called #-------------------------------------------------------------------------- def initialize(parent = nil) @parent = parent.kind_of?(SDK::Scene_Base) ? parent : nil @previous_scene = @parent == nil ? $scene.class : @parent.class return if @parent == nil # Return if this class is not a layer main_begin # Main Begin main_layer # Main Layer Initialization main_variable # Main Variable Initialization main_spriteset # Main Spriteset Initialization main_sprite # Main Sprite Initialization main_window # Main Window Initialization main_audio # Main Audio Initialization make_layer # Make this a layer main_transition # Main Transition end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main main_begin # Main Begin main_layer # Main Layer Initialization main_variable # Main Variable Initialization main_spriteset # Main Spriteset Initialization main_sprite # Main Sprite Initialization main_window # Main Window Initialization main_audio # Main Audio Initialization main_transition # Main Transition Initialization loop do # Scene Loop main_loop # Main Loop break if main_break? # Break If Breakloop Test end # End Scene Loop end #-------------------------------------------------------------------------- # * Main Processing : Begin Transition #-------------------------------------------------------------------------- def main_begin ; Graphics.freeze if @parent != nil ; end #-------------------------------------------------------------------------- # * Main Processing : Layering initialization #-------------------------------------------------------------------------- def main_layer @disable_dispose, @disable_update = true, true @active, @animating, @disposed, @break_loop = true, true, false, false @layers, @newlayers = [], [] end #-------------------------------------------------------------------------- # * Main Processing : Loop #-------------------------------------------------------------------------- def main_loop if @parent == nil # If nil parent update_modules # Update Modules end update_layers # Update parent layers main_update # Update scene objects if disposing? # Animation loops main_out_animation_loop # Make the out animation return elsif animating? main_animation_loop # Make the introductory animation return end update_background # Update background processes update if !has_layers? and self.active # Update Processing end #-------------------------------------------------------------------------- # * Main Processing : Layer Update #-------------------------------------------------------------------------- def update_layers # Update each of @layers if it exists and hasn't been disposed @layers.each do |layer| layer.main_loop if layer.kind_of?(SDK::Scene_Base) && !layer.disposed? end end #-------------------------------------------------------------------------- # * Disposing? (aka, out animating) #-------------------------------------------------------------------------- def disposing? # When not a layer, if scene changes; when a layer, if there's a new layer # or if the parent is disposing return @parent == nil ? $scene != self : (!(@newlayers.empty?) or @parent.disposing?) end #-------------------------------------------------------------------------- # * Out animation loop #-------------------------------------------------------------------------- def main_out_animation_loop if main_out_animation_done? dispose @newlayers.each do |layer| @parent.layers.push(layer) if layer.kind_of?(SDK::Scene_Base) end @newlayers.clear @break_loop = true end end #----------------------------------------------------------------------------- # * Animation done? #----------------------------------------------------------------------------- def main_out_animation_done? ; return true ; end #-------------------------------------------------------------------------- # * Disposal #-------------------------------------------------------------------------- def dispose main_out_transition # Prepare for transition main_dispose # Main Dispose dispose_layers # Layer Dispose main_end # Main End @parent.layers.delete(self) if @parent != nil @disposed = true end #-------------------------------------------------------------------------- # * Main Processing : Layer Disposal #-------------------------------------------------------------------------- def dispose_layers # Dispose each of @layers if it exists and hasn't been disposed # This is because the layers have disabled dispose, so that this doesn't # affect the @newlayers or the @parent @layers.each do |layer| layer.dispose if layer.kind_of?(SDK::Scene_Base) && !layer.disposed? end end #-------------------------------------------------------------------------- # * Disposed? #-------------------------------------------------------------------------- def disposed? @disposed end #-------------------------------------------------------------------------- # * Main Processing : Ending #-------------------------------------------------------------------------- def main_end Graphics.transition if @parent != nil end #-------------------------------------------------------------------------- # * Animating? #-------------------------------------------------------------------------- def animating? @animating end #-------------------------------------------------------------------------- # * Main Processing : Animation Loop #-------------------------------------------------------------------------- def main_animation_loop ; @animating = false if main_animation_done? ; end #--------------------------------------------------------------------------- # * Animation done? #--------------------------------------------------------------------------- def main_animation_done? ; return true ; end #-------------------------------------------------------------------------- # * Main Processing : Break Loop Test #-------------------------------------------------------------------------- def main_break? ; return @break_loop end #-------------------------------------------------------------------------- # * Replace the current class; different if a layer or not #-------------------------------------------------------------------------- def new_scene(object, *args) object = eval(object) if object.is_a?(String) # If this is the top layer if @parent == nil args.insert(0, nil) # Make the new scene as the described class $scene = object == nil ? nil : object.new(*args) else # If we're trying to dispose of this class if object == nil || object == @parent.class @newlayers.push(nil) else # Insert the parent into the array of arguments args.insert(0, @parent) # Replace this layer with the described class @newlayers.push(object.new(*args)) end end end #-------------------------------------------------------------------------- # * Create a new layer on top of this class #-------------------------------------------------------------------------- def new_layer(object, *args) return if object == nil object = eval(object) if object.is_a?(String) # Insert self as the parent into the array of arguments args.insert(0, self) # Add the described class as a layer @layers.push(object.new(*args)) end #-------------------------------------------------------------------------- # * Make this scene a layer #-------------------------------------------------------------------------- def make_layer # Return if no parent return if @parent == nil # Get Z Difference @z_diff = (max = @parent.z_max) - z_min(max) + Object_Value_Changes['z'] # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Make object layered make_object_layered(object) end end #-------------------------------------------------------------------------- # * Make object layered #-------------------------------------------------------------------------- def make_object_layered(object) # If Hash if object.is_a?(Hash) # Pass each key and value to make_object_layered object.each do |key, value| make_object_layered(key) ; make_object_layered(value) end return end # If Array if object.is_a?(Array) # Pass each object to make_object_layered object.each do |obj| make_object_layered(obj) end return end # Adjust opacity if object.respond_to?(:opacity=) vc = Object_Value_Changes['opacity'] object.opacity = Integer(object.opacity * vc) end # Adjust back opacity if object.respond_to?(:back_opacity=) vc = Object_Value_Changes['back_opacity'] object.back_opacity = Integer(object.back_opacity * vc) end # Adjust Z if @z_diff > 0 && object.respond_to?(:z=) object.z += @z_diff end end #-------------------------------------------------------------------------- # * Maximum Z value of all instance variables #-------------------------------------------------------------------------- def z_max # Starts 0 z counter output = 0 # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # If Hash if object.is_a?(Hash) # Pass through all keys and values object.each do |key, value| # Checks key z if key.respond_to?(:z) and key.z.kind_of?(Numeric) output = key.z if key.z > output end # Checks value z if value.respond_to?(:z) and value.z.kind_of?(Numeric) output = value.z if value.z > output end end end # If Array if object.is_a?(Array) # Passes through all object object.each do |obj| # Checks object z if obj.respond_to?(:z) and obj.z.kind_of?(Numeric) output = obj.z if obj.z > output end end end # Checks object z if object.respond_to?(:z) and object.z.kind_of?(Numeric) output = object.z if object.z > output end end # Returns max z value return output end #-------------------------------------------------------------------------- # * Minimum Z value of all instance variables #-------------------------------------------------------------------------- def z_min(max = 99999) # Sets ma output output = max # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # If Hash if object.is_a?(Hash) # Passes through all keys and values object.each do |key, value| # Checks key if key.respond_to?(:z) and key.z.kind_of?(Numeric) output = key.z if key.z < output end # Checks value if value.respond_to?(:z) and value.z.kind_of?(Numeric) output = value.z if value.z < output end end end # If Array if object.is_a?(Array) # Passes through all objects object.each do |obj| # Checks object if obj.respond_to?(:z) and obj.z.kind_of?(Numeric) output = obj.z if obj.z < output end end end # Checks object if object.respond_to?(:z) and object.z.kind_of?(Numeric) output = object.z if object.z < output end end # Returns min z value return output end #-------------------------------------------------------------------------- # * Find a return a specific layer #-------------------------------------------------------------------------- def layer(layer_name) @layers.each do |layer| return layer if layer.class == layer_name end end #-------------------------------------------------------------------------- # * Delete a specific layer #-------------------------------------------------------------------------- def delete_layer(layer_name) @layers.each do |layer| layer.new_scene(nil) if layer.class == layer_name end end #-------------------------------------------------------------------------- # * Clear all of this scene's layers #-------------------------------------------------------------------------- def clear_layers @layers.each {|layer| layer.new_scene(nil)} end #-------------------------------------------------------------------------- # * Find and return the root parent #-------------------------------------------------------------------------- def root return if @parent == nil ? self : @parent.root end #-------------------------------------------------------------------------- # * Has layers? (that prevent updating) #-------------------------------------------------------------------------- def has_layers? for layer in @layers return true if layer.kind_of?(SDK::Scene_Base) && layer.active end return false end
end #============================================================================ # * Scene_Base (Layered) Additions #============================================================================ end
Expand to see the code.
Note that it uses a few user-defined settings in the first portion of the SDK (under settings)
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Could you also include the methods :z_max and :z_min? They are similarly constructed to :auto_update and there may be use for them in Spriteset classes. I'd also like you to note the modifications to the conditions in :main_update for layers:
#-------------------------------------------------------------------------- # * Main Processing : Update #-------------------------------------------------------------------------- def main_update # Update each of @layers if it exists and hasn't been disposed @layers.each do |layer| layer.main_loop if layer.kind_of?(SDK::Scene_Base) && !layer.disposed? end # Passes Through All Instance Variables self.instance_variables.each do |object_name| # Evaluates Object object = eval object_name # Pass Object To Auto Update auto_update(object) unless (has_layers? or !self.active) and object.kind_of?(Window_Selectable) end end
Expand to see the code.
If that extra condition on auto_update(object) isn't there, selectable windows in scenes that are being layered will still be updated, and since their input processing is in their own classes you will, for example, move the index in the menu even though you opened the save menu.
EDIT: I changed a few things...I added :new_scene, :has_layers?, and :root to the class in simplified form before it checks for layering, for more fluidity between the two states of the Scene_Base (:root returns self, it doesn't :has_layers?, and :new_scene replaces $scene = object.new), added the main_update class back in since it has those important conditions to prevent Window_Selectable objects from updating (it rewrites from SDK::Auto), and a couple of minor things like fixing :root (the if statement would have screwed things up a bit). I think I'd like to change the way the script makes things into layers...so I'll do that. Remember that besides layering functions, the new Scene_Base also has animation functions...I'll have to put together a little demo of layering once the whole SDK 2.5 is out.
EDIT 2: Modifications done...now :initialize can function normally without needing the parent as an argument...additionally, using :new_scene from a layer should work better now. Before it would call Graphics.transition too much and would look weird...you can try this out by the L/R keys in Actor menus (skill, equip, status). I'll just PM it to you.
_________________
Last edited by rey meustrus on Sun Sep 14, 2008 10:31 pm, edited 1 time in total.
module SDK::GHU #-------------------------------------------------------------------------- # * Generate Has Updated Methods #-------------------------------------------------------------------------- def self.start # Create list @classes = [] # Starts checked list @checked = [Object] # Start by checking object consants self.check_constants(Object) # Remove Hash class @classes.delete(Hash) # Remove parent classes @classes.each do |c| (1...(anc = c.ancestors).size).each {|i| @classes.delete(anc[i])} end # Pass through classes @classes.each do |c| s = " include SDK::Has_Updated;" s += " alias sdk_#{c.to_s.downcase}_update update;" s += " def update(*args);" s += " return if has_updated?;" s += " @last_update = Graphics.frame_count;" s += " sdk_#{c.to_s.downcase}_update(*args);" s += " end;" c.module_eval(s) end end #-------------------------------------------------------------------------- # * Check Constants #-------------------------------------------------------------------------- def self.check_constants(constant) # Check if constant has constants constant.constants rescue return # Pass through constant's constants constant.constants.sort.each do |c| # Get constant con = eval c rescue next # Skip if already checked next if @checked.include?(con) # Add to checked list @checked << con # Check constant self.check_constants(con) end # If method defined :update if constant.method_defined?(:update) @classes << constant end end end
Expand to see the code.
It actually works, and only updates the child-most class of every class. It searches through all defined classes. Just wanted to share that before I get into the Compiler. Once the compiler is done, SDK 2.5 will be out!
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Since AStar_Pathfinding (by Cowlol) overwrites this method, I was inspired to do a method split for it in my own project. After about 5 minutes, I generated this, tested it a few events from my other games with different custom move route commands and it appears to be pretty stable and working like a charm!
EDIT: Did find a bug, but it only appears to happen with the player and not events. Player doesn't succesfully ignore impossible moves, I'll try 'n fix it when I'm not busy.
class Game_Character #----------------------------------------------------------------------------- # * Move Type Custom #----------------------------------------------------------------------------- def move_type_custom loop do return if move_type_custom_stop? while @move_route_index < @move_route.list.size command = @move_route.list[@move_route_index] if command.code == 0 move_type_custom_repeat(command) return elsif command.code <= 14 move_type_custom_movement(command) return elsif command.code == 15 move_type_custom_wait(command) return elsif command.code >= 16 and command.code <= 26 move_type_custom_direction(command) return elsif command.code >= 27 move_type_custom_other(command) return end end end end #----------------------------------------------------------------------------- # * Move Type Custom Interrupt? #----------------------------------------------------------------------------- def move_type_custom_stop? return (jumping? || moving?) end #----------------------------------------------------------------------------- # * Move Type Custom Ignore? #----------------------------------------------------------------------------- def move_type_custom_interrupt? # If movement failure occurs when [Ignore if can't move] option is OFF return (@move_route.skippable and moving? and jumping?) end #----------------------------------------------------------------------------- # * Move Type Custom Repeat #----------------------------------------------------------------------------- def move_type_custom_repeat(command) # If [repeat action] option is ON if @move_route.repeat # First return to the move route index @move_route_index = 0 end # If [repeat action] option is OFF unless @move_route.repeat # If move route is forcing if @move_route_forcing and not @move_route.repeat # Release forced move route @move_route_forcing = false # Restore original move route @move_route = @original_move_route @move_route_index = @original_move_route_index @original_move_route = nil end # Clear stop count @stop_count = 0 end end #----------------------------------------------------------------------------- # * Move Type Custom Movement #----------------------------------------------------------------------------- def move_type_custom_movement(command) # During move command (from move down to jump) # Branch by command code case command.code when 1 # Move down move_down when 2 # Move left move_left when 3 # Move right move_right when 4 # Move up move_up when 5 # Move lower left move_lower_left when 6 # Move lower right move_lower_right when 7 # Move upper left move_upper_left when 8 # Move upper right move_upper_right when 9 # Move at random move_random when 10 # Move toward player move_toward_player when 11 # Move away from player move_away_from_player when 12 # 1 step forward move_forward when 13 # 1 step backward move_backward when 14 # Jump jump(command.parameters[0], command.parameters[1]) end if move_type_custom_interrupt? return end @move_route_index += 1 end #----------------------------------------------------------------------------- # * Move Type Custom Wait #----------------------------------------------------------------------------- def move_type_custom_wait(command) # Set wait count @wait_count = command.parameters[0] * 2 - 1 @move_route_index += 1 end #----------------------------------------------------------------------------- # * Move Type Custom Direction #----------------------------------------------------------------------------- def move_type_custom_direction(command) # If direction change command # Branch by command code case command.code when 16 # Turn down turn_down when 17 # Turn left turn_left when 18 # Turn right turn_right when 19 # Turn up turn_up when 20 # Turn 90° right turn_right_90 when 21 # Turn 90° left turn_left_90 when 22 # Turn 180° turn_180 when 23 # Turn 90° right or left turn_right_or_left_90 when 24 # Turn at Random turn_random when 25 # Turn toward player turn_toward_player when 26 # Turn away from player turn_away_from_player end @move_route_index += 1 end #----------------------------------------------------------------------------- # * Move Type Custom Other #----------------------------------------------------------------------------- def move_type_custom_other(command) # Branch by command code case command.code when 27 # Switch ON $game_switches[command.parameters[0]] = true $game_map.need_refresh = true when 28 # Switch OFF $game_switches[command.parameters[0]] = false $game_map.need_refresh = true when 29 # Change speed @move_speed = command.parameters[0] when 30 # Change freq @move_frequency = command.parameters[0] when 31 # Move animation ON @walk_anime = true when 32 # Move animation OFF @walk_anime = false when 33 # Stop animation ON @step_anime = true when 34 # Stop animation OFF @step_anime = false when 35 # Direction fix ON @direction_fix = true when 36 # Direction fix OFF @direction_fix = false when 37 # Through ON @through = true when 38 # Through OFF @through = false when 39 # Always on top ON @always_on_top = true when 40 # Always on top OFF @always_on_top = false when 41 # Change Graphic @tile_id = 0 @character_name = command.parameters[0] @character_hue = command.parameters[1] if @original_direction != command.parameters[2] @direction = command.parameters[2] @original_direction = @direction @prelock_direction = 0 end if @original_pattern != command.parameters[3] @pattern = command.parameters[3] @original_pattern = @pattern end when 42 # Change Opacity @opacity = command.parameters[0] when 43 # Change Blending @blend_type = command.parameters[0] when 44 # Play SE $game_system.se_play(command.parameters[0]) when 45 # Script result = eval(command.parameters[0]) end @move_route_index += 1 end end
Expand to see the code.
Also, I see that you didn't branch off the Interpreter conditional branch segment. Other than splitting the methods, I changed it so when comparing $game_variables[?] you can use non-numeric data in your variables. For instance...
Condtional Branch: Script: $game_variables[????] == "I'm A String!" @> # Do something... End
Can be executed with events and it'll read the string. Previously, it used to only read numerical data. I already use the conditional branch method splits in 2 or 3 of my scripts, so it should probably be standard. One of the most important things I use it for is the Aleworks Input Module, which made event conditional branches for "If C Button Pressed" not work. vgvgf wrote a patch for me, then I broke down the Interpreter so that we didn't have to overwrite the whole shebang!
You can find any scripts I've submitted within the past year upto the date specified above. If you happen to find something else that is either not on the list or just doesn't have a URL that I had posted officially or otherwise, please PM me the link and I'll be sure to add it to the list.
Last edited by Kain Nobel on Wed Sep 17, 2008 6:03 pm, edited 1 time in total.
Ok. I guess I can throw those splits in. With those splits, all I have left is compiler. I am half tempted to save that for next version so I can get on to the MACL, but I have about half done already. The longest part is just splitting up the SDK into a bunch of files, which is very time consuming. A text file for part 1, then a text file for every method split, then a text file for every part 3 and part 4 class, and the patch.
After that is the less time consuming, more challenging, make a method that reads the scripts and checks for the split method names. But it shouldn't be too hard.
Oh, and I updated the Has_Update to Double_Prevention, so it also prevents double-disposal as well.
module SDK::Double_Prevention #-------------------------------------------------------------------------- # * Generate Prevention Methods #-------------------------------------------------------------------------- def self.start # Create list @hu_list, @dis_list = [], [] # Create method check list @method_checks = {:update => @hu_list, :dispose => @dis_list} # Make lists self.make_list # Has Updated self.start_has_updated # Disposed self.start_dispose end #-------------------------------------------------------------------------- # * Generate Prevention Methods: Has Updated #-------------------------------------------------------------------------- private def self.start_has_updated # Pass through classes @hu_list.each do |c| s = "alias sdk_#{c.to_s.downcase}_update update;" s += "def update(*args);" s += " return if has_updated?;" s += " @last_update = Graphics.frame_count;" s += " sdk_#{c.to_s.downcase}_update(*args);" s += "end;" s += "def has_updated?;" s += " return false if @last_update == nil;" s += " return Graphics.frame_count == @last_update;" s += "end;" c.module_eval(s) end end #-------------------------------------------------------------------------- # * Generate Prevention Methods: Dispose #-------------------------------------------------------------------------- private def self.start_dispose # Pass through classes @dis_list.each do |c| # If disposed? method not created if c.method_defined?(:disposed?) == false # Add disposed method and alias dispose method s = "alias sdk_#{c.to_s.downcase}_dispose dispose;" s += "def disposed?;" s += " return @disposed != nil && @disposed;" s += "end;" s += "def dispose;" s += " return if disposed?;" s += " @disposed = true;" s += " sdk_#{c.to_s.downcase}_dispose;" s += "end;" c.module_eval(s) # If disposed? method created else # Add disposed method and alias dispose method s = "alias sdk_#{c.to_s.downcase}_dispose dispose;" s += "def dispose;" s += " return if disposed?;" s += " sdk_#{c.to_s.downcase}_dispose;" s += "end;" c.module_eval(s) end end end #-------------------------------------------------------------------------- # * Generate Prevention Methods: Make Lists #-------------------------------------------------------------------------- private def self.make_list # Starts checked list @checked = [Object] # Start by checking object consants self.check_constants(Object) # Remove Hash class @hu_list.delete(Hash) # Remove parent classes for list in @method_checks.values list.each do |c| (1...(anc = c.ancestors).size).each {|i| @hu_list.delete(anc[i])} end end end #-------------------------------------------------------------------------- # * Check Constants #-------------------------------------------------------------------------- private def self.check_constants(constant) # Check if constant has constants constant.constants rescue return # Pass through constant's constants constant.constants.sort.each do |c| # Get constant con = eval c rescue next # Skip if already checked next if @checked.include?(con) # Add to checked list @checked << con # Check constant self.check_constants(con) end # Create method check list @method_checks.each do |method, list| if constant.method_defined?(method) list << constant end end end end
Expand to see the code.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
I'm having two issues with some old SDK scripts... I can't find 2.0 which sephs' auto save requires. but it says it can't find the the class method line... Method & Class Library (2.1+). Thats what it says it can't find. Sorry if I'm hard to under stand I'm sick and tired lol...
_________________ Be a pal! Support Dawn of Darkness =D!!!
It requires 2.0 or newer. You can always use the most recent version (except scripts using scripts before the 2.0, which most scripts will still work).
The MACL is a different script, which the script probably requires. Get the MACL too.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Seph, I've been messing with Scene_Base again. I've put :main_break? back to normal functionality so that anybody who changed it (god forbid we know why) could still have their scripts work, as well as fixing a small bug in the way new scenes are created when a layer exists. You would notice this layer in Scene_Load if you loaded a game. Also, I'm preventing people from loading more than one of the same layer on the same parent...it screws up some things.
Ok. Just post or PM your mods, and I'll check them out.
_________________ I want to review your script! I am always looking for scripts to look over and offer my advice on people's coding. If you want your script reviewed and to further develop your scripting skills, just put a [Review] tag in your topic. I will always post in any scripting topic marked [Review] offering whatever advice I can give.
Mentioning an incompatibility with another script on a different forum, and the guy helping me out mentioned that I should report a small bug, that line 1289 in 2.4 says "class Game_map" while it should probably be "class Game_Map".
Personally I have no idea if this affects ANYTHING, but I was advised to report it, so I thought I should . I don't know how case sensitive RGSS is, etc. If this has no impact on anything, feel free to ignore me.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
We are an independent, not-for-profit game making community.