Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Closed TopicStart new topic
> Munkis' Picture-based window cursor
munkis
post Oct 17 2011, 08:55 AM
Post #1


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Munkis' Picture-based Window cursor

Version: 1.1
Author: munkis
Release Date: 10/17/2011


Exclusive Script at RPG RPG Revolution


Introduction
Changes the cursor in the three major scenes (Scene_Title, Scene_End, and Scene_Menu) from the standard window cursor to a picture.

Features
Pretty straight-forward; it's a simple to use/configure 99% plug&play (requires one image) script that changes the cursor to a pic that you create.

Required Image

You can either use this in your project, or as a placeholder until you get someone to make what you want.

Images

For version 1.1 and on, this pic will need to be renamed MenuSelectCell01.png


Script
Munkis' Picture-based window cursor
CODE
#------------------------------------------------------------------------------
#  * Munkis' Picture-based window cursor V 1.1
#  * Made by munkis
#  ╔══════════╗
#  ║ FEATURES ║
#  ╚══════════╝
#  * Replaces the default window cursor with a picture you create.  Also centers
#    the text in the command windows (thanks to TheLawG14)
#  * ALIASES create_command_window, terminate, and update methods of Scene_Menu,
#    Scene_End, and Scene_Title.
#    OVERWRITES draw_item method of Window_Command.
#  * V 1.0: Initial release
#  * V 1.1: You can now use multiple cursor pics as individual animation cells
#------------------------------------------------------------------------------

class Command_Window_Pic_Test < Window_Base
  def initialize(x,y,width,height)
    super(x,y,width,height)
    self.z = 0
    self.opacity = 0
    @anim_start = 0
    @pick_cell = 0
#   [config]
    @anim_delay = 60 #Change this to speed up/slow down the delay between cells
    @anim_smooth = @anim_delay/10 #Change this to determine how much time is
                                  #spent displaying each cell
    @cursor_cells = ["MenuSelectCell01","MenuSelectCell02","MenuSelectCell03"]
#   @window_properties = [window_x, window_y, window_width,
#                         window_height, opacity in Scene_Menu,
#                         opacity in Scene_end, opacity in Scene_Title]
    @window_properties = [189,125,196,235,0,0,255]
#   [/config]
  end
  def refresh(window_contents)
    self.contents.clear
    if @anim_start != @anim_delay
      @anim_start +=1
      if @anim_delay%@anim_start == @anim_smooth
        @pick_cell = rand(3)
      end
    elsif @anim_start == @anim_delay
      @anim_start = 0
    end
    bitmap = Cache.picture(@cursor_cells[@pick_cell])
    if $scene.is_a?(Scene_Menu)
      self.opacity = @window_properties[4]
      rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
      self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
    elsif $scene.is_a?(Scene_End)
      self.opacity = @window_properties[5]
      rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
      self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
    elsif $scene.is_a?(Scene_Title)
      self.opacity = @window_properties[6]
      rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
      self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
    end
      bitmap.dispose if @anim_start == 60
  end
end
class Window_Command < Window_Selectable
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
      self.contents.draw_text(rect, @commands[index],1)
    else
      self.contents.draw_text(rect, @commands[index])
    end
  end
end
class Window_Selectable < Window_Base
  alias update_picture_cursor update_cursor
  def update_cursor
    update_picture_cursor
    self.cursor_rect.empty if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
  end
end
class Scene_Menu < Scene_Base
  alias picture_create_command_window_menu create_command_window
  alias picture_terminate_menu terminate
  alias picture_update_menu update
  def create_command_window
    picture_create_command_window_menu
    @command_window.opacity = 0
    @pic_test = Command_Window_Pic_Test.new(@command_window.x-28,@command_window.y-17,@command_window.width+96,@command_window.height+6)
  end
  def terminate
    picture_terminate_menu
    @pic_test.dispose
  end
  def update
    picture_update_menu
    if @window_contents != @command_window.index
      @window_contents = @command_window.index
    end
      @pic_test.refresh(@window_contents)
  end
