Post by mrdrpink on Mar 16, 2015 15:47:34 GMT
If anyone is interested with playing around with the LUA scripting I've gone ahead and posted the script entries to help out with your modifications.
Please note that some of these script entries might be out of date. Also if you do chose to edit your LUA Script files, please backup your files before hand.
LUA script locations
Scripts are stored as balance files called scripts.lua
In the Desktop folders there is a generic script file, used on all levels.
In the InitialWorldSetup folder and the individual mission folders are level specific files.
Script files contain event callbacks and general functions.
Event callbacks are only called by the game
2D screen co-ordinates
2D screen fractions are fractions of the screen - specifically fractions of the centred square of size min(scrWidth,scrHeight)
Values shown as cx,cy normally represent a centre-based co-ordinate system, x,y would represent a corner-based system
Persistent variables interface
Lua persistent variables are used by simply calling the Persist() function with the name of the variable, and optionally a value to set, or two values, in which case the second value is added to the current, the first is ignored
Note that the name is case insensitive
Examples:
soFar = Persist("TotalSculpts") -- sets soFar to the TotalSculpts persistent variable
soFar = Persist("TotalSculpts", 2) -- sets the TotalSculpts persistent variable to 2, returning the old value of TotalSculpts
soFar = Persist("TotalSculpts", 0, 1) -- adds one to the TotalSculpts persistent variable, returning the old value of TotalSculpts (the value before the addition)
The F9 console can be used to query and set these values outside of Lua: in F9 type persist,,<value>
Persistent variables are stored in the game save, so will be persisted for the life time of the game save.
LUA events callbacks
Event callbacks are of the form
function onThing():3
where 3 is the priority and is optional (i.e. no need for :3 or whatever), Thing is the event. By default scripts execute in the order they are loaded; using priorities you can specify the order.
onUpdate - called at the start of update every frame
onLateUpdate - called at the end of update every frame
onPreLoad - called after reading the level data but before game data load and setup
onPostLoad - called just before gameplay starts
onCameraPanStart - called when the camera starts moving
onCameraPanEnd - called when the camera stops moving
onTreeDestroyed - called when a tree is being destroyed by the player
onRockDestroyed - called when a rock is being destroyed by the player
onTempleComplete - called when a temple finishes building
onAbodeComplete - called when an abode finishes building
onAbodeSproggable - called when an abode becomes sproggable
onAbodeBuilding - called when an abode starts building
onFollowerSprogged - called when a follower is sprogged from a building
onKeyPressed - called when a key is pressed, context is the id of the key
onSculptStarted - called when a sculpt starts
onSculptComplete - called when a sculpt finished successfully, context is the id of the sculpt
onsculptblockedbylock - called when a voxel of a sculpt is blocked by SetSculptLock lua call
onCardReceived - called when a card is received
onCardDismissed - called when a card is dismissed
onAdvanceComplete - called when an advance card is completed; context is the unlock hash
onIntroComplete - called when the intro completes; context is 1 if the intro completed normally, 0 if it was cancelled
onRequesterDismissed - called when a requester has been dismissed by the user or by KillRequester
onTextDismissed - called when text has been cleared using ClearText
onFollowerBorn - called when a follower is born in an abode, context is the abode id
onResourceLevel - called when you go up a resource level, context is the resource level reached
onLevelUpCard - called when you get a spinning level up card thing
onBeliefGenerated - called when a house generates enough belief to be collectable
onCollectBelief - called when a house has belief collected
onReactionEnded – its parameter is the uid of the reaction that has ended
onStartPlay - called when the game is starting to display its first frame
onEnterHouse - called with the house id when a follower enters the house
onTimelineOpened - called when the timeline opens
onTimelineClosed - called when the timeline closes
onTimelineCloseClickedLocked - called when the timeline close button is clicked when the close button is locked
onBeliefMenuOpened - called when the belief menu is opened - context is 0 if from game, 1 if from sub-menu
onBeliefMenuClosed - called when the belief menu is closed - context is 0 if to game, 1 if to sub-menu
onPowerMenuOpened - called when the power menu is opened
onPowerMenuClosed - called when the power menu is closed
onFewFramesIn - called a few frames after the level has loaded
onLeashLongDrag - called when a leash is pulled past a configurable distance
onLeashcomplete - called when a leash is release, and followers are about to start walking towards the release position
onLeashcancel - called when a leash is cancel (eg, by shaking your finger to deactivate)
onLeashstart - called when the first follower/house has been leashed (ie, ring has shrunk and bing sfx played) and the user is still dragging
onLeashLongDrag - called when a leash is pulled past a configurable distance
onAbodeBuilderJoined - called once per level when a second builder joins a house construction
onWorldTap - called when the player taps the world; context is x*16 + y*16*65536 (also see WorldPosContextToXYZ, below)
onBettingScreen - called when the event betting screen is shown
onEventMissionBegin - called when the player completes the bidding screen and goes from preview to play mode in an event mission; context is the number of followers bid
onEventMissionEnd - called at the end of a mission when the reward screen is shown; context is 0 on failure, 1 on success
onObjectSelected - called when the object selection changes; context is the new selection
onWorkerAssigned - Called when a worker is assigned in settlement assign mode. Context value is the number of this worker assigned
onBreederAssigned - as above
onBufferAssigned - as above
onAssignStarted - In assign mode, this is called when an assign disc on a settlement has been held long enough so that the first follower to assign has been selected (ie, the first ring has shrunk completely).
onassignmodedeactivated - called assign mode has ended
onInfluenceChanged - triggers when influence area finishes changing
onGodPowerActive - triggers when a god power is activated
onGodPowerFinished - triggers when a god power finishes
onsettlementconfirmed - triggers when a user accepts a settlement merge
onsettlementcancelled - triggers when a user rejects a settlement merge
onsettlementmerged - triggers when a user either pinches or presses the merge button to merge the houses together
onsettlementpinchbegun - triggers when a user has started pinching the houses (pinch must be past a certain threshold to begin) in settlement compression mode
onsettlementpinchend - triggers when a user releases a pinch in settlement compression mode
onsettlementdragbegun - triggers when a user has started dragging the settlement compression ring (must be past a certain threshold to begin)
onsettlementdragend - triggers when a user releases a dragging the settlement compression ring
LUA game functions
Print(...) - prints the parameters to stdout
Log(...) - logs the parameters to the verbose log
Console(...) - logs the parameters to the on-screen console
ClearConsole() - clears the on-screen console
After(seconds, "function", context) - calls 'function' with parameter 'context' after 'seconds' seconds
NonPausingAfter(seconds, "function", context) - as After but doesn't pause when the game is paused
HashString("text") - returns the hash of the specified string
GetBuffValue("string") - returns a pair of (value, type) of the specified buff. Type is 0 for additive, 1 for multiplicative
mathFloor(value) - returns the mathematical floor of the specified value
IsDesktop() - returns true if the game is running on desktop
Random() - returns a random number between 0 and 1
TimeOfDay() - returns the time of day as a value between 0 and 1
Sunset() - returns sunset as a value in TimeOfDay units
Sunrise() - returns sunrise as a value in TimeOfDay units
Midday() - returns midday as a value in TimeOfDay units
CenterScreen() - returns the world position of the camera focus
PopulationCount([allegiance]) - returns the population count for the given allegiance. If allegiance parameter is not provided, returns the player's population.
Belief() - returns the players belief value
CardOwned(cardName) - returns a boolean showing whether the specified card is owned
CardComplete(cardName) - returns a boolean showing whether the specified card is complete
GiveCard(cardName, complete) - gives the player the specified card; if complete is set the advance card is completed as well
CardSilent(cardContext) - returns true if the specified card was given invisibly
AbodeCount() - returns the number of abodes in the world
BuildAbode(x, y, allegiance, bFull, jobType, isFactory, size, raceType, bFlattenGround) - constructs a building at the specified position - note: bXX are bools, the others are numbers
- jobType: 0 (builder) 1 (farmer) 2 (miner) 3 (champion) 4 (breeder) 5 (unemployed) 6 (buffer) 7 (merchant) 8 (astari)
- raceType: 0 (brown hair) 1 (red hair) 2 (champion) 3 (naked) 4 (astari)
CastPower(x,y,"power",allegiance,value, value2) - casts the specified god power at the specified position on behalf of the specified god. Currently works for (meaning of 'value' and 'value2' parameters shown in brackets):
- PlaceBuilding (orientation, not used)
- Swamp (not used, not used)
- Beautify (radius of effect, not used)
- Meteor (input angle, speed)
ResetStartPositions(player) - resets the list of start positions for the specified player
AddStartPosition(player, x, y) - adds a start positions for the specified player at the specified x/y position
Config("variable", value) - sets config variable "variable" to the specified value
GetConfig("variable") - gets the current value of the named config variable
Table("table", "column", row[, value]) - returns the table value described; if the 'value' parameter is passed the table value is set to this value
TableString("table", "column", row[, value]) - returns the table value described as a string (as long as the entry is a string)
AddNotification(x,y,z) - creates a notification icon at the specified position, returns a handle to it for RemoveNotification
RemoveNotification(id) - removes a previously created notification icon
IsPointOnScreen(x, y, marginFraction) - returns true if the specified 2D point at ground level is further than marginFraction of the screen away from the edge (for example if marginFraction is 0.1 then 10% into the screen)
IsAreaFlat(x, y, w, h) - checks whether the specified area is completely flat. Returns (isFlat, nonFlatX, nonFlatY)
IsRadiusFlat(x, y, r) - checks whether the specified radius is completely flat. Returns (isFlat, nonFlatX, nonFlatY)
PercentRadiusFlat(x, y, r) - returns the fraction (0..1) of the specified radius that is flat
PercentRadiusBelowStep(x, y, r, step) - returns the fraction (0..1) of the specified radius that is below the specified height step
Unlock(name) - unlocks the specified lock by name
OverrideInfluenceArea(name) - temporarily forces the specified influence area on
OverrideGodPowerLock(name) - overrides the locked status of the named god power (not saved)
IsPointInAreaOfInfluence(x,y) - does what is says, returns a boolean
AddToTimer(seconds) - adds the specified number of seconds to the game timer
TreePos(treeContext) - returns an x/y pair giving the position of the specified tree
PlotPos(plotContext) - returns an x/y pair giving the position of the specified plot
TempleType(templeContext) - returns the type of the specified temple
TempleUID(templeContext) - returns the UID of the specified temple
TemplePos(templeContext) - returns an x/y pair giving the position of the specified temple
TempleDoDamage(templeContext, damage) - does 'damage' damage to the specified temple
AbodePos(abodeContext) - returns an x/y pair giving the position of the specified abode
AbodeDoDamage(abodeContext, damage) - does 'damage' damage to the specified abode
AbodeForceBirth(abodeContext) - cause an immediate birth in the specified abode
AbodeOverrideBuildTimes(time) - overrides build times for all abodes
AbodeClearOverrideBuildTimes() - clears build time override
AbodeFillBelief(abodeContext) - fills a house with belief
AbodeType(abodeContext) - gets the type of a house; this is the 'order' value in the house table
AbodeRank(abodeContext) - gets the rank of a house
AbodeCanSprog(abodeContext) - returns true if the abode can sprog
AbodeIsInSettlement(abodeContext) - returns true if the abode is in a settlement
GetHeightAtPoint(x, y) - returns the height at the specified point
GetStepAtPoint(x, y) - returns the step number at the specified point
SculptPos(sculptContext) - returns an x/y pair giving the position of the start of the specified sculpt
SelectMission(missionID) - changes to the specified mission, zero for homeworld
LockCameraToRegion(x,y,w,h) - locks the game camera to the specified region
UnlockCameraToRegion() - unlocks the camera from a region lock
LockCamera() - locks the game camera; no camera user input will be honoured
UnlockCamera() - unlocks the game camera
LockZooming() - locks the camera zooming;
UnlockZooming() - unlocks the camera zooming
SetCamera(x, y, zoom) - moves the camera gracefully to the specified x/y location; if zoom is non-negative sets the zoom level to from zoomed in (0) to zoomed out (1)
SpawnFollower(allegiance, x, y, z, orientationInDegrees, race, boolFemale, job) - spawns a follower
SpawnThing("type", x, y, orientationInDegrees, toBeHit, onFire, depthUnderGround, "reward") - spawns a game item; type can be:
- tree1, tree2, tree3, tree4, tree5
- rock1, rock2, rock3, rock4, rock5, rock6, rock7
- wolf1
- treasure1, treasure2, treasure3, treasure4
- champion
HighlightArea(cx, cy, w, h, intensity) - highlights a specific area of the screen; cx, cy, w and h are in 2D screen fractions (see above); returns an id for the Clear function
ClearHighlightArea(id) - clears a previously created HighlightArea
LockInput(x1, y1, x2, y2, w) - locks input to a specific area of the screen; x1, y1, x2, y2 and w are in 2D screen fractions (see above); returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
LockInputWorld(x1, y1, x2, y2, w) - locks input to a specific area of the world; x1, y1, x2, y2 are world coordinates and w is in 2D screen fractions. Returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
LockInputWorldRadiusWorld(x1, y1, x2, y2, w) - locks input to a specific area of the screen; x1, y1, x2, y2 and w are in world coordinates. Returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
ClearLockInput(id) - clears a previously created LockInput
SnapTouchInput(x1, y1, r) - Snaps Input tap down events to the nearest position in locked input area if tap down occurs within r of (x1,y1). x1, y1, r are in 2D screen fractions (see above); returns an id for the Clear function.
ClearSnapTouchInput(id) - clears a previously created SnapTouchInput
LockTimelineInput(mode) -- Locks input when the timeline is open based on mode passed in. For the moment call with arg 0 to clear lock.
- 0 = No lock
- 1 = All locked
- 2 = All locked but sticker
DisableHUDElement(id) -- Allows you to hide any of the on-screen corner elements to be hidden. Arguments: -1 for all Elements or A flag index for the element you want to alter (To Be Provided).
- 0 = Population Bar
- 1 = Gems Bar
- 2 = Chat Bar
- 3 = Belief Bar
- 4 = Settings Bar (overriden in non-final mode)
- 5 = Info Buttons
- 6 = Alerts
- 7 = Battle Bar
- 8 = Expedition Bar
- 12 = Happiness Bar
EnableHUDElement(id) -- Re-Displays a previously hidden HUD element. Arguments: -1 for all Elements or A flag index for the element you want to alter (To Be Provided).
LockHudToOneComponent(id) -- Prevents all input, except through this one flash element Arguments: An ID number for the element (To Be Provided)
LockHudComponent(id) - Prevents input for this id Arguments: An ID number for the element
UnlockHudComponent(id) - Allows input for this id Arguments: An ID number for the element
UnlockAllHudComponents - Allows input to all hudelements
DisableTimelineOpening - Prevent the user from opening the timeline
EnableTimelineOpening - Allow the user to open the timeline
DisplayText(x, y, w, size, r,g,b, justify, pause, text) - create a text display; x, y and w are in 2D screen fractions (see above); returns an id for the Clear function. Justify is 0 (left), 1 (center), 2 (right). r,g,b are values 0..1 Pause is either true or false and specifies whether to pause the game while the text is shown.
ClearText(id) - clears the specified text display item
PlotInRadius(x, y, radius) - returns 0 if no plot found in radius, 1 otherwise
AbodeInRadius(x, y, radius) - returns 0 if no abode found in radius, 1 otherwise
TempleInRadius(x, y, radius) - returns 0 if no temple found in radius, 1 otherwise
FollowerInRadius(x, y, radius) - returns 0 if no follower found in radius, 1 otherwise
TreeInRadius(x, y, radius) - returns 0 if no tree found in radius, 1 otherwise
RockInRadius(x, y, radius) - returns 0 if no rock found in radius, 1 otherwise
GetFirstPlotInRadius(x, y, radius) - returns the context of the first plot found in the specified radius
GetFirstAbodeInRadius(x, y, radius) - returns the context of the first abode found in the specified radius
GetFirstTempleInRadius(x, y, radius) - returns the context of the first temple found in the specified radius
GetFirstFollowerInRadius(x, y, radius) - returns the context of the first follower found in the specified radius
GetFirstTreeInRadius(x, y, radius) - returns the context of the first plot tree in the specified radius
GetFirstRockInRadius(x, y, radius) - returns the context of the first plot rock in the specified radius
ProcessPlotsInRadius(x, y, radius, callback) - calls 'callback' on each plot within the radius, with a context identifying each one
ProcessAbodesInRadius(x, y, radius, callback) - calls 'callback' on each abode within the radius, with a context identifying each one
ProcessTemplesInRadius(x, y, radius, callback) - calls 'callback' on each temple within the radius, with a context identifying each one
ProcessFollowersInRadius(x, y, radius, callback) - calls 'callback' on each follower within the radius, with a context identifying each one
ProcessTreesInRadius(x, y, radius, callback) - calls 'callback' on each tree within the radius, with a context identifying each one
ProcessRocksInRadius(x, y, radius, callback) - calls 'callback' on each rock within the radius, with a context identifying each one
SelectTEMPLE(id) - Selects Temple with context id
SelectHOUSE(id)
SelectTREE(id)
SelectROCK(id)
SelectTREASURE(id)
SelectPLOT(id)
SelectDetailedFollower(id)
GetHappinessLevel(allegiance) - gets the happiness level for the specified allegiance
GetNumberOfPlacedGifts(allegiance) - gets the number of placed gift monuments of the specified allegiance; -1 for any allegiance
Persist("variable"[, setValue[, addValue]]) - gets the the current value of the specified variable; if a second parameter is given the value is replaced by this, if a third parameter is given the third value is added to the current, the second is ignored. See above for full details
LockActivity(activityId) - Locks the specified activity; activities are: 0 (Sculpt Up) 1 (Sculpt Down) 2 (Sprogging) 3 (Tree Tapping) 4 (Rock Tapping) 5 (Object Selection) -1 (All)
UnlockActivity(activityId) - Unlocks as above
VFXDisable(type) - Disables the specified VFX - type is: 0 (treasure indicator)
VFXEnable(type) - Re-enables a previously disabled VFX
ShowRequest(type, title, description, image[, xJustification[, yJustification]]) - shows a requester dialog and waits for mouse input. type is 1 (normal), image is currently ignored (pending Flash implementation). xJustification and yJustification specify the centring of the requester in the screen; 0 means left/top, 1 (default) is centre, 2 is right/bottom. Returns the requester id
KillRequest(id) - kills the specified requester
TriggerTip2D(x,y, boxX, boxY, text, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip at the specified 2D position, the second pair of xy coordinates determines the position of the tooltip box, returns an id to pass to ClearTip. Final optional arguments determine the various delays, negative for "don't do this", screenOverride can be used to force a tooltip to show behind or on top of fullscreen UI.
TriggerTip3D(x,y,z, text, type[, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip at the specified 3D position, returns an id to pass to ClearTip. Final optional arguments determine the various delays, negative for "don't do this"
TriggerTipGUI(GUIelement, plingText, context, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip on the specified GUI element [note: context can be a string or a number]:
- 0 - Belief button
- 1 - Gems button
- 2 - Settings button
- 3 - Multibar button
- 4 - Multibar card
- 5 - Multibar resource (context is number index of bar)
- 6 - Multibar bar (context is number index of bar)
- 7 - Timeline exit button
- 8 - Timeline card (context is the string name of the card)
- 9 - Timeline sticker (context is the string name of the sticker)
- 10 -Power select card (context is the string name of the card)
- 11- Power select menu (context is number index of menu item)
- 12 -Shop select card (context is the string name of the card)
- 13 - Info buttons (context is number index of button)
- 14 - Event timer
- 15 - Bidding slider button
- 16 - Card get - lock
- 17 - Card get - research
- 18 - Event temple
- 23 - Settlement button - breeders
- 24 - Settlement button - workers
- 25 - Settlement button - buffers
- 26 - Event map - boat
- 27 - Event map - dock (current)
- 28 - Event map - temple (current)
TriggerTipGameObject(context, text, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip tracking the specified game object
TriggerTipGameObjectAutoGUI(context, text, type, pip[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip tracking the specified auto-gui pip (by index) on the specified game objects
ClearTip(id) - clears the specified tool-tip
SetTipStemData(id, stemType[, len]) - alters the look of the stem of a tooltip. stemType: pass 0 for normal stem, 1 for tight stem, 2 for no stem. Last parameter controls stem length and is optional.
TriggerAlert(text, isFullScreenVisible) - triggers an alert showing the specified text; if isFullScreenVisible is true then the alert will appear on top of full screen Flash such as the timeline
ClearAlert() - clears a previously triggered alert
DisplayAction(type, speed, elevation, orientation, startX,Y,Z, endX,Y,Z, startReticuleAlpha, endReticuleAlpha, startWidth, startRadius, endWidth, endRadius) - creates an instance of the specified action. Returns an id for use in ClearAction. Start and end positions are in world co-ordinates. Alpha values are 0..1. Elevation and orientation are in degrees. Type is 1 (single finger), 2 (double finger) or 3 (single finger, hold on end). startWidth, startRadius, endWidth, endRadius can be left out (or set to -1) to use default values
ClearAction(id) - clears the specified DisplayAction
DisplayAction2D(type, speed, orientation, startX,Y, endX,Y, startReticuleAlpha, endReticuleAlpha) - creates an instance of the specified 2D action. Returns an id for use in ClearAction2D. Start and end positions are in 2D screen co-ordinates.
ClearAction2D(id) - clears the specified DisplayAction2D
SetStaminaSafeZone(x, y, radius) - defines a zone in which followers will not lose stamina
ClearStaminaSafeZone() - clears the stamina safe zone
DisplayRadius(x,y, radius, thickness, r,g,b) - adds a new radius display; thickness is currently ignored; r,g,b are 0..1; returns an id for ClearRadius
ClearRadius(id) - removes a radius display
CreateReaction(name, x, y) - creates a reaction in the world of the specified type. name is the case sensitive name as specified in reactions.csv; returns the uid of the reaction or 0 if one was not created
AttachReaction(name, itemID) - attaches a reaction to the specified game object. name is the case sensitive name as specified in reactions.csv
StopReaction(uID) - can be used to stop a reaction by passing in the uid of the reaction you would like to stop
ScrollToCard_Timeline(text) - Scroll the timeline (if it is visible and not doing anything clever) to center on the card hash text given.
ScrollToCard_PowerSelect(text) - Scroll the powerSelect screen (if it is visible and not doing anything clever) to center on the card hash text given.
TutorialPling_On - Activate one of the custom plingy circles. First argument is the type. Second argument is the hash string of the card/sticker you want to activate it for (if on timeline etc)
- 0 - Timeline: Card - Provide card hash
- 1 - Timeline: Sticker - Provide card hash
- 2 - Newcard: Lock Graphic - For the spinny just received card. No second argument needed
- 3 - Newcard: Research Icon - For the spinny just received card. No second argument needed
TutorialPling_Off - Dismiss the current pling
DebugSetCameraPos(x,y) - jumps the camera to the specified position
UndoSculpt(context) -Returns the land that was moved by sculpt context
SculptFinishedAtLocation(context, x, y) - Returns 1 if the sculpt context successfully adjusted the voxel at position (x,y)
SetSculptingLock(xmin, ymin, xmax, ymax) - Locks the sculpting to ONLY occur with the region specified
SetSculptingLock - Clears the above lock
ClearObjectSelection() - clears object selection
GetEventStage() - returns the current event stage
GetEventIndex() - returns the current event index
GetEventUID() - returns the current event UID
GetMissionDifficulty() - returns the current mission difficulty - 0 is easy, 2 is hard
GetMissionTimeRemaining() - returns the remaining time for this mission in seconds
GetNewestEvent() - returns the UID of the event with the highest start time
GetEventShipPopulation(eventUID) - returns the number of people left on the ship of the specified event, if no UID is provided, this will look at the currently selected event
GetEventShipCapacity(eventUID) - returns the maximum number of people that can fit on the ship of the specified event, if no UID is provided, this will look at the currently selected event
IsEventComplete(eventUID) - returns whether the specified event has been completed by the player, if no UID is provided, this will look at the currently selected event
WorldPosContextToXYZ(context) - Converts a returned position context into an x/y/z triple (see onWorldTap for an example)
LeashGetReleasePos(context) - Returns an x/y/z triple of the release position of the leash (only call after leashComplete callback has been issued).
LeashUndo(context) - Releases all followers/houses leashed by leash with id context
LeashSetLimit(context, limit) - Limits the number of followers/houses that can be leashed by leash with id context. Must be called after leash started callback received
LeashLongDragDist (distance) - Set the leash drag distance at which the callback onLeashLongDrag is called. Note, this is a global value, that will be used by every leash thereafter. Default value is 6.
ArrowCreate(red, green, blue, alpha, width, arrowSize) - creates a new (empty) arrow instance, returns an id for other functions
ArrowDestroy(id) - destroys the specified arrow
ArrowAddPoint(id, x, y, z) - adds a fixed point to the specified arrow
ArrowAddObject(id, context) - adds the specified item to the specified arrow
ArrowRemovePoint(id, x, y, z) - reverses ArrowAddPoint
ArrowRemoveObject(id, context) - reverses ArrowAddObject
LockSettlementAssignType(assigntypeid) - Locks the specified assign type in settlement assign mode; types are: 0 (worker) 1 (breeder) 2 (buffer) -1 (All)
UnlockSettlementAssignType(assigntypeid) - Unlocks as above
AssignModeDeactivate - Deactivates assign mode if active.
SendStepCompletedAnalytics(stepType, stepNumber) - Sends TutorialStepCompleted analytic event with specified step type (text, eg "Sculpting Tutorial") and specified step number.
PutSwampsOnBlight (x,y,w,h) - Places puddles using best fit algorithm on all the blighted land in the specified area. Normal puddles require a 2x2 area to appear, but 1x1 puddles can be forced to be placed by setting autoreg SwampSizeZeroPuddles to 1. (These puddles require significant testing before rolling out)
All puddles can be removed from map by pressing Left Ctrl + X
Puddles can be replaced on the map by pressing Left Shift + X
PlaceSwamp(x,y,z,size) - Places a swamp puddle at x y, of specified size, at step height z. To test, hold 'left ctrl' and 'm', then click on the map. A swamp of size SwampPudSize will be placed.
OverrideSettlementCapacity(context, capacity) - Overrides settlement capacity for settlement. 'context' should be a house context. Method returns 0 if house context did not have a settlement component, 1 for success.
PlayAudio(string mp3Name) - Play an mp3 file. mp3 name should be the name and the suffex .mp3, no directory path is needed. The mp3 file must be added to data/SoundBanks/Windows and data/SoundBanks/Mac.
OpenURL(url) - Opens the specified URL in an external web browser
Please note that some of these script entries might be out of date. Also if you do chose to edit your LUA Script files, please backup your files before hand.
LUA script locations
Scripts are stored as balance files called scripts.lua
In the Desktop folders there is a generic script file, used on all levels.
In the InitialWorldSetup folder and the individual mission folders are level specific files.
Script files contain event callbacks and general functions.
Event callbacks are only called by the game
2D screen co-ordinates
2D screen fractions are fractions of the screen - specifically fractions of the centred square of size min(scrWidth,scrHeight)
Values shown as cx,cy normally represent a centre-based co-ordinate system, x,y would represent a corner-based system
Persistent variables interface
Lua persistent variables are used by simply calling the Persist() function with the name of the variable, and optionally a value to set, or two values, in which case the second value is added to the current, the first is ignored
Note that the name is case insensitive
Examples:
soFar = Persist("TotalSculpts") -- sets soFar to the TotalSculpts persistent variable
soFar = Persist("TotalSculpts", 2) -- sets the TotalSculpts persistent variable to 2, returning the old value of TotalSculpts
soFar = Persist("TotalSculpts", 0, 1) -- adds one to the TotalSculpts persistent variable, returning the old value of TotalSculpts (the value before the addition)
The F9 console can be used to query and set these values outside of Lua: in F9 type persist,,<value>
Persistent variables are stored in the game save, so will be persisted for the life time of the game save.
LUA events callbacks
Event callbacks are of the form
function onThing():3
where 3 is the priority and is optional (i.e. no need for :3 or whatever), Thing is the event. By default scripts execute in the order they are loaded; using priorities you can specify the order.
onUpdate - called at the start of update every frame
onLateUpdate - called at the end of update every frame
onPreLoad - called after reading the level data but before game data load and setup
onPostLoad - called just before gameplay starts
onCameraPanStart - called when the camera starts moving
onCameraPanEnd - called when the camera stops moving
onTreeDestroyed - called when a tree is being destroyed by the player
onRockDestroyed - called when a rock is being destroyed by the player
onTempleComplete - called when a temple finishes building
onAbodeComplete - called when an abode finishes building
onAbodeSproggable - called when an abode becomes sproggable
onAbodeBuilding - called when an abode starts building
onFollowerSprogged - called when a follower is sprogged from a building
onKeyPressed - called when a key is pressed, context is the id of the key
onSculptStarted - called when a sculpt starts
onSculptComplete - called when a sculpt finished successfully, context is the id of the sculpt
onsculptblockedbylock - called when a voxel of a sculpt is blocked by SetSculptLock lua call
onCardReceived - called when a card is received
onCardDismissed - called when a card is dismissed
onAdvanceComplete - called when an advance card is completed; context is the unlock hash
onIntroComplete - called when the intro completes; context is 1 if the intro completed normally, 0 if it was cancelled
onRequesterDismissed - called when a requester has been dismissed by the user or by KillRequester
onTextDismissed - called when text has been cleared using ClearText
onFollowerBorn - called when a follower is born in an abode, context is the abode id
onResourceLevel - called when you go up a resource level, context is the resource level reached
onLevelUpCard - called when you get a spinning level up card thing
onBeliefGenerated - called when a house generates enough belief to be collectable
onCollectBelief - called when a house has belief collected
onReactionEnded – its parameter is the uid of the reaction that has ended
onStartPlay - called when the game is starting to display its first frame
onEnterHouse - called with the house id when a follower enters the house
onTimelineOpened - called when the timeline opens
onTimelineClosed - called when the timeline closes
onTimelineCloseClickedLocked - called when the timeline close button is clicked when the close button is locked
onBeliefMenuOpened - called when the belief menu is opened - context is 0 if from game, 1 if from sub-menu
onBeliefMenuClosed - called when the belief menu is closed - context is 0 if to game, 1 if to sub-menu
onPowerMenuOpened - called when the power menu is opened
onPowerMenuClosed - called when the power menu is closed
onFewFramesIn - called a few frames after the level has loaded
onLeashLongDrag - called when a leash is pulled past a configurable distance
onLeashcomplete - called when a leash is release, and followers are about to start walking towards the release position
onLeashcancel - called when a leash is cancel (eg, by shaking your finger to deactivate)
onLeashstart - called when the first follower/house has been leashed (ie, ring has shrunk and bing sfx played) and the user is still dragging
onLeashLongDrag - called when a leash is pulled past a configurable distance
onAbodeBuilderJoined - called once per level when a second builder joins a house construction
onWorldTap - called when the player taps the world; context is x*16 + y*16*65536 (also see WorldPosContextToXYZ, below)
onBettingScreen - called when the event betting screen is shown
onEventMissionBegin - called when the player completes the bidding screen and goes from preview to play mode in an event mission; context is the number of followers bid
onEventMissionEnd - called at the end of a mission when the reward screen is shown; context is 0 on failure, 1 on success
onObjectSelected - called when the object selection changes; context is the new selection
onWorkerAssigned - Called when a worker is assigned in settlement assign mode. Context value is the number of this worker assigned
onBreederAssigned - as above
onBufferAssigned - as above
onAssignStarted - In assign mode, this is called when an assign disc on a settlement has been held long enough so that the first follower to assign has been selected (ie, the first ring has shrunk completely).
onassignmodedeactivated - called assign mode has ended
onInfluenceChanged - triggers when influence area finishes changing
onGodPowerActive - triggers when a god power is activated
onGodPowerFinished - triggers when a god power finishes
onsettlementconfirmed - triggers when a user accepts a settlement merge
onsettlementcancelled - triggers when a user rejects a settlement merge
onsettlementmerged - triggers when a user either pinches or presses the merge button to merge the houses together
onsettlementpinchbegun - triggers when a user has started pinching the houses (pinch must be past a certain threshold to begin) in settlement compression mode
onsettlementpinchend - triggers when a user releases a pinch in settlement compression mode
onsettlementdragbegun - triggers when a user has started dragging the settlement compression ring (must be past a certain threshold to begin)
onsettlementdragend - triggers when a user releases a dragging the settlement compression ring
LUA game functions
Print(...) - prints the parameters to stdout
Log(...) - logs the parameters to the verbose log
Console(...) - logs the parameters to the on-screen console
ClearConsole() - clears the on-screen console
After(seconds, "function", context) - calls 'function' with parameter 'context' after 'seconds' seconds
NonPausingAfter(seconds, "function", context) - as After but doesn't pause when the game is paused
HashString("text") - returns the hash of the specified string
GetBuffValue("string") - returns a pair of (value, type) of the specified buff. Type is 0 for additive, 1 for multiplicative
mathFloor(value) - returns the mathematical floor of the specified value
IsDesktop() - returns true if the game is running on desktop
Random() - returns a random number between 0 and 1
TimeOfDay() - returns the time of day as a value between 0 and 1
Sunset() - returns sunset as a value in TimeOfDay units
Sunrise() - returns sunrise as a value in TimeOfDay units
Midday() - returns midday as a value in TimeOfDay units
CenterScreen() - returns the world position of the camera focus
PopulationCount([allegiance]) - returns the population count for the given allegiance. If allegiance parameter is not provided, returns the player's population.
Belief() - returns the players belief value
CardOwned(cardName) - returns a boolean showing whether the specified card is owned
CardComplete(cardName) - returns a boolean showing whether the specified card is complete
GiveCard(cardName, complete) - gives the player the specified card; if complete is set the advance card is completed as well
CardSilent(cardContext) - returns true if the specified card was given invisibly
AbodeCount() - returns the number of abodes in the world
BuildAbode(x, y, allegiance, bFull, jobType, isFactory, size, raceType, bFlattenGround) - constructs a building at the specified position - note: bXX are bools, the others are numbers
- jobType: 0 (builder) 1 (farmer) 2 (miner) 3 (champion) 4 (breeder) 5 (unemployed) 6 (buffer) 7 (merchant) 8 (astari)
- raceType: 0 (brown hair) 1 (red hair) 2 (champion) 3 (naked) 4 (astari)
CastPower(x,y,"power",allegiance,value, value2) - casts the specified god power at the specified position on behalf of the specified god. Currently works for (meaning of 'value' and 'value2' parameters shown in brackets):
- PlaceBuilding (orientation, not used)
- Swamp (not used, not used)
- Beautify (radius of effect, not used)
- Meteor (input angle, speed)
ResetStartPositions(player) - resets the list of start positions for the specified player
AddStartPosition(player, x, y) - adds a start positions for the specified player at the specified x/y position
Config("variable", value) - sets config variable "variable" to the specified value
GetConfig("variable") - gets the current value of the named config variable
Table("table", "column", row[, value]) - returns the table value described; if the 'value' parameter is passed the table value is set to this value
TableString("table", "column", row[, value]) - returns the table value described as a string (as long as the entry is a string)
AddNotification(x,y,z) - creates a notification icon at the specified position, returns a handle to it for RemoveNotification
RemoveNotification(id) - removes a previously created notification icon
IsPointOnScreen(x, y, marginFraction) - returns true if the specified 2D point at ground level is further than marginFraction of the screen away from the edge (for example if marginFraction is 0.1 then 10% into the screen)
IsAreaFlat(x, y, w, h) - checks whether the specified area is completely flat. Returns (isFlat, nonFlatX, nonFlatY)
IsRadiusFlat(x, y, r) - checks whether the specified radius is completely flat. Returns (isFlat, nonFlatX, nonFlatY)
PercentRadiusFlat(x, y, r) - returns the fraction (0..1) of the specified radius that is flat
PercentRadiusBelowStep(x, y, r, step) - returns the fraction (0..1) of the specified radius that is below the specified height step
Unlock(name) - unlocks the specified lock by name
OverrideInfluenceArea(name) - temporarily forces the specified influence area on
OverrideGodPowerLock(name) - overrides the locked status of the named god power (not saved)
IsPointInAreaOfInfluence(x,y) - does what is says, returns a boolean
AddToTimer(seconds) - adds the specified number of seconds to the game timer
TreePos(treeContext) - returns an x/y pair giving the position of the specified tree
PlotPos(plotContext) - returns an x/y pair giving the position of the specified plot
TempleType(templeContext) - returns the type of the specified temple
TempleUID(templeContext) - returns the UID of the specified temple
TemplePos(templeContext) - returns an x/y pair giving the position of the specified temple
TempleDoDamage(templeContext, damage) - does 'damage' damage to the specified temple
AbodePos(abodeContext) - returns an x/y pair giving the position of the specified abode
AbodeDoDamage(abodeContext, damage) - does 'damage' damage to the specified abode
AbodeForceBirth(abodeContext) - cause an immediate birth in the specified abode
AbodeOverrideBuildTimes(time) - overrides build times for all abodes
AbodeClearOverrideBuildTimes() - clears build time override
AbodeFillBelief(abodeContext) - fills a house with belief
AbodeType(abodeContext) - gets the type of a house; this is the 'order' value in the house table
AbodeRank(abodeContext) - gets the rank of a house
AbodeCanSprog(abodeContext) - returns true if the abode can sprog
AbodeIsInSettlement(abodeContext) - returns true if the abode is in a settlement
GetHeightAtPoint(x, y) - returns the height at the specified point
GetStepAtPoint(x, y) - returns the step number at the specified point
SculptPos(sculptContext) - returns an x/y pair giving the position of the start of the specified sculpt
SelectMission(missionID) - changes to the specified mission, zero for homeworld
LockCameraToRegion(x,y,w,h) - locks the game camera to the specified region
UnlockCameraToRegion() - unlocks the camera from a region lock
LockCamera() - locks the game camera; no camera user input will be honoured
UnlockCamera() - unlocks the game camera
LockZooming() - locks the camera zooming;
UnlockZooming() - unlocks the camera zooming
SetCamera(x, y, zoom) - moves the camera gracefully to the specified x/y location; if zoom is non-negative sets the zoom level to from zoomed in (0) to zoomed out (1)
SpawnFollower(allegiance, x, y, z, orientationInDegrees, race, boolFemale, job) - spawns a follower
SpawnThing("type", x, y, orientationInDegrees, toBeHit, onFire, depthUnderGround, "reward") - spawns a game item; type can be:
- tree1, tree2, tree3, tree4, tree5
- rock1, rock2, rock3, rock4, rock5, rock6, rock7
- wolf1
- treasure1, treasure2, treasure3, treasure4
- champion
HighlightArea(cx, cy, w, h, intensity) - highlights a specific area of the screen; cx, cy, w and h are in 2D screen fractions (see above); returns an id for the Clear function
ClearHighlightArea(id) - clears a previously created HighlightArea
LockInput(x1, y1, x2, y2, w) - locks input to a specific area of the screen; x1, y1, x2, y2 and w are in 2D screen fractions (see above); returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
LockInputWorld(x1, y1, x2, y2, w) - locks input to a specific area of the world; x1, y1, x2, y2 are world coordinates and w is in 2D screen fractions. Returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
LockInputWorldRadiusWorld(x1, y1, x2, y2, w) - locks input to a specific area of the screen; x1, y1, x2, y2 and w are in world coordinates. Returns an id for the Clear function. Locked screen area will be an vector from (x1,y1) to (x2,y2) with width w.
ClearLockInput(id) - clears a previously created LockInput
SnapTouchInput(x1, y1, r) - Snaps Input tap down events to the nearest position in locked input area if tap down occurs within r of (x1,y1). x1, y1, r are in 2D screen fractions (see above); returns an id for the Clear function.
ClearSnapTouchInput(id) - clears a previously created SnapTouchInput
LockTimelineInput(mode) -- Locks input when the timeline is open based on mode passed in. For the moment call with arg 0 to clear lock.
- 0 = No lock
- 1 = All locked
- 2 = All locked but sticker
DisableHUDElement(id) -- Allows you to hide any of the on-screen corner elements to be hidden. Arguments: -1 for all Elements or A flag index for the element you want to alter (To Be Provided).
- 0 = Population Bar
- 1 = Gems Bar
- 2 = Chat Bar
- 3 = Belief Bar
- 4 = Settings Bar (overriden in non-final mode)
- 5 = Info Buttons
- 6 = Alerts
- 7 = Battle Bar
- 8 = Expedition Bar
- 12 = Happiness Bar
EnableHUDElement(id) -- Re-Displays a previously hidden HUD element. Arguments: -1 for all Elements or A flag index for the element you want to alter (To Be Provided).
LockHudToOneComponent(id) -- Prevents all input, except through this one flash element Arguments: An ID number for the element (To Be Provided)
LockHudComponent(id) - Prevents input for this id Arguments: An ID number for the element
UnlockHudComponent(id) - Allows input for this id Arguments: An ID number for the element
UnlockAllHudComponents - Allows input to all hudelements
DisableTimelineOpening - Prevent the user from opening the timeline
EnableTimelineOpening - Allow the user to open the timeline
DisplayText(x, y, w, size, r,g,b, justify, pause, text) - create a text display; x, y and w are in 2D screen fractions (see above); returns an id for the Clear function. Justify is 0 (left), 1 (center), 2 (right). r,g,b are values 0..1 Pause is either true or false and specifies whether to pause the game while the text is shown.
ClearText(id) - clears the specified text display item
PlotInRadius(x, y, radius) - returns 0 if no plot found in radius, 1 otherwise
AbodeInRadius(x, y, radius) - returns 0 if no abode found in radius, 1 otherwise
TempleInRadius(x, y, radius) - returns 0 if no temple found in radius, 1 otherwise
FollowerInRadius(x, y, radius) - returns 0 if no follower found in radius, 1 otherwise
TreeInRadius(x, y, radius) - returns 0 if no tree found in radius, 1 otherwise
RockInRadius(x, y, radius) - returns 0 if no rock found in radius, 1 otherwise
GetFirstPlotInRadius(x, y, radius) - returns the context of the first plot found in the specified radius
GetFirstAbodeInRadius(x, y, radius) - returns the context of the first abode found in the specified radius
GetFirstTempleInRadius(x, y, radius) - returns the context of the first temple found in the specified radius
GetFirstFollowerInRadius(x, y, radius) - returns the context of the first follower found in the specified radius
GetFirstTreeInRadius(x, y, radius) - returns the context of the first plot tree in the specified radius
GetFirstRockInRadius(x, y, radius) - returns the context of the first plot rock in the specified radius
ProcessPlotsInRadius(x, y, radius, callback) - calls 'callback' on each plot within the radius, with a context identifying each one
ProcessAbodesInRadius(x, y, radius, callback) - calls 'callback' on each abode within the radius, with a context identifying each one
ProcessTemplesInRadius(x, y, radius, callback) - calls 'callback' on each temple within the radius, with a context identifying each one
ProcessFollowersInRadius(x, y, radius, callback) - calls 'callback' on each follower within the radius, with a context identifying each one
ProcessTreesInRadius(x, y, radius, callback) - calls 'callback' on each tree within the radius, with a context identifying each one
ProcessRocksInRadius(x, y, radius, callback) - calls 'callback' on each rock within the radius, with a context identifying each one
SelectTEMPLE(id) - Selects Temple with context id
SelectHOUSE(id)
SelectTREE(id)
SelectROCK(id)
SelectTREASURE(id)
SelectPLOT(id)
SelectDetailedFollower(id)
GetHappinessLevel(allegiance) - gets the happiness level for the specified allegiance
GetNumberOfPlacedGifts(allegiance) - gets the number of placed gift monuments of the specified allegiance; -1 for any allegiance
Persist("variable"[, setValue[, addValue]]) - gets the the current value of the specified variable; if a second parameter is given the value is replaced by this, if a third parameter is given the third value is added to the current, the second is ignored. See above for full details
LockActivity(activityId) - Locks the specified activity; activities are: 0 (Sculpt Up) 1 (Sculpt Down) 2 (Sprogging) 3 (Tree Tapping) 4 (Rock Tapping) 5 (Object Selection) -1 (All)
UnlockActivity(activityId) - Unlocks as above
VFXDisable(type) - Disables the specified VFX - type is: 0 (treasure indicator)
VFXEnable(type) - Re-enables a previously disabled VFX
ShowRequest(type, title, description, image[, xJustification[, yJustification]]) - shows a requester dialog and waits for mouse input. type is 1 (normal), image is currently ignored (pending Flash implementation). xJustification and yJustification specify the centring of the requester in the screen; 0 means left/top, 1 (default) is centre, 2 is right/bottom. Returns the requester id
KillRequest(id) - kills the specified requester
TriggerTip2D(x,y, boxX, boxY, text, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip at the specified 2D position, the second pair of xy coordinates determines the position of the tooltip box, returns an id to pass to ClearTip. Final optional arguments determine the various delays, negative for "don't do this", screenOverride can be used to force a tooltip to show behind or on top of fullscreen UI.
TriggerTip3D(x,y,z, text, type[, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip at the specified 3D position, returns an id to pass to ClearTip. Final optional arguments determine the various delays, negative for "don't do this"
TriggerTipGUI(GUIelement, plingText, context, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip on the specified GUI element [note: context can be a string or a number]:
- 0 - Belief button
- 1 - Gems button
- 2 - Settings button
- 3 - Multibar button
- 4 - Multibar card
- 5 - Multibar resource (context is number index of bar)
- 6 - Multibar bar (context is number index of bar)
- 7 - Timeline exit button
- 8 - Timeline card (context is the string name of the card)
- 9 - Timeline sticker (context is the string name of the sticker)
- 10 -Power select card (context is the string name of the card)
- 11- Power select menu (context is number index of menu item)
- 12 -Shop select card (context is the string name of the card)
- 13 - Info buttons (context is number index of button)
- 14 - Event timer
- 15 - Bidding slider button
- 16 - Card get - lock
- 17 - Card get - research
- 18 - Event temple
- 23 - Settlement button - breeders
- 24 - Settlement button - workers
- 25 - Settlement button - buffers
- 26 - Event map - boat
- 27 - Event map - dock (current)
- 28 - Event map - temple (current)
TriggerTipGameObject(context, text, type[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip tracking the specified game object
TriggerTipGameObjectAutoGUI(context, text, type, pip[, screenOverride, hintDelay, closeDelay, flashDelay, circleDelay, soundDelay]) - triggers a tool-tip tracking the specified auto-gui pip (by index) on the specified game objects
ClearTip(id) - clears the specified tool-tip
SetTipStemData(id, stemType[, len]) - alters the look of the stem of a tooltip. stemType: pass 0 for normal stem, 1 for tight stem, 2 for no stem. Last parameter controls stem length and is optional.
TriggerAlert(text, isFullScreenVisible) - triggers an alert showing the specified text; if isFullScreenVisible is true then the alert will appear on top of full screen Flash such as the timeline
ClearAlert() - clears a previously triggered alert
DisplayAction(type, speed, elevation, orientation, startX,Y,Z, endX,Y,Z, startReticuleAlpha, endReticuleAlpha, startWidth, startRadius, endWidth, endRadius) - creates an instance of the specified action. Returns an id for use in ClearAction. Start and end positions are in world co-ordinates. Alpha values are 0..1. Elevation and orientation are in degrees. Type is 1 (single finger), 2 (double finger) or 3 (single finger, hold on end). startWidth, startRadius, endWidth, endRadius can be left out (or set to -1) to use default values
ClearAction(id) - clears the specified DisplayAction
DisplayAction2D(type, speed, orientation, startX,Y, endX,Y, startReticuleAlpha, endReticuleAlpha) - creates an instance of the specified 2D action. Returns an id for use in ClearAction2D. Start and end positions are in 2D screen co-ordinates.
ClearAction2D(id) - clears the specified DisplayAction2D
SetStaminaSafeZone(x, y, radius) - defines a zone in which followers will not lose stamina
ClearStaminaSafeZone() - clears the stamina safe zone
DisplayRadius(x,y, radius, thickness, r,g,b) - adds a new radius display; thickness is currently ignored; r,g,b are 0..1; returns an id for ClearRadius
ClearRadius(id) - removes a radius display
CreateReaction(name, x, y) - creates a reaction in the world of the specified type. name is the case sensitive name as specified in reactions.csv; returns the uid of the reaction or 0 if one was not created
AttachReaction(name, itemID) - attaches a reaction to the specified game object. name is the case sensitive name as specified in reactions.csv
StopReaction(uID) - can be used to stop a reaction by passing in the uid of the reaction you would like to stop
ScrollToCard_Timeline(text) - Scroll the timeline (if it is visible and not doing anything clever) to center on the card hash text given.
ScrollToCard_PowerSelect(text) - Scroll the powerSelect screen (if it is visible and not doing anything clever) to center on the card hash text given.
TutorialPling_On - Activate one of the custom plingy circles. First argument is the type. Second argument is the hash string of the card/sticker you want to activate it for (if on timeline etc)
- 0 - Timeline: Card - Provide card hash
- 1 - Timeline: Sticker - Provide card hash
- 2 - Newcard: Lock Graphic - For the spinny just received card. No second argument needed
- 3 - Newcard: Research Icon - For the spinny just received card. No second argument needed
TutorialPling_Off - Dismiss the current pling
DebugSetCameraPos(x,y) - jumps the camera to the specified position
UndoSculpt(context) -Returns the land that was moved by sculpt context
SculptFinishedAtLocation(context, x, y) - Returns 1 if the sculpt context successfully adjusted the voxel at position (x,y)
SetSculptingLock(xmin, ymin, xmax, ymax) - Locks the sculpting to ONLY occur with the region specified
SetSculptingLock - Clears the above lock
ClearObjectSelection() - clears object selection
GetEventStage() - returns the current event stage
GetEventIndex() - returns the current event index
GetEventUID() - returns the current event UID
GetMissionDifficulty() - returns the current mission difficulty - 0 is easy, 2 is hard
GetMissionTimeRemaining() - returns the remaining time for this mission in seconds
GetNewestEvent() - returns the UID of the event with the highest start time
GetEventShipPopulation(eventUID) - returns the number of people left on the ship of the specified event, if no UID is provided, this will look at the currently selected event
GetEventShipCapacity(eventUID) - returns the maximum number of people that can fit on the ship of the specified event, if no UID is provided, this will look at the currently selected event
IsEventComplete(eventUID) - returns whether the specified event has been completed by the player, if no UID is provided, this will look at the currently selected event
WorldPosContextToXYZ(context) - Converts a returned position context into an x/y/z triple (see onWorldTap for an example)
LeashGetReleasePos(context) - Returns an x/y/z triple of the release position of the leash (only call after leashComplete callback has been issued).
LeashUndo(context) - Releases all followers/houses leashed by leash with id context
LeashSetLimit(context, limit) - Limits the number of followers/houses that can be leashed by leash with id context. Must be called after leash started callback received
LeashLongDragDist (distance) - Set the leash drag distance at which the callback onLeashLongDrag is called. Note, this is a global value, that will be used by every leash thereafter. Default value is 6.
ArrowCreate(red, green, blue, alpha, width, arrowSize) - creates a new (empty) arrow instance, returns an id for other functions
ArrowDestroy(id) - destroys the specified arrow
ArrowAddPoint(id, x, y, z) - adds a fixed point to the specified arrow
ArrowAddObject(id, context) - adds the specified item to the specified arrow
ArrowRemovePoint(id, x, y, z) - reverses ArrowAddPoint
ArrowRemoveObject(id, context) - reverses ArrowAddObject
LockSettlementAssignType(assigntypeid) - Locks the specified assign type in settlement assign mode; types are: 0 (worker) 1 (breeder) 2 (buffer) -1 (All)
UnlockSettlementAssignType(assigntypeid) - Unlocks as above
AssignModeDeactivate - Deactivates assign mode if active.
SendStepCompletedAnalytics(stepType, stepNumber) - Sends TutorialStepCompleted analytic event with specified step type (text, eg "Sculpting Tutorial") and specified step number.
PutSwampsOnBlight (x,y,w,h) - Places puddles using best fit algorithm on all the blighted land in the specified area. Normal puddles require a 2x2 area to appear, but 1x1 puddles can be forced to be placed by setting autoreg SwampSizeZeroPuddles to 1. (These puddles require significant testing before rolling out)
All puddles can be removed from map by pressing Left Ctrl + X
Puddles can be replaced on the map by pressing Left Shift + X
PlaceSwamp(x,y,z,size) - Places a swamp puddle at x y, of specified size, at step height z. To test, hold 'left ctrl' and 'm', then click on the map. A swamp of size SwampPudSize will be placed.
OverrideSettlementCapacity(context, capacity) - Overrides settlement capacity for settlement. 'context' should be a house context. Method returns 0 if house context did not have a settlement component, 1 for success.
PlayAudio(string mp3Name) - Play an mp3 file. mp3 name should be the name and the suffex .mp3, no directory path is needed. The mp3 file must be added to data/SoundBanks/Windows and data/SoundBanks/Mac.
OpenURL(url) - Opens the specified URL in an external web browser