Difference between revisions of "ObjectType:script"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Description ==
+
== Overview ==
 +
{{ObjectType-Vitals|script|[[LavishScript]]|none|TRUE|none|no|void *}}
 +
A script object provides access to a running LavishScript script.
  
 
== Members ==
 
== Members ==
*[[DataType:string|string]] '''Filename''': Filename of this script
+
*[[ObjectType:string|string]] '''Filename''': Filename of this script
*[[DataType:variable|variable]] '''Variable['''name''']''': A given script-scope variable
+
*[[ObjectType:variable|variable]] '''Variable['''name''']''': A given script-scope variable
*[[DataType:int|int]] '''RunningTime''': Number of milliseconds since this script began
+
*[[ObjectType:int|int]] '''RunningTime''': Number of milliseconds since this script began
*[[DataType:string|string]] '''CurrentDirectory''': Current working directory for this script
+
*[[ObjectType:filepath|filepath]] '''CurrentDirectory''': Current working directory for this script
 +
*[[ObjectType:bool|bool]] '''Paused''': Scripts current paused state
 +
*[[ObjectType:bool|bool]] '''Profiling''': Profiling status true/false. Debugging must be allowed for profiling to be on.
 +
*[[ObjectType:bool|bool]] '''AllowDebug''': If debugging is allowed
 +
*[[ObjectType:string|string]] '''ExecuteAtom['''name''','''...''']''': Executes an atom in script-scope with the given name.  Any extra parameters are passed as parameters to the atom.  If the atom returns a value, the value is given.
 +
*[[ObjectType:variablescope|variablescope]] '''VariableScope''': The script's variable scope
  
 
== Methods ==
 
== Methods ==
Line 12: Line 19:
 
*'''Squelch''': Squelches most output from this script (excluding most errors and generally excluding Echo)
 
*'''Squelch''': Squelches most output from this script (excluding most errors and generally excluding Echo)
 
*'''Unsquelch''': Unsquelches
 
*'''Unsquelch''': Unsquelches
 
+
*'''Pause''': Pauses this script
== Returns ==
+
*'''Resume''': Resumes this script
TRUE
+
*'''ExecuteAtom['''name''','''...''']''': Executes an atom in script-scope with the given name.  Any extra parameters are passed as parameters to the atom.
 +
*'''EnableProfiling''': Enables script profiling. Debugging must be turned on to enable.
 +
*'''DisableProfiling''': Disables script profiling.
 +
*'''DisableDebugging''': Disables debugging.
 +
*'''DumpStack''': Dumps the current stack into the console.
 +
*'''DumpProfiling''': Dumps the entire script into the console.
 +
*'''EnableDebugLogging['''filename''']''': Enables full debug logging to file.
 +
:'''Note:''' Do not use this with DumpProfiling, as the output will be mostly 0s.
 +
*'''DisableDebugLogging''': Disables full debug logging
  
 
== Examples ==
 
== Examples ==
*if ${Script[WoWBot](exists)} - Check if a script is running
+
===Display if a script is running===
*Script:End - When used as a command within a script will end the script
+
*echo ${Script[VentriloHUD](exists)}
*Script[WoWBot].Variable[DoSkinning]:Set[FALSE] - Will set the variable called DoSkinning in the currently running script called WoWBot to false.
+
;Output
 +
TRUE
 +
===End a script===
 +
*Script[VentriloHUD]:End
 +
*Script:End
 +
:'''Note:''' When used as a command within a script will end the script
 +
===Set a variable inside a currently running script===
 +
*Script[KillCount].VariableScope.TotalKills:Set[0] - Will set the variable called TotalKills in the currently running script called KillCount to zero.
  
 
== See Also ==
 
== See Also ==
* [[LavishScript:Data Types|Data Types]]
+
{{LavishScript:ObjectType}}
 
 
[[Category:LavishScript]]
 
[[Category:LavishScript Data Types]]
 

Latest revision as of 21:06, 3 December 2020

Overview

Object Type Vitals
script
Defined By LavishScript
Inherits none
Reduces To TRUE
Variable Object Type none
Uses Sub-Types no
C/C++ Type void *

A script object provides access to a running LavishScript script.

Members

  • string Filename: Filename of this script
  • variable Variable[name]: A given script-scope variable
  • int RunningTime: Number of milliseconds since this script began
  • filepath CurrentDirectory: Current working directory for this script
  • bool Paused: Scripts current paused state
  • bool Profiling: Profiling status true/false. Debugging must be allowed for profiling to be on.
  • bool AllowDebug: If debugging is allowed
  • string ExecuteAtom[name,...]: Executes an atom in script-scope with the given name. Any extra parameters are passed as parameters to the atom. If the atom returns a value, the value is given.
  • variablescope VariableScope: The script's variable scope

Methods

  • End: Ends execution of this script
  • QueueCommand[command]: Inserts a command in the script's command queue
  • Squelch: Squelches most output from this script (excluding most errors and generally excluding Echo)
  • Unsquelch: Unsquelches
  • Pause: Pauses this script
  • Resume: Resumes this script
  • ExecuteAtom[name,...]: Executes an atom in script-scope with the given name. Any extra parameters are passed as parameters to the atom.
  • EnableProfiling: Enables script profiling. Debugging must be turned on to enable.
  • DisableProfiling: Disables script profiling.
  • DisableDebugging: Disables debugging.
  • DumpStack: Dumps the current stack into the console.
  • DumpProfiling: Dumps the entire script into the console.
  • EnableDebugLogging[filename]: Enables full debug logging to file.
Note: Do not use this with DumpProfiling, as the output will be mostly 0s.
  • DisableDebugLogging: Disables full debug logging

Examples

Display if a script is running

  • echo ${Script[VentriloHUD](exists)}
Output
TRUE

End a script

  • Script[VentriloHUD]:End
  • Script:End
Note: When used as a command within a script will end the script

Set a variable inside a currently running script

  • Script[KillCount].VariableScope.TotalKills:Set[0] - Will set the variable called TotalKills in the currently running script called KillCount to zero.

See Also

LavishScript Object Types