Cursor Blink Remover

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Cursor Blink Remover V2.0

Typhon01
 

 
For versions prior to 2.0, please refer to this thread: http://forums.rpgmakerweb.com/index.php?/topic/28835-stop-cursor-from-blinking/
 
Introduction
This script prevents the "cursor" on selector windows (such as the Title Scene window, the main menu windows, battle scene windows, etc) from "blinking". If you start playtesting a new game, as soon as the title scene starts, on that window there, you will see the cursor I'm talking about, and how it rapidly fades in and out. This script can control that fading effect. Although I myself don't intend on using this script, it's here for anyone who does want it.
 
Features
This script has three customization features to give you control over the windows that have the blinking cursor.

  • You can disable blinking by turning on a game switch. The default switch is 15, but that is customizable in the script.
  • You can disable blinking at the Title Scene with a control in the script (something that option #1 couldn't do), this is set to false by default.
  • You can disable blinking entirely, which renders the first two controls powerless regardless of their setting. No windows will have the blinking cursor, period. This is set to false by default.
Due to the effect of this script, screenshots cannot show you what I'm talking about. Try out the demo instead.
 
How to Use
Full instructions are given in the script, but this script installs under the materials section, and above main. This script is usable with zero configuration, just launch the game, and should you want the cursor to not blink for whatever reason, flip the magic switch (15 by default) to ON. If you want to reverse that effect, simply flip it OFF again. More customization options are available, within the "Editable Region" inside the script.
 
Demo
The demo for this script can be downloaded here.
 
There are three NPCs that will show you exactly what the script does, and their dialog changes if you use the activate the third
setting within the script.
 
Script
At long last, here is the script itself. You can plug-and-play with zero customization if that's your thing, but at the very least, I recommend changing the default switch to something that works better for you.

 

Code:
#==============================================================================# ** CURSOR BLINK REMOVER **#           V2.0# Author: Typhon01#------------------------------------------------------------------------------#  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 everyone knows 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#==============================================================================  endend#==============================================================================# ** 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  endend#==============================================================================# ** 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  endend 
 
 
Credit and Terms of Use
This script is free to use for all projects, commercial or otherwise, so long as proper credit is given to me, Typhon01.

You are permitted to re-post and redistribute this script however you please, so long as anyone who ends up with it also provides proper credit to the original author of this script, Typhon01.
 
You may alter and edit this script how you see fit, however, you do so at your own risk. It is not my responsibility to fix any issues caused as a direct result of the tampering of this script.
 
If you do alter the script, and you decide to redistribute your alterations, it is your responsibility to inform everyone that your script is not the original, and you must inform them of any changes you have made to the script.
 
Author's Notes
I have personally tested this script with multiple windows in-game, including name-processing windows, the title scene, battle scene, choice dialogs, my own custom scene, and even the play-testing switch and variable control window that appears when you press F9. I have not stumbled upon any issues while testing THIS version of the script V2.0, but that doesn't mean they don't exist. After all, this script modifies the update method of a hidden class, which means I made this script without having any source code to work with. There's no way to know for certain what could be affected by my script, but if you do stumble upon any bugs/issues, I will certainly do my best to correct them.
 
Special Thanks
I'd like to give a special thanks to theadellie, for posting the original request for this script. The making of this script served as a learning experience for me, and helped me to understand the inner workings of the engine better.
 

Halfmoon Media

Illustrator, Eventer, Writer
Veteran
Joined
Aug 17, 2014
Messages
61
Reaction score
9
First Language
English
Primarily Uses
That's a great idea, and really close to something I've been looking for.  But I noticed that the cursor stops blinking "midway" through (at least, that's the effect it gives) which leaves the non-blinking cursor to be semi transparent. id there any way to make that a solid cursor instead?
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Hey! I'm glad that it's something you're interested in. I'll be honest, I didn't think anyone would really use it, because personally, I kind of like the blinking effect of the cursor.

Anyways, as for your question, I'm not certain that it can be done. You see, this script relies on code that's within a "hidden" class, that is, I can't see the code that causes the cursor to behave like it does. This script accomplishes what it does by making the game engine think that any given window is inactive when the update method is called, but it remains active to process input. I can play around with some stuff to see if I can't figure out how to lock the cursor into a certain "stage" of its blinking cycle, but without access to the original code that handles that in the first place, I can't guarantee anything.

I'm at work right now, but I'll take a gander when I get home.

EDIT:

I haven't figured it out yet, but I'll continue to try in my free time. I've got a couple more ideas I want to try before I give up on you.
 
Last edited by a moderator:

Halfmoon Media

Illustrator, Eventer, Writer
Veteran
Joined
Aug 17, 2014
Messages
61
Reaction score
9
First Language
English
Primarily Uses
Oh, thanks! It's not a huge deal, but if you're up for it, go for it!
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Hey, sorry it's taken me so long to give you an update, but I'm afraid I don't have good news. Without being able to work with the original code of the Window class, I am unable to control the cursor as you requested. I really tried, but to no avail... I tried aliasing so many different things, and even went so far as to re-write portions of the Window class to try and learn more, but it's beyond my abilities. :/ I hate giving up on challenges, but I've tried everything I could think to try.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You could modify it to use a custom cursor at 255 opacity (this is how I do it on my menu scripts). Or simply redraw the cursor at 255 opacity after stopping it.
 
Last edited by a moderator:

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
Well, I agree with your first point, and I'll probably implement that seeing how that shouldn't be too difficult to do. However, with your second point, I've tried affecting the opacity of the cursor directly. Everything I've tried to do so has failed. cursor_rect doesn't have an opacity property (gives me errors when I try that), and there were several other things I tried as well. As simple as it seems it ought to be, it seems like it's directly the opposite. I'll go with writing a dummy cursor that draws over the existing one, and mimics its movement, but I'll have to wait before adding that in, as I just started a project unrelated to VX Ace with a real-life friend.

Anyways, I can't believe I didn't think of the custom cursor idea earlier. Thanks Adiktuzmiko!
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
cursor_rect is a rect, so it really won't have opacity.. :)
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
(sigh) I know cursor_rect is a rect... I guess my point was that the only thing that appears to be directly related would be cursor_rect, and that rects themselves don't have opacity settings, as I discovered via trial and error. According to the documentation, the window class is "created internally from multiple sprites", so I also tried playing around with the Sprite class too, but what I discovered from that is the Window class doesn't make use of Sprite. Or at least, it never calls Sprite.new...

I suppose that the Window class can have all unique methods specifically designed to draw windows, that behave similarly to the Sprite class methods. It appears that that's the case, but without having access to the source, there's nothing I can do about it.

If you have any solutions to directly affect the opacity of the cursor, I'm all ears. I'd much rather utilize a line of code to the effect of cursor.opacity = <value> instead of writing new methods to both draw and move a customized cursor that looks exactly like the one that it's drawn over, only with the ability to affect its transparency.

At any rate, I must be going. I'll work on writing a customized cursor during my free-time, but as I said before, I have priorities with another project outside of VX Ace. I'll post the updated script when it gets finished though.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It calls Sprite on the hidden Window class probably. The contents variable of a window is a bitmap, and bitmaps need to be created inside sprites, so it's there somewhere..


Anyway, I don't think the cursor is editable directly.
 
Last edited by a moderator:

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
I'm sorry, but I really don't think that Window does rely on the Sprite class, and here's my reasoning:

Put this snippet of code within a new project where you would install all of your other user-made scripts, then run the project.

class Sprite alias testing_alias initialize def initialize msgbox_p("Initialized") testing_alias endendWhen you start up, right before the title scene, you should get precisely three message boxes that pop-up, one right after the other. They pop-up every time a new instance of the Sprite class is made, and within the Scene_Title script, we see that the method create_background has 2 such cases (@sprite1 and @sprite2), and the create_foreground has one such case simply called @foreground_sprite, which add up to a total of three, which was the number of message boxes we had. Unless I'm mistaken, the Window class couldn't possibly call Sprite.new because there are no message boxes that display to support such a case. If there's another way to create an instance of a class without it "initializing", then I could be completely wrong, but I don't know of any such method.

On the other hand, yes. You seem to be correct in stating that the cursor is not directly editable. That being said, I now have some free time again, being finished with my project in the real-world. I'll begin work on writing methods to support a custom cursor.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
It could be that window handles that internally thru some way or another. The contents variable of the window behaves as a bitmap, and bitmaps need sprites in order to show...


Also, from the help file"

Window


The game window class. Created internally from multiple sprites.
 
Last edited by a moderator:

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
Excellent script!

Thank you.
 

tale

Volunteer
Veteran
Joined
Dec 16, 2016
Messages
709
Reaction score
1,194
First Language
English
Primarily Uses
N/A
Fixed script format, credit Typhon01.
Code:
#==============================================================================
# ** CURSOR BLINK REMOVER **
#           V2.0
# Author: Typhon01
#------------------------------------------------------------------------------
#  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 everyone knows 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
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

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
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top