Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Improved command window, Shows an animated cursor instead of highlighting a row
BigEd781
post Dec 28 2008, 05:56 PM
Post #1


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




Improved Command Window
By BigEd781


Introduction
This script will change the appearance of all windows in game that present choices. This means any menu, the battle screen, etc. The game will no longer highlight the selected row. Instead, an animated cursor will appear next to the selected option. I recommend using this is conjunction with my Final Fantasy IX style menu.

Features
➮ 99% plug'n'play (you need to download an image).
➮ Looks cool!


Screenshots

All cursors animate automatically. Just name an image "Pointer.png" (no quotes) and place it in your "\Graphics\Pictures" folder
Menu


---

---

---



battle


---

---



Different Cursors


---

---



Configuration / Use

Just place the script above in the "Materials" section. Download a cursor image (below), rename the one you want to use to "Pointer.png" (without the quotes) and place it in your game's "\Graphics\Pictures" folder.











Script
Don't forget to download a cursor image wink.gif
CODE
=begin
                      BigEd781's Improved Command Window
=end

module EdsCursorConfig
  
  # image preferred size of 18x18
  POINTER_NAME = 'Pointer'
  
end

class Window_Selectable < Window_Base
  
  #--------------------------------------------------------------------------
  # * initialize
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_initialize :initialize
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)    
    @arrow_image = Cache.picture(EdsCursorConfig::POINTER_NAME)
    @arrow_sprite = Sprite.new
    @arrow_sprite.bitmap = Bitmap.new(@arrow_image .width + 7, @arrow_image .height)
    @arrow_sprite.z = 999    
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0    
    @update_pointer = true
    eds_pre_window_command_mod_initialize(width, commands, column_max, row_max, spacing)
  end  
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  def dispose
    super
    @arrow_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * close
  #--------------------------------------------------------------------------
  def close
    super
    @arrow_sprite.visible = false
  end
  #--------------------------------------------------------------------------
  # * open
  #--------------------------------------------------------------------------
  def open
    super
    @arrow_sprite.visible = true
  end
  #--------------------------------------------------------------------------
  # * visible=
  #--------------------------------------------------------------------------
  def visible=(value)
    super    
    @arrow_sprite.visible = value ? (@index != -1) : value    
  end
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------
  def active=(value)
    super            
    @update_pointer = value
  end
  #--------------------------------------------------------------------------
  # * cursor_rect= (OVERWRITTEN)
  #--------------------------------------------------------------------------
  def cursor_rect=(rect)
    offset_y = self.viewport.nil? ? 0 : self.viewport.rect.y
    offset_x = self.viewport.nil? ? 0 : self.viewport.rect.x - self.viewport.ox
    boost_y = @arrow_image.height >= 29 ? 0 : 29 - @arrow_image.height
    @arrow_sprite.x = 5 + rect.x + self.x - (@arrow_image.width / 2) + offset_x
    @arrow_sprite.y = rect.y + self.y + (@arrow_image.height / 2) + offset_y  + boost_y
  end
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_update_cursor :update_cursor  
  def update_cursor  
    eds_pre_window_command_mod_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  #--------------------------------------------------------------------------
  # * draw_pointer
  #--------------------------------------------------------------------------
  def draw_pointer        
    return unless @update_pointer
    return unless (@intern_frame_count % 5) == 0            
    @arrow_sprite.bitmap.clear        
    return if @index == -1    
    if @sprite_last_draw_x == 7
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x == 0
      @sprite_inc_x = 1
    end        
    x = @sprite_last_draw_x + @sprite_inc_x    
    @sprite_last_draw_x = x
    @arrow_sprite.bitmap.blt(x, 0, @arrow_image, @arrow_image.rect)  
  end
  
end

class Window_Item < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)          
    super            
    @arrow_sprite.visible = value
  end
  
end

class Window_Skill < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)    
    super
    @arrow_sprite.visible = value
  end
  
end

class Window_MenuStatus < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * cursor_rect= (OVERWRITTEN)
  #--------------------------------------------------------------------------
  def cursor_rect=(rect)
    @arrow_sprite.x = rect.x + self.x - 16
    @arrow_sprite.y = rect.y + self.y + 48      
  end
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)    
    super
    @arrow_sprite.visible = value
  end
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_stat_update_cursor :update_cursor  
  def update_cursor
    eds_pre_window_command_mod_stat_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  
end

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # * start_main
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_main :start_main
  def start_main
    @party_command_window.visible = false
    @actor_command_window.visible = false
    eds_pre_window_command_mod_start_main      
  end  
  #--------------------------------------------------------------------------
  # * start_party_command_selection
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_party_command_selection :start_party_command_selection
  def start_party_command_selection
    @party_command_window.visible = true    
    eds_pre_window_command_mod_start_party_command_selection    
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * start_actor_command_selection
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_actor_command_selection :start_actor_command_selection
  def start_actor_command_selection
    @actor_command_window.visible = true    
    eds_pre_window_command_mod_start_actor_command_selection    
    @party_command_window.visible = false
  end
  
end

class Window_Message < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_win_mes_update_cursor :update_cursor  
  def update_cursor  
    eds_pre_window_command_mod_win_mes_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  
end



Compatibility / Bugs

This should be compatible with most scripts. As a lot is affected here (but not overwritten), there may be problems sometimes. If you find a bug, let me know how to reproduce it. If it is clashing with another script, let me know which script that is and provide a link or demo.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
paladin99706
post Dec 28 2008, 07:02 PM
Post #2


Level 8
Group Icon

Group: Revolutionary
Posts: 124
Type: Artist
RM Skill: Skilled




Amazing! I would probably use it, and create some new arrows if you don't mind. But overall, I'm quite fine with the highlight thing, Not saying yours isn't great, just saying I'm fine with the highlight system, Nice work again, and just wanted to say
"First reply"!
happy.gif


__________________________
Current project:
Silent Sword

Percentage
3.87%

Last worked on:
3/4/09


Plan: Remaking Silent Sword from scratch
Go to the top of the page
 
+Quote Post
   
EvilEagles
post Dec 28 2008, 07:03 PM
Post #3


Level 3
Group Icon

Group: Member
Posts: 39
Type: Developer
RM Skill: Beginner




I'm using a japanese custom title screen, like this:

How can I disable the cursor at the title screen?.


__________________________
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 28 2008, 07:12 PM
Post #4


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




EvilEagles: Use this script instead. It will be disabled on the title screen.
CODE
=begin
                      BigEd781's Improved Command Window
=end

module EdsCursorConfig
  
  # image preferred size of 18x18
  POINTER_NAME = 'Pointer'
  
end

class Window_Selectable < Window_Base
  
  #--------------------------------------------------------------------------
  # * initialize
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_initialize :initialize
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)    
    @arrow_image = Cache.picture(EdsCursorConfig::POINTER_NAME)
    @arrow_sprite = Sprite.new
    @arrow_sprite.bitmap = Bitmap.new(@arrow_image .width + 7, @arrow_image .height)
    @arrow_sprite.z = 999    
    @sprite_last_draw_x = 0
    @sprite_inc_x = 1
    @intern_frame_count = 0    
    @update_pointer = true
    eds_pre_window_command_mod_initialize(width, commands, column_max, row_max, spacing)
  end  
  #--------------------------------------------------------------------------
  # * dispose
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_dispose :dispose
  def dispose
    eds_pre_window_command_mod_dispose
    @arrow_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * close
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_close :close
  def close
    eds_pre_window_command_mod_close
    @arrow_sprite.visible = false
  end
  #--------------------------------------------------------------------------
  # * open
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_open :open
  def open
    eds_pre_window_command_mod_open
    @arrow_sprite.visible = true
  end
  #--------------------------------------------------------------------------
  # * visible=
  #--------------------------------------------------------------------------
  def visible=(value)
    super    
    @arrow_sprite.visible = value ? (@index != -1) : value    
  end
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------
  def active=(value)
    super            
    @update_pointer = value
  end
  #--------------------------------------------------------------------------
  # * cursor_rect= (OVERWRITTEN)
  #--------------------------------------------------------------------------
  def cursor_rect=(rect)
    offset_y = self.viewport.nil? ? 0 : self.viewport.rect.y
    offset_x = self.viewport.nil? ? 0 : self.viewport.rect.x - self.viewport.ox
    boost_y = @arrow_image.height >= 29 ? 0 : 29 - @arrow_image.height
    @arrow_sprite.x = 5 + rect.x + self.x - (@arrow_image.width / 2) + offset_x
    @arrow_sprite.y = rect.y + self.y + (@arrow_image.height / 2) + offset_y  + boost_y
  end
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_update_cursor :update_cursor  
  def update_cursor  
    eds_pre_window_command_mod_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  #--------------------------------------------------------------------------
  # * draw_pointer
  #--------------------------------------------------------------------------
  def draw_pointer  
    return if $scene.is_a?(Scene_Title)
    return unless @update_pointer
    return unless (@intern_frame_count % 5) == 0            
    @arrow_sprite.bitmap.clear        
    return if @index == -1    
    if @sprite_last_draw_x == 7
      @sprite_inc_x = -1
    elsif @sprite_last_draw_x == 0
      @sprite_inc_x = 1
    end        
    x = @sprite_last_draw_x + @sprite_inc_x    
    @sprite_last_draw_x = x
    @arrow_sprite.bitmap.blt(x, 0, @arrow_image, @arrow_image.rect)  
  end
  
end

class Window_Item < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)          
    super            
    @arrow_sprite.visible = value
  end
  
end

class Window_Skill < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)    
    super
    @arrow_sprite.visible = value
  end
  
end

class Window_MenuStatus < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * cursor_rect= (OVERWRITTEN)
  #--------------------------------------------------------------------------
  def cursor_rect=(rect)
    @arrow_sprite.x = rect.x + self.x - 16
    @arrow_sprite.y = rect.y + self.y + 48      
  end
  #--------------------------------------------------------------------------
  # * active=
  #--------------------------------------------------------------------------  
  def active=(value)    
    super
    @arrow_sprite.visible = value
  end
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_stat_update_cursor :update_cursor  
  def update_cursor
    eds_pre_window_command_mod_stat_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  
end

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # * start_main
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_main :start_main
  def start_main
    @party_command_window.visible = false
    @actor_command_window.visible = false
    eds_pre_window_command_mod_start_main      
  end  
  #--------------------------------------------------------------------------
  # * start_party_command_selection
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_party_command_selection :start_party_command_selection
  def start_party_command_selection
    @party_command_window.visible = true    
    eds_pre_window_command_mod_start_party_command_selection    
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * start_actor_command_selection
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_start_actor_command_selection :start_actor_command_selection
  def start_actor_command_selection
    @actor_command_window.visible = true    
    eds_pre_window_command_mod_start_actor_command_selection    
    @party_command_window.visible = false
  end
  
end

class Window_Message < Window_Selectable
  
  #--------------------------------------------------------------------------
  # * update_cursor
  #--------------------------------------------------------------------------
  alias :eds_pre_window_command_mod_win_mes_update_cursor :update_cursor  
  def update_cursor  
    eds_pre_window_command_mod_win_mes_update_cursor
    @intern_frame_count += 1
    draw_pointer
  end
  
end


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Canuck
post Dec 28 2008, 07:51 PM
Post #5


Level 17
Group Icon

Group: Revolutionary
Posts: 278
Type: Developer
RM Skill: Skilled




My only complaint is that the arrows seem rather unnatural with the background. Perhaps if the windowskin was changed.


__________________________

Click my sig!

Go to the top of the page
 
+Quote Post
   
Chronno
post Dec 28 2008, 08:01 PM
Post #6


Level 5
Group Icon

Group: Member
Posts: 64
Type: None
RM Skill: Undisclosed




wii this looks really nice, just a question if i make the window opacity = 0 the cursor will be visible?
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 28 2008, 08:03 PM
Post #7


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (Chronno @ Dec 28 2008, 08:01 PM) *
wii this looks really nice, just a question if i make the window opacity = 0 the cursor will be visible?


Yes, it will.

QUOTE (Canuck @ Dec 28 2008, 07:51 PM) *
My only complaint is that the arrows seem rather unnatural with the background. Perhaps if the windowskin was changed.


you can change use any windowskin or cursor that you like. I am not an artist, I just got a few together for demo purposes.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Chronno
post Dec 29 2008, 12:05 AM
Post #8


Level 5
Group Icon

Group: Member
Posts: 64
Type: None
RM Skill: Undisclosed




BigEd781 can you make it work in a new class, something like Window_Cursor?
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 29 2008, 12:19 AM
Post #9


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




No. You do it in the base classes so that you do not have to edit every place a window is created throughout the entire engine.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Valnar
post Dec 29 2008, 06:52 AM
Post #10


Level 4
Group Icon

Group: Member
Posts: 47
Type: Developer
RM Skill: Masterful




I´m Useing the Skill Mix Script and when i mix a Skill the Curser Stays at Start Mixing,and don´t move back to the skills.


__________________________
Memories....
http://avalnar.co.cc/ - PHP;HTML;CSS;SQL;PS;TOP Tutorials and Sources

Go to the top of the page
 
+Quote Post
   
Warder
post Dec 29 2008, 08:37 PM
Post #11


Level 31
Group Icon

Group: Revolutionary
Posts: 750
Type: None
RM Skill: Undisclosed




I like this a lot. I've always preferred a cursor over highlighting text. Now I just need to find one that suits my game. smile.gif

Thanks for making this.

EDIT: Just discovered something. If I use F12 to return to the title screen, I get the error message saying "line 50:SystemStackError occurred. Stack level too deep."

I don't think it's a big deal or anything, just thought I'd mention it. I seem to recall a similar problem with a cursor script I used for XP.
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 29 2008, 10:43 PM
Post #12


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (Fade @ Dec 29 2008, 08:37 PM) *
EDIT: Just discovered something. If I use F12 to return to the title screen, I get the error message saying "line 50:SystemStackError occurred. Stack level too deep."

I don't think it's a big deal or anything, just thought I'd mention it. I seem to recall a similar problem with a cursor script I used for XP.


Fixed in the newest version. Very weird, don't know exactly why it was happening, but it made me realize that I did not need to alias those methods.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Warder
post Jan 1 2009, 07:52 PM
Post #13


Level 31
Group Icon

Group: Revolutionary
Posts: 750
Type: None
RM Skill: Undisclosed




Is there a way to stop the cursor from animating? The one I'm using doesn't look so great when it's bouncing back and forth like that.
Go to the top of the page
 
+Quote Post
   
FaytSaratome
post Jan 9 2009, 12:52 PM
Post #14


Level 3
Group Icon

Group: Member
Posts: 34
Type: Artist
RM Skill: Intermediate




I was wondering if I made an error.

Did I do something wrong to make that second arrow appear?

EDIT: Also found another clash with KGC's skill categorize.

Think you could make a patch for me?

This post has been edited by FaytSaratome: Jan 9 2009, 01:03 PM
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 9 2009, 01:56 PM
Post #15


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




@FaytSaratome: This script needs an update. I have it almost finished at home, so I'll post it this weekend.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Mickadell
post Jan 17 2009, 08:46 PM
Post #16


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




Comment
Rate: Ok

I have to rate it ok even though I love it because it is a very little diffrence in the game. But I do
like it very much. Keep up the good scripting.
Attached File(s)
Attached File  Good.png ( 2.39K ) Number of downloads: 0
 
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 17 2009, 08:54 PM
Post #17


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




QUOTE (Mickadell @ Jan 17 2009, 08:46 PM) *
Comment
Rate: Ok

I have to rate it ok even though I love it because it is a very little diffrence in the game. But I do
like it very much. Keep up the good scripting.


lol, ok, thanks wink.gif


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Shadow_Satey
post Jan 19 2009, 08:55 PM
Post #18


Level 6
Group Icon

Group: Member
Posts: 88
Type: Writer
RM Skill: Skilled




This happened....


A choice...




The text after it and after every text box now!



How fix? rolleyes.gif


__________________________
"An ocelet never lets his prey escape."
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jan 19 2009, 10:04 PM
Post #19


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




Like I said a few posts ago, this script needs an update. I haven't had a ton of time lately, but I'll get to it soon.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
DarkBolo
post Jan 19 2009, 11:05 PM
Post #20


Level 8
Group Icon

Group: Revolutionary
Posts: 126
Type: Mapper
RM Skill: Skilled




Nice script man !
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 10:24 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker