Jump to content

Home

Need Script help using GetGlobalNumber to section up a script


T7nowhere

Recommended Posts

What I'm trying to do is add conditions to parts of a script based on global numbers. So if the conditions for the global numbers are met then only that section of the script will fire and ignore the rest of the code where the conditions are not met.

 

So I think what I need to know is how to encapsulate the parts of the code that I only want to fire if the globals specified return as being true.

Link to comment
Share on other sites

Something like this you are looking for?

void main() {

//Get this from a dialog use: GetScriptStringParameter();
string sGlobalName = "your_globalnumber_name";

//global number to check for
int iGlobaNumber1 = 1; //Get it from dialog use: GetScriptParameter(1);
int iGlobaNumber2 = 2; //Get it from dialog use: GetScriptParameter(2);
int iGlobaNumber3 = 3; //Get it from dialog use: GetScriptParameter(3);

if(GetGlobalNumber(sGlobalName) == iGlobaNumber1)
{
	//do your stuff
}
else if(GetGlobalNumber(sGlobalName) == iGlobaNumber2)
{
	//do your stuff
}
else if(GetGlobalNumber(sGlobalName) == iGlobaNumber2)
{
	//do your stuff
}
else
{
	//if no condition is met do this
}
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...