Difference between revisions of "LlRaiseError"
Jump to navigation
Jump to search
m |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<h3>Stopgap Solution</h3> | <h3>Stopgap Solution</h3> | ||
Use in conjunction with the [[script console]] in the client. Uses [[DEBUG_CHANNEL]]. | Use in conjunction with the [[script console]] in the client. Uses [[DEBUG_CHANNEL]]. | ||
< | <lsl>llShout(DEBUG_CHANNEL, msg);</lsl> | ||
RaiseError(string msg, integer level) | <lsl>RaiseError(string msg, integer level) | ||
{ | { | ||
if(level <= 1) | if(level <= 1) | ||
Line 13: | Line 13: | ||
llShout(DEBUG_CHANNEL, msg); | llShout(DEBUG_CHANNEL, msg); | ||
if(level <= 1) | if(level <= 1) | ||
0 | 1/0; | ||
else if(level == 2) | else if(level == 2) | ||
llSetScriptState(llGetScriptName(), FALSE); | llSetScriptState(llGetScriptName(), FALSE); | ||
} | }</lsl>}}{{LSL_Function | ||
</ | |||
|func_id|mode=request|func_sleep=0.0|func_energy=10.0 | |func_id|mode=request|func_sleep=0.0|func_energy=10.0 | ||
|func=llRaiseError|sort=RaiseError|p1_type=string|p1_name=errText | |func=llRaiseError|sort=RaiseError|p1_type=string|p1_name=errText | ||
|func_desc=Causes the script to raise a run-time error.<br/> | |func_desc=Causes the script to raise a run-time error.<br/> | ||
<b>Functionality duplicated by using [[llSay]] or [[llShout]] on the [[DEBUG_CHANNEL]].</b> | <b>Functionality duplicated by using [[llSay]] or [[llShout]] on the [[DEBUG_CHANNEL]].</b> | ||
|return_text|spec|caveats|examples=< | |return_text|spec|caveats|examples= | ||
<lsl> | |||
if (errState > 0) { | |||
llRaiseError("Internal Error: Something went wrong."); | llRaiseError("Internal Error: Something went wrong."); | ||
}</ | } | ||
</lsl> | |||
|helpers|related|also|notes=This would allow script writers to log errors to an interface designed for handling errors. This would be superior to sending across the more general purpose [[llOwnerSay]] because errors are not lost over time and don't incur a time delay unlike [[llInstantMessage]]. | |helpers|related|also|notes=This would allow script writers to log errors to an interface designed for handling errors. This would be superior to sending across the more general purpose [[llOwnerSay]] because errors are not lost over time and don't incur a time delay unlike [[llInstantMessage]]. | ||
*Why not use [[llSay]] or [[llShout]] on [[DEBUG_CHANNEL]], that pretty much does what you want. And if you want the script to die after that just add a 1/0; after the call. [[User:Strife Onizuka|Strife Onizuka]] | *Why not use [[llSay]] or [[llShout]] on [[DEBUG_CHANNEL]], that pretty much does what you want. And if you want the script to die after that just add a 1/0; after the call. [[User:Strife Onizuka|Strife Onizuka]] | ||
*For much the same reason that I said llOwnerSay (which I currently am using,) is not so useful. The information is lost after a short amount of time. Having an option to kill the script would be nice, but that task is already fulfilled by [[llSetScriptState]] and I dislike duplication of functionality. If error messages would cause the script to halt, do to the nature of the error handling system, that is fine. No need to rework that subsystem. In my case I am writing a script that accepts notecard commands and if there is a parsing or | *For much the same reason that I said llOwnerSay (which I currently am using,) is not so useful. The information is lost after a short amount of time. Having an option to kill the script would be nice, but that task is already fulfilled by [[llSetScriptState]] and I dislike duplication of functionality. If error messages would cause the script to halt, do to the nature of the error handling system, that is fine. No need to rework that subsystem. In my case I am writing a script that accepts notecard commands and if there is a parsing or lexical error I would like a "system-level" error to show so that it's impossible to miss. [[User:Cron Stardust|Cron Stardust]] 22:13, 3 March 2007 (PST) | ||
*Duh... I just read up on DEBUG_CHANNEL. llSay with DEBUG_CHANNEL is the same as this. That duplicates the functionality. There is therefore no more need of this feature request. [[User:Cron Stardust|Cron Stardust]] 22:25, 3 March 2007 (PST) | *Duh... I just read up on DEBUG_CHANNEL. llSay with DEBUG_CHANNEL is the same as this. That duplicates the functionality. There is therefore no more need of this feature request. [[User:Cron Stardust|Cron Stardust]] 22:25, 3 March 2007 (PST) | ||
}} | }} |
Latest revision as of 09:37, 4 April 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
LSL Feature Request | |
The described function does not exist. This article is a feature request.
Stopgap SolutionUse in conjunction with the script console in the client. Uses DEBUG_CHANNEL. <lsl>llShout(DEBUG_CHANNEL, msg);</lsl> <lsl>RaiseError(string msg, integer level) { if(level <= 1) msg = "FATAL: " + msg; else if(level == 2) msg = "BREAK: " + msg; else if(level == 3) msg = "WRNNG: " + msg; llShout(DEBUG_CHANNEL, msg); if(level <= 1) 1/0; else if(level == 2) llSetScriptState(llGetScriptName(), FALSE); }</lsl> |
Summary
Function: llRaiseError( string errText );REQUEST | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Causes the script to raise a run-time error.
Functionality duplicated by using llSay or llShout on the DEBUG_CHANNEL.
• string | errText |
Caveats
Examples
<lsl> if (errState > 0) {
llRaiseError("Internal Error: Something went wrong.");
}
</lsl>Notes
This would allow script writers to log errors to an interface designed for handling errors. This would be superior to sending across the more general purpose llOwnerSay because errors are not lost over time and don't incur a time delay unlike llInstantMessage.
- Why not use llSay or llShout on DEBUG_CHANNEL, that pretty much does what you want. And if you want the script to die after that just add a 1/0; after the call. Strife Onizuka
- For much the same reason that I said llOwnerSay (which I currently am using,) is not so useful. The information is lost after a short amount of time. Having an option to kill the script would be nice, but that task is already fulfilled by llSetScriptState and I dislike duplication of functionality. If error messages would cause the script to halt, do to the nature of the error handling system, that is fine. No need to rework that subsystem. In my case I am writing a script that accepts notecard commands and if there is a parsing or lexical error I would like a "system-level" error to show so that it's impossible to miss. Cron Stardust 22:13, 3 March 2007 (PST)
- Duh... I just read up on DEBUG_CHANNEL. llSay with DEBUG_CHANNEL is the same as this. That duplicates the functionality. There is therefore no more need of this feature request. Cron Stardust 22:25, 3 March 2007 (PST)