How do I "RPG" some text?

  • I have accomplished getting the text working via Ashley's example, but using SpriteFont+ instead:

    https://www.scirra.com/forum/typewriter-text-effect_t63552

    The question is, how do I "RPG" this method? IE: How do I load text within the SpriteFont+ box, wait for user input, then continue the text? This would require a "hold button to scroll faster" and a "hold button doesn't continue text, only pressing when text is ready to scroll on" condition. Is there an example of this in action?

    To get a better understanding of what I'm talking about, play any RPG ever.

    I do have a few ideas on how to do it, but it would require multiple texts. I'm sure I could also set the text in the code itself instead of calling on pre-defined text, but I'm not sure that would be the best way to go about this.

    If anyone has an idea or maybe a forum post I haven't found, please let me know!

  • I might have a couple examples for you, but how are you actually loading the text? As in, if not from internal system actions (i.e, "set text"), such as a dictionary, .txt file, or array.

  • https://www.dropbox.com/s/av6kbtg32idgj ... .capx?dl=0

    While I don't know how spritefont+ works, this should give you an idea for how to continue.

    I highly recommend using a project file to handle your text like I have done - load it in with AJAX. Working with significant amounts of text within C2 is a pretty miserable experience.

  • I might have a couple examples for you, but how are you actually loading the text? As in, if not from internal system actions (i.e, "set text"), such as a dictionary, .txt file, or array.

    I don't have a method yet because I was playing with my options. I suppose I should have also asked about best practices as well. I'm doing a big project that will have a lot of text which is already typed up and ready for production, but I'm just not sure what the best method would be.

  • dropbox.com/s/av6kbtg32idgj7u/typewriterprogression.capx

    While I don't know how spritefont+ works, this should give you an idea for how to continue.

    I highly recommend using a project file to handle your text like I have done - load it in with AJAX. Working with significant amounts of text within C2 is a pretty miserable experience.

    Sprite font plus works just like sprite font.

    I'm on my way to bed but I'll check out your example when I wake up.

  • > dropbox.com/s/av6kbtg32idgj7u/typewriterprogression.capx

    >

    > While I don't know how spritefont+ works, this should give you an idea for how to continue.

    >

    > I highly recommend using a project file to handle your text like I have done - load it in with AJAX. Working with significant amounts of text within C2 is a pretty miserable experience.

    >

    Sprite font plus works just like sprite font.

    I'm on my way to bed but I'll check out your example when I wake up.

    I would second having some external means to store text, so you can pull it dynamically based on scenario/object/etc.

  • dropbox.com/s/av6kbtg32idgj7u/typewriterprogression.capx

    While I don't know how spritefont+ works, this should give you an idea for how to continue.

    I highly recommend using a project file to handle your text like I have done - load it in with AJAX. Working with significant amounts of text within C2 is a pretty miserable experience.

    Do you have this in stable release format? I've run into so many issues using Beta builds versions of C2 that I like to stick with Stable builds. Sorry for the inconvenience.

  • I think there is actually a typewriter example that comes with Construct as a template (if not I found it as a tutorial, or I could share later).

    I would start with that and then speed it up if button pressed/is down.

    Basic process is just a txtSource (offscreen) and txtDestination. Start of function will place your desired text in txtSource and every tick will update txtDestination with another letter. I think it was

    Every Tick

    -txtDestination = txtSource.length(txtDestination+1)

    Could have change it to an if else scenario with +2 as the faster one

  • https://www.dropbox.com/s/a9vurmgzjurgx ... e.PNG?dl=0

    There are several ways to handle the text - I've used a simple .txt file with line breaks, and the tokenat expression with newline to break them up. You can use XML as well, or even a spreadsheet .csv and import it into an array.

    Also this one instantly completes the current line when hitting space, but let me know if you have trouble modifying it to speed up the rate of display.

    EDIT: Here is the one for speeding up - https://www.dropbox.com/s/941g2c2dkjujc ... 2.PNG?dl=0

  • dropbox.com/s/a9vurmgzjurgxt9/textexample.PNG

    There are several ways to handle the text - I've used a simple .txt file with line breaks, and the tokenat expression with newline to break them up. You can use XML as well, or even a spreadsheet .csv and import it into an array.

    Also this one instantly completes the current line when hitting space, but let me know if you have trouble modifying it to speed up the rate of display.

    EDIT: Here is the one for speeding up - https://www.dropbox.com/s/941g2c2dkjujc ... 2.PNG?dl=0

    Your edit was perfect! Exactly what I've been trying to figure out! Thanks a million!

  • Final question here: for "tokenat" can I specify which line it's going to?

  • The second argument in the tokenat() expression specifies which line. In my example I used "CurrentText", which is a global variable (number) that increments by one every time a new line is set. You can change that to whatever number you want.

  • Okay for some reason now that I've got this the way I want, I tried experimenting using SpriteFont+. It worked in the original example as I said, but it's no longer working with this method.

    It should be noted that any self respecting RPG game designer would never use system fonts but instead opt for a more custom font. Could you possibly show an example of this working in SpriteFont+ at all?

  • Okay, it works with regular SpriteFont but not with SF+? They have the exact same options and operators etc...?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I was going to say, just replace all DestText.Text with SpriteFont.Text (and DestText object's actions with SpriteFont object's actions) and it should work fine, but again, I'm not familiar with SF+, sorry.

    Can you describe exactly what part isn't working and maybe I can think of a workaround? Is the text not showing up at all? Do the inputs not work? Can you screenshot your events?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)