Page 1 of 1

A bug? Or am I just stupid? Perhaps...

PostPosted: Sat Dec 22, 2007 7:10 pm
by MrScience101
There are four dots. After the sequence is done playing, the user is supposed to click the dots in the same sequence/order that the dots appeared in. I am trying to write a global function that updates the progress text number everytime a dot is clicked on. If I update the text number in the local funtion, it updates just fine. If I then create a global function that contains the same line of code, the textNumber is no longer updated.

In the attached example you can click on the green, red, and yellow dots and see that the progress.textNumber is updated on the screen. When you click on the blue dot you can see that when the global function: check() is called, which contains the same progress.textNumber++ line as the local function, the progress.textNumber is not updated on the screen. Why is it that when progress.textNumber is updated locally by the actor, it updates on the screen, but when progress.textNumber is updated by a global function, the screen is no longer updated?

Very Respectfully,
MrScience101

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Sun Dec 23, 2007 8:59 am
by summer_goth
Nope, you are not stupid. :wink:

Unfortunately it's not possible to change the text of actors from the global code. I think it's all internal actor variables that can't be changed from the global code. For instance the colour of actors can't be changed from the global code either.

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Wed Dec 26, 2007 11:58 am
by Fuzzy
Global code doesnt get executed. You need to refer to those functions from within an actor.

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Wed Dec 26, 2007 3:37 pm
by MrScience101
I am not yet convinced though you are probably correct :oops:
I have a global function called Update, in fact here is an example:
Update()
{
score.textNumber++;
}

This update function is placed in the script editor mouse down event on an actor, for instance the blue dot. When the user presses the blue dot the script editor then calls the update function:
Update();

This in fact does update the score.textNumber, but the updated number does not display. I need a function that forces the screen to update. Because while the score does indeed update and increment, the update is not accounted for by the graphics. Lol, I suppose my explination is as clear as mud? :? Well thank you for the responses, I think what summer_goth may be right, but I hope not....

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Wed Dec 26, 2007 3:49 pm
by speckford123
MrScience101 wrote:I think what summer_goth may be right, but I hope not....


yeah i think thats true too, but the other part was you can affect internal variables right?
do this, create an internal variable called textN or anything you want and try this for global,

Update()
{
textN=textN+1; // or use textN++;
textNumber=textN; // if this doesnt work here i guess it will need to go on the actor directly
}

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Wed Dec 26, 2007 6:10 pm
by Sgt. Sparky
MrScience101 wrote:There are four dots. After the sequence is done playing, the user is supposed to click the dots in the same sequence/order that the dots appeared in. I am trying to write a global function that updates the progress text number everytime a dot is clicked on. If I update the text number in the local funtion, it updates just fine. If I then create a global function that contains the same line of code, the textNumber is no longer updated.

In the attached example you can click on the green, red, and yellow dots and see that the progress.textNumber is updated on the screen. When you click on the blue dot you can see that when the global function: check() is called, which contains the same progress.textNumber++ line as the local function, the progress.textNumber is not updated on the screen. Why is it that when progress.textNumber is updated locally by the actor, it updates on the screen, but when progress.textNumber is updated by a global function, the screen is no longer updated?

Very Respectfully,
MrScience101

I made a game called Beat Master where you do this same thing. (Only completely different code.)
once I get home I will send you some code that should help. :D

Re: A bug? Or am I just stupid? Perhaps...

PostPosted: Wed Dec 26, 2007 9:52 pm
by MrScience101
Sgt. Sparky, your my hero!

-MrScience101