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
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#1
Terminal Numpad Help

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.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-21-2016, 09:22 PM
Find
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
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#3
RE: Terminal Numpad Help

Aight, I'll check it out. Also, is there a list of all the StationGui_X somewhere?

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-21-2016, 09:49 PM
Find
Abion47 Offline
Senior Member

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

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.
07-21-2016, 10:00 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#5
RE: Terminal Numpad Help

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.

void DoorNumPad_OnGui(const tString&in asEntityName, float afTimeStep)
        {
        StationGui_Numpad("Numpad Header", 4);
        
        StationGuiBG_Backdrop();
        StationGuiBG_Scanlines();
        
        tString sCode = StationGui_GetNumpadInput();
        
        if (sCode == "1111")
            {
                Button_SetLocked("panel_laboratory_11", true,true);
            
                Depth_Audio_Terminal_Confirm(ImGui_GetName());
            }
        else
            {
                Depth_Audio_Terminal_Negative(ImGui_GetName());
            }
        }
}

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.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 07-21-2016, 10:47 PM by i3670.)
07-21-2016, 10:18 PM
Find
Abion47 Offline
Senior Member

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

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);
07-22-2016, 06:59 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#7
RE: Terminal Numpad Help

Ah, I see. It's fixed now and working as intended. Expect to hear from me again soon as I attempt terminal-scripting again Big Grin

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-22-2016, 11:44 PM
Find




Users browsing this thread: 1 Guest(s)