diff options
author | David Rowe | 2014-01-24 15:32:12 -0800 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-31 00:20:10 +0000 |
commit | 67ec95bde88d852df0f150dd55ea19456b4a070b (patch) | |
tree | a0c365e6ace8c551b6fd2415a456f0dd7be5a2db /OpenSim/Region/ScriptEngine | |
parent | Record whether login to home fails because no home set (UUID.Zero) or region ... (diff) | |
download | opensim-SC-67ec95bde88d852df0f150dd55ea19456b4a070b.zip opensim-SC-67ec95bde88d852df0f150dd55ea19456b4a070b.tar.gz opensim-SC-67ec95bde88d852df0f150dd55ea19456b4a070b.tar.bz2 opensim-SC-67ec95bde88d852df0f150dd55ea19456b4a070b.tar.xz |
Updated methods for handling LSL script errors, deprecated, and not implemented
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 65 |
1 files changed, 58 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e54b697..1aa094b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
101 | /// </summary> | 101 | /// </summary> |
102 | protected TaskInventoryItem m_item; | 102 | protected TaskInventoryItem m_item; |
103 | 103 | ||
104 | protected bool throwErrorOnNotImplemented = true; | 104 | protected bool throwErrorOnNotImplemented = false; |
105 | protected AsyncCommandManager AsyncCommands = null; | 105 | protected AsyncCommandManager AsyncCommands = null; |
106 | protected float m_ScriptDelayFactor = 1.0f; | 106 | protected float m_ScriptDelayFactor = 1.0f; |
107 | protected float m_ScriptDistanceFactor = 1.0f; | 107 | protected float m_ScriptDistanceFactor = 1.0f; |
@@ -11245,20 +11245,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11245 | return item.ItemID; | 11245 | return item.ItemID; |
11246 | } | 11246 | } |
11247 | 11247 | ||
11248 | internal void ShoutError(string msg) | 11248 | /// <summary> |
11249 | /// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel. | ||
11250 | /// </summary> | ||
11251 | /// <param name="command">The name of the command that generated the error.</param> | ||
11252 | /// <param name="message">The error message to report to the user.</param> | ||
11253 | internal void Error(string command, string message) | ||
11249 | { | 11254 | { |
11250 | llShout(ScriptBaseClass.DEBUG_CHANNEL, msg); | 11255 | string text = command + ": " + message; |
11256 | if (text.Length > 1023) | ||
11257 | { | ||
11258 | text = text.Substring(0, 1023); | ||
11259 | } | ||
11260 | |||
11261 | World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL, | ||
11262 | m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); | ||
11263 | |||
11264 | IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
11265 | if (wComm != null) | ||
11266 | { | ||
11267 | wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text); | ||
11268 | } | ||
11251 | } | 11269 | } |
11252 | 11270 | ||
11253 | internal void NotImplemented(string command) | 11271 | /// <summary> |
11272 | /// Reports that the command is not implemented as a script error. | ||
11273 | /// </summary> | ||
11274 | /// <param name="command">The name of the command that is not implemented.</param> | ||
11275 | /// <param name="message">Additional information to report to the user. (Optional)</param> | ||
11276 | internal void NotImplemented(string command, string message = "") | ||
11254 | { | 11277 | { |
11255 | if (throwErrorOnNotImplemented) | 11278 | if (throwErrorOnNotImplemented) |
11256 | throw new NotImplementedException("Command not implemented: " + command); | 11279 | { |
11280 | if (message != "") | ||
11281 | { | ||
11282 | message = " - " + message; | ||
11283 | } | ||
11284 | |||
11285 | throw new NotImplementedException("Command not implemented: " + command + message); | ||
11286 | } | ||
11287 | else | ||
11288 | { | ||
11289 | string text = "Command not implemented"; | ||
11290 | if (message != "") | ||
11291 | { | ||
11292 | text = text + " - " + message; | ||
11293 | } | ||
11294 | |||
11295 | Error(command, text); | ||
11296 | } | ||
11257 | } | 11297 | } |
11258 | 11298 | ||
11259 | internal void Deprecated(string command) | 11299 | /// <summary> |
11300 | /// Reports that the command is deprecated as a script error. | ||
11301 | /// </summary> | ||
11302 | /// <param name="command">The name of the command that is deprecated.</param> | ||
11303 | /// <param name="message">Additional information to report to the user. (Optional)</param> | ||
11304 | internal void Deprecated(string command, string message = "") | ||
11260 | { | 11305 | { |
11261 | throw new ScriptException("Command deprecated: " + command); | 11306 | string text = "Command deprecated"; |
11307 | if (message != "") | ||
11308 | { | ||
11309 | text = text + " - " + message; | ||
11310 | } | ||
11311 | |||
11312 | Error(command, text); | ||
11262 | } | 11313 | } |
11263 | 11314 | ||
11264 | internal void LSLError(string msg) | 11315 | internal void LSLError(string msg) |