mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
llList-commands from ldvoipeng, new Default.lsl from dalien
This commit is contained in:
@@ -1,48 +1,104 @@
|
||||
integer touch_count = 0;
|
||||
|
||||
to_integer(float num)
|
||||
{
|
||||
llSay(0, num + " floor: " + llFloor(num));
|
||||
llSay(0, num + " ceiling: " + llCeil(num));
|
||||
llSay(0, num + " round: " + llRound(num));
|
||||
}
|
||||
|
||||
default {
|
||||
state_entry()
|
||||
{
|
||||
llSay(0, "Hello, Avatar!");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
float angle45 = PI/4.0; // 45 degrees
|
||||
float angle30 = PI/6.0; // 30 degrees
|
||||
float sqrt2 = llSqrt(2.0);
|
||||
float deltaCos = llCos(angle45) - sqrt2/2.0;
|
||||
float deltaSin = llSin(angle30) - 0.5;
|
||||
float deltaAtan = llAtan2(1, 1)*4 - PI;
|
||||
float deltaTan = llTan(PI);
|
||||
llSay(0, "deltaSin: " + deltaSin);
|
||||
llShout(0, "deltaCos: " + deltaCos);
|
||||
llWhisper(0, "deltaTan: " + deltaTan);
|
||||
llWhisper(0, "deltaAtan: " + deltaAtan);
|
||||
llSay(0, "Fabs(power(2^16)): " + llFabs(0-llPow(2, 16)));
|
||||
llSay(0, "Abs(-1): " + llAbs(-1));
|
||||
llSay(0, "One random(100): " + llFrand(100));
|
||||
llSay(0, "Two random(100): " + llFrand(100));
|
||||
llSay(0, "Three random(100): " + llFrand(100));
|
||||
llSay(0, "Four random(100.0): " + llFrand(100.0));
|
||||
llWhisper(0, "The unix time is: " + llGetUnixTime());
|
||||
to_integer(2.4);
|
||||
to_integer(2.5);
|
||||
to_integer(2.6);
|
||||
to_integer(3.51);
|
||||
llSay(0, "Should be 112abd47ceaae1c05a826828650434a6: " + llMD5String("Hello, Avatar!", 0));
|
||||
llSay(0, "Should be 9: " +llModPow(2, 16, 37));
|
||||
llSay(0, "Region corner: " + (string)llGetRegionCorner());
|
||||
llSetText("This is a text", <1,0,0>, 1);
|
||||
|
||||
touch_count++;
|
||||
llSay(0, "Object was touched. Touch count: " + touch_count);
|
||||
}
|
||||
}
|
||||
// autogenerated by generate_default_lsl.rb
|
||||
integer touch_count = 0;
|
||||
|
||||
default {
|
||||
touch_start(integer total_number) {
|
||||
float angle45 = PI/4.0; // 45 degrees
|
||||
float angle30 = PI/6.0; // 30 degrees
|
||||
float sqrt2 = llSqrt(2.0);
|
||||
if((llFabs(-1.5) != 1.5) || (llFabs(10.4) != 10.4)) {
|
||||
llShout(0, "Houston, we have a big problem! llFabs() does not work! Need it for other tests!");
|
||||
}
|
||||
llSetText("This is a text by llSetText", <1,0,0>, 1);
|
||||
llWhisper(0, "llWhispering a few random numbers between 0 and 100: " + llFrand(100) + "," + llFrand(100) + "," + llFrand(100) + "," + llFrand(100));
|
||||
llShout(0, "llShouting the unix time: " + llGetUnixTime() + ", and region corner: " + llGetRegionCorner());
|
||||
llShout(1, "Shouting a random number between 0 and 100 on the channel#1: " + llFrand(100));
|
||||
if (llAbs(-1) != 1) {
|
||||
llSay(0, "Assert failed: llAbs(-1) != 1");
|
||||
}
|
||||
if (llAbs(10) != 10) {
|
||||
llSay(0, "Assert failed: llAbs(10) != 10");
|
||||
}
|
||||
if (llFabs((llCos(angle45) - sqrt2/2.0) - 0) > 0.000001) {
|
||||
llSay(0, "Assert failed: (llCos(angle45) - sqrt2/2.0) differs from 0 by more than 0.000001");
|
||||
llSay(0, " --> The actual result: " + (llCos(angle45) - sqrt2/2.0));
|
||||
}
|
||||
if (llFabs((llSin(angle30) - 0.5) - 0) > 0.000001) {
|
||||
llSay(0, "Assert failed: (llSin(angle30) - 0.5) differs from 0 by more than 0.000001");
|
||||
llSay(0, " --> The actual result: " + (llSin(angle30) - 0.5));
|
||||
}
|
||||
if (llFabs((llAtan2(1, 1)*4 - PI) - 0) > 0.000001) {
|
||||
llSay(0, "Assert failed: (llAtan2(1, 1)*4 - PI) differs from 0 by more than 0.000001");
|
||||
llSay(0, " --> The actual result: " + (llAtan2(1, 1)*4 - PI));
|
||||
}
|
||||
if (llFabs((llTan(PI)) - 0) > 0.000001) {
|
||||
llSay(0, "Assert failed: (llTan(PI)) differs from 0 by more than 0.000001");
|
||||
llSay(0, " --> The actual result: " + (llTan(PI)));
|
||||
}
|
||||
if (llFloor(2.4) != 2) {
|
||||
llSay(0, "Assert failed: llFloor(2.4) != 2");
|
||||
}
|
||||
if (llCeil(2.4) != 3) {
|
||||
llSay(0, "Assert failed: llCeil(2.4) != 3");
|
||||
}
|
||||
if (llRound(2.4) != 2) {
|
||||
llSay(0, "Assert failed: llRound(2.4) != 2");
|
||||
}
|
||||
if (llFloor(2.5) != 2) {
|
||||
llSay(0, "Assert failed: llFloor(2.5) != 2");
|
||||
}
|
||||
if (llCeil(2.5) != 3) {
|
||||
llSay(0, "Assert failed: llCeil(2.5) != 3");
|
||||
}
|
||||
if (llRound(2.5) != 3) {
|
||||
llSay(0, "Assert failed: llRound(2.5) != 3");
|
||||
}
|
||||
if (llFloor(2.51) != 2) {
|
||||
llSay(0, "Assert failed: llFloor(2.51) != 2");
|
||||
}
|
||||
if (llCeil(2.51) != 3) {
|
||||
llSay(0, "Assert failed: llCeil(2.51) != 3");
|
||||
}
|
||||
if (llRound(2.51) != 3) {
|
||||
llSay(0, "Assert failed: llRound(2.51) != 3");
|
||||
}
|
||||
if (llFloor(3.49) != 3) {
|
||||
llSay(0, "Assert failed: llFloor(3.49) != 3");
|
||||
}
|
||||
if (llCeil(3.49) != 4) {
|
||||
llSay(0, "Assert failed: llCeil(3.49) != 4");
|
||||
}
|
||||
if (llRound(3.49) != 3) {
|
||||
llSay(0, "Assert failed: llRound(3.49) != 3");
|
||||
}
|
||||
if (llFloor(3.5000001) != 3) {
|
||||
llSay(0, "Assert failed: llFloor(3.5000001) != 3");
|
||||
}
|
||||
if (llCeil(3.5000001) != 4) {
|
||||
llSay(0, "Assert failed: llCeil(3.5000001) != 4");
|
||||
}
|
||||
if (llRound(3.5000001) != 4) {
|
||||
llSay(0, "Assert failed: llRound(3.5000001) != 4");
|
||||
}
|
||||
if (llFloor(3.51) != 3) {
|
||||
llSay(0, "Assert failed: llFloor(3.51) != 3");
|
||||
}
|
||||
if (llCeil(3.51) != 4) {
|
||||
llSay(0, "Assert failed: llCeil(3.51) != 4");
|
||||
}
|
||||
if (llRound(3.51) != 4) {
|
||||
llSay(0, "Assert failed: llRound(3.51) != 4");
|
||||
}
|
||||
if ((llFabs(0-llPow(2, 16))) != 65536) {
|
||||
llSay(0, "Assert failed: (llFabs(0-llPow(2, 16))) != 65536");
|
||||
}
|
||||
if (llMD5String("Hello, Avatar!",0) != "112abd47ceaae1c05a826828650434a6") {
|
||||
llSay(0, "Assert failed: llMD5String('Hello, Avatar!',0) != '112abd47ceaae1c05a826828650434a6'");
|
||||
}
|
||||
if (llModPow(2, 16, 37) != 9) {
|
||||
llSay(0, "Assert failed: llModPow(2, 16, 37) != 9");
|
||||
}
|
||||
touch_count++;
|
||||
llSay(0, "Object was touched. Touch count: " + touch_count);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user