Declaration Parameters Return Value Remarks Revisions Example See Also
| Declaration
tParam __stdcall getParamVal(
char* name // parameter name
);

Parameters
- name
- Name of a valid parameter.

Return Value
The current value of the parameter name or 0 if not found.

Remarks
This function is available through the API. Use it to retrieve the current value of a parameter. getParamVal is slower than getParamRef so it should not be used in frequently called functions like onTick. However, there is one function where it must be used in place of getParamRef: in the user-supplied getParamAbout. See that function for more information.
If a parameter named name can't be found, the function returns 0 and reports the failure in R2DToo's Debug window.

Revisions
API v1.5

Example
#include <string.h> // for strcmp(a,b) which returns 0 if a==b
//---------------------------------------------------------------------------
char* __stdcall getParamAbout(char* name)
{
if (!strcmp(name,"Neighbourhood Type")) {
switch(int(getParamVal(name))) {
case 0: return "Non-spatial, all agents can interact.";
case 1: return "1 dimension (horizontal). Periodic boundaries. "
"Each row is separate.";
case 2: return "2 dimensions, Moore neighbourhood. 4 nearest and "
"4 diagonal neighbours. Periodic boundaries.";
case 3: return "Symmetric Erdos-Renyi random graph. Links are "
"reciprocal.";
case 4: return "Deterministic scale-free network with clustering.";
}
}
return "Unknown.";
}
//---------------------------------------------------------------------------

See Also
getParamAbout, getParamRef.
|