[RESOLVED] [RMXP] Is it possible to create a scroll view?

Status
Not open for further replies.

callmedan

Friendly Stranger
Veteran
Joined
Dec 27, 2015
Messages
588
Reaction score
904
First Language
Vietnamese
Primarily Uses
RMXP
I’d like to know if it’s possible to create a scroll view window and use arrow keys to scroll the content vertically.
For example, I have a big credits list or instruction, and it’s longer than the height of the window. Using smaller font size might not be a good solution, because some people might find it hard to read.

I’d appreciate any help. Thanks in advance!
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,324
Reaction score
4,423
First Language
English
Primarily Uses
RMMV
I imagine you don't have a script for that and that you're looking for one, so...

I've moved this thread to RGSS Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
173
Reaction score
62
First Language
English
Primarily Uses
RMXP
How is it any different from, say, an item window filled with items that you have to move the cursor down to the window's edges to scroll the contents?

If you just want that but for Window_Base (not Window_Selectable), it's just a matter of setting the window's oy to something higher than 0 to scroll the contents. That, and making your window's contents Bitmap height larger than the window itself.
 

callmedan

Friendly Stranger
Veteran
Joined
Dec 27, 2015
Messages
588
Reaction score
904
First Language
Vietnamese
Primarily Uses
RMXP
@KK20 I want that for Window_Base. I also tried what you said, but the contents wouldn't scroll.
Did I miss something? Here is the code.
Code:
class Window_Credits < Window_Base
# ------------------------
def initialize()
   super(0, 32, 636, 443)
   self.contents = Bitmap.new(width - 32, height + 64)
   self.contents.font.size = 15
   self.contents.font.bold = true
   refresh
end

#--------------------------------------------------------------------------
# * Draw the contents of the item window
#--------------------------------------------------------------------------
def refresh
 
   self.contents.clear
   x = 10
   y = 24
   w = width - 30
 
   self.contents.draw_text(x, y * 1, w, 32, "A:")
   self.contents.draw_text(x, y * 2, w, 32, "B:")
   self.contents.draw_text(x, y * 3, w, 32, "C:")
   self.contents.draw_text(x, y * 4, w, 32, "D:")
   self.contents.draw_text(x, y * 5, w, 32, "E:")
   self.contents.draw_text(x, y * 8, w, 32, "F:")
   self.contents.draw_text(x, y * 9, w, 32, "G:")
   self.contents.draw_text(x, y * 12, w, 32, "H:")
   self.contents.draw_text(x, y * 16, w, 32, "I:")
   self.contents.draw_text(x, y * 17, w, 32, "K:")
   self.contents.draw_text(x, y * 18, w, 32, "L:")
 
   x = 150
   self.contents.draw_text(x, y * 1, w, 32, "1")
   self.contents.draw_text(x, y * 2, w, 32, "2")
   self.contents.draw_text(x, y * 3, w, 32, "3")
   self.contents.draw_text(x, y * 4, w, 32, "4")
   self.contents.draw_text(x, y * 5, w, 32, 5")
   self.contents.draw_text(x, y * 6, w, 32, "6")
   self.contents.draw_text(x, y * 7, w, 32, "7")
   self.contents.draw_text(x, y * 8, w, 32, "8")
   self.contents.draw_text(x, y * 9, w, 32, "9")
   self.contents.draw_text(x, y * 10, w, 32, "10")
   self.contents.draw_text(x, y * 11, w, 32, "11")
   self.contents.draw_text(x, y * 12, w, 32, "12")
end
end
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
173
Reaction score
62
First Language
English
Primarily Uses
RMXP
That's some weird style you got there...

Looks fine to me. Did you even add code to control the input? You know, something like
Ruby:
  def update
    if Input.press?(Input::DOWN)
      self.oy = [self.oy + 8, max_scroll_oy].min
    elsif Input.press?(Input::UP)
      self.oy = [self.oy - 8, 0].max
    end
  end
 
  def max_scroll_oy
    [self.contents.height - height + 32, 0].max
  end
 

callmedan

Friendly Stranger
Veteran
Joined
Dec 27, 2015
Messages
588
Reaction score
904
First Language
Vietnamese
Primarily Uses
RMXP
@KK20 Oh, thank you! I didn't have input control. It's working great now.

Btw, I'm not sure about the style because I only have a little knowledge about coding. Just copy what I saw in some other scripts.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,798
Reaction score
4,614
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

The sinking feeling when you realize your grandmother probably isn't long for this world, and the frustration when you know that this pandemic will take her away...not because she has Covid, but because no doctor is willing to see a patient to even run simple diagnostics anymore if one of her symptoms happens to be a recurring fever, even if her primary care physician gives her the test and it comes back negative.
Will be revealing my project to the forum soon.
Ohboi, I'mma learning how to mix/sing better warming up (by singing game songs) for eventually singing my team's game's main theme. (Plus singing for my Patrons XD)
For anyone using my Extended Generator, would you like a discord server where you can exchange ideas, help, suggestions and news about the development ?

Forum statistics

Threads
99,606
Messages
967,233
Members
131,281
Latest member
isabelx10
Top