[solved]How do I load plaintext text into a text object?

0 favourites
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • How do I load plaintext text into a text object?

    I seriously have no idea, and search comes up with no mention. It's a largeish text.

    Thank you

  • Bump.

    Pretty Please?

  • When you click on the text box there is a menu on the left side, scroll down to properties and change the text in there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am guessing that you want to load the text from an external file, like txt document..? If yes, I would also like to know.

  • eli0s Exactly. That's what I wanted to know. Use Json or something? How would that work? What's the simplest way, and fastest?

    On set text, my project lag CONSIDERABLY on the ipad and iphone 5S. I can't have that. It drops to 5 FPS, from a constant +60

    So I was considering not using "set text" or "append" but to load it from an external file.

    jakepugh15 I meant through code, on runtime, not via project. Sorry I wasn't clear.

  • damjancd , although I don't know if json is the way to do it (I believe you're right though), I suspect that the Text object is responsible for the low frame rates on your tablet and phone.

    Have you tried the Spritefont object instead? It's supposedly much faster than the regular Text object.

  • External files can be loaded via AJAX and Project Files. First import your file (right click on the "Files" folder -> Import files). Then use AJAX to request a project file, select your file, and with the "On completed" AJAX trigger, set your text object to AJAX.LastData

  • Magistross, THANK YOU. I will check this out immediately.

    I can't use sprite font since I have a lot of text formatting, I use verdana and I there is letter specific kerning there. I sure hope AJAX works faster on tablets.

  • Magistross It's working and fuckyeah and thankyou and fuckyeah. Even if the text object is still slow on cocoonJS, this is a superior way to load text for me. May you find 500 000 dollars on the ground, randomly, today.

  • Magistross , I thank you also for your instructions

    I would like to stretch the topic a bit and ask you something else too:

    Is there a way to stream separate lines of text (or paragraphs) from the same txt file? You know, for building dialog systems or create cut-scenes that each "balloon" has its own paragraph of text. I am sure that having multiple txt files loaded with AJAX for each line is not the way to do dialogs...

  • damjancd No prob mate, just spreading the knowledge !

    eli0s You might want to take a look at XML. Using a simple XML document you could probably achieve a fully functionnal dialog system. Although you could do it with tokens, it's definitely not the most effective way. The method would be quite similar, Request Project File -> Your XML file. On completed -> Load XML using Ajax.LastData. Then using an easy XPath syntax you can fetch your nodes.

  • eli0s, I would also love to find out the answer to your question

  • I will concoct an example for both of you guys. Stay tuned !

  • Magistross , thank you in advance for your help!

  • This tutorial covers the basics about that..

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