OsRound: Difference between revisions
From OpenSimulator
Jump to navigationJump to search
imported>Ubit No edit summary |
imported>Djphil Add exemple |
||
| Line 5: | Line 5: | ||
|function_syntax=float osRound(float value, integer ndigits) | |function_syntax=float osRound(float value, integer ndigits) | ||
|ossl_example= | |ossl_example= | ||
<source lang = "lsl"> | |||
// Example of osRound | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSay(PUBLIC_CHANNEL, "Touch me to show osRound"); | |||
} | |||
touch_start(integer n) | |||
{ | |||
float value = llFrand(1000); | |||
float round = osRound(value, 3); | |||
llOwnerSay( "osRound(value, 3) of \"" + (string)value + "\" is \"" + (string)round + "\""); | |||
} | |||
} | |||
</source> | |||
|description=returns the value rounded to the number with a number if decimal places set by ndigits.<br />ndigits = 0 is same as llRound(), max value is 15. | |description=returns the value rounded to the number with a number if decimal places set by ndigits.<br />ndigits = 0 is same as llRound(), max value is 15. | ||
|additional_info=note that ll*Say do llRound(value,6) by default so you can't test with them.. | |additional_info=note that ll*Say do llRound(value,6) by default so you can't test with them.. | ||
}} | }} | ||
Revision as of 07:47, 2 March 2019
float osRound(float value, integer ndigits)
| |
| returns the value rounded to the number with a number if decimal places set by ndigits. ndigits = 0 is same as llRound(), max value is 15. | |
| Threat Level | No threat level specified |
| Permissions | No permissions specified |
| Extra Delay | 0 seconds |
| Example(s) | |
// Example of osRound
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Touch me to show osRound");
}
touch_start(integer n)
{
float value = llFrand(1000);
float round = osRound(value, 3);
llOwnerSay( "osRound(value, 3) of \"" + (string)value + "\" is \"" + (string)round + "\"");
}
}
| |
| Notes | |
| note that ll*Say do llRound(value,6) by default so you can't test with them.. | |