Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on June 09, 2010, 06:24:45 pm

Title: [XP] Window Hand Cursor
Post by: G_G on June 09, 2010, 06:24:45 pm
Window Hand Cursor
Authors: game_guy
Version: 1.0
Type: Window Add-On
Key Term: Misc Add-on



Introduction

Tired of the boring, rectangle cursor you use for your window selection? This nifty script makes it so it uses an actual cursor like a hand or an arrow and displays it next to the choice.


Features




Screenshots

Spoiler: ShowHide
(http://i678.photobucket.com/albums/vv143/GameGuysProjects/example2.png)

Spoiler: ShowHide
(http://i678.photobucket.com/albums/vv143/GameGuysProjects/example1.png)



Demo

N/A


Script

Spoiler: ShowHide

#===============================================================================
# Hand Cursor
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Tired of the boring, rectangle cursor you use for your window selection?
# This nifty script makes it so it uses an actual cursor like a hand or an
# arrow and displays it next to the choice.
#
# Features:
# Use Windows With or Without Hand Cursors
#
# Instructions:
# To use windowskins with cursor, place this in the windowskins filename.
# $cur then the system will detect it and use a hand cursor instead of a
# rectangle cursor. This way if you want you can still use normal rectangle
# cursors as well.
# Example: 001-Blue01$cur
#
# You can also change the X and Y offset, go down to begin config, and change
# the numbers.
# X_OFFSET ~ X coordinate for the cursor
# Y_OFFSET ~ Y coordinate for the cursor
# Its recommended to leave it as is for its at a pretty good setting.
#
# Compatability:
# Not tested with SDK.
# Should not conflict with anything.
#
# Credits:
# game_guy ~ For making it
# Chaze007 ~ For windowskin in screenshots
# Some RPG's ~ For having a hand cursor
#===============================================================================
module GameGuy
  X_OFFSET = -16
  Y_OFFSET = 0
end
class Window_Base
  def check_hand_cursor
    text = @windowskin_name
    text.gsub!(/\$cur/) do
      return true
    end
    return false
  end
end
class Window_Selectable < Window_Base
  alias gg_update_cursor_rect_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_lat
    end
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 32
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    self.cursor_rect.set(x + GameGuy::X_OFFSET, y + GameGuy::Y_OFFSET, 32, 32)
  end
end

class Window_MenuStatus < Window_Selectable
  alias gg_update_cursor_rect_status_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_status_lat
    end
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0 + GameGuy::X_OFFSET,
        @index * 116 + GameGuy::Y_OFFSET, 32, 32)
    end
  end
end

class Window_Target < Window_Selectable
  alias gg_update_cursor_rect_target_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_target_lat
    end
    if @index <= -2
      self.cursor_rect.set(0, (@index + 10) * 116, 32, 32)
    elsif @index == -1
      self.cursor_rect.set(0, 0, 32, 32)
    else
      self.cursor_rect.set(0 + GameGuy::X_OFFSET,
        @index * 116 + GameGuy::Y_OFFSET, 32, 32)
    end
  end
end
class Window_Message < Window_Selectable
  alias gg_update_cursor_rect_message_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_message_lat
    end
    if @index >= 0
      n = $game_temp.choice_start + @index
      self.cursor_rect.set(8 + GameGuy::X_OFFSET, n * 32, @cursor_width, 32)
    else
      self.cursor_rect.empty
    end
  end
end
class Window_PartyCommand < Window_Selectable
  alias gg_update_cursor_rect_partycmd_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_partycmd_lat
    end
    self.cursor_rect.set(160 + index * 160 + GameGuy::X_OFFSET,
      0 + GameGuy::Y_OFFSET, 32, 32)
  end
end
class Window_SaveFile < Window_Base
  alias gg_update_cursor_rect_savefile_lat update_cursor_rect
  def update_cursor_rect
    if !check_hand_cursor
      return gg_update_cursor_rect_savefile_lat
    end
    if @selected
      self.cursor_rect.set(0 + GameGuy::X_OFFSET, 0 + GameGuy::Y_OFFSET, 32, 32)
    else
      self.cursor_rect.empty
    end
  end
end



Instructions

In the script. Place above main.


Compatibility

Not tested with SDK.
Shouldn't conflict with anything.


Credits and Thanks




Author's Notes

Enjoy. If you have any weird window displays in anything let me know.
Title: Re: [XP] Window Hand Cursor
Post by: Chaze007 on June 10, 2010, 01:00:35 am
Can't wait to see it in Divine Rebirth ;D
Title: Re: [XP] Window Hand Cursor
Post by: G_G on August 21, 2010, 01:23:24 pm
Not to sound like an attention whore. But bump. Any opinions?
Title: Re: [XP] Window Hand Cursor
Post by: Blizzard on August 21, 2010, 01:27:08 pm
*slaps you* Well done. *slaps you again* You like that, don't you? *slaps again*
Title: Re: [XP] Window Hand Cursor
Post by: ShadowPierce on August 21, 2010, 01:28:56 pm
->Good script, It's already in Wipe's script list... ;)


Title: Re: [XP] Window Hand Cursor
Post by: element on August 21, 2010, 03:12:35 pm
Nice G_G
Keep up teh great scripts!  :D
Title: Re: [XP] Window Hand Cursor
Post by: MarkHest on August 06, 2014, 02:53:41 pm
Legal necro post?

I was trying this script out but I couldn't get it to work. There's no errors but the cursor just won't show up for some reason. I'm putting $cur in the filename as described and even tried different sizes of the cursor itself to see if it was a problem with the X and Y dimensions but didn't get any results.
Title: Re: [XP] Window Hand Cursor
Post by: G_G on August 06, 2014, 07:38:09 pm
Possible script compatibility? Not sure to be honest. I made this so longer ago. >.<