BlowTorch - DRAFT version 1
|
Executes a script that has been loaded during the plugin parsing phase.
GetActionBarHeight()
none |
barHeight = GetActionBarHeight()
Executes a script that has been loaded during the plugin parsing phase.
GetActionBarHeight()
none |
barHeight = GetActionBarHeight()
Get the current external storage volume directory. Checks if the volume exists, but not if it is write protected.
GetExternalStorageDirectory()
none |
path = GetExternalStorageDirectory()
Environment = luajava.bindClass("android.os.Environment") local path = nil if(Environment:getExternalStorageState() == Environment.MEDIA_MOUNTED) then path = Environment:getExternalStorageDirectory():getAbsolutePath() else if(Environment:getExternalStorageState() == Environment.MEDIA_MOUNTED_READ_ONLY) then path = Environment:getExternalStorageDirectory():getAbsolutePath() Note("alert: external storage is read only!") end end
Gets the plugin ID associated with this plugin.
GetPluginID()
none |
id = GetPluginID()
Gets the plugin name associated with this plugin.
GetPluginName()
none |
name = GetPluginName()
Get the absolute path to the path that the plugin was loaded from.
GetPluginInstallDirectory()
none |
path = GetPluginInstallDirectory()
Gets the current height of the status bar.
GetStatusBarHeight()
none |
height = GetStatusBarHeight()
This is the basic linkage between Lua and the Console. The function will echo the parameter string to the main window.
Note(text)
text | The text to echo back |
Note("Example text!")
Send the given string to the server.
SendToServer(str)
str | string the data to send to the server |
SendToServer("run north;open door")
Sends a packet of GMCP data to the server
AppendLineToWindow(line,windowName)
line | com.offsetnull.bt.window.TextTree$Line the line to append, this usually comes from a trigger callback |
function calledFromTrigger(line,number,map) AppendLineToWindow(line,GetPluginID().."_chat_window") end
Attaches a settings group from a window to the plugin settings block. This is to allow a plugin writer to include window settings in the main options dialog block at their discretion.
AppendWindowSettings(name)
name | string the line to append, this usually comes from a trigger callback |
function OnBackgroundStartup() AppendWindowSettings(GetPluginID().."_chat_window") end
Calls a named global function in another plugin.
CallPlugin(name,function,arguments[,...])
name | string the line to append, this usually comes from a trigger callback |
function | function the global function to call. |
arguments | a list of arguments to provide, can be more than one separated by commas. Numbers or strings. |
CallPlugin("button_window","newbutton",400,800,299,894)
Deletes a trigger.
DeleteTrigger(name)
name | string the the trigger to delete |
DeleteTrigger("mob_alert_1")
Deletes an entire group of triggers.
DeleteTriggerGroup(name)
name | string the name of the trigger group to delete. |
DeleteTriggerGroup("campaign_targets")
Sets the enabled state for all triggers in a group.
EnableTriggerGroup(name,state)
name | string Name of the trigger group to manipulate. |
state | boolean Enabled state for the group's triggers. |
EnableTriggerGroup("auto_hunt")
Executes a script that has been loaded during the plugin parsing phase.
ExecuteScript(name)
name | name of the script to run, this is configured in the plugin settings. |
ExecuteScript("parseInventory")
Gets the raw /c com.offsetnull.bt.service.WindowToken object that is being held by the background service. This is to allow direct manipulation of the buffer.
GetWindowTokenByName(name)
name | string the id of the window to get. |
window = GetWindowTokenByName(GetPluginID().."_chat_window")
Invalidates a foreground windows text and forces it to redraw.
InvalidateWindowText(name)
name | string the name of the window to redraw |
InvalidateWindowText(GetPluginID().."_chat_window")
Gets the raw com.offsetnull.bt.service.settings.SettingsGroup settings, this is to allow direct manipulation.
InvalidateWindowText(name)
none |
settings = GetPluginSettings()
Makes a new trigger with the given parameters
NewTrigger(name,pattern,config[,action,...])
name | string name of the new trigger. |
pattern | string the pattern to use |
config | table Configuration of the trigger options like, regex, fireOnce, etc. see example. |
action | table representing response actions to perform when triggered. May have as many as desired, see example. |
--configuration parameters is a table that can have the following properties defined: --regex = [boolean] indicates use of regular expression or literal text. --group = [string] group name to enroll this trigger into. --fireOnce = [boolean] indicates whether this trigger is a one shot trigger. --notification action table configuration can have the following properties --{ -- type="notification", (must be set for the action type) -- title = [string], title of the notification -- message = [string], long message of the notification -- soundpath = [string/boolean/nil], absolute path to the sound file to play for this notification. -- if nil/not set it will play the default sound. if set to false it won't play sound. -- vibrate = [number], vibrate pattern to use, 0=short, 1=medium, 2=long, 3=super long -- spawnNew = [boolean], indicates whether to spawn a new notification. --} --toast action table configuration --{ -- type = "toast", (must be set for the action type) -- message = [string], message to display -- duration = [number], 0 = short duration, 1 = long duration. --} --send action table configuratio --{ -- type = "send", (must be set for the action type) -- text = [string] text to send to the server. --} --gag action table configuration --{ -- type = "gag" -- output=[boolean], gag from output -- log = [boolean], gag from log -- retarget = [string] window to send this gagged line to. --} --replace action table configuration --{ -- type = "replace", (must be set for the action type). -- text = [string] text to replace matched text with. --} --color action table configuration --{ -- type = "color", (must be set for the action type). -- foreground = [number], 1-256 indicating the foreground xterm256 color to use. -- background = [number], 1-256 indicating the background xterm256 color to use. --} --simple notification NewTrigger("tmp", "^foo\.$", { regex = true,group = "test", fireOnce = false }, { type = "notification", title="custom title", message="custom message", vibrate = 2 }) --literal trigger with colorize and response to the server. NewTrigger("tmp2", "fox", { regex = false }, { type = "color", foreground = 36, background = 75}, { type = "send", text = "listen fox" })
Makes a new window with the given paramters.
NewWindow(name,x,y,width,height,script)
name | string name or id of the window |
x | number the x coordinate of the window |
y | number the y coordinate of the window |
width | number the width of the window |
height | number the height of the window |
script | string the named script to load into the window's Lua state. |
NewWindow("chat_window",0,0,400,400,"chat_script")
Checks whether a plugin has a global function of a desired name.
PluginSupports(name,function)
name | string the name of the plugin to interrogate. |
function | string the name of the global function to be checked. |
if(PluginSupports("button_window","exportButtons")) then CallPlugin("button_window","exportButtons") end
Causes the BlowTorch core to dump the current settings and reload them from the source files.
ReloadSettings()
none |
ReloadSettings()
Adds and entry into the "special command" processor, or .nameyouwant and it will call the specified global function
RegisterSpecialCommand(sortName,callbackName)
shortName | string short name that will be searched for |
callbackName | string the name of a global function to call when this is called. |
function goHome(args) SendToServer("enter portal") end RegisterSpecialCommand("home","goHome")
Initiates the saving of the whole settings wad for the currently open connection.
SaveSettings()
none |
SaveSettings()
Simulates incoming data from the server. Will be processed for triggers but not for telnet data (although it probably should).
SimulateInput(data)
data | string the data to simulate |
SimulateInput("\n[this looks like a prompt]->\n")
Sends a packet of GMCP data to the server
Send_GMCP_Packet(str)
str | string the data to send, more in the GMCP documentation. |
Send_GMCP_Packet("core.hello foo")
Sets or Tests the enabled state of a trigger
TriggerEnabled(name[,state])
name | string the trigger to test or manipulate |
state | boolean the new enabled state |
if(TriggerEnabled("afk")) then TriggerEnabled("afk",false) end
Call to get a boolean indicating if the screen is on / user present.
UserPresent()
none |
present = UserPresent()
Instructs a named window to either start or stop buffering incoming text
WindowBuffer(name,state)
name | string the name of the window to affect |
state | boolean the state of the buffering desired |
WindowBuffer(GetPluginID().."_chat_window",false)
Sends a message to a foreground window that it should run a specified callback with the desired argument data.
WindowXCallB(name,data)
name | string the global callback in the window to call |
data | string the data to send |
WindowXCallB(GetPluginID().."_chat_window",42)
Sends a message to a foreground window that it should run a specified callback with the desired argument data.
WindowXCallS(name,data)
name | string the global callback in the window to call |
data | string the data to send |
WindowXCallS(GetPluginID().."_chat_window",42)
Add a top level menu item that will call a global function when pressed.
AddOptionCallback(functionName,menuText,iconDrawable)
functionName | string value of the function name that will be called when the menu item is pressed. |
menuText | string value that will appear on the menu item. |
iconDrawable | android.graphics.drawable.Drawable the drawable resource that will be used for the icon. |
AddOptionCallback("functionName","Click Me!",nil)
drawable = luajava.newInstance("android.drawable.BitmapDrawable",context:getResources(),"/path/to/image.png") function menuClicked() Note("Menu Item Clicked!") end AddOptionCallback("menuClicked","Click Me!",drawable)
Cancel a scheduled call made with ScheduleCallback.
CancelCallback(id)
id | number the callback id to cancel |
CancelCallback(100)
Closes the Options dialog if it is currently open.
CloseOptionsDialog()
none |
CloseOptionsDialog()
Get a handle to the current Activity that is hosting the foreground window process.
GetActivity()
none |
activity = GetActivity()
Gets an option value by key from the parent plugin's option table.
GetOptionValue(key)
key | unique key for the option given. |
value = GetOptionValue("input_mode")
Gets the state of the status bar.
IsStatusBarHidden()
none |
if(IsStatusBarHidden()) then Note("status bar hidden") else Note("status bar not hidden") end
Calls a function in the parent plugin's Lua state. Provides one way signaling across the AIDL bridge to the plugin host running in the background.
PluginXCallS(functionName,data)
functionName | string the global function in the plugin's host Lua state. |
data | string the data to pass as a argument to the given function |
PluginXCallS("saveData","300")
Removes the current menu item and returns the menu stack to its previous state.
PopMenuStack()
none |
PopMenuStack()
Starts the creating of a new menu object, providing a global function name to call that will handle weather or not the back button is pressed while the menu stack is active. After this function is called, the PopulateMenu entry point will be called when the operating system has created the new menu to show.
PushMenuStack(callbackName)
\b | string the name of a global function to call if the back button is pressed to cancel the menu. |
function PopulateMenu(menu) menu:addItem(0,1,1,foo) end PushMenuStack("menuBackPressed") function menuBackPressed() PopMenuStack() end
Add a top level menu item that will call a global function when pressed.
ScheduleCallback(id,callbackName,delayMillis)
id | number unique identifier associated with this event, will be passed to the callback. |
callbackName | string name of the global function to call after the desired elapsed time. |
delayMillis | dumber how long in milliseconds to delay the execution of the callback |
function delayCallback(id) Note(string.format("event %d fired.",id)) end ScheduleCallback(100,"delayCallback",3000) ScheduleCallback(104,"delayCallback",5000)
Checks whether a plugin is installed.
PluginInstalled(name)
name | the plugin name to test. |
if(PluginInstalled("button_window")) then WindowCall("button_window","clearButtons") end
Calls a named global function in every window (if the window has defined it).
WindowBroadcast(function,arg)
function | the function to call. |
arg | string a string or number to provide to the function as an argument. |
WindowBroadcast("adjustZOrder","now")
Calls a named global function on the target window.
WindowCall(name,function,arg)
name | string the name of the window to target. |
function | the function to call. |
arg | string a string or number to provide to the function as an argument. |
WindowCall("button_window","loadButtonSet","default")
Tests whether a named global function exists in the target window.
WindowSupports(name,function)
name | string the name of the window to target. |
function | the function to test. |
if(WindowSupports("button_window","clearButtons")) then WindowCall("button_window","clearButtons") end