diff options
author | Teravus Ovares | 2008-04-30 03:36:13 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-30 03:36:13 +0000 |
commit | 36bf16d35e928a338c932feeec42c0c8f35d8846 (patch) | |
tree | 06f11a4c546fce85fe1504fce08a09dd4bdebb06 /OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |
parent | * Disabled IntergridModule until a Mono bug can be isolated. (diff) | |
download | opensim-SC-36bf16d35e928a338c932feeec42c0c8f35d8846.zip opensim-SC-36bf16d35e928a338c932feeec42c0c8f35d8846.tar.gz opensim-SC-36bf16d35e928a338c932feeec42c0c8f35d8846.tar.bz2 opensim-SC-36bf16d35e928a338c932feeec42c0c8f35d8846.tar.xz |
Patch from Melanie: 0001077: [PATCH] LSL types cannot be cast implicitly or explicitly in many cases Thanks Melanie!
* Also, I moved the event parser and re-writer to a separate static object. More work will be done here shortly.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 64 |
1 files changed, 39 insertions, 25 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 | } |