Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: wotmeworry on Thu 15/01/2009 03:30:42

Title: Need help with DoOnceOnly
Post by: wotmeworry on Thu 15/01/2009 03:30:42
Well, I want my guy to look under a rug and find a ruler. But of course, I don't want him to say, "oh look a ruler" every time he looks under the rug. One problem, I'm a total moron  :P. I need help with using the DoOnceOnly script command thingy. YES IV'E READ THE TUTORIAL! But big words scare me and I don't understand it ???. PLEASE HELP! :'(
Title: Re: Need help with DoOnceOnly
Post by: Gilbert on Thu 15/01/2009 05:14:07
Quote from: wotmeworry on Thu 15/01/2009 03:30:42
YES IV'E READ THE TUTORIAL! But big words scare me and I don't understand it ???. PLEASE HELP! :'(

Well, big words scare us too. If you really want help, it's always okay to ask, but please don't yell in CAPS. It's a bit impolite. :P

To use the DoOnce() function, you just think of a text string you like which relates to the action you want.

In your case, you can do something like this in the 'look at rug' action:

if (Game.DoOnceOnly("found ruler")) Display("Oh look! A ruler!");
  else Display("I have looked under the rug before.");

In this way, when you looked under the rug for the first time the first Display() line is used, whereas when you looked under the rug for the second, third, ... times the Display() line in the 'else' part is used.
Title: Re: Need help with DoOnceOnly
Post by: wotmeworry on Thu 15/01/2009 05:28:45
thanks for your help ;D. However, I love caps. I just can't change. SORRY! :P