Terminal Numpad Help - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: SOMA (https://www.frictionalgames.com/forum/forum-55.html) +--- Forum: User created content (https://www.frictionalgames.com/forum/forum-79.html) +---- Forum: Development (https://www.frictionalgames.com/forum/forum-82.html) +---- Thread: Terminal Numpad Help (/thread-51383.html) |
Terminal Numpad Help - i3670 - 07-21-2016 So I have been wrestling with creating a numpad today and I've come nowhere. I tried reverse engingeering FG's script from Upsilon 01_02 in a way to just a get the numpad to show, but I've got zilch clue. My code is therefore a mess and meaningless, no error messages, but also no results. Does anyone (nudge-nudge) know how to set up a basic numpad that will trigger a doorpanel to unlock? I'm using the small monitor panel if that's vital. RE: Terminal Numpad Help - Abion47 - 07-21-2016 There are two key (ha) parts of it. First, when you want to display the numpad, you use the function StationGui_Numpad. Generally, all you need to use are the first two parameters, as the default value for the rest will make the numpad display how it is generally intended to for the StationGui look-and-feel. The first parameter is the text that will display at the top of the numpad, and the second parameter is the number of characters in the full code. Code: StationGui_Numpad("Numpad Header", 4); Second, you get the current value of the numpad by using the StationGui_GetNumpadInput function. You can then compare this value against whatever pre-defined code to determine if the player put in the right code. Code: tString sCode = StationGui_GetNumpadInput(); The simplest way to tie it all together would be to put it all inside nested if-then blocks within your OnGui function: Code: if (StationGui_Numpad("Numpad Header", 4)) RE: Terminal Numpad Help - i3670 - 07-21-2016 Aight, I'll check it out. Also, is there a list of all the StationGui_X somewhere? RE: Terminal Numpad Help - Abion47 - 07-21-2016 Not yet that I know of. There's a list of the generic ImGui functions on the wiki, but for StationGui specifically you are stuck looking at the script files or at existing map code for the time being. RE: Terminal Numpad Help - i3670 - 07-21-2016 Alright, the actual numpad shows up now, but how do I set the code for it? I presume it's the four digit number after sCode(?) but that's not it because it gives me the else function when I enter it. Code: void DoorNumPad_OnGui(const tString&in asEntityName, float afTimeStep) On a side note: there's a glitched sound surrounding the panel whenever you're not looking at it. Like it is continuously playing one of the sounds over and over again. RE: Terminal Numpad Help - Abion47 - 07-22-2016 You didn't put StationGui_Numpad as the expression of an if statement. StationGui_Numpad returns true on the frame when the OK button is pressed. The way you have it setup now, it is always checking sCode against your "1111" on every update (30 or so times per second) and that causes one of the two sounds to play every time, which is where the glitched sound is coming from. Also, your Button_SetLocked function seems to be locking the button rather than unlocking it. I'm not sure if that was your intention, but it might be what is causing you to believe the code isn't working. To unlock the button, use Button_SetLocked("panel_laboratory_11", false, true); RE: Terminal Numpad Help - i3670 - 07-22-2016 Ah, I see. It's fixed now and working as intended. Expect to hear from me again soon as I attempt terminal-scripting again |