text object doesn't re-populate upon restart of la

Get help using Construct 2

Post » Tue Sep 17, 2013 7:01 pm

I have a small issue with the game I'm working on. There are three layouts, the first upon startup loads a project text file via AJAX and loads the text into a Text object. Press a key, goes to the next layout. The player dies, it goes to the third layout (GAME OVER) and if the player presses R it should go back to the very first layout. Upon eturn to that first layout, it doesn't seem to get the text from the porject file and put it into the text object...

Any ideas?
B
14
S
6
G
1
Posts: 143
Reputation: 1,800

Post » Tue Sep 17, 2013 9:55 pm

Since I haven't received any answers I've posted screen shots of the two event sheets in question...

https://dl.dropboxusercontent.com/u/108572298/introLayoout.png
https://dl.dropboxusercontent.com/u/108572298/gameoverLayout.png
B
14
S
6
G
1
Posts: 143
Reputation: 1,800

Post » Wed Sep 18, 2013 6:02 am

Remember, the first time through it works, the next time through it does not. It's not covered in the manual, nor could I find a tutorial specific to this issue.

I don't think it's a logic thing because if it were, it would most likely not work the first time. Granted, I don't really need to do this via a file (an embedded project file) and the AJAX object, but I thought it'd be an interesting exercise.

Can anyone offer a suggestion as to why it works once, and only once unless I completey reload the browser?

1st layout - loads the project text file via AJAX displays it into the text object. Got to level 2, play the game. In the event the character dies, go to layout 3. Press R to restart, go to 1st layout, project file does not get loaded, and no error reported by the AJAx object.
B
14
S
6
G
1
Posts: 143
Reputation: 1,800

Post » Wed Sep 18, 2013 7:56 am

So, the second time through it isn't pulling the data from the intro.txt file, correct?

Would that info change? If not, would it be possible to load that info once and store it in a global variable for use later?

Or is this just more of a, why isn't this working?
B
101
S
32
G
12
Posts: 1,549
Reputation: 21,993

Post » Wed Sep 18, 2013 2:35 pm

It's more of a why isn't it working. I could do 1 of three things to display the text I need, but I really would've thought the AJAX call should work at the layout start when that layout starts.

Option 1: populate the text object and leave it static (currently I re-use the text object for some other textual elements to try and make it more efficient) or a global variable I suppose, I could just hard code the text in the event sheet (not a fan of this idea with quotes and newlines breaking it up in the dialog for entering text via the event sheet and if it needs to be edited) and option 3 would be on the game restart don't go to the first layout at all since it's the intro layout, but I know who'll be playing this game (friends & family) and they'll need the intro re-fresher... :)

So there's a few options I could take, but it's just befuddling me that it's not working. It's not all that complicated if you looked at the screen shots posted above...
B
14
S
6
G
1
Posts: 143
Reputation: 1,800

Post » Wed Sep 18, 2013 2:50 pm

Looking at the code I can't think of any reason it's not working either. I haven't played with AJAX very much, but this looks like a bug to me.
B
101
S
32
G
12
Posts: 1,549
Reputation: 21,993

Post » Tue Sep 24, 2013 5:52 am

I wanted to second that I'm also having this error. AJAX requests don't appear to fire on layout restart. Saving it to another file as a workaround for now until fixed (also still on r141 given all the bugs/performance issues with latest releases, possible it was fixed in a later release).
B
9
S
3
Posts: 58
Reputation: 1,566


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests