Stop cursor from blinking

Status
Not open for further replies.

Adellie

NPC
Veteran
Joined
May 4, 2014
Messages
340
Reaction score
481
Primarily Uses
Hello,

I'm looking for a way to stop the window cursor from blinking/changing opacity. By "cursor", I do mean the rectangle that appears behind active menu items; not a custom cursor.

Does anyone know where i can find that effect?

If not, are there any scripts readily available that can put that splice of windowskin (or another image) under the text?

Any input appreciated.

(and apologies if i've overlooked something simple)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Moving to RGSSx Script Request


You can't do this without scripting. And I'm actually not sure that you CAN do it, because I THINK the code that handles the cursor (selector) blinking is not part of the provided scripts, but built into the engine.
 

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
The cursor blinking code is in the "update" method of the "Window" class. It would be difficult to change the functionality of the cursor without the source code of this method.
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Wow, it's been some time since I've been on here.
Anyways, I got online as I happened to have free time today, and I stumbled upon this post. I must admit, I was a little intrigued with your request, and I couldn't resist wanting to try my hand at this. I cleared up the rest of my schedule, and started fumbling with code.
 
What I've come up with, theadellie, is not a script I would personally recommend to use. I'll post what I have here to satisfy any curiosity anyone may have, but unless someone can improve it to eliminate the rather annoying problem that I've noticed this script can present, I find it unsuitable to use in any game. 
 
Here's the script:

#==============================================================================
# ** CURSOR BLINK REMOVER **
#------------------------------------------------------------------------------
# DESCRIPTION
#------------------------------------------------------------------------------
# This script prevents the cursor from "blinking" by limiting the updating
# functions of selectable windows so their processes only update whenever a
# key stroke is registered. Due to the nature of this script, any and all
# windows that inherit from the Window_Selectable or the Window_Command class
# will not display entrance and exit animations correctly. The animated effects
# for the Title Scene have been circumvented by removing them entirely within
# this script, but you can still see the result by pressing escape in-game
# and choosing the "Quit Game" option. The resulting window will gradually appear
# only if input is recieved, and then will only disappear given the same.# 

# Please keep in mind that this script may not be compatible with any scripts that

# have to do with window handling or the title scene itself.
#
# NOTE: USE OF THIS SCRIPT IS NOT RECOMMENDED
#------------------------------------------------------------------------------
# Instructions
#------------------------------------------------------------------------------
# Plug and play. Paste script under the materials section, but above main.
# To reverse the effects of the script, simply delete. This script is not
# recommended for use.
#==============================================================================


#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================

class Window_Selectable < Window_Base
alias t01_winselect_init initialize
def initialize(x, y, width, height)
t01_winselect_init(x, y, width, height)
end
alias t01_winselect_update update
def update
if Input.trigger?:)UP) || Input.trigger?:)DOWN) || Input.trigger?:)LEFT) || Input.trigger?:)RIGHT) || Input.trigger?:)pagedown) || Input.trigger?:)pageup) || Input.trigger?:)C) || Input.trigger?:) B) || Input.trigger?:)R) || Input.trigger?:)L)
t01_winselect_update
end
end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================

class Scene_Title < Scene_Base

#--------------------------------------------------------------------------
# * Close Command Window
#--------------------------------------------------------------------------
def close_command_window
@command_window.dispose unless @command_window.disposed?
end
end

#==============================================================================
# ** Window_TitleCommand
#------------------------------------------------------------------------------
# This window is for selecting New Game/Continue on the title screen.
#==============================================================================

class Window_TitleCommand < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
update_placement
select_symbol:)continue) if continue_enabled
self.openness = 255
end

end
Now, it's worth noting here just exactly what you're getting into. What this script does, is it prevents any windows that have a cursor (window_selectable and window_command) from updating as they normally would, unless input is processed. That means if you have any opening animations or exiting animations on any such window, you have to constantly be pressing a key (up, down, left, right, page up, etc..) in order for the animation to update, simply because that is the nature of this script. Originally, you could see this effect immediately by play-testing the game, but it annoyed me so much that in this very script I disabled the title-scene window animations. Rather, you can see evidence of this problem by pressing Escape while in game, and selecting the "Game End" option.

Another thing, this script doesn't even actually stop the cursor from blinking anyways. As the window is allowed to process, it updates the cursors blink as well, and while it's subtle enough that you probably won't notice the difference much, it's definitely NOT a solution to your original request, rather, it is merely a mask.

My conclusion after testing this is in utter agreement with eugene222. Changing the functionality of the cursor without the source code is a difficult task to do, and it's not likely that you'll get the feature exactly as you requested it, unless someone out there has a method of looking at the source code so they can implement a direct fix to your dilemma. 
 

Adellie

NPC
Veteran
Joined
May 4, 2014
Messages
340
Reaction score
481
Primarily Uses
Thanks for the input guys. 

typhon01:

