• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

About pbDrawTextPositions...

  • 60
    Posts
    10
    Years
    • Seen Jul 9, 2015
    I'm using pbDrawTextPositions to display a .txt file, the problem is that I have no idea how to change to a second line, that's what I tried:

    Code:
        textPositions=
        [
           [_INTL(file.readlines.to_s),34,20,0,baseColor,shadowColor]
        ]
        
        for i in file.readlines
          textPositions.push i.sub(/\n/) {}
        end

    I did type \n in the .txt file but it didn't really work, any help would be appreciated!

    -edit-
    Of course I know I could just use a "for i" each line and it would still be good enough, what I'm asking is having
    a single line but with "\n" each time I want to break it and a way to recognize that \n must be read as a break line and not just as text.

    The reason I won't simply do a simple "for i" with i being the number of lines, is just for learning purposes =P that's if what i'm asking is even possible.
     
    Last edited:

    Nickalooose

    --------------------
  • 1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Wait! What are you doing? Reading from txt files or creating txt files or what?
     
  • 60
    Posts
    10
    Years
    • Seen Jul 9, 2015
    Reading from a txt file to display the text on screen.
    Instead of having a txt with multiple lines, something like:

    textPositions= [
    [_INTL(file.readlines.to_s),34,20,0,baseColor,shadowColor]
    [_INTL(file.readlines.to_s),34,40,0,baseColor,shadowColor]
    [_INTL(file.readlines.to_s),34,60,0,baseColor,shadowColor]
    ...
    ]

    what I'm asking is, instead, having a single long line in the txt file separated by "\n" and a way to recognize "\n" as a way to break a line and make a new one.
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    pbDrawTextPositions doesn't do multi-line text. Use drawTextEx or drawFormattedTextEx instead (as seen in the summary screens). I don't know if you'd need to do anything fancy to the \n to make them work, though.
     
    Back
    Top