Help With a Text Box

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hey guys!

    I've been learning to use Construct 2 for the last couple of months and really enjoyed my time with the software. I'm currently going through Jerementor's absolutely wonderful "Platform Mini-Series" tutorial on Scirra's YouTube channel. His way of making a text box with AJAX and XML looks really neat, but the problem is... I can't get it to work.

    The way it should work is this. When player is overlapping a sign, an invisible layer with a text box is made visible. The text box slowly fills with text from an XML file. I can get the box to appear, but not the actual text. I'm currently still using the free version of C2, but I don't think that should have an effect here.

    I've gone through my code line by line until I just gave up and made a testing project with the relevant parts copied straight from Jerementor's example capx, and I still have the problem. If anyone could nudge me towards the solution, I'd be really grateful! Even a hint would be appreciated, as right now I'm feeling quite frustrated with this. Thanks!

    Since this is my first post on the forum, I can't post any links. You can still download my capx from Dropbox or check out the event sheet (it's quite short) on imgur, you just have to fill the latter part of the address line yourself.

    To get the capx, go to Dropbox and then add this to the address line: /s/1nyuadxf2knhvf9/Textbox_test.capx?dl=0

    Or to see event sheet, go to Imgur and add this: /lngNzcw

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I dont understand the logic in your cap.

    On overlap you make the AJAX plugin request a file. But you never wait for the file to end loading. Yeah in the code you do. But in reality, the overlap keeps happening, the instance variable will not change, so the request to load the file will happen again and again before the file is loaded. The event 'on instructions loaded' will never ever trigger.

    This happens because you did not follow the tutorial. Read it all over here: https://www.scirra.com/tutorials/807/ho ... -game-talk

    The basics are simple though.

    1/ Let the AJAX plugin request the file only once in the whole project. Preferable 'on start of layout'.

    2 / Wait for the file to complete loading, only once in the whole project . Preferable in a root event. Assign the data to the XML plugin.

    Now you can ask the XML plugin questions, and it wil answer. It wil keep the data till you change them. No need to asign them over and over again.

  • I realised later the xml is really small. And that it did not load even when not colliding.

    So there had to be something more beeing wrong. I checked your xml, it is not formatted right.

    Here as it should be:

    https://

    drive.google.com/open?id=0B1SSuCVV8v74NTh6b2EwWUhKejA

    Still, my previuous comments are still valid.

  • Hey 99Instances2Go, thank you so much! I got it the basic idea to work by using your fixed xml and following the tutorial you linked.

    As I said, the capx I posted is pretty much a straight copy of a video tutorial found on the Scirra YouTube channel. This is the first time I've tried to use XML in C2, so I wasn't sure at all if it was weird or not. The bad formatting of the XML file was of course just my mistake. Thanks again for putting me on the right path with this.

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