• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!
Textbook Script

Resource Textbook Script N/A

TechSkylander1518 submitted a new resource:

Textbook Script - Big bunches of text without needing to scroll through them!

View attachment 2863
To see this script in action, check out The Last Nurse Joy!

Love lore dumps but hate scrolling through little textboxes? Boy do I have a script for you!

Code
Ruby:
Expand Collapse Copy
def textbook(book)
   # oldsprites = pbFadeOutAndHide(@sprites)
    scene = Textbook_Scene.new
    screen = TextbookScreen.new(scene)
    screen.pbStartTextbookScreen(book)
    yield if block_given...

Read more about this resource...
 

ArchyArc

Lead Developer of Pokemon Sacred Johto
Member
Joined
May 10, 2017
Posts
38
Love the script and even seems backwards compatible with v17 (except changing the closemenuSE)
saw your future plans for it, specifically the background.

Got suggestions for that, not that you need to take them but either way felt i'd share them as i might end up doing them myself.
have the background use the (book) thing when you call the book (so background0, background1 etc.) or, add a second thing to the book being background so you can specify it there, same execution really just one has limitations but more ease.
 
Love the script and even seems backwards compatible with v17 (except changing the closemenuSE)
Sick, thanks for checking that!
have the background use the (book) thing when you call the book (so background0, background1 etc.) or, add a second thing to the book being background so you can specify it there, same execution really just one has limitations but more ease.
That sounds perfect, thanks for suggesting that! I was planning on the background0 plan but wasn't sure how to make it to where it would default to a certain file if background(book) didn't exist, but if I made it to where you can set it in the script call, it'd also cut down on file space if multiple books used the same background! Thanks for the suggestion!
 

Ique

Rookie
Member
Joined
Mar 29, 2021
Posts
2
Obrigado pela última resposta à minha pergunta. Eu queria saber se você pode colocar uma foto. Minha ideia era falar sobre um pokémon e sua imagem.
 
Obrigado pela última resposta à minha pergunta. Eu queria saber se você pode colocar uma foto. Minha ideia era falar sobre um pokémon e sua imagem.
Hm, the best way I could suggest doing this right now would be to add an extra bit of code in def drawTextbookPage(page). Right above the last end, you'd do something like this:
Ruby:
Expand Collapse Copy
    if book==6 && page==1
      @sprites["image"] = IconSprite.new(100,200,@viewport)
      @sprites["image"].setBitmap("Graphics/Pictures/introBoy")
    else
      if @sprites["image"]
        @sprites["image"].dispose
      end
    end
  • book==6 is to set which book you want the image on, page==1 to set the page
  • Graphics/Pictures/introBoy is the filepath for the file you want
  • IconSprite.new(100,200,@viewport) sets the coordinates of the image- 100 is the X, 200 is the Y
It's a little clunky, though, I'll try to include something better in the next update!
 
Could you work on a v19 update sometime?
It's actually already v19 compatible! It's just displaying graphics and text, so the calls generally don't change between versions or anything! The only real change was controls, and even then, (Input::B) worked fine for me when I playtested. (Although I've updated it now to (Input::BACK) in case B stops working in v20 or something)

That said, the code does need some cleaning up, and I've been thinking about rewriting it to use modules instead of arrays now that I'm more familiar with them, so there might be another update in the future!
 

Armin

☆★★☆
Member
Joined
Oct 9, 2020
Posts
162
Hi there! Suppose I would like to insert the player's name into the text. How do I go about doing it? Using $Trainer.name or $game_variables[X] would give me an undefined method 'name' or '[]' respectively.
 

Armin

☆★★☆
Member
Joined
Oct 9, 2020
Posts
162
Ah, that's because the book text is loaded before the save file is loaded. I'll try to make a fix for that in the future!
Thank you so much! 😄 Just for curiosity's sake, is it something easily fixable (can be done with a couple of lines and some simple coding)? If so, how can I go about doing it?
 
Thank you so much! 😄 Just for curiosity's sake, is it something easily fixable (can be done with a couple of lines and some simple coding)? If so, how can I go about doing it?
(Ack, sorry, I could have sworn I replied to this earlier!)

Unfortunately, I'm pretty sure it's not going to be as simple as that- it'll involve changing around how the script as a whole operates rather than just a couple lines. It shouldn't be too hard, I just need to have some dedicated time to figure it out!
 

PorousMist

Novice
Member
Joined
Aug 2, 2020
Posts
37
In case if anybody was wondering, this script is compatible with v20.1. However, the text will be positioned incorrectly, so the following changes needs to be made:

In line 93, change the following:
Ruby:
Expand Collapse Copy
       [pagename,Graphics.width/2,10,2,base]
To this:
Ruby:
Expand Collapse Copy
       [pagename,Graphics.width/2,12,2,base]

In line 100, change the following:
Ruby:
Expand Collapse Copy
       drawFormattedTextEx(overlay,25,35,Graphics.width-40,text,base)
To this:
Ruby:
Expand Collapse Copy
       drawFormattedTextEx(overlay,25,55,Graphics.width-40,text,base)
 

leo_ranger

Keeper of Secrets
Member
Joined
Nov 16, 2022
Posts
11
If anyone wants to use this in v20.1 with changing backgrounds first make the changes as given by PorousMist
In case if anybody was wondering, this script is compatible with v20.1. However, the text will be positioned incorrectly, so the following changes needs to be made:

In line 93, change the following:
Ruby:
Expand Collapse Copy
       [pagename,Graphics.width/2,10,2,base]
To this:
Ruby:
Expand Collapse Copy
       [pagename,Graphics.width/2,12,2,base]

In line 100, change the following:
Ruby:
Expand Collapse Copy
       drawFormattedTextEx(overlay,25,35,Graphics.width-40,text,base)
To this:
Ruby:
Expand Collapse Copy
       drawFormattedTextEx(overlay,25,55,Graphics.width-40,text,base)

then on line 88, change:
@sprites["background"].setBitmap("Graphics/Pictures/textbookbg")
to
@sprites["background"].setBitmap("Graphics/Pictures/Book/Book_#{@book}/TBbg_#{@page}")
This tells the script to go to "Graphics\Pictures\Book\book_(Book number)\TBbg_(Page number")

then create this folder pathway:
"Graphics\Pictures\Book\book_(number)"
For example:
"Graphics\Pictures\Book\book_0"

Then save and label each page background "TBbg_(Number)" in the folder pathway
The backgrounds go up by two due to the way the titles work so your PNGs would need to be labled as follows:
"TBbg_0", "TBbg_2", "TBbg_4", etc

If you've done it right then each page can have its own distinct background .png
Allowing you have different styles of books and pages
 
Last edited:

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
Hey Tech, does the download still work? The Mega link just lets me download the picture textbookbg.png and that's it
 
Back
Top