You must be logged in to do that.

FunctionExists

FunctionExists
int FunctionExists(string funcname)

Documentation

Returns 1 if the function named in the argument exists, 0 if it doesn't exist. However, it does so with the following caveats:

  • v3 builtin functions will return 0.
  • All user-defined system functions will return 1.
  • All map-specific functions will only return 1 if the map with that function is loaded.

    ie: if island.map has a Sully() in it's vc file, and castle.map does not have Sully() in it's vcfile, FunctionExists("Sully") will return 1 if island.map is loaded, and 0 if castle.map (or any other map that doesn't have a Sully()) is loaded.

  • All compares are case insenitive.

This function is extremely useful for errorchecking purposes when you're using CallFunction() in conjunction with datafile-defined strings, or any other time you're using CallFunction() and explicitly demand that a function exist.

Example Usage

//copy this all into a blank system.vc and run verge 
//if you don't understand what's going on.

void Sully() 
{
	exit( "I am a clam.  I have no beard.  Isn't that weird?" );
}

void Autoexec() 
{
	if( FunctionExists("Sully") )
	{
		CallFunction( "Sully" );
	}
	else
	{
		exit( "Sully() does not Exist!" );
	}
}
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.