Notification Box displaying old information

Get help using Construct 2

Post » Sun Aug 04, 2013 5:21 am

My notification box is controlled by two functions: a spawn function and a destroy function. The way the box works is: when a notification needs to be sent, the box appears and moves halfway across the screen. After the user touches the screen, the box moves to the right and is then destroyed.

The events look like the following:



There are two instances where the notification box is called:





The group names are relatively self-explanatory: the notification box appears before the player is allowed to spawn, and before the computer spawns.

You can run the program yourself to see how it works. Basically the problem is, the notification box text doesn't change like it's supposed to when the computer is spawning (it still displays the instructions for player spawning).

BoardGame.capx

My current theory is that DestroyNotification() is not being called at all, but I'm unsure how to test for that.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sun Aug 04, 2013 6:07 am

I've tossed in a few major actions to see if the DestroyNotification function is firing, and indeed it is.

I wonder if this is a bug. I've done multiple searches through my events to find problem areas but so far the instances in the screenshots above are the only places where txtNotification is modified.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sun Aug 04, 2013 6:55 am

I've made some modifications, but now the issue I'm having is, after EndNotification() is called, the return value doesn't appear to be returning.

I have a debug active in the program that displays Function.ReturnValue every tick, but it never changes from 0 to 1.



In particular, this function that is supposed to be called upon being given the return value is actually never called.

Excal2013-08-04 07:00:50
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sun Aug 04, 2013 8:08 am

I've decided this function.returnvalue thing just isn't going to work. I've implemented a workaround.

The original issue (the point of this thread) is still present: the second time the notification box appears, it displays the first message instead of the second. I've done a debug test and the second message is correctly being passed into the function, but for some odd reason, the first message overrides the second.

The three images in the first post of this thread depict every instance of when txtNotification is modified. I'm starting to wonder if this is a C2 bug because I cannot find anywhere in the game logic where the text is being overriden by the text passed in the first function call.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224

Post » Sun Aug 04, 2013 8:23 am

You seem to be abusing the Function.ReturnValue. You are using it as a global variable, to control your state, but that value is going to change every time a function is called, whether it returns a value or not. You should only be checking the return value immediately after a function call, and holding any state that you need to for later.
ImageImageImage
B
71
S
19
G
179
Posts: 3,478
Reputation: 102,677

Post » Sun Aug 04, 2013 8:35 am

Only one function is called at a time in my program :)

My intention is to check for when the notification box is done.

EDIT: If a function does not have a specified return value, by 'default' the return value is 0, so this is not the issue since I'm checking for 1.Excal2013-08-04 09:00:33
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,224


Return to How do I....?

Who is online

Users browsing this forum: AllanR, Artpunk, oosyrag, QuantumMMX and 8 guests