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

assignParam

Declaration
Parameters
Return Value
Remarks
Revisions
Example
See Also

Declaration

pParam __stdcall assignParam(
	int index,  	// parameter index
	char *name, 	// parameter name
	tParam deflt	// default value
);
Top of page

Parameters

index
Base zero index of parameter.
name
Name of parameter to show the user. Include parameter properties in trailing brackets [...].
deflt
Default value of parameter to begin the simulation.
Top of page

Return Value

A pointer to the newly created parameter value (pParam). Top of page

Remarks

This function is available through the API. It is meant to be used from within the model-provided function
onModelLoad and should be called once for each parameter after calling setParamCount.

Properties

Properties of a parameter may be specified in brackets [...] after the parameter's name. The user will only be allowed to enter values which satisfy the properties. Properties are comma-separated assignments of the form

property=value,....
Valid properties in the current version of the API (to be expanded in future versions) are
enabled=false
The user is not allowed to modify this parameter.
type=bool
Parameter can only take on the values 0 or 1.
type=int
Parameter must be an integer.
min=number
Minimum allowed value of the parameter.
max=number
Maximum allowed value of the parameter.

In the absence of any properties, a parameter is assumed to be an unbounded real number. Top of page


Revisions

API v1.5
  • returns pointer to parameter
API v1.4
  • introduced parameter "properties" to replace constraints
Top of page

Example

pParam density = NULL; //--------------------------------------------------------------------------- void __stdcall onModelLoad(void) { setParamCount(5); // index name [properties] default value assignParam(0, "World Width [type=int,min=1]", 30); // integer, >=1 assignParam(1, "World Height [type=int,min=1]", 30); // integer, >=1 density = assignParam(2, "Initial Density [min=0,max=1]", 0.5); // real, in range [0,1] assignParam(3, "Density [enabled=false,min=0,max=1]",0.5); // real, in range [0,1], not modifiable by user assignParam(4, "Pretty Graphics [type=bool]", 0); // boolean (0 or 1) } //--------------------------------------------------------------------------- Top of page

See Also

onModelLoad, setParamCount, pParam.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 2:35pm