Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Albino-I on Fri 25/11/2005 19:50:39

Title: SCRIPTING: If hostpot has been interacted before? (SOLVED!)
Post by: Albino-I on Fri 25/11/2005 19:50:39
I need some help with my script.

I want the script to display some text and do some other interactions IF the hotspot hasn't been interacted with before. But if the hotspot has been interacted with, the same actions won't happen again. What kind of script should I use?
Title: Re: SCRIPTING: If hostpot has been interacted before?
Post by: Ishmael on Fri 25/11/2005 21:58:47
Put into the beginning of the room script:

int var;

Then into the interaction script something like:

  if (var == 0) {
    //first interaction, scripts here
    var++;
  } else {
    //second and following interactions
  }
Title: Re: SCRIPTING: If hostpot has been interacted before?
Post by: Albino-I on Fri 25/11/2005 22:21:49
Umm.. this might sound dumb, but what do you mean by this 'var'? Yes, I am new to this.

Could you be more precise with your instructions please? Step to step?
Title: Re: SCRIPTING: If hostpot has been interacted before?
Post by: Ashen on Fri 25/11/2005 22:30:22
That pretty much is step by step. What Ishmael means is, you have to use variables. var is just the example name he's has given the variable - it could just as easily been hasbeenclicked or interacted or anything - the important bit is the int in the first line, and the if / else parts.

For more details on using variables, read the BFAQ (http://bfaq.xylot.com/#coding01), or read the AGS Tutorial (http://www.adventuregamestudio.co.uk/actutor.htm) (scroll about half way down the page for variables).
Title: Re: SCRIPTING: If hostpot has been interacted before?
Post by: Albino-I on Fri 25/11/2005 22:42:57
Yeah I just noticed my own stupidity.

Reading the scripting tutorial helped me understand couple of small things. My main problem was that I didn't know where to put the 'int variable' script (I was trying to put it under the 'first time player enters the screen' tag).

Thanks for all your help. I finally uderstand the use of variables now too  :)