GM:S 1.4 Make a Textbox engine from Scratch

Discussion in 'Programming' started by ethian, Jul 11, 2018.

  1. ethian

    ethian Member

    Joined:
    Apr 19, 2018
    Posts:
    99
    Greetings

    Currently using GMS2 with the subject of the textbox on my game, i finally decided to make a textbox engine from scratch, identical to the full ones that are for sale in the marketplace, the difference is don't use them on my game because of my lack of virtual money...
    It must have the next features:
    • Closed inside a sprite box, it just features 3 lines of text as maximun...
    • Typewritter-like typing text
    • Play sound when typing (Customizable via Interactible object/NPC object Creation Code)
    • When typing, perform a short pause at commas, and probably dots, double dot and dot and coma...
    • If the main character is at the top of the screen, the textbox is at the bottom of the screen and if the main character is at the bottom of the screen, the textbox is at the top of the screen.
    • When typing, the sprite of the one who is responsable of the current dialougue (Face in textbox and Overworld NPC (Both of them customizable via Interactive Object/NPC object Creation Code)) becomes animated, when isn't typing, unanimated...
    • When the text stops and it's complete, an arrow in the bottom right position of the box appears telling to you: "You can continue with the next dialougue by pressing z".
    • Some characters/words are of different colors (Custom per Dialougue)
    • Characters sometimes shake or move on circle (Optional via creation code or something else, if the variable "canshake" is true to make characters shake, and "cancircle" is true to make characters move on circles...)
    • "Skip" the dialougue by pressing x while typing (Make the rest of the typing text type already, making it finished)
    • Just continue with next dialougue by pressing z when text is not typing and it's complete, if out of dialougues, textbox disappear.
    And the important question for start: what is the most basical point to start to make the engine from scratch? For later continue implementing the features of adove? In a safe order?

    (i was working with GMS2 before, but i'm now working with GM:S now... see what comes next below...)
     
    Last edited: Jul 14, 2018
  2. CptChuckles

    CptChuckles Member

    Joined:
    Aug 9, 2016
    Posts:
    35
    Your starting point would be making the box appear and disappear when the NPC triggers it. Then make the textbox type out short lines of text; don't worry about scrolling or multiple sections, just get one sentence to type out and then when z is pressed close it. You can work on doing multiple lines from there.

    This is similar to a project I did years ago which displayed books, much like you'd find in Skyrim. Each book had custom text that was loaded in from a .txt file in the game's directory. The book object would tell the text-parser what file to open, and then everything else was automatic. It didn't type out, but that's only a small difference. So I suggest you keep dialogues either in separate files or separate resources, and have each NPC simply tell the textbox which resource to lookup/load, and that's pretty much all the NPC does.

    As for word highlighting, pauses, etc. I would suggest you encode those kinds of things into the message, such that as the text-typer algorithm parses out the text, it reads those codes first and then displays the text accordingly. So you could have a message like this:
    Code:
    Watch out for $rMonsters.
    The text parser would iterate over the characters, look out for '$' and think "oh this character signifies that there is a color change coming up", it would then parse 'r' and know "ok r right after $ signifies red, so switch the draw color to red for the next letters" and then it would continue typing the letters in the new color,
    and what the player sees would be "Watch out for Monsters."

    In general, I suggest inventing a set of preprocessor markup tags that the text-parser reads and does different things. Then you can code all the special text-style events in the message text resource itself, just like color: you could make another special character to signify delays or changes in typing speed, one for special event cues, etc.
     
    Pfap, Rob and IndianaBones like this.
  3. Niels

    Niels Member

    Joined:
    Jun 22, 2016
    Posts:
    659
    Watch this tutorial:
     
  4. ethian

    ethian Member

    Joined:
    Apr 19, 2018
    Posts:
    99
    Oh... i'll do what you gave to me this weekend... i'm currently on a trip where i take a break, and it will end tomorrow... taking the break i'm taking it's really good, trough...
    Also...
    That is because the Textbox is powered via script instead of object, because of the "$r" that, as appears on the script, if "$r" is on the message, the rest of the text becomes red...
    Hmm... i was thinking also on make the textbox be script-powered...
    Ah! And i forgot to put something more on the festure list:
    • If the main character is at the top of the screen, the textbox is at the bottom of the screen and if the main character is at the bottom of the screen, the textbox is at the top of the screen.
     
  5. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    339
    Well, in much the same way with a text editor, if you change the colour for a word, you usually have to change it back after you've typed that word, so it'd be like "$rMonster$b" or something.
     
  6. ethian

    ethian Member

    Joined:
    Apr 19, 2018
    Posts:
    99
    New News...

    I started to work with GM:S like before again... much easier, much more issue-less compared with GMS2 and much more fun to work! (for me...)...

    So, let's reboot the thread starting with what GM:S tutorial should see to get started from scratch?
     
  7. ethian

    ethian Member

    Joined:
    Apr 19, 2018
    Posts:
    99
    Hey, the time for implement a textbox on my game, came!

    I just followed this tutorial:



    Now is the hour of implement the features of adove

    Help me, please?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice