Label flash

Started by Slasher, Tue 06/11/2012 09:31:26

Previous topic - Next topic

Slasher

Hi

The 'SHOP' (gui) I am constructing has all the maths working correctly and I now have a small issue to clear up.

I have the label LElfers which displays The Int Elfers.

I have it stop at 10 yet it flashes a number (number can vary depending on product) very briefly before displaying 10.

Here's the bit of code for that part (Rep Exe Always):

Code: AGS
if (Elfers >=  10)
 {
   Elfers= 10;


If you can assist I thank you





Khris

Are you setting the label's text before or after that?
Because if you're setting it before that code, it'll show the higher value for one frame.

Slasher

Hi Khris

I see what you mean, it's being updated before the condition!

I have it declared:

Code: AGS

Lelfers.Text = String.Format("%d", Elfers);


Then:

The Elfers label changes when an item is brought or cancelled but should never go over 10.
Code: AGS
 
// STOP COUNT IF OVER 10
 } 
 if (Elfers >=  10)
 {
   Elfers= 10;
 }  



Also never under 0.

Code: AGS
 
 } 
 if (Elfers <=  0)
 {
  Elfers= 0;
 }


I do have a couple of minor issues if you have the time to help Khris?

Thank you

slasher



Khris

In case that wasn't entirely clear, what you're supposed to do is move the label update below the checks so the label is only ever updated with the correct value.

If you have other issues, just post them here, in case you were thinking of sending me a PM. I'm currently at work and I'm sure others can help you just as well as I.

Slasher


SMF spam blocked by CleanTalk