Use an Indicator instead of a Cursor
Tsunokiette
Jun 28 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
I've been grave digging through my old scripting topics lately, and am redoing them more simply, not overthinking anything, and making them work.
I'm also making sure they require minimum work from the user.
Just import this into your pictures folder. (make sure to make the background transparent)
(DEAD IMAGE LINK But we're talking a hand icon like Final Fantasy...)
Then replace Window_Command with the following code. (this is version 1, version 2 will be much cleaner)
Code
Code:
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands,pointer = false)
# Compute window height from command quantity
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
@pointer = pointer
self.contents = Bitmap.new(width - 32, @item_max * 32)
if @pointer = true
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture('hand')
@sprite.x = self.x + 16
@sprite.y = self.y + 16 + 4
@sprite.z = 9999
end
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
if @pointer == true
rect = Rect.new(4 + 24, 32 * index, self.contents.width - 8 - 24, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
else
rect = Rect.new(4 , 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
alias :orig_update :update
def update
if @pointer = true
if self.visible == false or @index < 0
@sprite.opacity = 0
elsif self.visible == true or @index >= 0
@sprite.opacity = 255
end
@sprite.x = self.x + 16
@sprite.y = self.y + 16 + 4 + (32 * @index)
end
orig_update
end
alias :orig_dispose :dispose
def dispose
if @pointer == true
@sprite.dispose
end
orig_dispose
end
alias :orig_u_c_r :update_cursor_rect
def update_cursor_rect
if @pointer == true
return
end
orig_u_c_r
end
end
Then in any command_window you want an indicator as opposed to the selector, add a "," and true.