Jump to content
  • Bored of optimization yet?


    Toothpastefairy

    Well good news for you! Because today we

    are

    dealing with line breaks. A sort of intermezzo if you will. Line breaks are a pain in the butt cheeks, because there seems to be no rhyme or reason to their existence. You can change the words before the line break and it will disappear. Okay, seems logical enough. You can add words after the line break and it will disappear. Okay, what? And until one of Ame's patreons looked into things, you could do nothing and they would randomly appear and disappear. RMXP are you drunk? When doing our optimization run (ha! still talking about optimization) I noticed something which I would've bet was the cause.

     

    Dear reader, always bet against me, for I was wrong.

     

    And then I found a line break while playing. And another. And yet one more. Time to actually look into things. After putting print statements down like no tomorrow, the following conversation between me and essentials happened:

     

    See, the function in question is getFormattedText. And this function is over-engineered like no tomorrow. Want to left-align stuff? seems logical. Want to right or center align, this function got your back. Want to use the weirdest font you can find? No problem for this badboy. Want to add Icons? Make only one line right align? Okay please slow down. Color certain words? Add your own line breaks? A second way to add Icons?

    Want to try splitting the text? No, stop!

    And that one is the problem. getFormattedText decides to rerun itself when a condition is met. What that condition exactly entails, I still don't know. But to spice things up, getFormattedText quickly adds a \n in the middle of the string. Which in ruby is syntax for: start a new line. And when it is rerun, it starts another new line right before the word after which the \n is placed.

    🤔🤔🤔🤔🤔

     

    That part of the function has officially been yeeted. We now are free

    after

    all this time of suffering.

     

     

    • Like 19
    • Thanks 3
    • Haha 5
    • Upvote 5

    User Feedback

    Recommended Comments

    The fact that you guys take the time to make memes about essential is just phenomenal

     

    Also, hasn't the line break thing been an issue since... always? Congrats for beating that boss, geez it's been a stubborn one

    Link to comment
    Share on other sites

    Quote

     

    I just want to say, you guys are doing an amazing job with the development of this, as nothing else seems to fit better here, masterpiece of game called Pokémon Reborn. Indeed, we missed some lines here and there because of this damn /n but now this guy is down, never to return!

    Keep up the excellent work fellas! 

     

    PS: Don't you worry, we'll wait as long as needed 😉

    Link to comment
    Share on other sites

    As I noticed these lines automatically skipping by way too fast I always thought they must be separate text formatting mistakes regarding the line width, maybe exclusive to my font. Glad the real culprit is finally found and we are rid of these offputting dialogue hickups!

    Link to comment
    Share on other sites

    • Veterans
    13 hours ago, SpenceMcFence said:

    when is the 52% gonna change to 53%, you've been optimizing this shit all year thats gotta be at least 1%

     

    technically we, uh, don't really count this since it wasn't planned 😕

    Link to comment
    Share on other sites

    I love these Pkm Reborn Dev Blogs. Great to see you tackling all the bizarre Pkm Essentials issues and tell us what the cause was. And the more directly game design/programming centered posts concerning e.g. AI just make me wish GF had a remotely as good eye, interest, and ambition for that kind of stuff.

    Link to comment
    Share on other sites

    Hi Guys. I know we got the game-z.exe recently. When I try to soft reset in it using F12, I am getting error.

    I wanted to soft reset for the starter but when I try F12 I am getting an error. The error is as follows:

    Script 'Settings' line 97:Errorno::EBADF occurred
    Bad file descriptor.

    Does anyone know how to fix this?

    Thanks.

    Link to comment
    Share on other sites

    14 hours ago, Storm said:

    Hi Guys. I know we got the game-z.exe recently. When I try to soft reset in it using F12, I am getting error.

    I wanted to soft reset for the starter but when I try F12 I am getting an error. The error is as follows:

    Script 'Settings' line 97:Errorno::EBADF occurred
    Bad file descriptor.

    Does anyone know how to fix this?

    Thanks.

    We already have a party going. Join us here.

     

    Edit: fixed in 18.4.3

    Edited by Scy Guy
    Link to comment
    Share on other sites

    • Developers

    Hello. I'm the patron you mentioned. 😄 I'm soooo happy that someone finally managed to find the true cause. Thank you! Okay, bye.

    • Like 1
    Link to comment
    Share on other sites

    • Supporter

    ye no problem. I'm gonna use 18.4.3 as source here. In the DrawText part of the script, there's is this pretty big if statement, highlighted below.afbeelding.png.a6673ab53f5711c1d23e6eb69a805c8b.png

    This is in the function getFormattedText as I said above. The whole of that if statement is flat out useless as far as I could tell, with it only messing things up. Thus it was hit by the good ol' delete. The if statement lasts till here below, where i've marked the end. Right above that is where the function recurses

    afbeelding.png.a2d63d28c7c0f79bd406b9ad9900e5ec.png 

    This part of the code is also in getFormattedTextFast, so you can yeet it there as well. From what I tested the game doesn't even run through that code while formatting text, but better safe than sorry. Hope this helps!

    • Like 1
    Link to comment
    Share on other sites

    • Developers
    On 3/22/2021 at 5:48 AM, Tabletpillowlamp said:

    Do you know specifically where in the code you yeeted it out? Just like to know.

     

    My little contribution was making the linewrap issues consistent. You see RMXP somehow managed to make it so that most of them only appeared in the real game but not when using the debug mode. Somehow in the compiled game there was an extra space at the end of the string so the length was different. Why? I never found that out but by adding a trim function to a particular place in the code, half of the errors were instantly fixed and the other half appeared consistently in both normal and debug code making it much easier for someone more familiar with RMXP to come and finish it. :-)

    • Like 1
    Link to comment
    Share on other sites



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • i know i'm, like, criminally bad at updating the sidebar

    but it's just the scripts!

    i never know what's worth mentioning.

    anyway we might redo the battle system.

    (6/15)

     

     

    SPOILER_shaving_luna_head.png

  • 16-4.png
    16-5.png
    16-6.png
    16-7.png
    16-8.png
    16-11.png
    16-12.png

×
×
  • Create New...