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

Non-platform specific questions.

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

Postby MrScience101 » Sat Dec 22, 2007 7:10 pm

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
Attachments
ss.zip
ss.zip
(95.88 KiB) Downloaded 101 times
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

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

Postby summer_goth » Sun Dec 23, 2007 8:59 am

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.
User avatar
summer_goth
 
Posts: 153
Joined: Fri Jun 22, 2007 8:07 am
Location: South Africa
Score: 5 Give a positive score

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

Postby Fuzzy » Wed Dec 26, 2007 11:58 am

Global code doesnt get executed. You need to refer to those functions from within an actor.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

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

Postby MrScience101 » Wed Dec 26, 2007 3:37 pm

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....
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

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

Postby speckford123 » Wed Dec 26, 2007 3:49 pm

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
}
speckford123
 
Posts: 334
Joined: Fri May 05, 2006 6:33 pm
Score: 49 Give a positive score

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

Postby Sgt. Sparky » Wed Dec 26, 2007 6:10 pm

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

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

Postby MrScience101 » Wed Dec 26, 2007 9:52 pm

Sgt. Sparky, your my hero!

-MrScience101
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron