Hpl3:Community:scripting:custom depth:station apps

From Frictional Wiki
Revision as of 14:42, 9 July 2020 by Maintenance script (talk | contribs) (Upload from wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Station Gui - Apps

The functions in this page originate from different script files. Look at the header for each section to know which script to include to use the functions in that section.


Airlock Pressure

To use functions in this section, add #include “helper_imgui_station_app_airlockpressure.hps” to the top of your script file.

StationGui_AirlockPressure

void StationGui_AirlockPressure(
				const tString &in asStatus, 
				float afPressure, 
				bool abStatusIsWarning)

Parameters

  • tString: The message to display in the status window.
  • afPressure: The pressure level, on a range from 0.0 - 1.0.
  • abStatusIsWarning: If true, the status message will blink red.

Remarks

While the typical range for afPressure is from 0.0 - 1.0, this places the indicator somewhere between the "IN" and "OUT" markers. If desired, you can also put values outside the range to make the indicator appear to the left or right of those markers.

Note: This function sets the Trans Category internally and doesn't change it back. If you're getting errors related to a missing trans category entry, use ImGui_SetTransCategory after calling this function.


Audio Playback

To use functions in this section, add #include “helper_imgui_station_app_audioplayback.hps” to the top of your script file.

StationGui_AudioPlaybackApp

int StationGui_AudioPlaybackApp(
				cStationGui_AudioPlaybackSettings aSettings = cStationGui_AudioPlaybackSettings())

Parameters

  • (Optional) aSettings: The message to display in the status window.

Returns

  • int: The index of the selected voice file, or -1 if no voice file is selected.

Remarks

This function creates an audio player widget that uses a list of audio files, each of which automatically generates a playlist entry in the widget.

Add voice files to the audio player using Depth_ImGui_AddAudioFile_Sound or Depth_ImGui_AddAudioFile_Voice.


StationGui_VoicePlaybackWindow

bool StationGui_VoicePlaybackWindow(
				const tString &in asFile, 
				const tString &in asSubject, 
				const tString &in asVoiceCallback,
				const cVector3f &in avPos, 
				const cVector2f &in avSize, 
				float afFontSizeMul = 1.0f)

Parameters

  • asFile: The text to display above the audio player.
  • asSubject: The voice subject to play.
  • asVoiceCallback: The name of the callback function to execute when voice playback ends.
  • avPos: The position of the window.
  • avSize: The size of the window.
  • (Optional) afFontSizeMul: The font size multiplier.

Returns

  • bool: Whether the play button was pressed.

Remarks

This function adds a widget for playing a single voice file.


StationGui_VoicePlaybackButton

bool StationGui_VoicePlaybackButton(
				const tString &in asSubject, 
				const tString &in asVoiceCallback, 
				const cVector3f &in avPos, 
				const cVector2f &in avSize)

Parameters

  • asSubject: The voice subject to play.
  • asVoiceCallback: The name of the callback function to execute when voice playback ends.
  • avPos: The position of the button.
  • avSize: The size of the button.

Returns

  • bool: Whether the button was pressed.

Remarks

This function adds a button that plays a voice file when it is pressed.


StationGui_VoicePlaybackButtonExt

bool StationGui_VoicePlaybackButtonExt(
				const tString &in asSubject, 
				const tString &in asVoiceCallback, 
				const cVector3f &in avPos, 
				const cVector2f &in avSize
				const cImGuiButtonData &in aButton)

Parameters

  • asSubject: The voice subject to play.
  • asVoiceCallback: The name of the callback function to execute when voice playback ends.
  • avPos: The position of the button.
  • avSize: The size of the button.
  • aButton: The data to use for the button.

Returns

  • bool: Whether the button was pressed.

Remarks

This function adds a button that plays a voice file when it is pressed, using a specified cImGuiButtonData as the button data.


StationGui_StartVoicePlayback

void StationGui_StartVoicePlayback(
				const tString &in asTerminal, 
				const tString &in asSubject, 
				const tString &in asCallback)

Parameters

  • asTerminal: The name of the terminal to play the voice from.
  • asSubject: The voice subject to play.
  • asCallback: The name of the callback function to execute when voice playback ends.

Remarks

This is a utility function to play a voice subject from a terminal.


StationGui_StopVoicePlayback

void StationGui_StopVoicePlayback(
				const tString &in asTerminal, 
				bool abResetTime)

Parameters

  • asTerminal: The name of the terminal to stop the voice playback from.
  • abResetTime: Whether the playback counter of the terminal should be reset to zero.

Remarks

This is a utility function to stop playback of a voice subject from a terminal.


StationGui_AudioPlaybackWindow

void StationGui_AudioPlaybackWindow(
				const tString &in asDisplayName, 
				const tString &in asAudioFileName, 
				const cVector3f &in avPos, 
				const cVector2f &in avSize, 
				float afFontSizeMul = 1.0f)

Parameters

  • asDisplayName: The text to display above the audio player.
  • asAudioFileName: The audio file to play.
  • avPos: The position of the window.
  • avSize: The size of the window.
  • (Optional) afFontSizeMul: The font size multiplier.

Remarks

This function adds a widget for playing a single audio file.


StationGui_StartAudioPlayback

void StationGui_StartAudioPlayback(
				const tString &in asTerminal, 
				const tString &in asSoundFile = "")

Parameters

  • asTerminal: The name of the terminal to stop the sound playback from.
  • (Optional) asSoundFile: The sound file to play. (If empty, a TODO message is printed automatically.)

Remarks

This is a utility function to play an audio file from a terminal.


StationGui_StopAudioPlayback

void StationGui_StopAudioPlayback(
				const tString &in asTerminal,
				bool abResetTime)

Parameters

  • asTerminal: The name of the terminal to play the voice from.
  • abResetTime: Whether the playback counter of the terminal should be reset to zero.

Remarks

This is a utility function to stop playback of an audio file from a terminal.


Door Locks

To use functions in this section, add #include “helper_imgui_station_app_doorlocks.hps” to the top of your script file.


StationGui_DoorLockApp

void StationGui_DoorLockApp(
				const cStationGui_DoorLockAppSettings &in aSettings = cStationGui_DoorLockAppSettings())

Parameters

  • (Optional) aSettings: The data to use for the app window.

Remarks

This function adds a widget that handles automatic door locks based on an interactive map overlay. Add locks to the widget by calling StationGui_DoorLockApp_AddLock.


StationGui_DoorLockApp

void StationGui_DoorLockApp_AddLock(
				const cDoorLockAppButton &in aButton)

Parameters

  • (Optional) aButton: The button data to use for the lock.

Remarks

This function adds a lock object to a DoorLockApp.


Error

To use functions in this section, add #include “helper_imgui_station_app_error.hps” to the top of your script file.


StationGui_GetError

tString StationGui_GetError()

Returns

  • tString: The current StationGui error message.

Remarks

This function returns the current StationGui error message.


StationGui_SetError

void StationGui_SetError(
				const tString&in asErrorMsg, 
				const tString &in asSoundEffect = "")

Parameters

  • asErrorMsg: The error message.
  • (Optional) asSoundEffect: The name of the sound effect to play when the error message is displayed.

Remarks

This function sets the current StationGui error message to the given value.


StationGui_SetError

void StationGui_SetError(
				const tString&in asTerminal,
				const tString&in asErrorMsg, 
				const tString &in asSoundEffect = "")

Parameters

  • asTerminal: The terminal to set the error message for.
  • asErrorMsg: The error message.
  • (Optional) asSoundEffect: The name of the sound effect to play when the error message is displayed.

Remarks

This function sets the current StationGui error message to the given value. This overload is for setting the error message for a specific terminal.


StationGui_ErrorBox

bool StationGui_ErrorBox(
				bool abDisplayOKButton = true)

Parameters

  • (Optional) abDisplayOKButton: Whether an OK button is displayed in the dialog box.

Returns

  • bool: Whether the OK button has been pressed.

Remarks

This function retrieves the current StationGui error message and displays it in a dialog box in the center of the terminal screen. If the error message is not set, this function returns true without displaying anything. Set the current error message by calling StationGui_SetError.


StationGui_ErrorBox

bool StationGui_ErrorBox(
				const tString &in asError, 
				const cGuiDialogBoxSettings &in aDialogBox))

