[XP] Mouse Controller Enhancement Script

Started by nathmatt, March 24, 2010, 08:31:41 pm

Previous topic - Next topic

nathmatt

update 1:44 fixed bug that prevented player touch and auto run from working on events
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ojp2010

Everything is working very well with the script, however, I have run into a small problem. I have a quest in my game where players need to collect flowers for NPC. So I made an event, the following:

Page 1 > Action Touch
Change Item: +1 [Flower]
Control Switch: 0001 Flower ON

Page 2 > Parallel Process > Control Switch 0001 Flower
Wait: 20
Control Switch 0001 Flower OFF

The event works however when looking at the server log after a player clicks on the flower, I am using Mouse Controller, the flower is set to true. But the event doesn't go away in the Map Scene. When I click on it again it is set to true again then disappears for the 20 then reappears and it set to true again. So bacially a player has to click it twice before it will "despawn" giving the player a chance to collect two flowers from one "node". Can anyone help me with this? I don't want them to be able to do that just one click and one flower.

I tested it, I am using blizzard's mouse controller script, and the event works fine with just that script. I am assuming it is either the Enchance mouse controller and mouse controller drop down menu is causing the problem.

Here are both scripts, if anyone has any ideas.

Enhance mouse controller
(click to show/hide)

Mouse Controller Drop Down Menu

(click to show/hide)

nathmatt

can you make a new project with just that event in it so i can look at it because i can not reproduce it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ojp2010

Here you go sir, thanks for taking a look for me. I am using RMX-OS too, I don't know if you have a server set up or not, the will need the server to run.

http://www.mediafire.com/?rgo6a4mpoqvmche

nathmatt

September 06, 2010, 06:52:47 pm #84 Last Edit: September 06, 2010, 06:59:41 pm by nathmatt
do you have a message to display like in the 1 you sent me ? because the second click would be disposing the message

edit never mind on that as soon as i added the global switches it started doing it
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ojp2010

Alright, do you need anything from me then?

nathmatt

it seems it was the global switch script replace it with this

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Global Switches and Variables for RMX-OS by Blizzard
# Version: 1.01
# Type: RMX-OS Add-on
# Date: 7.1.2010
# Date: 22.2.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: RMX-OS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed below RMX-OS and requires RMX-OS v1.09 or
#   higher to work properly. This script will allow to have global switches and
#   variables on your server.
#   
#   
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !defined?(RMXOS) || RMXOS::VERSION < 1.09
  raise 'ERROR: The "Global Switches and Variables" requires RMX-OS 1.09 or higher.'
end

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

GLOBAL_SWITCHES = [1, 2] # make sure this matches the extension configuration
GLOBAL_VARIABLES = [1, 2] # make sure this matches the extension configuration

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_Temp
#==============================================================================

class Game_Temp
 
  attr_accessor :disable_global
 
end
 
#==============================================================================
# Game_Switches
#==============================================================================

class Game_Switches
 
  alias set_gswivar_later []=
  def []=(id, value)
    if !$game_temp.disable_global && GLOBAL_SWITCHES.include?(id)
      $network.send_switch(id, value)
    else
      set_gswivar_later(id, value)
    end
  end
 
end
 
#==============================================================================
# Game_Switches
#==============================================================================

class Game_Variables
 
  alias set_gswivar_later []=
  def []=(id, value)
    if !$game_temp.disable_global && GLOBAL_VARIABLES.include?(id)
      $network.send_variable(id, value)
    else
      set_gswivar_later(id, value)
    end
  end
 
end
 
#==============================================================================
# RMXOS::Network
#==============================================================================