Welcome back and thanks kindly for taking the time to write something up. I can certainly see how this isn't a real solution; However, it's interesting to see the way you've approached it. 

Mods, I understand it's not accessible but is it ok to leave this open in case anyone has other ideas for a workaround?
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Hey, it's me again.

Well, I was going through the documentation for the Window class, and I noticed that the definition for the method 'active' said that it determined the cursor's blink status. So, a few theories went through my head, and I determined that there must be a conditional statement of some sort within the update method of the Window class that determines whether a given window is "active" or not, and depending on the result, it would alter the cursor accordingly...

Long story short, I wrote another script with a similar approach as before, only instead of limiting the update method, I added code inside the Window class update method to deactivate any windows that are currently active, then restore their active state immediately thereafter, ONLY if they were active to begin with. To do this, I had to implement an instance variable to determine if a window is supposed to be active or not, but after it's all said and done, it SEEMS to work without issue.

If anyone's interested, I'll put the script here in this spoiler.

#==============================================================================
# ** CURSOR BLINK REMOVER **
#------------------------------------------------------------------------------
# DESCRIPTION
#------------------------------------------------------------------------------
# This script prevents the cursor from "blinking" by deactivating all windows
# that are open while the Window class does it's processing, then restoring the
# proper "active state" of each respective window when the update process has
# finished.
#------------------------------------------------------------------------------
# Instructions
#------------------------------------------------------------------------------
# Plug and play. Paste script under the materials section, but above main.
# To reverse the effects of the script, simply delete. This script is not
# recommended for use until more testing has been achieved to determine what
# side-effects, if any, may occur.
#------------------------------------------------------------------------------
# Compatibility
#------------------------------------------------------------------------------
# No testing has been performed to determine the compatibility of this script,
# but issues with most scripts in theory should be minimal. If there are scripts
# that rely on the original update method from the hidden Window class, this
#script may cause errors.
#------------------------------------------------------------------------------
# Terms
#------------------------------------------------------------------------------
# This script is free for use in all projects, commercial or otherwise, so long
# as credit is given to me, Typhon01.
#==============================================================================



#==============================================================================
# ** Window
#------------------------------------------------------------------------------
# This is the Window Class, based on the help file, it inherits from Object
#==============================================================================
class Window < Object
@t01_active_state = 1
alias t01_window_update update
def update
self.active = false
t01_window_update
activate unless @t01_active_state == 0
end
end


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Deactivate Window
#--------------------------------------------------------------------------
def deactivate
@t01_active_state = 0
self.active = false
self
end
#--------------------------------------------------------------------------
# * Activate Window
#--------------------------------------------------------------------------
def activate
@t01_active_state = 1
self.active = true
self
end
end
This still isn't a direct solution to your problem, and I'm not sure I would use it in any game without testing it further for issues, but at least it doesn't have any (obvious) issues, which makes it an improvement from before, ;)
 

Adellie

NPC
Veteran
Joined
May 4, 2014
Messages
340
Reaction score
481
Primarily Uses
Nice, i'm going to use this for the time being.

Thanks again!
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,204
First Language
Binary
Primarily Uses
RMMZ
The best way to do this would be to (almost completely) rewrite the window class.
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Well, I took the time to test the script that I provided, and with everything that I've tested, it works flawlessly. You shouldn't have any problems with any of the in-game windows provided by built-in scripts and what-not, nor should there be any problems with Event windows like NPC dialog, number input, name input, etc. 

 

I HAVEN'T tested this with other people's scripts, but unless they directly rely upon the original updating methods of the Window class, chances of incompatibility are theoretically minimal.

 

This is (most likely) the final version of the script that I'm going to write, but I did take the liberty of adding three options to give you more control over when the script ought to be running. First and foremost, I've added the "turn on game switch to activate script" feature, with the default switch being #15, but that is editable within the script. This allows you to selectively decide which kind of windows should have a blinking cursor in-game by flipping that switch off and on.

 

Secondly, I added a feature to prevent the blinking cursor from happening on the Title Scene. I had to add that in because of the re-work that I did, but it's a useful feature to have if you want some in-game windows to have a blinking cursor, but you don't want the Title Scene to have said cursor.... This option is a boolean, and it's default is set to false.

 

The final option I put in the script just flat out prevents the cursor from blinking always, so if you don't want the blinking cursor period, than this is the option that will save you a switch for your game. This option will override the previous two, so keep that in mind. This option is also a boolean, and it's default is set to false.

 

So, if you installed this script and played without configuration, you would have a blinking cursor on the Title Scene, and on every window thereafter unless you flipped game switch #15 on. As with all scripts, this one installs under materials, but above main.

 

You can get the script here:

