Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED!]Aleworks Input script(s) interfering with Event Input Conditions

Good day to everybody, I need some help with some of the Aleworks stuff, namely the Input module. (I hope vgvgf reads this, since he is the author of these modules, so he can make a fix for all of us.)

Alright, here's the scenario, I use a standard conditional branch to check if the player is pressing a directional key, in this example, player is pressing down transfers to next map.

Code:
@> Conditional Branch: The Down Button is being pressed
  @> # Transfer map command
  : Branch End
@>

...However, the Button conditions don't work anymore (at least direction, I haven't checked the other stuff.) So I have to do a workaround and do it script-style...

Code:
@> Conditional Branch: Script: Input.press?(Input::DOWN)
  @> # Transfer map command
  : Branch End
@>

...And now, it works like its supposed to, but that means I have to change this in all similiar events in my game (and that could be painstaking if, god forbid, I had a huge game.)

How do I restore the functionality of the Conditional Branch Input commands? I don't mind doing it script style, but it shouldn't be required. Can someone help me fix this? (Or vgvgf, can you fix this for us, please?) Help is much appreciated!
 
Good news, here you have the fix: :grin:
Code:
#=============================================================================
# *** 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
#   * Overwrite Methods: input_button; command_111
#=============================================================================

#=============================================================================
# ** 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
  #---------------------------------------------------------------------------
  # * Conditional Branch
  #---------------------------------------------------------------------------
  def command_111
    result = false
    case @parameters[0]
    when 0
      result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
    when 1
      value1 = $game_variables[@parameters[1]]
      if @parameters[2] == 0
        value2 = @parameters[3]
      else
        value2 = $game_variables[@parameters[3]]
      end
      case @parameters[4]
      when 0
        result = (value1 == value2)
      when 1
        result = (value1 >= value2)
      when 2
        result = (value1 <= value2)
      when 3
        result = (value1 > value2)
      when 4
        result = (value1 < value2)
      when 5
        result = (value1 != value2)
      end
    when 2
      if @event_id > 0
        key = [$game_map.map_id, @event_id, @parameters[1]]
        if @parameters[2] == 0
          result = ($game_self_switches[key] == true)
        else
          result = ($game_self_switches[key] != true)
        end
      end
    when 3
      if $game_system.timer_working
        sec = $game_system.timer / Graphics.frame_rate
        if @parameters[2] == 0
          result = (sec >= @parameters[1])
        else
          result = (sec <= @parameters[1])
        end
      end
    when 4
      actor = $game_actors[@parameters[1]]
      if actor != nil
        case @parameters[2]
        when 0
          result = ($game_party.actors.include?(actor))
        when 1
          result = (actor.name == @parameters[3])
        when 2
          result = (actor.skill_learn?(@parameters[3]))
        when 3
          result = (actor.weapon_id == @parameters[3])
        when 4
          result = (actor.armor1_id == @parameters[3] or
                    actor.armor2_id == @parameters[3] or
                    actor.armor3_id == @parameters[3] or
                    actor.armor4_id == @parameters[3])
        when 5
          result = (actor.state?(@parameters[3]))
        end
      end
    when 5
      enemy = $game_troop.enemies[@parameters[1]]
      if enemy != nil
        case @parameters[2]
        when 0
          result = (enemy.exist?)
        when 1
          result = (enemy.state?(@parameters[3]))
        end
      end
    when 6
      character = get_character(@parameters[1])
      if character != nil
        result = (character.direction == @parameters[2])
      end
    when 7
      if @parameters[2] == 0
        result = ($game_party.gold >= @parameters[1])
      else
        result = ($game_party.gold <= @parameters[1])
      end
    when 8
      result = ($game_party.item_number(@parameters[1]) > 0)
    when 9
      result = ($game_party.weapon_number(@parameters[1]) > 0)
    when 10
      result = ($game_party.armor_number(@parameters[1]) > 0)
    when 11
      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
      result = (Input.press?(n))
    when 12
      result = eval(@parameters[1])
    end
    @branch[@list[@index].indent] = result
    if @branch[@list[@index].indent] == true
      @branch.delete(@list[@index].indent)
      return true
    end
    return command_skip
  end
end
Just add it in a new script section, or in the same section of AIM.
 
Thank you thank you very much vgvgf, I'm not the only person that will benefit from the patch. I'm enjoying the whole library so far, I'll probably be making much use of it in future scripts!

This topic is resolved!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top