class RMXOS::Network
 
  alias check_game_gswivar_later check_game
  def check_game(message)
    case message
    when /\AGSW(.+)\t(.+)/
      $game_temp.disable_global = true
      $game_switches[$1.to_i] = ($2 != '0')
      $game_temp.disable_global = false
      $game_map.need_refresh = true
      return true
    when /\AGVA(.+)\t(.+)/
      $game_temp.disable_global = true
      $game_variables[$1.to_i] = $2.to_i
      $game_temp.disable_global = false
      $game_map.need_refresh = true
      return true
    end
    return check_game_gswivar_later(message)
  end
 
  alias check_loading_gswivar_later check_loading
  def check_loading(message)
    result = check_loading_gswivar_later(message)
    if result
      if @messages.include?(RMXOS::LOADING_END)
        @messages.delete(RMXOS::LOADING_END)
        self.send('LGD')
      end
    else
      case message
      when /\ALGS(.+)/ # load global switches
        hash = eval($1)
        $game_temp.disable_global = true
        hash.each_key {|id| $game_switches[id] = hash[id]}
        $game_temp.disable_global = false
        return true
      when /\ALGV(.+)/ # load global variables
        hash = eval($1)
        $game_temp.disable_global = true
        hash.each_key {|id| $game_variables[id] = hash[id]}
        $game_temp.disable_global = false
        $game_map.need_refresh = true
        @messages.push(RMXOS::LOADING_END)
        return true
      end
    end
    return result
  end
 
  def send_switch(id, value)
    self.send("GSW#{id}\t#{value ? 1 : 0}")
  end
 
  def send_variable(id, value)
    self.send("GVA#{id}\t#{value}")
  end
 
end
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ojp2010

Works great thank you very much for your help.

Arnon

Hi again. Can you suggest how to enable route change while movement and did not wait until hero will end his move from point A to point B?

Quoteforce_moving if !$game_player.moving?


I try to disable this condition but it didn't work :)

nathmatt

ill see what i can do you cant just turn it off it messes up the pathfinder if you click before you finish moving causes it to go to the wrong spot and eventually stop working all together
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Arnon

Quote from: nathmatt on September 25, 2010, 07:32:45 am
ill see what i can do you cant just turn it off it messes up the pathfinder if you click before you finish moving causes it to go to the wrong spot and eventually stop working all together

Ok, thanks. Today I found a new bug: If you press F12 (to reset the game) you will get this error:

(a little demo if you need: http://www.mediafire.com/?jsy5m8xf45rlnmj)

nathmatt

i actuall suggest not using F12 because you will get an error on all every thing that was aliased
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Arnon

Quote from: nathmatt on September 26, 2010, 07:04:15 am
i actuall suggest not using F12 because you will get an error on all every thing that was aliased

Hmm, if you rename a variable (for example, ColorCFG    = Color.new(0,0,160,255) and in line #271) you can avoid this error.
But then in the original Mouse Controller script appears Stack level too deep error after pressing F12.

nathmatt

i know thats y i said that i was about to post the fix when i noticed that you will get the same error on all things aliased
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Arnon

Another bug: when using your script with Tons of Add-ons it disable Enter and Space action keys.

nathmatt

only on events you have to click them its not a bug its a bug fix to prevent events from activating when you click to move
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Arnon

September 27, 2010, 04:07:25 pm #96 Last Edit: September 27, 2010, 04:15:36 pm by Arnon
Quote from: nathmatt on September 27, 2010, 03:53:07 pm
only on events you have to click them its not a bug its a bug fix to prevent events from activating when you click to move

But with BlizzABS action keys works well...

Sorry if I bother :) And what about events under the player? Even if you click on invisible one (without any graphic) the hero comes near, not on the tile with such event, like it was impassable. Maybe you should add some check for this types of events and for "always on top" too, etc.

Also when you click at events that move, the script doesn't work well.

nathmatt

yea i know i need to rework the move route to fix that and the allow you to click again before reaching the destination
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Karltheking4

(Sorry for necroposting!)

When movement is disabled, events activated by the action button won't activate anymore, is there anything you can do about that?

nathmatt

January 18, 2011, 02:48:20 pm #99 Last Edit: January 18, 2011, 02:50:38 pm by nathmatt
are you making sure your disabling movement like this
$MCES.movement_disabled = true


edit: events will never activate using the action button while using this script they have been changed to activate by click when you finish moving or are next to the but you still have to click them
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script