end
class Scene_End < Scene_Base
  alias picture_create_command_window_end create_command_window
  alias picture_terminate_end terminate
  alias picture_update_end update
  def create_command_window
    picture_create_command_window_end
    @command_window.opacity = 0
    @pic_test = Command_Window_Pic_Test.new(@command_window.x-28,@command_window.y-17,@command_window.width+96,@command_window.height+6)
  end
  def terminate
    picture_terminate_end
    @pic_test.dispose
  end
  def update
    picture_update_end
    if @window_contents != @command_window.index
      @window_contents = @command_window.index
    end
      @pic_test.refresh(@window_contents)
  end
end
class Scene_Title < Scene_Base
  alias picture_create_command_window_title create_command_window
  alias picture_terminate_title terminate
  alias picture_update_title update
  def create_command_window
    picture_create_command_window_title
    @command_window.opacity = 0
    @pic_test = Command_Window_Pic_Test.new(@command_window.x,@command_window.y,@command_window.width,@command_window.he
ight)
  end
  def terminate
    picture_terminate_title
    @pic_test.dispose unless @command_window.nil?
  end
  def update
    picture_update_title
    unless @command_window.nil?
      if @window_contents != @command_window.index
        @window_contents = @command_window.index
      end
        @pic_test.refresh(@window_contents)
    end
  end
end


Compatibility patch for Munkis' Achievements
CODE
class Window_Command < Window_Selectable
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    if $scene.is_a?(Munkis_Achievements)
      self.contents.font.size = 15
      if MNK_Achievements::IS_SECRET[index] == true and $game_switches[MNK_Achievements::COMPLETED_SWITCH[index]] == false
       self.contents.draw_paragraph(rect.x,rect.y+2,Graphics.width-228,Graphics.height-55, MNK_Achievements::WINDOWS[11])
      else
       self.contents.draw_paragraph(rect.x,rect.y+2,Graphics.width-228,Graphics.height-55, @commands[index])
      end
    elsif $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
      self.contents.draw_text(rect, @commands[index],1)
    else
      self.contents.draw_text(rect, @commands[index])
    end
  end
end


Customization
Just look at the array in the initialize method; there's not that much to it. Although, if you want this script to work properly in any of the other screens, you'll need to do a little tinkering. Nothing too drastic, you just need to add an extra

CODE
or $scene.is_a?(<your scene name here>)


anywhere you see

CODE
if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)


You'll also need to alias the start, terminate, and update methods of the particular script, but you have three examples of how to do that in the script.

Compatibility
There aren't any known issues.

Screenshot


DEMO
The script is simple enough to figure out...

Installation
Place in MATERIALS, above MAIN.

FAQ
Q: ZOMG teh scripz doesn't werk!!!
A: First of all, be more specific, Second, all reports typed in chat-speak or 1337-speak will be ignored.

Terms and Conditions
I don't mind if this script is posted or linked on other RMVX sites AS LONG AS YOU GIVE CREDIT!!! Same goes for using this in your project. Contact me if you want to use this in a commercial project.

Credits
Credit goes to me for the script.

This post has been edited by munkis: Feb 16 2012, 04:49 PM


__________________________
Go to the top of the page
 
+Quote Post
   
SloaTheDemon
post Oct 23 2011, 06:38 AM
Post #2


Level 7
Group Icon

Group: Member
Posts: 95
Type: Musician
RM Skill: Beginner




this looks pretty cool, not really something i would probably use for my game but someone else might want it ^.^ good job man


__________________________





Current projects

    RMVX games-
    nothing


    RMXP-
      nothing


music
my music


Go to the top of the page
 
+Quote Post
   
munkis
post Jan 2 2012, 08:19 AM
Post #3


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Version 1.1 uploaded


__________________________
Go to the top of the page
 
+Quote Post
   
munkis
post Feb 16 2012, 04:52 PM
Post #4


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Uploaded a compatibility patch for my achievements script. They wouldn't clash, but they would override each other's settings. They need to be in this order:

Achievements
Cursor
Patch

EDIT: All three scripts also should be placed be BELOW all other custom scripts to ensure compatibility.

This post has been edited by munkis: Feb 24 2012, 11:22 AM


__________________________
Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 06:26 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker