Label text display enigma

Started by steptoe, Mon 24/10/2011 09:54:31

Previous topic - Next topic

steptoe

Hi

For some strange reason if I click the Bgenie button (on gstastusline) a second time in the same room it starts with displaying the second Lgenie.Text first.

The gstastusline is visible if a condition is previously met and starts game as initailly off.

Code: ags

function Bgenie_OnClick(GUIControl *control, MouseButton button)

{  if (gStatusline.Visible==true  && player.Room==9) {
 
  gGeniepic.Visible=true;
  gGeniepic.Transparency=0;
  Buttong.Height=30;
  Buttong.Animate(12, 0, 1, eOnce);

  Wait(80);
  Buttong.Animate(17, 0, 4, eRepeat);
  Lgenie.Text="Sinbad. My powers have no effect on this part of the island. Kazima has cast some sort of dark spell.";
  Wait(200);
  Lgenie.Text="However, I can still help you. You need to make something to throw and kill the Cyclops. [That is all I can tell you Sinbad.";
  Wait(200);
 
  Buttong.Animate(18, 0, 0, eRepeat);
  gGeniepic.Transparency=60;
  Wait(40);
  gGeniepic.Transparency=80;
  Wait(40);
  gGeniepic.Transparency=100;
  Wait(10);
  gGeniepic.Visible=false;



}  else if (gStatusline.Visible==true && player.Room==11) {

 gGeniepic.Visible=true;
 gGeniepic.Transparency=0;
 Buttong.Height=30;
  Buttong.Animate(12, 0, 1, eOnce);

 Wait(80);
 Buttong.Animate(17, 0, 4, eRepeat);
  Lgenie.Text="Sinbad.Trap the harpys from ahigh. That is all I can tell you.";
 Wait(240);
  Buttong.Animate(18, 0, 0, eRepeat);
 gGeniepic.Transparency=60;
 Wait(40);
 gGeniepic.Transparency=80;
 Wait(40);
 gGeniepic.Transparency=100;
 Wait(10);
 gGeniepic.Visible=false;
	
	
// and other if else functions




Please tell me if you spot something that needs changing unless I do all Lgenie.Text on one line only?

All help appreciated.

cheers

steptoe




Gilbert

I haven't read all the codes, but that's possibly because you didn't clear the text after the event ended (Note: Turning a GUI off will NOT erase the label's text, the text is still there when you turn the GUI on again). Text on a label will persist until you change it. Either have a:
Code: ags
Lgenie.Text="";

when the event ends and you no longer need it, or put this at the beginning of the event, so the text is cleared before you Wait() some loops and change it to something else.

steptoe

#2
Of course... silly me... thanks  ;)

I'll stick that in between any 2 Lgenie.Texts as well.

cheers

SMF spam blocked by CleanTalk