Advertisement
TheSixth

Save/Load Menu Patch v1.0 - Mouse + Mog's Scene File A

Dec 10th, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.11 KB | None | 0 0
  1. =begin
  2.  
  3. - Save/Load Menu Patch v1.0
  4. - Made by: Sixth
  5.  
  6. - Description:
  7.  
  8. This little script fixes the issues with Moghunter's Scene File A script and
  9. Unknown's Mouse script. No, really, I don't know who wrote that mouse script.
  10.  
  11. The player must click the left mouse button to select the previous/next
  12. savefile windows (when the mouse is NOT on the selected savefile window) or to
  13. save/load a file (when the mouse is on the selected savefile window).
  14. The right mouse click will exit the save/load menu.
  15.  
  16. - Installation:
  17.  
  18. Put this script below Moghunter's Scene File A script!
  19.  
  20. =end
  21.  
  22. class Scene_File
  23.    
  24.   alias mouse_upd9997 update
  25.   def update
  26.     mouse_upd9997
  27.     mouse_cursor
  28.   end
  29.  
  30.   def mouse_cursor
  31.     pos = Mouse.pos?
  32.     $cursor.x = pos[0] + CURSOR_OFFSET_X
  33.     $cursor.y = pos[1] + CURSOR_OFFSET_Y
  34.   end
  35.  
  36.   def mouse_input
  37.     if Mouse.lclick?
  38.       last_index = @index
  39.       @savefile_windows.each_with_index do |win,i|
  40.         case i
  41.         when @aw # Currently selected
  42.           return on_savefile_ok if sel_cur_win(win,i)
  43.         when @nw # Previous window
  44.           break if sel_prev_win(win,i)
  45.         when @pw # Next window
  46.           break if sel_next_win(win,i)
  47.         else # Not shown
  48.           next
  49.         end
  50.       end
  51.       if @index != last_index
  52.         Sound.play_cursor
  53.         @savefile_windows[last_index].selected = false
  54.         @savefile_windows[@index].selected = true
  55.       end      
  56.     end
  57.     on_savefile_cancel if Mouse.rclick?
  58.   end
  59.  
  60.   def sel_cur_win(win,i)
  61.     wrct = Rect.new(win.x,win.y,win.width,win.height)
  62.     return Mouse.within?(wrct)
  63.   end
  64.  
  65.   def sel_prev_win(win,i)
  66.     wrct = Rect.new(win.x,win.y,win.width,win.height)
  67.     if Mouse.within?(wrct)
  68.       execute_index(1)
  69.       @file_max > 2 ? reset_position(1) : reset_position(0)
  70.       return true
  71.     end
  72.     return false
  73.   end
  74.  
  75.   def sel_next_win(win,i)
  76.     wrct = Rect.new(win.x,win.y,win.width,win.height)
  77.     if Mouse.within?(wrct)
  78.       execute_index(-1)
  79.       reset_position(0)
  80.       return true
  81.     end
  82.     return false
  83.   end
  84.  
  85. end
  86. # End of script! O_O
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement