Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
05-02-2004 08:28
string llGetPrimitiveParameter( integer iParameter)
Reciprocal function to llSetPrimitiveParameter.
Useful when you want to use primitive parameters to get input from a user, eg use cut to get InnerAngle and OuterAngle in a Particle Generator.
Azelda
|
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
|
05-02-2004 23:19
This was discussed back when llSetPrimitiveParameters() was created. Turns out that the "set" function is a few hours' work, but the "get" function is much, much more complicated.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
05-05-2004 01:25
I assume because of typing? So cast to a string (it's done in the prototype above). The caller is responsible for decasting back to whatever the original type is.
Do you have a specific reason why Get could be harder than Set?
Azelda
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
05-05-2004 01:48
Edit: I'm assuming it probably is because of typing and multiplexing. This can actually be done very simply and easily: - cast everything to a string - join with -=- as the delimiter Example: string sReturn = llGetPrimitiveParameter( PRIM_OBJECT_TYPE ); list sValues = llParseString2List( sReturn, ["-=-"], [] );
integer iObjectType = (integer)llList2String( sValues, 0 );
if( iObjectType == PRIM_TYPE_CONE ) { vector vCut = (vector)llList2String( sValues, 1 ); float fTwist = (float)llList2String( sValues, 2 ); float fHollow = (float)llList2String( sValues, 3 ); vector vTopSize = (vector)llList2String( sValues, 4 ); }
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
05-05-2004 02:41
Or even better, just return a list.
The calliee can just put the values as they are in the list to return and the caller can just check the type of something with llGetListEntryType.
==Chris
|