I have little problem with this my_counter.
I have placed top of my room script int my_counter; and I have placed this to one of the hotspots:
if (my_counter == 0) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx");
}
if (my_counter == 1) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx");
}
if (my_counter == 2) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx"
}
if (my_counter <2) {
my_counter ++;
}
It works fine, but I want to make more of these in same room. How can I do that? I tried to look at he manual, but didn't find.
Thanks
since you want them global to the room you can just make more variables to use... if you want to just have one variable, you can make it an array
int my_counter[x]; //Where x is the number of vars you need
Then access them by
if (my_counter[0]<1)
EDIT stupid Yabb code didn't like me using braces :(
I'm not exactly sure what you mean by 'I don't want to make more of these in the same room.' Do you want to use that script for multiple hotspots. If so you can make it a function. Put in the room script, after defining variables:
function x(){
if (my_counter == 0) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx");
}
else if (my_counter == 1) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx");
}
else if (my_counter == 2) {
DisplaySpeech(EGO,"xxxxxxxxxxxxxx");
}
if (my_counter <2) {
my_counter ++;
}
}
whenever you want to use it in a script, put x(); or whatever you made the function name. I also added else if's in there to make it neater. It doesn't make much difference but it's more efficient if the computer doesn't have to check each statement everytime...whatever, it doesn't really matter.
Hopefully this will help.
Or, just make more variables:
int my_counter;
int my_counter2;
int my_counter3;
... and so on, as many as you need. Or give them names that reflect the hotspot they're related to.
Edit: This may be exactly what Alynn said. Sorry.
It is working now like I wanted it to work :)
Thanks for help!!! ;D