Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Terminal Numpad Help
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#2
RE: Terminal Numpad Help

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.

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.

tString sCode = StationGui_GetNumpadInput();
if (sCode == "4546")
{
    // Unlock door, change current app, or whatever
}

The simplest way to tie it all together would be to put it all inside nested if-then blocks within your OnGui function:

if (StationGui_Numpad("Numpad Header", 4))
{
    tString sCode = StationGui_GetNumpadInput();
    if (sCode == "4546")
    {
        // Unlock door or whatever

        // Success beep so the player knows it's the right code
        Depth_Audio_Terminal_Confirm(ImGui_GetName());
    }
    else
    {
        // Error beep so the player knows it's the wrong code
        Depth_Audio_Terminal_Negative(ImGui_GetName());
    }
}
(This post was last modified: 07-21-2016, 09:45 PM by Abion47.)
07-21-2016, 09:45 PM
Find


Messages In This Thread
Terminal Numpad Help - by i3670 - 07-21-2016, 09:22 PM
RE: Terminal Numpad Help - by Abion47 - 07-21-2016, 09:45 PM
RE: Terminal Numpad Help - by i3670 - 07-21-2016, 09:49 PM
RE: Terminal Numpad Help - by Abion47 - 07-21-2016, 10:00 PM
RE: Terminal Numpad Help - by i3670 - 07-21-2016, 10:18 PM
RE: Terminal Numpad Help - by Abion47 - 07-22-2016, 06:59 PM
RE: Terminal Numpad Help - by i3670 - 07-22-2016, 11:44 PM



Users browsing this thread: 1 Guest(s)