Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > getParamVal

getParamVal

Declaration
Parameters
Return Value
Remarks
Revisions
Example
See Also

Declaration

tParam __stdcall getParamVal(
    char* name    // parameter name
);
Top of page

Parameters

name
Name of a valid parameter.
Top of page

Return Value

The current value of the parameter name or 0 if not found. Top of page

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.

Top of page

Revisions

API v1.5
  • new!
Top of page

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."; } //--------------------------------------------------------------------------- Top of page

See Also

getParamAbout, getParamRef.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:39pm