Jump to content
Cigs4

Difficulty with variables

Recommended Posts

Hello!
I'm having difficulty using the mod AirFell's Keypad. There isn't much explanation on how to do things, but I believe it's very basic for those who have knowledge, which isn't my case. Anyway, what I would like to do is that when I type the code 3x wrong on the keypad, it runs a script.
In init you can choose the code, like this:

if (IsServer) then {code = "123321";publicVariable 'code';};

And if you have a trigger condition: (code = OutputText), it gives it as the correct code and executes it. Everything OK so far, but I want to execute this trigger when the code is entered 3 times wrong.
I don't know if I managed to explain it correctly, but this is the mod: http:// https://steamcommunity.com/sharedfiles/filedetails/?id=384197619&searchtext=AirFell's+Keypad

If anyone could help me, I would greatly appreciate it.

Thanks!

Share this post


Link to post
Share on other sites

you could put the following into AF_KP_vars.sqf

errorcounter = 0;

then just increment it in the enter statement in AF_KP_fncs.sqf


 

case "enter": {

        if (code isnotequalto inputText) then {
               errorcounter = errorcounter + 1;
        };

        if (errorcounter == 3) then { // Add what you want to be executed here
              "do something";
         };

        OutputText = InputText;
        hint format["Keycode is %1", OutputText];
        closeDialog 0;
        InputText = "";
    };

 

Not quite sure if it's what you're asking.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks a LOT, Rouglee!

It was exactly what I was looking for.

Sorry for the delay in answer, I had even given up, but now I'm going to bring hell on some missions. 😁

Take care!

Share this post


Link to post
Share on other sites

No problem! 🙂

 

Hope your mission becomes a blast.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×