Some Int key clicks take 2 clicks and not 1 SOLVED but new question about it

Started by steptoe, Tue 07/02/2012 05:57:17

Previous topic - Next topic

steptoe

Hi

EDIT: I just spotted duplicate entries, now corrected in below script.

New question: After click 6 can the clicks begin again from 1 as if able to keep running through at will?


======================================================

I have the following script that works, trouble is some take 2 clicks for the next lable to appear and not 1.

Code: ags


function Button24_OnClick(GUIControl *control, MouseButton button)
{
  key_clicks++;
    
 if (key_clicks == 1)
 {
  Lsplash.Text="1500BC. In the known world a Tibetan holy secret society held 6 sacred tablets of enlightenment given by the God of hope. Each sacred tablet has the power to bring peace and health to mankind through spiritual and astral projections.[[They could not be used to hurt mankind directly but in wrong hands could open portals to other dimensions and therefore bring fouth demons of unspeakable hell!";
  Button24.Text=">";
}
 else if (key_clicks == 2)
 {
   Lsplash.Text="";
   Lsplash.Text="Wang the Merciless, the most feared Mongol leader, was said to be seeking out the 6 sacred tablets to obtain supreme and utter power![[Mandrin, a Tibetan secret society holy High Priest, knew that the great war leader Wang the Merciless would seek out the 6 sacred tablets. This could never happen!!"; 
   Button24.Text=">";
}
 
 else if (key_clicks ==3)
 {
   Lsplash.Text="";
   Lsplash.Text="Because of such threat, Mandrin decided to seperate the sacred tablets and have each one transported to an unknown location.[[So secret were the locations that nobody knew where they were taken to. Those that had transported the sacred tablets were killed for secrecy!";
   Button24.Text=">";
}
 
 else if (key_clicks ==4)
 {
   Lsplash.Text="";
   Lsplash.Text="2012AD. The secret society of holy order had a last gathered enough information as to the approximate whereabouts of each sacred tablet. It was time to 'Bring them home'.[[They needed someone of the holy order to go and find the exact locations and return with all the sacred tablets.";
   Button24.Text=">";
  }
 else if (key_clicks ==5)
 {
   Lsplash.Text="";
   Lsplash.Text="They chose someone with much courage and strength. They have chosen you, Jonesy Smith.[[An airplane has been charted for your use and after a briefing you set off immediately to your plane anticipating your journeys ahead.";
   Button24.Text=">";
   }
 else if (key_clicks ==6)
 {
    Button24.Visible=false;
    Lsplash.Text="";
    Wait(100);
    gsplash.Visible=false; // Shows Room 1
   }
}


Cheers for all help



It's not over until the fat lady sings..

Khris

What are you doing in there...?
Why set Lsplash to "" if you're changing it again in the very next line? When will you learn not to do stuff like that?

Code: ags
function Button24_OnClick(GUIControl *control, MouseButton button)
{
  key_clicks++;
  
  if (key_clicks == 1) Lsplash.Text = String.Format("%s %s %s %s",
    "1500BC. In the known world a Tibetan holy secret society held 6 sacred tablets of enlightenment given",
    "by the God of hope. Each sacred tablet has the power to bring peace and health to mankind through",
    "spiritual and astral projections.[[They could not be used to hurt mankind directly but in wrong hands",
    "could open portals to other dimensions and therefore bring fouth demons of unspeakable hell!");

  if (key_clicks == 2) Lsplash.Text = String.Format("%s %s %s",
    "Wang the Merciless, the most feared Mongol leader, was said to be seeking out the 6 sacred tablets to",
    "obtain supreme and utter power![[Mandrin, a Tibetan secret society holy High Priest, knew that the great",
    "war leader Wang the Merciless would seek out the 6 sacred tablets. This could never happen!!");
    
  if (key_clicks == 3) Lsplash.Text = String.Format("%s %s %s",
    "Because of such threat, Mandrin decided to seperate the sacred tablets and have each one transported to",
    "an unknown location.[[So secret were the locations that nobody knew where they were taken to. Those",
    "that had transported the sacred tablets were killed for secrecy!");
    
  if (key_clicks == 4) Lsplash.Text = String.Format("%s %s %s",
    "2012AD. The secret society of holy order had a last gathered enough information as to the approximate",
    "whereabouts of each sacred tablet. It was time to 'Bring them home'.[[They needed someone of the holy",
    "order to go and find the exact locations and return with all the sacred tablets.");
    
  if (key_clicks == 5) Lsplash.Text = String.Format("%s %s %s",
    "They chose someone with much courage and strength. They have chosen you, Jonesy Smith.[[An airplane",
    "has been charted for your use and after a briefing you set off immediately to your plane anticipating",
    "your journeys ahead.");

  if (key_clicks == 6) {
    key_clicks = 0;
    Button24_OnClick(Button24, eMouseLeft);
  }
}

steptoe

Hi Khris

It's the way I have done it in the past but shall adopt the way you have put it in the future. Thanks.

I will incorporate your script method.

Also its actually Button 15

The only thing is is that the button should change from 'Intro' to '>>' (Different custom buttons) Button15.Graphic=898 to  Button15.NormalGraphic=898 when button is clicked.

cheers for your help

steptoe


It's not over until the fat lady sings..

Khris

Quote from: steptoe on Tue 07/02/2012 10:53:52It's the way I have done it in the past

The point is, why?
What made you think that it is necessary to "clear" the variable before storing something else in there? You must have gotten this from somewhere.

I urge you to get a grip of basic programming &/ logic before continuing to churn out another game that people won't really care about.
Sorry, but that's how I see it.

steptoe

Khris

There was a case once when an old label text appeared before new label text showed, that is why "" between. And Yes, I was informed to do this.

Logic told me to use custom buttons with AGS text and amending button text to previous  query.

As much as I appreciate your help and comments I will ignore your snide remarks as another bad day at the office  ;)


It's not over until the fat lady sings..

Khris

Yes, if time passes in between setting it to "" and new text, it does make sense.
Here it's a fraction of a millisecond though and most importantly, the screen isn't redrawn in between.

As for my "snide remark", you're free to ignore it, of course.
In general though, making those isn't some weird hobby of mine, it's supposed to make a useful point.
Believe it or not, it was intended to ultimately get your games more recognition in the forums.

steptoe

Hi Khris

I do thank you for your comments and look upon you as a great help and have learnt a lot from you over the months and of course today.

I find things easier now although I'm still going through the motions of gaining experience every day such as Variable bools and ints to which I have used exclusively in my latest project and thank god for them I say.

I hope you will still assist me in my quest to 'get it right'.

The word is mightier than the sword and can be twice as cutting.

End of topic I think  ;)

steptoe




It's not over until the fat lady sings..

SMF spam blocked by CleanTalk