Parameters

  • asError: The error message to display.
  • aDialogBox: The data to use for the dialog box.

Returns

  • bool: Whether the OK button has been pressed.

Remarks

This function displays a given error message in a dialog box in the center of the terminal screen.


StationGui_DrawAndCheckErrors

bool StationGui_DrawAndCheckErrors(
				const cStationGui_ErrorSettings &in aSettings = cStationGui_ErrorSettings())

Parameters

  • (Optional) aSettings: The data to use for the error box.

Returns

  • bool: Whether an error message is currently displayed.

Remarks

This function retrieves the current StationGui error message and displays it in a dialog box in the center of the terminal screen. If the error message is not set, this function returns true without displaying anything. Set the current error message by calling StationGui_SetError.


Mail

To use functions in this section, add #include “helper_imgui_station_app_mail.hps” to the top of your script file.


StationGui_MailApp

void StationGui_MailApp(
				const tString &in asSendMailCallback = "")

Parameters

  • (Optional) asSendMailCallback: The callback function for when a Send button is pressed.

Remarks

This function creates an email widget. Add emails by using calls to Depth_ImGui_AddMail.

The callback signature is bool functionName(const tString &in asTitle).


Numpad

To use functions in this section, add #include “helper_imgui_station_app_numpad.hps” to the top of your script file.


