aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs64
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs176
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs2
8 files changed, 185 insertions, 98 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index e29ee5a..66d2700 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -80,6 +80,15 @@ namespace OpenSim.Region.ScriptEngine.Common
80 // Set it if it changed 80 // Set it if it changed
81 if (m_state != value) 81 if (m_state != value)
82 { 82 {
83 try
84 {
85 m_ScriptEngine.m_EventManager.state_exit(m_localID);
86
87 }
88 catch (AppDomainUnloadedException)
89 {
90 Console.WriteLine("[SCRIPT]: state change called when script was unloaded. Nothing to worry about, but noting the occurance");
91 }
83 m_state = value; 92 m_state = value;
84 try 93 try
85 { 94 {
@@ -2136,7 +2145,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2136 m_host.TaskInventory[invItemID].PermsMask=0; 2145 m_host.TaskInventory[invItemID].PermsMask=0;
2137 2146
2138 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2147 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2139 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); 2148 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(0)});
2140 2149
2141 return; 2150 return;
2142 } 2151 }
@@ -2158,7 +2167,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2158 m_host.TaskInventory[invItemID].PermsMask=perm; 2167 m_host.TaskInventory[invItemID].PermsMask=perm;
2159 2168
2160 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2169 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2161 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); 2170 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(perm)});
2162 2171
2163 return; 2172 return;
2164 } 2173 }
@@ -2175,7 +2184,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2175 m_host.TaskInventory[invItemID].PermsMask=perm; 2184 m_host.TaskInventory[invItemID].PermsMask=perm;
2176 2185
2177 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2186 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2178 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)perm}); 2187 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(perm)});
2179 2188
2180 return; 2189 return;
2181 } 2190 }
@@ -2202,7 +2211,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2202 2211
2203 // Requested agent is not in range, refuse perms 2212 // Requested agent is not in range, refuse perms
2204 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2213 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2205 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); 2214 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(0)});
2206 } 2215 }
2207 2216
2208 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) 2217 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
@@ -2220,7 +2229,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2220 2229
2221 m_host.TaskInventory[invItemID].PermsMask=answer; 2230 m_host.TaskInventory[invItemID].PermsMask=answer;
2222 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2231 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2223 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer}); 2232 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {new LSL_Types.LSLInteger(answer)});
2224 } 2233 }
2225 2234
2226 public string llGetPermissionsKey() 2235 public string llGetPermissionsKey()
@@ -2600,7 +2609,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2600 2609
2601 object[] resobj = new object[] 2610 object[] resobj = new object[]
2602 { 2611 {
2603 m_host.LinkNum + 1, num, msg, id 2612 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2604 }; 2613 };
2605 2614
2606 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2615 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2627,7 +2636,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2627 partItemID = item.ItemID; 2636 partItemID = item.ItemID;
2628 Object[] resobj = new object[] 2637 Object[] resobj = new object[]
2629 { 2638 {
2630 m_host.LinkNum + 1, num, msg, id 2639 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2631 }; 2640 };
2632 2641
2633 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2642 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2655,7 +2664,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2655 partItemID = item.ItemID; 2664 partItemID = item.ItemID;
2656 Object[] resobj = new object[] 2665 Object[] resobj = new object[]
2657 { 2666 {
2658 m_host.LinkNum + 1, num, msg, id 2667 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2659 }; 2668 };
2660 2669
2661 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2670 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2685,7 +2694,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2685 partItemID = item.ItemID; 2694 partItemID = item.ItemID;
2686 Object[] resobj = new object[] 2695 Object[] resobj = new object[]
2687 { 2696 {
2688 m_host.LinkNum + 1, num, msg, id 2697 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2689 }; 2698 };
2690 2699
2691 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2700 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2709,7 +2718,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2709 2718
2710 object[] resobj = new object[] 2719 object[] resobj = new object[]
2711 { 2720 {
2712 m_host.LinkNum + 1, num, msg, id 2721 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2713 }; 2722 };
2714 2723
2715 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2724 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2737,7 +2746,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2737 partItemID = item.ItemID; 2746 partItemID = item.ItemID;
2738 Object[] resObjDef = new object[] 2747 Object[] resObjDef = new object[]
2739 { 2748 {
2740 m_host.LinkNum + 1, num, msg, id 2749 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2741 }; 2750 };
2742 2751
2743 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2752 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -3058,7 +3067,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3058 { 3067 {
3059 return 0; 3068 return 0;
3060 } 3069 }
3061 return Convert.ToInt32(src.Data[index]); 3070 try
3071 {
3072 return Convert.ToInt32(src.Data[index]);
3073 }
3074 catch (System.FormatException e)
3075 {
3076 return 0;
3077 }
3062 } 3078 }
3063 3079
3064 public double osList2Double(LSL_Types.list src, int index) 3080 public double osList2Double(LSL_Types.list src, int index)
@@ -3086,7 +3102,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3086 { 3102 {
3087 return 0.0; 3103 return 0.0;
3088 } 3104 }
3089 return Convert.ToDouble(src.Data[index]); 3105 try
3106 {
3107 return Convert.ToDouble(src.Data[index]);
3108 }
3109 catch (System.FormatException e)
3110 {
3111 return 0.0;
3112 }
3090 } 3113 }
3091 3114
3092 public string llList2String(LSL_Types.list src, int index) 3115 public string llList2String(LSL_Types.list src, int index)
@@ -3112,18 +3135,9 @@ namespace OpenSim.Region.ScriptEngine.Common
3112 } 3135 }
3113 if (index >= src.Length) 3136 if (index >= src.Length)
3114 { 3137 {
3115 return "00000000-0000-0000-0000-000000000000"; 3138 return "";
3116 }
3117 //return OpenSim.Framework.ToString(src[index]);
3118 LLUUID tmpkey;
3119 if (LLUUID.TryParse(src.Data[index].ToString(), out tmpkey))
3120 {
3121 return tmpkey.ToString();
3122 }
3123 else
3124 {
3125 return "00000000-0000-0000-0000-000000000000";
3126 } 3139 }
3140 return src.Data[index].ToString();
3127 } 3141 }
3128 3142
3129 public LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index) 3143 public LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index)
@@ -4317,7 +4331,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4317 if (xmlrpcMod.IsEnabled()) 4331 if (xmlrpcMod.IsEnabled())
4318 { 4332 {
4319 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); 4333 LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID);
4320 object[] resobj = new object[] { 1, channelID.ToString(), LLUUID.Zero.ToString(), String.Empty, 0, String.Empty }; 4334 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) };
4321 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); 4335 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj);
4322 } 4336 }
4323 } 4337 }
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 65047fb..5337d7f 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -64,6 +64,11 @@ namespace OpenSim.Region.ScriptEngine.Common
64 str = str.Replace('<', ' '); 64 str = str.Replace('<', ' ');
65 str = str.Replace('>', ' '); 65 str = str.Replace('>', ' ');
66 string[] tmps = str.Split(new Char[] { ',', '<', '>' }); 66 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
67 if(tmps.Length < 3)
68 {
69 x=y=z=0;
70 return;
71 }
67 bool res; 72 bool res;
68 res = Double.TryParse(tmps[0], out x); 73 res = Double.TryParse(tmps[0], out x);
69 res = res & Double.TryParse(tmps[1], out y); 74 res = res & Double.TryParse(tmps[1], out y);
@@ -76,14 +81,27 @@ namespace OpenSim.Region.ScriptEngine.Common
76 81
77 public override string ToString() 82 public override string ToString()
78 { 83 {
79 return "<" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ">"; 84 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
85 return s;
86 }
87
88 public static explicit operator LSLString(Vector3 vec)
89 {
90 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
91 return new LSLString(s);
80 } 92 }
81 93
82 public static explicit operator string(Vector3 vec) 94 public static explicit operator string(Vector3 vec)
83 { 95 {
84 return "<" + vec.x.ToString() + ", " + vec.y.ToString() + ", " + vec.z.ToString() + ">"; 96 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
97 return s;
85 } 98 }
86 99
100 public static explicit operator Vector3(string s)
101 {
102 return new Vector3(s);
103 }
104
87 public static bool operator ==(Vector3 lhs, Vector3 rhs) 105 public static bool operator ==(Vector3 lhs, Vector3 rhs)
88 { 106 {
89 return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); 107 return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);
@@ -278,6 +296,11 @@ namespace OpenSim.Region.ScriptEngine.Common
278 str = str.Replace('<', ' '); 296 str = str.Replace('<', ' ');
279 str = str.Replace('>', ' '); 297 str = str.Replace('>', ' ');
280 string[] tmps = str.Split(new Char[] { ',', '<', '>' }); 298 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
299 if(tmps.Length < 4)
300 {
301 x=y=z=s=0;
302 return;
303 }
281 bool res; 304 bool res;
282 res = Double.TryParse(tmps[0], out x); 305 res = Double.TryParse(tmps[0], out x);
283 res = res & Double.TryParse(tmps[1], out y); 306 res = res & Double.TryParse(tmps[1], out y);
@@ -307,14 +330,27 @@ namespace OpenSim.Region.ScriptEngine.Common
307 330
308 public override string ToString() 331 public override string ToString()
309 { 332 {
310 return "<" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ", " + s.ToString() + ">"; 333 string st=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s);
334 return st;
311 } 335 }
312 336
313 public static explicit operator string(Quaternion r) 337 public static explicit operator string(Quaternion r)
314 { 338 {
315 return "<" + r.x.ToString() + ", " + r.y.ToString() + ", " + r.z.ToString() + ", " + r.s.ToString() + ">"; 339 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
340 return s;
341 }
342
343 public static explicit operator LSLString(Quaternion r)
344 {
345 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
346 return new LSLString(s);
316 } 347 }
317 348
349 public static explicit operator Quaternion(string s)
350 {
351 return new Quaternion(s);
352 }
353
318 public static bool operator ==(Quaternion lhs, Quaternion rhs) 354 public static bool operator ==(Quaternion lhs, Quaternion rhs)
319 { 355 {
320 // Return true if the fields match: 356 // Return true if the fields match:
@@ -369,12 +405,20 @@ namespace OpenSim.Region.ScriptEngine.Common
369 405
370 public int Length 406 public int Length
371 { 407 {
372 get { return m_data.Length; } 408 get {
409 if(m_data == null)
410 m_data=new Object[0];
411 return m_data.Length;
412 }
373 } 413 }
374 414
375 public object[] Data 415 public object[] Data
376 { 416 {
377 get { return m_data; } 417 get {
418 if(m_data == null)
419 m_data=new Object[0];
420 return m_data;
421 }
378 } 422 }
379 423
380 public static list operator +(list a, list b) 424 public static list operator +(list a, list b)
@@ -571,13 +615,20 @@ namespace OpenSim.Region.ScriptEngine.Common
571 if(Data.Length == 0) 615 if(Data.Length == 0)
572 return new list(); // Don't even bother 616 return new list(); // Don't even bother
573 617
618 string[] keys;
619
574 if(stride == 1) // The simple case 620 if(stride == 1) // The simple case
575 { 621 {
576 Object[] ret=new Object[Data.Length]; 622 Object[] ret=new Object[Data.Length];
577 623
578 Array.Copy(Data, 0, ret, 0, Data.Length); 624 Array.Copy(Data, 0, ret, 0, Data.Length);
579 625
580 Array.Sort(ret); 626 keys=new string[Data.Length];
627 int k;
628 for(k=0;k<Data.Length;k++)
629 keys[k]=Data[k].ToString();
630
631 Array.Sort(keys, ret);
581 632
582 if(ascending == 0) 633 if(ascending == 0)
583 Array.Reverse(ret); 634 Array.Reverse(ret);
@@ -588,7 +639,7 @@ namespace OpenSim.Region.ScriptEngine.Common
588 639
589 int len=(Data.Length+stride-1)/stride; 640 int len=(Data.Length+stride-1)/stride;
590 641
591 string[] keys=new string[len]; 642 keys=new string[len];
592 Object[][] vals=new Object[len][]; 643 Object[][] vals=new Object[len][];
593 644
594 int i; 645 int i;
@@ -1016,17 +1067,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1016 1067
1017 public override bool Equals(object o) 1068 public override bool Equals(object o)
1018 { 1069 {
1019 if (o is String) 1070 return o.ToString() == value;
1020 {
1021 string s = (string)o;
1022 return s == this.value;
1023 }
1024 if (o is key)
1025 {
1026 key k = (key)o;
1027 return this.value == k.value;
1028 }
1029 return false;
1030 } 1071 }
1031 1072
1032 public override int GetHashCode() 1073 public override int GetHashCode()
@@ -1046,6 +1087,13 @@ namespace OpenSim.Region.ScriptEngine.Common
1046 { 1087 {
1047 m_string = s; 1088 m_string = s;
1048 } 1089 }
1090
1091 public LSLString(double d)
1092 {
1093 string s=String.Format("{0:0.000000}", d);
1094 m_string=s;
1095 }
1096
1049 #endregion 1097 #endregion
1050 1098
1051 #region Operators 1099 #region Operators
@@ -1071,44 +1119,47 @@ namespace OpenSim.Region.ScriptEngine.Common
1071 return new LSLString(s); 1119 return new LSLString(s);
1072 } 1120 }
1073 1121
1074 // Commented out: 1122 public static string ToString(LSLString s)
1075 /* 1123 {
1076 [echo] Build Directory is /home/tedd/opensim/trunk/OpenSim/Region/ScriptEngine/Common/bin/Debug 1124 return s.m_string;
1077 [csc] Compiling 5 files to '/home/tedd/opensim/trunk/OpenSim/Region/ScriptEngine/Common/bin/Debug/OpenSim.Region.ScriptEngine.Common.dll'. 1125 }
1078 [csc] error CS0121: The call is ambiguous between the following methods or properties: `OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString.operator /(OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString, OpenSim.Region.ScriptEngine.Common.LSL_Types.LSLString)' and `string.operator /(string, string)' 1126
1079 [csc] /home/tedd/opensim/trunk/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs(602,32): (Location of the symbol related to previous error) 1127 public override string ToString()
1080 [csc] /usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error) 1128 {
1081 [csc] Compilation failed: 1 error(s), 0 warnings 1129 return m_string;
1082 */ 1130 }
1083 //public static bool operator ==(LSLString s1, LSLString s2) 1131
1084 //{ 1132 public static bool operator ==(LSLString s1, string s2)
1085 // return s1.m_string == s2.m_string; 1133 {
1086 //} 1134 return s1.m_string == s2;
1087 //public static bool operator !=(LSLString s1, LSLString s2) 1135 }
1088 //{ 1136
1089 // return s1.m_string != s2.m_string; 1137 public static bool operator !=(LSLString s1, string s2)
1090 //} 1138 {
1139 return s1.m_string != s2;
1140 }
1141
1142 public static explicit operator double(LSLString s)
1143 {
1144 return Convert.ToDouble(s.m_string);
1145 }
1146
1147 public static explicit operator LSLInteger(LSLString s)
1148 {
1149 return new LSLInteger(Convert.ToInt32(s.m_string));
1150 }
1151
1152 public static explicit operator LSLString(double d)
1153 {
1154 return new LSLString(d);
1155 }
1156
1091 #endregion 1157 #endregion
1092 1158
1093 #region Overriders 1159 #region Overriders
1094 public override bool Equals(object o) 1160 public override bool Equals(object o)
1095 { 1161 {
1096 if (o is String) 1162 return m_string == o.ToString();
1097 {
1098 string s = (string)o;
1099 return s == this.m_string;
1100 }
1101 if (o is key)
1102 {
1103 key k = (key)o;
1104 return this.m_string == k.value;
1105 }
1106 if (o is LSLString)
1107 {
1108 LSLString s = (string)o;
1109 return this.m_string == s;
1110 }
1111 return false;
1112 } 1163 }
1113 1164
1114 public override int GetHashCode() 1165 public override int GetHashCode()
@@ -1154,6 +1205,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1154 return i.value; 1205 return i.value;
1155 } 1206 }
1156 1207
1208 static public explicit operator LSLString(LSLInteger i)
1209 {
1210 return new LSLString(i.ToString());
1211 }
1212
1157 static public implicit operator Boolean(LSLInteger i) 1213 static public implicit operator Boolean(LSLInteger i)
1158 { 1214 {
1159 if (i.value == 0) 1215 if (i.value == 0)
@@ -1171,6 +1227,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1171 return new LSLInteger(i); 1227 return new LSLInteger(i);
1172 } 1228 }
1173 1229
1230 static public explicit operator LSLInteger(string s)
1231 {
1232 return new LSLInteger(int.Parse(s));
1233 }
1234
1174 static public implicit operator LSLInteger(double d) 1235 static public implicit operator LSLInteger(double d)
1175 { 1236 {
1176 return new LSLInteger(d); 1237 return new LSLInteger(d);
@@ -1182,6 +1243,17 @@ namespace OpenSim.Region.ScriptEngine.Common
1182 return ret; 1243 return ret;
1183 } 1244 }
1184 1245
1246 public static LSLInteger operator ++(LSLInteger i)
1247 {
1248 i.value++;
1249 return i;
1250 }
1251
1252 public static LSLInteger operator --(LSLInteger i)
1253 {
1254 i.value--;
1255 return i;
1256 }
1185 1257
1186 //static public implicit operator System.Double(LSLInteger i) 1258 //static public implicit operator System.Double(LSLInteger i)
1187 //{ 1259 //{
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs
index 521402e..4b7ee84 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/HttpRequest.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
72 { 72 {
73 object[] resobj = new object[] 73 object[] resobj = new object[]
74 { 74 {
75 httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body 75 new LSL_Types.LSLString(httpInfo.reqID.ToString()), new LSL_Types.LSLInteger(httpInfo.status), null, new LSL_Types.LSLString(httpInfo.response_body)
76 }; 76 };
77 77
78 sman.m_EventQueueManager.AddToScriptQueue( 78 sman.m_EventQueueManager.AddToScriptQueue(
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs
index 874a905..2b68360 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/Listener.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
58 object[] resobj = new object[] 58 object[] resobj = new object[]
59 { 59 {
60 //lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage() 60 //lInfo.GetChannel(), lInfo.GetName(), lInfo.GetID().ToString(), lInfo.GetMessage()
61 lInfo.GetChannel(), lInfo.GetName(), lInfo.GetSourceItemID().ToString(), lInfo.GetMessage() 61 new LSL_Types.LSLInteger(lInfo.GetChannel()), new LSL_Types.LSLString(lInfo.GetName()), new LSL_Types.LSLString(lInfo.GetSourceItemID().ToString()), new LSL_Types.LSLString(lInfo.GetMessage())
62 }; 62 };
63 63
64 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 64 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
index 71ae80c..1210b77 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/SensorRepeat.cs
@@ -314,7 +314,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
314 else 314 else
315 { 315 {
316 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "sensor", EventQueueManager.llDetectNull, 316 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "sensor", EventQueueManager.llDetectNull,
317 new object[] { SensedObjects.Length }); 317 new object[] { new LSL_Types.LSLInteger(SensedObjects.Length) });
318 } 318 }
319 } 319 }
320 } 320 }
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
index c3e1804..63c529a 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
@@ -60,9 +60,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
60 //Deliver data to prim's remote_data handler 60 //Deliver data to prim's remote_data handler
61 object[] resobj = new object[] 61 object[] resobj = new object[]
62 { 62 {
63 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), String.Empty, 63 new LSL_Types.LSLInteger(2), new LSL_Types.LSLString(rInfo.GetChannelKey().ToString()), new LSL_Types.LSLString(rInfo.GetMessageID().ToString()), new LSL_Types.LSLString(String.Empty),
64 rInfo.GetIntValue(), 64 new LSL_Types.LSLInteger(rInfo.GetIntValue()),
65 rInfo.GetStrVal() 65 new LSL_Types.LSLString(rInfo.GetStrVal())
66 }; 66 };
67 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 67 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
68 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj 68 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
@@ -83,9 +83,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
83 //Deliver data to prim's remote_data handler 83 //Deliver data to prim's remote_data handler
84 object[] resobj = new object[] 84 object[] resobj = new object[]
85 { 85 {
86 3, srdInfo.channel.ToString(), srdInfo.GetReqID().ToString(), String.Empty, 86 new LSL_Types.LSLInteger(3), new LSL_Types.LSLString(srdInfo.channel.ToString()), new LSL_Types.LSLString(srdInfo.GetReqID().ToString()), new LSL_Types.LSLString(String.Empty),
87 srdInfo.idata, 87 new LSL_Types.LSLInteger(srdInfo.idata),
88 srdInfo.sdata 88 new LSL_Types.LSLString(srdInfo.sdata)
89 }; 89 };
90 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 90 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
91 srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj 91 srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index cbc94e2..3bc01a9 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
100 public void changed(uint localID, uint change) 100 public void changed(uint localID, uint change)
101 { 101 {
102 // Add to queue for all scripts in localID, Object pass change. 102 // Add to queue for all scripts in localID, Object pass change.
103 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "changed", EventQueueManager.llDetectNull, new object[] { (int)change }); 103 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "changed", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(change) });
104 } 104 }
105 105
106 public void state_entry(uint localID) 106 public void state_entry(uint localID)
@@ -115,7 +115,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
115 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 115 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
116 detstruct._key = new LSL_Types.key[1]; 116 detstruct._key = new LSL_Types.key[1];
117 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString()); 117 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
118 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { (int)1 }); 118 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
119 } 119 }
120 120
121 public void touch_end(uint localID, IClientAPI remoteClient) 121 public void touch_end(uint localID, IClientAPI remoteClient)
@@ -124,7 +124,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
124 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct(); 124 EventQueueManager.Queue_llDetectParams_Struct detstruct = new EventQueueManager.Queue_llDetectParams_Struct();
125 detstruct._key = new LSL_Types.key[1]; 125 detstruct._key = new LSL_Types.key[1];
126 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString()); 126 detstruct._key[0] = new LSL_Types.key(remoteClient.AgentId.ToString());
127 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { (int)1 }); 127 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_end", detstruct, new object[] { new LSL_Types.LSLInteger(1) });
128 } 128 }
129 129
130 public void OnRezScript(uint localID, LLUUID itemID, string script) 130 public void OnRezScript(uint localID, LLUUID itemID, string script)
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
145 145
146 public void money(uint localID, LLUUID agentID, int amount) 146 public void money(uint localID, LLUUID agentID, int amount)
147 { 147 {
148 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "money", EventQueueManager.llDetectNull, new object[] { agentID.ToString(), (int)amount }); 148 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "money", EventQueueManager.llDetectNull, new object[] { agentID.ToString(), new LSL_Types.LSLInteger(amount) });
149 } 149 }
150 150
151 // TODO: Replace placeholders below 151 // TODO: Replace placeholders below
@@ -154,9 +154,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
154 // then queued in EventQueueManager. 154 // then queued in EventQueueManager.
155 // When queued in EventQueueManager they need to be LSL compatible (name and params) 155 // When queued in EventQueueManager they need to be LSL compatible (name and params)
156 156
157 public void state_exit(uint localID, LLUUID itemID) 157 public void state_exit(uint localID)
158 { 158 {
159 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_exit", EventQueueManager.llDetectNull); 159 // Add to queue for all scripts in ObjectID object
160 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "state_exit", EventQueueManager.llDetectNull, new object[] { });
160 } 161 }
161 162
162 public void touch(uint localID, LLUUID itemID) 163 public void touch(uint localID, LLUUID itemID)
@@ -166,22 +167,22 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
166 167
167 public void touch_end(uint localID, LLUUID itemID) 168 public void touch_end(uint localID, LLUUID itemID)
168 { 169 {
169 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull); 170 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "touch_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
170 } 171 }
171 172
172 public void collision_start(uint localID, LLUUID itemID) 173 public void collision_start(uint localID, LLUUID itemID)
173 { 174 {
174 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start", EventQueueManager.llDetectNull, new object[] { (int)1 }); 175 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_start", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
175 } 176 }
176 177
177 public void collision(uint localID, LLUUID itemID) 178 public void collision(uint localID, LLUUID itemID)
178 { 179 {
179 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision", EventQueueManager.llDetectNull, new object[] { (int)1 }); 180 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
180 } 181 }
181 182
182 public void collision_end(uint localID, LLUUID itemID) 183 public void collision_end(uint localID, LLUUID itemID)
183 { 184 {
184 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end", EventQueueManager.llDetectNull, new object[] { (int)1 }); 185 myScriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "collision_end", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(1) });
185 } 186 }
186 187
187 public void land_collision_start(uint localID, LLUUID itemID) 188 public void land_collision_start(uint localID, LLUUID itemID)
@@ -237,7 +238,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
237 238
238 public void at_target(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos) 239 public void at_target(uint localID, uint handle, LLVector3 targetpos, LLVector3 atpos)
239 { 240 {
240 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "at_target", EventQueueManager.llDetectNull, new object[] { (int)handle, new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z), new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) }); 241 myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "at_target", EventQueueManager.llDetectNull, new object[] { new LSL_Types.LSLInteger(handle), new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z), new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) });
241 } 242 }
242 243
243 public void not_at_target(uint localID) 244 public void not_at_target(uint localID)
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
index 1c85646..1edd3bd 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.Common
40 void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient); 40 void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
41 void OnRezScript(uint localID, LLUUID itemID, string script); 41 void OnRezScript(uint localID, LLUUID itemID, string script);
42 void OnRemoveScript(uint localID, LLUUID itemID); 42 void OnRemoveScript(uint localID, LLUUID itemID);
43 void state_exit(uint localID, LLUUID itemID); 43 void state_exit(uint localID);
44 void touch(uint localID, LLUUID itemID); 44 void touch(uint localID, LLUUID itemID);
45 void touch_end(uint localID, LLUUID itemID); 45 void touch_end(uint localID, LLUUID itemID);
46 void collision_start(uint localID, LLUUID itemID); 46 void collision_start(uint localID, LLUUID itemID);