Got some problems with animating objects. I have a closet door and when I interact with it opens but when I click again it start the animation again.
I need to open a closet then close it when I click again
Just use a variable, e.g.:
if (doorisopen == 0) {
// Door opening animation
doorisopen = 1;
}
else if (doorisopen == 1) {
// Door closinging animation
doorisopen = 0;
}
(BFAQ entry on variables (http://bfaq.xylot.com/#coding01), if you're not sure how they work.) You could also use Get/SetGlobalInt().
What do I need to put in 'doorisopen' It tells me its undefined.
(i'm still beginner)
You have to put
int doorisopen;
in the very beginning of room script. (It has to be outside the door opening function)
Did you not read the BFAQ entry Ashen linked?
This page (http://www.adventuregamestudio.co.uk/actutor.htm) (scroll down to the bit about variables) might be a bit clearer. The short version is (as Pablo said):
Open up the Room Script for the room the door is in (Ctrl-E, or the '{}' button on the 'Settings' tab.)
At the top of the script, outside of any functions, put int doorisopen;
As I said you can use GetGlobalInt() and SetGlobalInt() instead. (Look them up in the manual for more details - they're built-in variables you can use instead of creating your own.) Take the chance to read through the BFAQ, though, as well as the other tutorial I linked.
Quote from: Pablo on Mon 14/11/2005 14:49:18
You have to put
int doorisopen;
in the very beginning of room script. (It has to be outside the door opening function)
Did you not read the BFAQ entry Ashen linked?
yes I just read but à  never worked with variables before. Just trying to get the hang of it.
QuoteAs I said you can use........as well as the other tutorial I linked.
thanks, I shall read more about the variables