Code:
#==============================================================================
# ** CURSOR BLINK REMOVER **
#------------------------------------------------------------------------------
#  DESCRIPTION
#------------------------------------------------------------------------------
# This script prevents the cursor from "blinking" by deactivating all windows
# that are open while the Window class does it's processing, then restoring the
# proper "active state" of each respective window when the update process has
# finished.
# 
# There are different settings explained in the "Instructions" section that alter
# how and when the script works, so it allows for a little bit of flexibility.
#------------------------------------------------------------------------------
#  Instructions
#------------------------------------------------------------------------------
# Look at the editable region below to set the script up for your needs. You can
# alter how the blinking cursor restrictions work with the three settings below.
#
# By default, whenever you want the cursor to NOT blink, you would set the game
# switch #15 to ON. When you get to a point when you would like the cursor to act
# as it normally would, you simply turn the switch OFF.The switch that is used, 
# of course, is customizable, and you can control that with the settings in the 
# editable region.
#
# You can also make it so the script prevents the cursor from blinking at the
# title scene, something that the script won't do by default.
#
# The third setting is for if you don't want the cursor to blink period. This
# setting renders the other two useless regardless of how they are set.
#------------------------------------------------------------------------------
#  Compatibility
#------------------------------------------------------------------------------
# No testing has been performed to determine the compatibility of this script,
# but issues with most scripts IN THEORY should be minimal. If there are scripts
# that rely on the original update method from the hidden Window class, this 
# script may cause errors.
#------------------------------------------------------------------------------
#  Terms of Use
#------------------------------------------------------------------------------
# This script is free for use in all projects, commercial or otherwise, so long
# as credit is given to me, Typhon01.
#
# You may redistribute this script however and wherever you please, so long
# as you make sure the original source of this script is mentioned and anyone
# who uses this script as a result of your distribution gives proper credit
# to me.
#
# You may edit this script however you want, to fit your purposes and suite your
# needs, HOWEVER, you do so at your own risk. It is not my responsibility to
# fix any issues caused as a direct result of tamperment of this script.
#
# If you do alter this script, and you decide to distribute the altered script,
# you must make certain that the script is NOT in it's original state, and you
# must describe any and all changes you have made.
#==============================================================================

module Typhon01
  module Cursor_Blink_Remover
#==============================================================================
# ** EDITABLE REGION
#==============================================================================

# This is the game switch you would activate if you want to disable cursor blinking.
    BLINK_REMOVER_SWITCH  = 15

# Set this to true if you want some windows to have a blinking cursor, but not the
# title scene.
    REMOVE_TITLE_BLINK    = false

# Set this to true if you NEVER want the cursor to blink.
    NEVER_BLINK           = false

#==============================================================================
# ** END EDITABLE REGION
#==============================================================================
  end
end


#==============================================================================
# ** Window
#------------------------------------------------------------------------------
#  "The game window class. Created internally from multiple sprites."
#   A hidden class within the engine, editing here MAY be dangerous, 
#==============================================================================

# According to the help contents, Window inherits from the Object class.
class Window < Object

  # This is a new instance variable, used to determine when a window should be active
  @t01_active_state = 1

  # According to the contents, the cursor blink is handled in the Update method.
  alias t01_window_update         update
  def update

    # We only skip the blinks if the settings are in line with current circumstances
    if $game_switches[Typhon01::Cursor_Blink_Remover::BLINK_REMOVER_SWITCH] ||
        Typhon01::Cursor_Blink_Remover::NEVER_BLINK || 
        Typhon01::Cursor_Blink_Remover::REMOVE_TITLE_BLINK && 
        SceneManager.scene_is?(Scene_Title)

      # Deactivates any active windows without using the modified method
      self.active = false

      # Calls original method
      t01_window_update

      # Reactivates windows, but only if they are supposed to be active.
      activate unless @t01_active_state == 0

    # Simply call the original method if the right circumstances AREN'T in place.
    else
      t01_window_update
    end
  end
end


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This is a super class of all windows within the game.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Deactivate Window
  #--------------------------------------------------------------------------
  alias t01_win_base_deact        deactivate
  def deactivate
    # This let's us know that the window is supposed to STAY inactive.
    @t01_active_state = 0
    t01_win_base_deact
  end
  #--------------------------------------------------------------------------
  # * Activate Window
  #--------------------------------------------------------------------------
  alias t01_win_base_act          activate
  def activate
    # This let's us know that the window is supposed to become active again.
    @t01_active_state = 1
    t01_win_base_act
  end
end



 

Anyways, that's it for me, it's been a fun learning experience, ;)

 

-EDIT-

I forgot to mention, I updated the terms of use inside the script. It's all highly reasonable, but make sure you check it out.
 
Last edited by a moderator:

Adellie

NPC
Veteran
Joined
May 4, 2014
Messages
340
Reaction score
481
Primarily Uses
Dekita: 

I know that would be more elegant, but i doubt anyone would take that on as a script request.

For now this is fine. :)

typhon01: 

I'm going to stick with the second script you posted here. But yes, if my project ever sees the light of day, i'll be sure to follow the terms. Gonna message you in a bit about returning the favour.

mods may close if they wish.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top