After much demand, here is a guide on how to set up a basic terminal in SOMA.This guide will cover these concepts:
The guide will not cover more advanced topics like password input, video cameras, locking doors, etc. Those will be in a later guide, so if you're searching for an advanced topic like one of the ones I've listed then be patient until a guide is made for them. Keep in mind, there are few limits to what you can pull off with a terminal; I'll be teaching you how to quickly set up the normal terminals seen throughout SOMA, but you can also setup GUI for things like the laptop at the start of the game, and, as far as I know, much more advanced and interactive GUI than the basic stuff if you have the patience for it.
I also recommend you know the following things first:
After you've done ALLLLL this crap, or the things you think are necessary, then follow me to the basic setup.
Alright. So to start off, make sure you have a map set up with the terminal you want. Name the terminal something you'll remember thats code friendly. (IE coolTerminal, cool_terminal, etc) If you select the terminal, you should see something like this in it's entity tab:
If not, then find another terminal to use that has this menu. (I imagine there are ways to create any entity into a terminal with the model editor, but I have not looked yet.) Make sure your terminal is once again properly named, and then in terminal window find the boxes entitled 'OnGuiFunction', 'EnterCallback', and 'LeaveCallback'. These are the callbacks that we will primarily use in our code to run the terminal. I recommend clicking the generate button beneath each, but if you prefer you can name each callback yourself. Also make sure to check the 'allowInteraction' box if the player can interact with the terminal. Otherwise they can only look at it. Once the boxes have names, generated or otherwise, save your map and open up your script. Your terminal on the map side of things should be done!
This tutorial assumes you have a basic .hps file set up with your map already. Scroll down to the bottom of the script and you may see a section like this:
///////////////////////////////////////// // ============== // TERMINALS // ============== //{////////////////////////////////////// //------------------------------------------------------- ///////////////////////////////////////// // Terminal *Name Of Terminal* //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used Terminal here.*/ //------------------------------------------------------- /*Put any functions that are only used Terminal here.*/ //------------------------------------------------------- //} END Terminal *Name Of Terminal* //------------------------------------------------------- //} END TERMINALS
This is the template setup. I do not recommend you delete this from any script! It is good reference and a good starting point for your first terminal in any map. Also, check the part of your scipt where the #include's are; add the lines:
#include "helper_imgui_station.hps" #include "helper_imgui_station_app_audioplayback.hps" #include "helper_imgui_station_app_photoviewer.hps"
These will include some functions that can quickly setup SOMA's terminal's GUI, which you will need if you directly follow this terminal's setup. Now, going back to the template for your terminal, edit it to look something like this:
///////////////////////////////////////// // ============== // TERMINALS // ============== //{////////////////////////////////////// //------------------------------------------------------- ///////////////////////////////////////// // Terminal room_terminal //{////////////////////////////////////// //------------------------------------------------------- /*Put any variables that are only used Terminal here.*/ //------------------------------------------------------- void room_terminal_OnGui(const tString&in asEntityName, float afTimeStep) { } void room_terminal_GuiEnter(const tString&in asEntityName) { } void room_terminal_GuiLeave(const tString&in asEntityName) { } //------------------------------------------------------- //} END Terminal *Name Of Terminal* //------------------------------------------------------- //} END TERMINALS