Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Calling methods on arrow keys
Tsukihime
post Apr 12 2012, 08:27 PM
Post #1


Level 25
Group Icon

Group: Revolutionary
Posts: 565
Type: None
RM Skill: Undisclosed
Rev Points: 25




I want another window to refresh itself to the currently selected item in a selectable window whenever I hit any of the keys that move the cursor (up, down, left, right, pg up, pg down). How can I tell that window to refresh when I hit one of those keys?


__________________________
My Scripts
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Apr 14 2012, 05:57 PM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,529
Type: Scripter
RM Skill: Undisclosed




CODE
if Input.repeat?(Input.dir4) or Input.trigger?(:L) or Input.trigger?(:R)
window.refresh
end


I've used Input.repeat?, which is what the system uses for scrolling though selectable windows, but you can also use Input.trigger? which only activated when you start pressing the buttons.

But otherwise the code that the windows use to check if selected item has moved is
CODE
  #--------------------------------------------------------------------------
  # * Cursor Movement Processing
  #--------------------------------------------------------------------------
  def process_cursor_move
    return unless cursor_movable?
    last_index = @index
    cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
    cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
    cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
    cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
    cursor_pagedown   if !handle?(:pagedown) && Input.trigger?(:R)
    cursor_pageup     if !handle?(:pageup)   && Input.trigger?(:L)
    Sound.play_cursor if @index != last_index
  end


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
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: 19th June 2013 - 08:39 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker