See if a function is running?

Get help using Construct 2

Post » Thu Feb 20, 2014 1:02 pm

Is there a way to check if a function is running, and if so to wait before calling it again? I'm having this problem where I call the same function two times. The way it happens:

If skill >= skillnext call function "level"

On function "damage", deal damage variable to enemy, then distribute points for "hits" and "misses" to the skill being used, call function "display text" "you deal 6 points of damage"

On function "level", call function "display text" "your unarmed has gone up, it is now 3"


Here, you see the second line calls text to display, as does the third, but the third you don't see until you level, but when you do you get the "damage" text and the "level" text in teh same sprite box. I'll send my CAPX to anyone willing to tackle the problem. Please be serious.
B
25
S
6
G
6
Posts: 265
Reputation: 3,696

Post » Thu Feb 20, 2014 1:14 pm

You want to display in the same object 2 texts at the same time, so the last you call is displayed and hides the previous call.

The function "display text" could be instead "queue text", a function that adds the text to an array of "buffered text". Another function would be called on regular intervals, and would check if the array is empty or not. If not, it would select the first text from it (remove it from the array too), and display it.
This is a simple log system...
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Thu Feb 20, 2014 1:31 pm

didn't you see the updated capx in the other post ? No wait, no overwrite, call multiple times in same tick...

https://dl.dropboxusercontent.com/u/143 ... ffset.capx
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Thu Feb 20, 2014 2:18 pm

Okay I think the example you gave on the other post wasn't the CAPX so I didn't really know what to do, they both loaded in the browser as HTML files. I did take your suggestion though, I just suck at understanding these things. lol
B
25
S
6
G
6
Posts: 265
Reputation: 3,696


Return to How do I....?

Who is online

Users browsing this forum: David181, shawnzien and 10 guests