- 10
- Posts
- 6
- Years
- United States
- Seen Jan 16, 2023
So, I haven't found anything regarding to scrolling text in Essentials. Honestly, I'm kind of picky when it comes to certain things, and for some reason, this is one of them.
This is the Jukebox from inside the Pokégear. I don't like the text squished together, so I was thinking if it was somehow possible to maybe make the text scroll from one side to another, and repeat in order prevent the text from being squished together or having longer names be cut off.Now, I could make the names shorter, but I really don't want to, but if I can't I guess I will.
Any help would be appreciated! Thanks!
Nevermind, I figured it out. Among various minor changes in PScreen_Jukebox, Vendily and I ended up adding some code to SpriteWindow_text.
The end result turned out to be...
Thanks for those that viewed, and another thanks to Vendily for helping me over at the Discord.
![[PokeCommunity.com] Making Certain Text Scroll in the Jukebox [PokeCommunity.com] Making Certain Text Scroll in the Jukebox](https://images-ext-1.discordapp.net/external/CHwgVfEhFd7DzSmIFGOF0l0QgZAahssm5L5BVA6dx6A/https/cdn.discordapp.com/attachments/195683353121390592/554031256913051651/unknown.png?width=865&height=671)
This is the Jukebox from inside the Pokégear. I don't like the text squished together, so I was thinking if it was somehow possible to maybe make the text scroll from one side to another, and repeat in order prevent the text from being squished together or having longer names be cut off.
Any help would be appreciated! Thanks!
Nevermind, I figured it out. Among various minor changes in PScreen_Jukebox, Vendily and I ended up adding some code to SpriteWindow_text.
Code:
class Window_CommandPokemonScroll < Window_CommandPokemon
attr_accessor(:offset)
def drawItem(index,count,rect)
pbSetSystemFont(self.contents) if @starting
rect=drawCursor(index,rect)
if self.index==index && self.offset
pbDrawShadowText(self.contents,rect.x-self.offset,rect.y,rect.width,rect.height,
@commands[index],self.baseColor,self.shadowColor)
else
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
@commands[index],self.baseColor,self.shadowColor)
end
end
def index=(value)
self.offset=0 # reset when index changes
super # call the normal code
end
def update
self.offset ||= 0 # Initialize to 0 if not set.
tmpbitmap=BitmapWrapper.new(1,1)
pbSetSystemFont(tmpbitmap)
txtwidth=tmpbitmap.text_size(@commands[self.index]).width # how big of a line is it?
self.offset += (txtwidth>=475) ? 4:0
self.offset=0 if self.offset>txtwidth # reset when it gets to the end
refresh2 # new refresh method
super
end
def drawCursor(index,rect)
return Rect.new(rect.x+16,rect.y,rect.width-16,rect.height)
end
def refresh2
@item_max = itemCount()
dwidth = self.width-self.borderX
dheight = self.height-self.borderY
self.contents = pbDoEnsureBitmap(self.contents,dwidth,dheight)
self.contents.fill_rect(itemRect(self.index),Color.new(50,50,255)) # Change the color to the way it was in drawCursor
drawItem(self.index,@item_max,itemRect(self.index))
end
end
The end result turned out to be...
![[PokeCommunity.com] Making Certain Text Scroll in the Jukebox [PokeCommunity.com] Making Certain Text Scroll in the Jukebox](https://cdn.discordapp.com/attachments/195683353121390592/554874138930577408/unknown.png)
Thanks for those that viewed, and another thanks to Vendily for helping me over at the Discord.
Last edited: