The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: game_guy on June 10, 2010, 03:06:51 AM

Title: [XP] Hand Cursor
Post by: game_guy on June 10, 2010, 03:06:51 AM
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](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fexample2.png&hash=fe3b9c0f9ebe51d02186a40be53b792d81f0143d)[/spoiler]
[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fexample1.png&hash=59cfb1b8bec734dcdd53ddffe8b5253476658ace)[/spoiler]


Demo

N/A


Script

[SPOILER]
#===============================================================================
# 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
[/SPOILER]


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] Hand Cursor
Post by: cozziekuns on June 10, 2010, 03:35:11 AM
Nice script game_guy. I'm just curious, is there some sort of specification on the cursor size? Like, 32 x 32?
Title: Re: [XP] Hand Cursor
Post by: game_guy on June 10, 2010, 04:10:05 AM
It uses a 32x32 area from the windowskin. Here's what it could look like.
That hand cursor is a 32x32 area. Normally a rectangle cursor would go there.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fhand02cur.png&hash=20b8b99e74b9cdd5d66277c4f9bcd5c0d45fb503)

Its more of a limitation of how windowskins are supposed to be setup.
Title: Re: [XP] Hand Cursor
Post by: Mitsarugi on July 03, 2010, 10:55:56 AM
Quote from: game_guy on June 10, 2010, 04:10:05 AM
It uses a 32x32 area from the windowskin. Here's what it could look like.
That hand cursor is a 32x32 area. Normally a rectangle cursor would go there.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fhand02cur.png&hash=20b8b99e74b9cdd5d66277c4f9bcd5c0d45fb503)

Its more of a limitation of how windowskins are supposed to be setup.

could you send me a copy of the feather cursor plz? i really like it :)
Title: Re: [XP] Hand Cursor
Post by: game_guy on July 03, 2010, 09:31:33 PM
Quote from: Mitsarugi on July 03, 2010, 10:55:56 AM
Quote from: game_guy on June 10, 2010, 04:10:05 AM
It uses a 32x32 area from the windowskin. Here's what it could look like.
That hand cursor is a 32x32 area. Normally a rectangle cursor would go there.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fhand02cur.png&hash=20b8b99e74b9cdd5d66277c4f9bcd5c0d45fb503)

Its more of a limitation of how windowskins are supposed to be setup.

could you send me a copy of the feather cursor plz? i really like it :)

I would, but unfortunately, my main computer was ruined D: Lost everything. Only got my laptop for now. I'll see if I can have my friend remake it. =)
Title: Re: [XP] Hand Cursor
Post by: Mitsarugi on July 04, 2010, 09:40:24 AM
Quote from: game_guy on July 03, 2010, 09:31:33 PM
Quote from: Mitsarugi on July 03, 2010, 10:55:56 AM
Quote from: game_guy on June 10, 2010, 04:10:05 AM
It uses a 32x32 area from the windowskin. Here's what it could look like.
That hand cursor is a 32x32 area. Normally a rectangle cursor would go there.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi678.photobucket.com%2Falbums%2Fvv143%2FGameGuysProjects%2Fhand02cur.png&hash=20b8b99e74b9cdd5d66277c4f9bcd5c0d45fb503)

Its more of a limitation of how windowskins are supposed to be setup.

ah :) thank you my friend , very appreciated :p 

could you send me a copy of the feather cursor plz? i really like it :)

I would, but unfortunately, my main computer was ruined D: Lost everything. Only got my laptop for now. I'll see if I can have my friend remake it. =)