What's up, RMers?
(10-03-2026, 04:20 AM)DerVVulfman Wrote: The second a sort of RMXP scripts database rewrite based on the old RMXP SDK.  But for that, I am using kyonides's HiddenChest system as it is using a much newer version of Ruby so it is definitely more compliant with newer versions of RUBY.  The old SDK focused mostly on initialization and the main update methods in the scene classes... but ignored much anything else.  LOTS to break down where would-be scripters could comparatively attach code much easier.

Funny thing when you actually work to slice and dice the default scripts that the original team of the RMXP SDK of 2006-2008 didn't finish  break into smaller sections.

I found this in Scene_Battle.

  def start_phase4
    # Shift to phase 4
    @phase = 4
    # Turn count
    $game_temp.battle_turn += 1
    # Search all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event page
      page = $data_troops[@troop_id].pages[index]
      # If this page span is [turn]
      if page.span == 1
        # Clear action completed flags
        $game_temp.battle_event_flags[index] = false
      end
    end
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    # Enable party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
I'm sorry.  The comment/description says the party command window is being ENABLED?  Dizzy  HAHAHA!   Yeah, whoever was translating the original Japanese comments to English.... missed a spot.


Now when I say I am breaking down the scripts... er...
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # Exit if unable to use due to SP running out
      return if make_skill_action_result_blocked?
    end
    # Apply cost
    make_skill_action_cost
    # Refresh status window
    @status_window.refresh
    # Set Skill/Item actions
    make_object_action_effects(@skill)
    # Apply skill effect
    make_skill_action_effect
  end

I invite you to look at the original method from RPGMaker's Scene_Battle.  Its a bit larger.

For this, I made several smaller methods
  •  make_skill_action_result_blocked?   Which determines if a skill can be used or not...
  •  make_skill_action_cost  Which reduces the attacker's SP cost
  •  make_object_action_effects  Which updates the help, sets the animations, common events and targets (also used by Items)
  •  make_skill_action_effect Which finally performs the Game_Battler attack effects on the target(s)

Being broken into smaller sections makes adding new content (script addons) easier as rewriting the base method will likely not be needed.

The old RMXP SDK had a couple of good ideas; standarization on script method names, smaller and more manageable methods which would allow more compliance with other works, a means to optimize the code so systems automatically update without needs to be called.

They just sucked at marketing as they kept making updates after updates after updates, so when you made your SDK script it was immediatly broken by the NEXT version.  I'm gong to work a bit on this... and see what tricks I can retrieve whilst keeping the XP naming standards.

.... this is just one of the many things I have been working upon...
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply
Man... I still have a ways to go on breaking the RMXP default scripts into smaller modules.

For Game_Battler, I so need to look at how scripts that alter the actor's equipment (slots, two-handed weapons) and see what they #$%^d up with the stats methods. And then I want to see how far I can get in making the actual damage inflicting methods even more diced.

Anything to do with Element Rates... I want to attack as some individuals have shown a desire to have a different way to handle element-based damage. So that is going to be broken into individual chunks.

And any overly lengthy methods need to be taken down in size and reduced as someone may wish to add code IN THE CENTER which can't be done without whole rewrites. Any of the passables, the massive 'refresh' and 'update' in Window_Message. Heck, I'm looking at 'command_111' in the Interpreter class as its HUMONGOUS and handles the conditional branch system. Imagine being able to add new code there if someone creates an adaptive script call to add more conditional branch options.

But yeah. I did get a lot of work done. But I have more work to do.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply
My endeavor to more SDK the old RPGMaker SDK and 'slicing' it into smaller modules continues...

AND THIS ... is now the size of my refresh method in Window_Message

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    @x = @y = 0
    @cursor_width = 0
    # Indent if choice
    if $game_temp.choice_start == 0
      @x = 8
    end
    # If waiting for a message to be displayed
    if $game_temp.message_text != nil
      @text = $game_temp.message_text
      refresh_text
    end
    refresh_choices
    refresh_number_input
  end
* I highlighted methods I created to make it modular...

And the ORANGE part IN that method that draws the actual message is this!
  #--------------------------------------------------------------------------
  # * Refresh Message Text
  #--------------------------------------------------------------------------
  def refresh_text
    # Control text processing
    begin
      last_text = @text.clone
      @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      @text.gsub!(/\\[Ss][Ww]\[([0-9]+)\]/) { $game_switches[$1.to_i] }
    end until @text == last_text
    @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
      $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
    end
    # Change "\\\\" to "\000" for convenience
    @text.gsub!(/\\\\/) { "\000" }
    # Change any other message code to special command code
    text_substitute   
    # Get 1 text character in c (loop until unable to get text)
    while ((c = @text.slice!(/./m)) != nil)
      # Return to original text if \\
      c = "\\" if c == "\000"
      # Skip if text actively replaced with special codes
      next if text_replace?(c)
      # Draw text
      self.contents.draw_text(4 + @x, 32 * @y, 40, 32, c)
      # Add x to drawn text width
      @x += self.contents.text_size(c).width       
    end
  end

Doesn't that look sexy?

Yes, the YELLOW highlighted area does show I added a \sw[#] message code to let you get switches (true/false) just the same as using \v[#] to get the value of variables

But more than that, the PINK areas go to these two new methods...

  #--------------------------------------------------------------------------
  # * Convert message code into a command code (eg \g into \002)
  #--------------------------------------------------------------------------
  def text_substitute
    @text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
    @text.gsub!(/\\[Gg]/) { "\002" }
    @text.gsub!(/\\[Bb]/) { "\010" }
    @text.gsub!(/\\[Ii]/) { "\011" }
  end
-and-
  #--------------------------------------------------------------------------
  # * Determine if actively replaced codes in text
  #--------------------------------------------------------------------------
  def text_replace?(c)
    return true if text_replace_bold(c)
    return true if text_replace_italic(c)
    return true if text_replace_color(c)
    return true if text_replace_gold(c)
    return true if text_replace_newline(c)
    return false
  end

And what does this mean?

These two methods are open to adding MORE WINDOW COMMAND CODES.  I already added \b for Boldfaced text and \i to make text italicized.  And yep, I have the feature that changes the color of text within its 'own' individual method if anyone wants to adapt it to use HEX codes or whatever.

ITS THAT MODULAR AND SEXY!

I could add more options like changing the font or font size... But no.   And if I wanted to add \u for underline, \o for outline or \s for Strikethru, I would need to include a font script to add those features as they are not engine native.

But yeah, adding command codes is a tad easier now.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply




Users browsing this thread: 37 Guest(s)