Creating Apps: Difference between revisions
Jump to navigation
Jump to search
(→States) |
|||
Line 13: | Line 13: | ||
iconColor = { 0, 0.4, 0.9843, 1 }, | iconColor = { 0, 0.4, 0.9843, 1 }, | ||
actions = { | |||
UI. | { | ||
name = "Action", | |||
run = function(target) | |||
if app.options.Save then | |||
Spectrum.SaveDataPoint(target.data) | |||
end | |||
if app.options.Delete then | |||
Spectrum.DeleteDataPoint(target.data) | |||
end | |||
end, | |||
}, | |||
}, | |||
options = { | |||
Save = true, | |||
Delete = false, | |||
}, | |||
OnStateChange = function(state) | |||
if state == AppState.on then | |||
UI.ToggleLightMonitor(true) | |||
elseif state == AppState.off then | |||
UI.ToggleLightMonitor(false) | |||
end | |||
app.state = state | |||
SetState(app.state) | |||
end, | end, | ||
UpdateActions = function(target) | |||
print(target.name) | |||
print(target.type) | |||
end, | end, | ||
Revision as of 11:09, 16 August 2018
Example Lua script
app = { name = "DataDelete", description = "Delete a data point.", cost = 2.0, targets = {"data"}, showInRadial = "target", showInAppWheel = "default", state = "off", icon = "Common/Apps/Icons/DataDelete.png", iconColor = { 0, 0.4, 0.9843, 1 }, actions = { { name = "Action", run = function(target) if app.options.Save then Spectrum.SaveDataPoint(target.data) end if app.options.Delete then Spectrum.DeleteDataPoint(target.data) end end, }, }, options = { Save = true, Delete = false, }, OnStateChange = function(state) if state == AppState.on then UI.ToggleLightMonitor(true) elseif state == AppState.off then UI.ToggleLightMonitor(false) end app.state = state SetState(app.state) end, UpdateActions = function(target) print(target.name) print(target.type) end, }
App configuration
App Table | ||
---|---|---|
Name | Required/Optional | Description |
name | required | Name of the app |
description | required | Short description of what the app does |
cost | optional | How many seconds the tracking progress increases when using this app |
targets | optional | List of what target types the app can have |
showInRadial | optional | How the app should be displayed in Radial menu. See menu options. |
showInAppWheel | optional | How the app should be displayed in the AppWheel. See menu options. |
state | required | Current state of the app. |
icon | required | Path to icon image |
iconColor | optional | background color for the app icon |
OnClickAppWheel | optional | The function to run when the app is launched from the AppWheel |
OnClickRadial | optional | The function to run when the app is launched from the radial menu |
Target types
targets = {TargetType.Data, TargetType.Hackable},
Name | value | Description |
---|---|---|
None | 0 | No target. USe for apps which don't require any target at all. |
Data | 1 | Any data points currently visible to the player |
Interaction | 2 | Physical interactions in the levels |
Hackable | 4 | Hackable devices in player's current networks |
Character | 8 | People |
Menu options
Name | Description |
---|---|
always | App is always displayed in this menu. |
never | App will never be shown in this menu |
default | App will be set as favourite for this menu by default |
target | App will always display in Radial menu if current target matches the App's targets value. |
States
Name | Description |
---|---|
unavailable | The player doesn't have this app yet |
disabled | App can't be used at the moment, for example no network connection |
off | "App is not doing anything |
on | App is switched on and running in the background |
alert | "App displays alert to notify the player about something |