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());
}
}