llList-commands from ldvoipeng, new Default.lsl from dalien
parent
b9346844c1
commit
7e06df5f83
|
@ -37,7 +37,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
|
|
||||||
|
|
||||||
private string m_state = "default";
|
private string m_state = "default";
|
||||||
public string State() {
|
|
||||||
|
public string State()
|
||||||
|
{
|
||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +83,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
return OpenSim.Framework.Utilities.Util.RandomClass.Next((int)mag);
|
return OpenSim.Framework.Utilities.Util.RandomClass.Next((int)mag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int llFloor(double f) { return (int)Math.Floor(f); }
|
public int llFloor(double f) { return (int)Math.Floor(f); }
|
||||||
public int llCeil(double f) { return (int)Math.Ceiling(f); }
|
public int llCeil(double f) { return (int)Math.Ceiling(f); }
|
||||||
public int llRound(double f) { return (int)Math.Round(f, 3); }
|
public int llRound(double f) { return (int)Math.Round(f, 3); }
|
||||||
|
|
||||||
//This next group are vector operations involving squaring and square root. ckrinke
|
//This next group are vector operations involving squaring and square root. ckrinke
|
||||||
public double llVecMag(LSL_Types.Vector3 v) { return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); }
|
public double llVecMag(LSL_Types.Vector3 v)
|
||||||
|
{
|
||||||
|
return (v.X*v.X + v.Y*v.Y + v.Z*v.Z);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
|
public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
|
||||||
{
|
{
|
||||||
double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
|
double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
|
||||||
|
@ -120,7 +127,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
|
public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
|
||||||
{ //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
|
{
|
||||||
|
//this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
|
||||||
float err = 0.00001f;
|
float err = 0.00001f;
|
||||||
double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2);
|
double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2);
|
||||||
double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2);
|
double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2);
|
||||||
|
@ -160,6 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
World.SimChat(Helpers.StringToField(text),
|
World.SimChat(Helpers.StringToField(text),
|
||||||
0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSay(int channelID, string text)
|
public void llSay(int channelID, string text)
|
||||||
{
|
{
|
||||||
//type for say is 1
|
//type for say is 1
|
||||||
|
@ -237,7 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
public LSL_Types.Vector3 llGetAccel() { return new LSL_Types.Vector3(); }
|
public LSL_Types.Vector3 llGetAccel() { return new LSL_Types.Vector3(); }
|
||||||
public LSL_Types.Vector3 llGetOmega() { return new LSL_Types.Vector3(); }
|
public LSL_Types.Vector3 llGetOmega() { return new LSL_Types.Vector3(); }
|
||||||
public double llGetTimeOfDay() { return 0; }
|
public double llGetTimeOfDay() { return 0; }
|
||||||
public double llGetWallclock() { return DateTime.Now.TimeOfDay.TotalSeconds; }
|
|
||||||
|
public double llGetWallclock()
|
||||||
|
{
|
||||||
|
return DateTime.Now.TimeOfDay.TotalSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
public double llGetTime() { return 0; }
|
public double llGetTime() { return 0; }
|
||||||
public void llResetTime() { }
|
public void llResetTime() { }
|
||||||
public double llGetAndResetTime() { return 0; }
|
public double llGetAndResetTime() { return 0; }
|
||||||
|
@ -263,11 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { }
|
public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { }
|
||||||
public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { }
|
public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { }
|
||||||
public void llStopLookAt() { }
|
public void llStopLookAt() { }
|
||||||
|
|
||||||
public void llSetTimerEvent(double sec)
|
public void llSetTimerEvent(double sec)
|
||||||
{
|
{
|
||||||
// Setting timer repeat
|
// Setting timer repeat
|
||||||
m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
|
m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); }
|
public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); }
|
||||||
public double llGetMass() { return 0; }
|
public double llGetMass() { return 0; }
|
||||||
public void llCollisionFilter(string name, string id, int accept) { }
|
public void llCollisionFilter(string name, string id, int accept) { }
|
||||||
|
@ -281,10 +297,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
public void llInstantMessage(string user, string message) { }
|
public void llInstantMessage(string user, string message) { }
|
||||||
public void llEmail(string address, string subject, string message) { }
|
public void llEmail(string address, string subject, string message) { }
|
||||||
public void llGetNextEmail(string address, string subject) { }
|
public void llGetNextEmail(string address, string subject) { }
|
||||||
|
|
||||||
public string llGetKey()
|
public string llGetKey()
|
||||||
{
|
{
|
||||||
return m_host.UUID.ToStringHyphenated();
|
return m_host.UUID.ToStringHyphenated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llSetBuoyancy(double buoyancy) { }
|
public void llSetBuoyancy(double buoyancy) { }
|
||||||
public void llSetHoverHeight(double height, int water, double tau) { }
|
public void llSetHoverHeight(double height, int water, double tau) { }
|
||||||
public void llStopHover() { }
|
public void llStopHover() { }
|
||||||
|
@ -362,19 +380,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); }
|
public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); }
|
||||||
public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); }
|
public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); }
|
||||||
public double llGetTextureRot(int side) { return 0; }
|
public double llGetTextureRot(int side) { return 0; }
|
||||||
|
|
||||||
public int llSubStringIndex(string source, string pattern)
|
public int llSubStringIndex(string source, string pattern)
|
||||||
{
|
{
|
||||||
return source.IndexOf(pattern);
|
return source.IndexOf(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string llGetOwnerKey(string id) { return ""; }
|
public string llGetOwnerKey(string id) { return ""; }
|
||||||
public LSL_Types.Vector3 llGetCenterOfMass() { return new LSL_Types.Vector3(); }
|
public LSL_Types.Vector3 llGetCenterOfMass() { return new LSL_Types.Vector3(); }
|
||||||
|
|
||||||
public List<string> llListSort(List<string> src, int stride, int ascending)
|
public List<string> llListSort(List<string> src, int stride, int ascending)
|
||||||
{ return new List<string>(); }
|
{
|
||||||
public int llGetListLength(List<string> src) { return 0; }
|
//List<string> nlist = src.Sort();
|
||||||
public int llList2Integer(List<string> src, int index) { return 0; }
|
|
||||||
public double llList2double(List<string> src, int index) { return 0; }
|
//if (ascending == 0)
|
||||||
public string llList2String(List<string> src, int index) { return ""; }
|
//{
|
||||||
public string llList2Key(List<string> src, int index) { return ""; }
|
//nlist.Reverse();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//return nlist;
|
||||||
|
return new List<string>(); ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int llGetListLength(List<string> src)
|
||||||
|
{
|
||||||
|
return src.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int llList2Integer(List<string> src, int index)
|
||||||
|
{
|
||||||
|
return Convert.ToInt32(src[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double llList2Double(List<string> src, int index)
|
||||||
|
{
|
||||||
|
return Convert.ToDouble(src[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float llList2Float(List<string> src, int index)
|
||||||
|
{
|
||||||
|
return Convert.ToSingle(src[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string llList2String(List<string> src, int index)
|
||||||
|
{
|
||||||
|
return src[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
public string llList2Key(List<string> src, int index)
|
||||||
|
{
|
||||||
|
//return OpenSim.Framework.Types.ToStringHyphenated(src[index]);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
|
public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
|
||||||
{ return new LSL_Types.Vector3(); }
|
{ return new LSL_Types.Vector3(); }
|
||||||
public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
|
public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
|
||||||
|
@ -391,19 +449,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
{ return new List<string>(); }
|
{ return new List<string>(); }
|
||||||
public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
|
public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
|
||||||
{ return new List<string>(); }
|
{ return new List<string>(); }
|
||||||
|
|
||||||
public LSL_Types.Vector3 llGetRegionCorner()
|
public LSL_Types.Vector3 llGetRegionCorner()
|
||||||
{ return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); }
|
{
|
||||||
|
return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> llListInsertList(List<string> dest, List<string> src, int start)
|
public List<string> llListInsertList(List<string> dest, List<string> src, int start)
|
||||||
{ return new List<string>(); }
|
{ return new List<string>(); }
|
||||||
public int llListFindList(List<string> src, List<string> test) { return 0; }
|
public int llListFindList(List<string> src, List<string> test) { return 0; }
|
||||||
public string llGetObjectName() { return ""; }
|
public string llGetObjectName() { return ""; }
|
||||||
public void llSetObjectName(string name) { }
|
public void llSetObjectName(string name) { }
|
||||||
|
|
||||||
public string llGetDate()
|
public string llGetDate()
|
||||||
{
|
{
|
||||||
DateTime date = DateTime.Now.ToUniversalTime();
|
DateTime date = DateTime.Now.ToUniversalTime();
|
||||||
string result = date.ToString("yyyy-MM-dd");
|
string result = date.ToString("yyyy-MM-dd");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return 0; }
|
public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return 0; }
|
||||||
public int llGetAgentInfo(string id) { return 0; }
|
public int llGetAgentInfo(string id) { return 0; }
|
||||||
public void llAdjustSoundVolume(double volume) { }
|
public void llAdjustSoundVolume(double volume) { }
|
||||||
|
@ -454,7 +518,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { }
|
public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { }
|
||||||
public void llVolumeDetect(int detect) { }
|
public void llVolumeDetect(int detect) { }
|
||||||
public void llResetOtherScript(string name) { }
|
public void llResetOtherScript(string name) { }
|
||||||
public int llGetScriptState(string name) { return 0; }
|
|
||||||
|
public int llGetScriptState(string name)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void llRemoteLoadScript() { }
|
public void llRemoteLoadScript() { }
|
||||||
public void llSetRemoteScriptAccessPin(int pin) { }
|
public void llSetRemoteScriptAccessPin(int pin) { }
|
||||||
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { }
|
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { }
|
||||||
|
|
|
@ -1,47 +1,103 @@
|
||||||
|
// autogenerated by generate_default_lsl.rb
|
||||||
integer touch_count = 0;
|
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 {
|
default {
|
||||||
state_entry()
|
touch_start(integer total_number) {
|
||||||
{
|
|
||||||
llSay(0, "Hello, Avatar!");
|
|
||||||
}
|
|
||||||
|
|
||||||
touch_start(integer total_number)
|
|
||||||
{
|
|
||||||
float angle45 = PI/4.0; // 45 degrees
|
float angle45 = PI/4.0; // 45 degrees
|
||||||
float angle30 = PI/6.0; // 30 degrees
|
float angle30 = PI/6.0; // 30 degrees
|
||||||
float sqrt2 = llSqrt(2.0);
|
float sqrt2 = llSqrt(2.0);
|
||||||
float deltaCos = llCos(angle45) - sqrt2/2.0;
|
if((llFabs(-1.5) != 1.5) || (llFabs(10.4) != 10.4)) {
|
||||||
float deltaSin = llSin(angle30) - 0.5;
|
llShout(0, "Houston, we have a big problem! llFabs() does not work! Need it for other tests!");
|
||||||
float deltaAtan = llAtan2(1, 1)*4 - PI;
|
}
|
||||||
float deltaTan = llTan(PI);
|
llSetText("This is a text by llSetText", <1,0,0>, 1);
|
||||||
llSay(0, "deltaSin: " + deltaSin);
|
llWhisper(0, "llWhispering a few random numbers between 0 and 100: " + llFrand(100) + "," + llFrand(100) + "," + llFrand(100) + "," + llFrand(100));
|
||||||
llShout(0, "deltaCos: " + deltaCos);
|
llShout(0, "llShouting the unix time: " + llGetUnixTime() + ", and region corner: " + llGetRegionCorner());
|
||||||
llWhisper(0, "deltaTan: " + deltaTan);
|
llShout(1, "Shouting a random number between 0 and 100 on the channel#1: " + llFrand(100));
|
||||||
llWhisper(0, "deltaAtan: " + deltaAtan);
|
if (llAbs(-1) != 1) {
|
||||||
llSay(0, "Fabs(power(2^16)): " + llFabs(0-llPow(2, 16)));
|
llSay(0, "Assert failed: llAbs(-1) != 1");
|
||||||
llSay(0, "Abs(-1): " + llAbs(-1));
|
}
|
||||||
llSay(0, "One random(100): " + llFrand(100));
|
if (llAbs(10) != 10) {
|
||||||
llSay(0, "Two random(100): " + llFrand(100));
|
llSay(0, "Assert failed: llAbs(10) != 10");
|
||||||
llSay(0, "Three random(100): " + llFrand(100));
|
}
|
||||||
llSay(0, "Four random(100.0): " + llFrand(100.0));
|
if (llFabs((llCos(angle45) - sqrt2/2.0) - 0) > 0.000001) {
|
||||||
llWhisper(0, "The unix time is: " + llGetUnixTime());
|
llSay(0, "Assert failed: (llCos(angle45) - sqrt2/2.0) differs from 0 by more than 0.000001");
|
||||||
to_integer(2.4);
|
llSay(0, " --> The actual result: " + (llCos(angle45) - sqrt2/2.0));
|
||||||
to_integer(2.5);
|
}
|
||||||
to_integer(2.6);
|
if (llFabs((llSin(angle30) - 0.5) - 0) > 0.000001) {
|
||||||
to_integer(3.51);
|
llSay(0, "Assert failed: (llSin(angle30) - 0.5) differs from 0 by more than 0.000001");
|
||||||
llSay(0, "Should be 112abd47ceaae1c05a826828650434a6: " + llMD5String("Hello, Avatar!", 0));
|
llSay(0, " --> The actual result: " + (llSin(angle30) - 0.5));
|
||||||
llSay(0, "Should be 9: " +llModPow(2, 16, 37));
|
}
|
||||||
llSay(0, "Region corner: " + (string)llGetRegionCorner());
|
if (llFabs((llAtan2(1, 1)*4 - PI) - 0) > 0.000001) {
|
||||||
llSetText("This is a text", <1,0,0>, 1);
|
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++;
|
touch_count++;
|
||||||
llSay(0, "Object was touched. Touch count: " + touch_count);
|
llSay(0, "Object was touched. Touch count: " + touch_count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue