Here is some of my sample code for a door:
Code: ags
These of course, appear in order as you click on the door, but this just seems so.... clunky. I'm going to have to create this type of script every time I want to create a list of ordered things that happen in any interaction. I tried to declare the variable as static inside the function but that didn't work, so I settled for a global.
Is there any way to have the string descriptions inside an XML file, or maybe inside the properties of the hotspot, like in the property schema?
On a similar note, I wanted to create a function like this:
Code: ags
But I don't think it's possible to get an array length without passing it manually, and I'm not sure if it's even possible to pass an array in a function parameter.
I tried looking through the FAQ, wiki, and tried running some searches, but I couldn't really dig up anything about this.
Thanks,
Mumford
int m = 0;
function hDoor_Interact()
{
if(m == 0) Display("You shove at the door in a manly way. It laughs at your muscles.");
if(m == 1) Display("Undeterred, you begin to pound on the door like a dozen madmen.");
if(m == 2) Display("Because of your unwavering determination and singleminded concentration, the door..... remains shut.");
m++;
if(m == 3) m = 0;
}
These of course, appear in order as you click on the door, but this just seems so.... clunky. I'm going to have to create this type of script every time I want to create a list of ordered things that happen in any interaction. I tried to declare the variable as static inside the function but that didn't work, so I settled for a global.
Is there any way to have the string descriptions inside an XML file, or maybe inside the properties of the hotspot, like in the property schema?
On a similar note, I wanted to create a function like this:
function ShowRandomLine( param string[] arrText )
{
int x = Random(arrText.Length - 1);
Display( arrText[x] );
}
But I don't think it's possible to get an array length without passing it manually, and I'm not sure if it's even possible to pass an array in a function parameter.
I tried looking through the FAQ, wiki, and tried running some searches, but I couldn't really dig up anything about this.
Thanks,
Mumford