StationGui_MailApp

bool StationGui_Numpad(
				const tString &in asHeader, 
				uint alMaxChars, 
				float afNumpadDisplayRatio = 0.2, 
				const cVector3f &in avPos = ImGui_NrmPos(cVector3f(0.125, 0.1, 1.5)), 
				const cVector2f &in avSize = ImGui_NrmSizeGroup(cVector2f(0.75, 0.675)))

Parameters

  • asHeader: The text to display at the top of the app.
  • alMaxChars: The number of characcters in the passcode.
  • afNumpadDisplayRatio: The ratio that determines the height of the numpad portion of the app.
  • (Optional) avPos: The position of the app.
  • (Optional) avSize: The size of the app.

Returns

  • bool: Returns true if the OK button was pressed.

Remarks

This function creates a number pad app for numerical code entry. It does not handle checking the code against a passcode automatically - manually check the input code by calling StationGui_GetNumpadInput.


StationGui_MailApp

tString StationGui_GetNumpadInput()

Returns

  • tString: Returns the current input in the numpad app.

Remarks

Use this function to check the current input against a particular passcode.


StationGui_MailApp

void StationGui_SetNumpadInput(
				const tString &in asInput)

Parameters

  • asInput: The input of the numpad.

Remarks

Use this function if you need to manually set the number pad's value.


Photo Viewer

To use functions in this section, add #include “helper_imgui_station_app_photoviewer.hps” to the top of your script file.


StationGui_PhotoViewer

int StationGui_PhotoViewer(
				const tString &in asCaption = "", 
				const tString &in asName = "", 
				const cStationGui_PhotoViewerSettings &in aSettings = cStationGui_PhotoViewerSettings())

Parameters

  • (Optional) asCaption: The caption to display at the top of the app.
  • (Optional) asName: The name of this instance of the app.
  • (Optional) aSettings: The settings to use for the app.

Returns

  • int: The index of the selected photo.

Remarks

This function creates a photo viewer widget that displays a slideshow of photos. Add photos to the app using Depth_ImGui_AddPhotoFile.