Home   Help Search Login Register  

Author Topic: displaying numbers pressed on a key pad in a dialog  (Read 3241 times)

0 Members and 1 Guest are viewing this topic.

Offline Meatball0311

  • Members
  • *
displaying numbers pressed on a key pad in a dialog
« on: 20 Mar 2010, 21:15:22 »
I am creating a dialog using an image of a radio.  On the radio there is a keypad that would be used to dial radio frequencies.  I am wanting to allow the player to press (click) the numbers on the key pad and for the numbers to be displayed in some sort of active box on the radio screen, then enter and select a certain action when the correct frequency is inputed.

example...

lets say the player wants to call headquarters to request a helo extraction.  The headquarters radio frequency is 123456.  The player will select 1, 2, 3, 4, 5, 6 on the radio keypad then press enter and the helo extract scrip will be executed.

I have a radio.hpp file
Quote
#define RUM_RADIO_IDD 1000
#define RUM_BttnOne_IDC 1002
#define RUM_ScreenListBox_IDC 1003

// Main Dialog

class RUM_Radio
{
   idd = RUM_RADIO_IDD;  
   movingEnable = false;  
   
   // Radio Image  ----------------------------------------
   
   class controlsBackground {
      
      class RUM_RadioBACKGRD : RUM_RscPicture
      {
         x = 0.150;  
         y = 0.2;  
         w = 0.75;  
         h = 0.35;  
         text = "RUM\Images\RUM_PRC117.paa";
      };
   };
   
   // Controls --------------------------------------
   
   class controls {
      
      // PRC-117 Screen
      
      class RUM_RadioScreenlistBox : RUM_RscEdit
      {         
         idc = RUM_ScreenListBox_IDC;
         x = 0.3699;
         y = 0.3033;
         w = 0.08;
         h = 0.02;      
         sizeEx = .02;
      };      
      
      // PRC-117 Buttons
         
      class RUM_1Button : RUM_RscButton
      {
         idc = RUM_BttnOne_IDC;
         style = 2;
         sizeEx = 0.02;
         colorText[] = { 1, 1, 1, 1 };
         colorFocused[] = {0,0,0,1};  
         colorDisabled[] = {};  
         colorBackground[] = {0,0,0,1};
         colorBackgroundDisabled[] = {0,0,0,1};
         colorBackgroundActive[] = {0,0,0,1};  
         offsetX = 0.0;
         offsetY = 0.0;
         offsetPressedX = 0.0;
         offsetPressedY = 0.0;
         colorShadow[] = {};
         colorBorder[] = {};
         x = 0.3615;
         y = 0.3699;
         w = 0.010;
         h = 0.02;
         text = "1";
         action = "[] call RUM_buttn_1";
      };

      class RUM_2Button : RUM_1Button
      {
         x = 0.3899;
         text = "2";
         action = "hint ""2 BUTTON""";
      };

      class RUM_3Button : RUM_1Button
      {
         x = 0.4185;
         text = "3";
         action = "hint ""3 BUTTON""";
      };

      class RUM_4Button : RUM_1Button
      {
         y = 0.4099;
         text = "4";
         action = "hint ""4 BUTTON""";
      };

      class RUM_5Button : RUM_1Button
      {
         x = 0.3899;
         y = 0.4099;
         text = "5";
         action = "hint ""5 BUTTON""";
      };

      class RUM_6Button : RUM_1Button
      {
         x = 0.4185;
         y = 0.4099;
         text = "6";
         action = "hint ""6 BUTTON""";
      };

      class RUM_7Button : RUM_1Button
      {
         y = 0.4445;
         text = "7";
         action = "hint ""7 BUTTON""";
      };

      class RUM_8Button : RUM_1Button
      {
         x = 0.3899;
         y = 0.4445;
         text = "8";
         action = "hint ""8 BUTTON""";
      };

      class RUM_9Button : RUM_1Button
      {
         x = 0.4185;
         y = 0.4445;
         text = "9";
         action = "hint ""9 BUTTON""";
      };

      class RUM_0Button : RUM_1Button
      {
         x = 0.3333;
         y = 0.3715;
         text = "0";
         action = "hint ""0 BUTTON""";
      };
             };
};      

then a radio.sqf
Quote
RUM_RADIO_IDD = 1000;
RUM_BttnOne_IDC = 1002;
RUM_ScreenListBox_IDC = 1003;

// Buttons ----------------------------
_list1 = "";

RUM_buttn_1 = {
   _string = _list1 + "1";
   lbAdd [RUM_ScreenListBox_IDC, _string];
};

_dialog = createDialog "RUM_Radio";
waitUntil { !dialog };
hint "Dialog closed.";

how do I get it when the button is pressed to display a number in a box??
« Last Edit: 20 Mar 2010, 21:21:19 by Meatball »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: displaying numbers pressed on a key pad in a dialog
« Reply #1 on: 20 Mar 2010, 22:51:30 »
Although the dialog might not work, the script should still be compatible : CodePad (for ArmA). Will have everything you need in it.

 :good:

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Meatball0311

  • Members
  • *
Re: displaying numbers pressed on a key pad in a dialog
« Reply #2 on: 21 Mar 2010, 02:18:26 »
I am checking it out and will have to spend some time looking through it.  Would help out more if there was a test mission for ArmA2 with it.  Thanks for pointing me in a good direction...

-----------------------------

looks as if my skills arent that high speed yet.  I am new to dialogs so if maybe you could help me out with my original question that would be better.  any suggestions on how to link a button to display text in a box?
« Last Edit: 21 Mar 2010, 06:21:30 by Meatball »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: displaying numbers pressed on a key pad in a dialog
« Reply #3 on: 22 Mar 2010, 01:26:43 »
The CodePad script linked is, in fact, very very simple. I see you're using somebody else's description.ext (judging by the RUM_ tag at least) so I'm assuming you don't really know how to use dialogs properly. Don't worry, I was the same (still am, to an extent) for a long time - all I'm saying is that it's not something you can give an easy "this is the way to do it" answer. I also just tested it and it works in ArmA 2 without any editing (aside from adding a path to the sounds, since Arma 2 no longer uses the 'default' "sound" folder), also the dialog. Attached the ArmA 2 version of the demo mission (slightly edited).

Basically however in the CodePad.sqf, the pertinent part is this:

Code: [Select]
// Loads keycheck script and assigns a displayEventhandler so that numbers can be filled in by simply writing them on your keyboard.

if (isNil "RUG_CodePad_KeyCheck") then {RUG_CodePad_KeyCheck =
{
_key = _this select 1;

_n1 = 2;
_n2 = 3;
_n3 = 4;
_n4 = 5;
_n5 = 6;
_n6 = 7;
_n7 = 8;
_n8 = 9;
_n9 = 10;
_n0 = 11;
_n10 = 43;
_n11 = 55;
_NUM_0 = 82;
_NUM_1 = 79;
_NUM_2 = 80;
_NUM_3 = 81;
_NUM_4 = 75;
_NUM_5 = 76;
_NUM_6 = 77;
_NUM_7 = 71;
_NUM_8 = 72;
_NUM_9 = 73;
_NUM_star = 55;

_CodePadDisplay = findDisplay 182173;
_CP0 = _CodePadDisplay displayCtrl 100;
_CP1 = _CodePadDisplay displayCtrl 101;
_CP2 = _CodePadDisplay displayCtrl 102;
_CP3 = _CodePadDisplay displayCtrl 103;
_CP4 = _CodePadDisplay displayCtrl 104;
_CP5 = _CodePadDisplay displayCtrl 105;
_CP6 = _CodePadDisplay displayCtrl 106;
_CP7 = _CodePadDisplay displayCtrl 107;
_CP8 = _CodePadDisplay displayCtrl 108;
_CP9 = _CodePadDisplay displayCtrl 109;
_CP10 = _CodePadDisplay displayCtrl 110;
_CP11 = _CodePadDisplay displayCtrl 111;

if (_key == _n0 OR _key == _NUM_0) then {call compile (buttonAction _CP0);ctrlSetFocus _CP0;};
if (_key == _n1 OR _key == _NUM_1) then {call compile (buttonAction _CP1);ctrlSetFocus _CP1;};
if (_key == _n2 OR _key == _NUM_2) then {call compile (buttonAction _CP2);ctrlSetFocus _CP2;};
if (_key == _n3 OR _key == _NUM_3) then {call compile (buttonAction _CP3);ctrlSetFocus _CP3;};
if (_key == _n4 OR _key == _NUM_4) then {call compile (buttonAction _CP4);ctrlSetFocus _CP4;};
if (_key == _n5 OR _key == _NUM_5) then {call compile (buttonAction _CP5);ctrlSetFocus _CP5;};
if (_key == _n6 OR _key == _NUM_6) then {call compile (buttonAction _CP6);ctrlSetFocus _CP6;};
if (_key == _n7 OR _key == _NUM_7) then {call compile (buttonAction _CP7);ctrlSetFocus _CP7;};
if (_key == _n8 OR _key == _NUM_8) then {call compile (buttonAction _CP8);ctrlSetFocus _CP8;};
if (_key == _n9 OR _key == _NUM_9) then {call compile (buttonAction _CP9);ctrlSetFocus _CP9;};
if (_key == _n10) then {call compile (buttonAction _CP10);ctrlSetFocus _CP10;};
if (_key == _n11 OR _key == _NUM_star) then {call compile (buttonAction _CP11);ctrlSetFocus _CP11;};

};
};

// Sets the displayeventhandler to react to keypresses while the display is up

(findDisplay _CodePadDisplay) displaySetEventHandler ["KeyDown", "nil = _this call RUG_CodePad_KeyCheck"];

So, you need to change the _CPs to the proper IDCs for the buttons (I noticed your description.ext has no, ergo -1, IDCs on all the buttons - they will all need to be assigned one by adding idc = ### (some number) into each entry). The keys are still the same. What the script does is call the buttonAction of each button upon keypress. The buttonactions on the other hand are as such, as an example for the "1" button:

Code: [Select]
action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),1];ctrlSetText [999,num];playsound ""button1"""
(the Keypad_num global variable is just to count how many buttons have been pressed all in all, so that if more than X buttons are entered it can automatically beep "wrong". You can remove that for your script). The important part here is ctrlSetText and num. What it does is first take the text from idc 999 (which should be your "screen" where you want the numbers to show), add the number you just pressed (in this case 1), and then ctrlSetText idc 999 to the "new" text. However, for your use I suppose this simple code should do it (change the "1" to whatever number the button corresponds to):

Code: [Select]
action = "num = ((ctrlText 999) + "1"); ctrlSetText [999, num];"
(judging by your description.ext I'm guessing the IDC you want instead of 999 is 1003 for the listbox).

Anyway, ugh. As mentioned, it's not necessarily easy, but if you study the CodePad code in detail and try to get some of these things to work, you should be able to do this. :) I suggest you read some dialog tutorials if you're still completely lost as to what I mean with stuff like "idc" and "ctrlsettext" :D

Good luck...

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Meatball0311

  • Members
  • *
Re: displaying numbers pressed on a key pad in a dialog
« Reply #4 on: 22 Mar 2010, 01:59:40 »
Thanks for the help and I will be looking at this tonight.  RUM_ is actually my tag and it is my little project name.  I have also looked through the dialog tutorial and that was actually one of the main helping tools that has gotten me this far.  Really appreciate the time you are taking to help me and I will get back to you after I go through your test mission.

-------------------------------------------------------

YEAH!!  I just got it to work what I have been working on!!  Thanks for the help and I am sure I will be bothering you in the future, as I am now moving on to figuring out how to preset certain codes or frequencies to execute certain scripts.
« Last Edit: 24 Mar 2010, 17:09:35 by Meatball »

Offline Meatball0311

  • Members
  • *
Re: displaying numbers pressed on a key pad in a dialog
« Reply #5 on: 10 Apr 2010, 07:36:44 »
I got the key pad to display numbers when keypad is pressed, but now I need help with typing in numbers and selecting enter and the code to execute a script.... please I need some help with this one :weeping: :D

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: displaying numbers pressed on a key pad in a dialog
« Reply #6 on: 10 Apr 2010, 14:08:35 »
What exactly do you have in mind? The easiest would be to have a button, labelled, say, "Send", which you could use the same key-grabbing technique I showed you earlier to react to "Enter". After that, just give it an action that runs a script. This script would then read the numbers inputted (using ctrlText), and then based on those numbers do whatever it is you wanted done, including probably shutting down the dialog.

Also, you seem to have changed your name? Have you lost your account information or somesuch/need to merge two accounts? In that case, you might want to contact, well, bedges maybe, or h-. It's unnecessary to run around with more than one account, y'see. Confuses things. Did you get my latest PM, a couple of weeks ago?

Good luck!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Meatball0311

  • Members
  • *
Re: displaying numbers pressed on a key pad in a dialog
« Reply #7 on: 11 Apr 2010, 01:32:05 »
Wolfrug,

I thought it would be easier for me to post this so you can see where I am at and would help in an instructional purpose for the community to post my scripts here.  I guess I am having trouble with exactly where I would need to implement the coding.

Lets use this example of what I am trying to do...  

Situation:
The player needs to call for a helo extract, so the player has to call command and request helo extraction.  The command radio frequency is 1,2,3,4,5... so the player has to input the correct frequency on the radio to call headquarters.  The player selects an addAction

Quote
RUM_Radio_action = SPT_Actual addAction ["R.U.M. PRC-117","RUM\Dialog\RUM_Radio.sqf",[], 6, false, false, "", "_target == player"];



that when the action is clicked it then runs "RUM_Radio.sqf" which pops up (dialog) an image of a radio with a keypad.  I want the player to select on the keypad the numbers 1,2,3,4,5 (which I have gotten to be displayed on the radio image screen) then select a button named "ENTER" at that time I understand that it needs to check to see if the right frequency has been entered and if so executes the next phase, but if the wrong frequency is entered I want it to lets say play the sound of static..

I have gone back over your scripts and things are making more sense.. but I am still needing a little direction in how to do what I am wanting to do.  I will try and explain what I am gathering and what I dont understand.  

I understand: That it needs three parameters 1. an array of numbers/special characters 2) a script (ontrue) that launches on succesful entering of code and 3) a script (onfalse) that launches on the wrong entering of the code.

I dont understand: how do I get the numbers that are pressed to be in an array and when the "Enter" button is pressed how is that array passed on to check for ontrue or onfalse?

I dont know where to put it so I will post what my scripts and possibly you could tell me where to input what and how. I am working with an init.sqf, description.ext, RUM_Common.hpp, RUM_Radio.hpp, RUM_Radio.sqf  

It all starts off by adding an addAction command in the init.sqf file of the mission:
Quote
RUM_Radio_action = SPT_Actual addAction ["R.U.M. PRC-117","RUM\Dialog\RUM_Radio.sqf",[], 6, false, false, "", "_target == player"];

description.ext
Quote
#include "RUM\RUM_Common.hpp"
#include "RUM\Dialog\RUM_Radio.hpp"

RUM_Common.hpp
Quote
just the common constants

RUM_Radio.hpp
Quote
// Realistic Unit Modification Radio Dialog
// v. Beta

// Main Dialog

class RUM_RadioDialog
{
   idd = 001;  
   movingEnable = true;
   objects[] = { };
     controls[] = {RUM_RadioIMAGE,RUM_Display,RUM_0Button,RUM_1Button,RUM_2Button,RUM_3Button,RUM_4Button,
RUM_5Button,RUM_6Button,RUM_7Button,RUM_8Button,RUM_9Button,RUM_EnterButton};
     
onLoad = "";

// Radio Image  ----------------------------------------
   class RUM_RadioIMAGE : RUM_RscPicture
   {
      idc = 500
      x = 0.150;  
      y = 0.2;  
      w = 0.75;  
      h = 0.35;  
      text = "RUM\Images\RUM_PRC117.paa";
   };
         
// Radio Display  ----------------------------------------
   class RUM_Display : RUM_RscText
   {         
      idc = 999;
      x = 0.3699;
      y = 0.3033;
      w = 0.08;
      h = 0.02;      
      colorText[] = { 0, 0, 0, 1 };
       SizeEX = 0.02;
        colorSelect[] = {0, 0, 0, 0};
   };
   
// Radio Buttons  ----------------------------------------
   class RUM_0Button
   {
      idc = 100;
      type = CT_ACTIVETEXT;
      style = 2;
      sizeEx = 0.02;
      font = FontM;
      color[] = { 1, 1, 1, 1 };
      colorActive[] = { 1, 1, 1, 1 };
      soundEnter[] = { "", 0, 1 };   // no sound
      soundPush[] = { "", 0, 1 };
      soundClick[] = { "", 0, 1 };
      soundEscape[] = { "", 0, 1 };
      x = 0.3333;
      y = 0.3715;
      w = 0.010;
      h = 0.02;
      text = "0";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),0];ctrlSetText [999,num]";
      default = true;
   };
   
   class RUM_1Button : RUM_0Button
   {
      idc = 101;
      x = 0.3615;
      y = 0.3699;
      text = "1";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),1];ctrlSetText [999,num]";
   };
   
   class RUM_2Button : RUM_0Button
   {
      idc = 102;
      x = 0.3899;
      text = "2";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),2];ctrlSetText [999,num]";
   };

   class RUM_3Button : RUM_0Button
   {
      idc = 103;
      x = 0.4185;
      text = "3";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),3];ctrlSetText [999,num]";
   };

   class RUM_4Button : RUM_0Button
   {
      idc = 104;
      x = 0.3615;
      y = 0.4099;
      text = "4";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),4];ctrlSetText [999,num]";
   };

   class RUM_5Button : RUM_0Button
   {
      idc = 105;
      x = 0.3899;
      y = 0.4099;
      text = "5";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),5];ctrlSetText [999,num]";
   };

   class RUM_6Button : RUM_0Button
   {
      idc = 106;
      x = 0.4185;
      y = 0.4099;
      text = "6";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),6];ctrlSetText [999,num]";
   };

   class RUM_7Button : RUM_0Button
   {
      idc = 107;
      x = 0.3615;
      y = 0.4445;
      text = "7";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),7];ctrlSetText [999,num]";
   };

   class RUM_8Button : RUM_0Button
   {
      idc = 108;
      x = 0.3899;
      y = 0.4445;
      text = "8";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),8];ctrlSetText [999,num]";
   };

   class RUM_9Button : RUM_0Button
   {
      idc = 109;
      x = 0.4185;
      y = 0.4445;
      text = "9";
      action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),9];ctrlSetText [999,num]";
   };

   class RUM_EnterButton : RUM_0Button
   {
      sizeEx = 0.0150;
      x = 0.4415;
      y = 0.4485;
      w = 0.02025;
      h = 0.01;
      text = "ENT";
      action = "**********************DONT KNOW WHAT TO PUT HERE TO MAKE THE NUMBERS PRESSED INTO AN ARRAY****************************""";
   };
};


RUM_Radio.sqf
Quote
_RUM_RadioScreen = 001;
_RUM_Display = 999;

_dialog = createDialog "RUM_RadioDialog";
waitUntil { !dialog };
hint "Dialog closed.";

if (isNil "RUM_CodePad_KeyCheck") then {RUG_CodePad_KeyCheck =
{
_key = _this select 1;

_n1 = 2;
_n2 = 3;
_n3 = 4;
_n4 = 5;
_n5 = 6;
_n6 = 7;
_n7 = 8;
_n8 = 9;
_n9 = 10;
_n0 = 11;
_n10 = 43;
_n11 = 55;
_NUM_0 = 82;
_NUM_1 = 79;
_NUM_2 = 80;
_NUM_3 = 81;
_NUM_4 = 75;
_NUM_5 = 76;
_NUM_6 = 77;
_NUM_7 = 71;
_NUM_8 = 72;
_NUM_9 = 73;
_NUM_star = 55;

_RUM_RadioScreen = findDisplay 001;
_RUM0 = _RUM_RadioScreen displayCtrl 100;
_RUM1 = _RUM_RadioScreen displayCtrl 101;
_RUM2 = _RUM_RadioScreen displayCtrl 102;
_RUM3 = _RUM_RadioScreen displayCtrl 103;
_RUM4 = _RUM_RadioScreen displayCtrl 104;
_RUM5 = _RUM_RadioScreen displayCtrl 105;
_RUM6 = _RUM_RadioScreen displayCtrl 106;
_RUM7 = _RUM_RadioScreen displayCtrl 107;
_RUM8 = _RUM_RadioScreen displayCtrl 108;
_RUM9 = _RUM_RadioScreen displayCtrl 109;
//_CP10 = _CodePadDisplay displayCtrl 110;
//_CP11 = _CodePadDisplay displayCtrl 111;

if (_key == _n0 OR _key == _NUM_0) then {call compile (buttonAction _RUM0);ctrlSetFocus _RUM0;};
if (_key == _n1 OR _key == _NUM_1) then {call compile (buttonAction _RUM1);ctrlSetFocus _RUM1;};
if (_key == _n2 OR _key == _NUM_2) then {call compile (buttonAction _RUM2);ctrlSetFocus _RUM2;};
if (_key == _n3 OR _key == _NUM_3) then {call compile (buttonAction _RUM3);ctrlSetFocus _RUM3;};
if (_key == _n4 OR _key == _NUM_4) then {call compile (buttonAction _RUM4);ctrlSetFocus _RUM4;};
if (_key == _n5 OR _key == _NUM_5) then {call compile (buttonAction _RUM5);ctrlSetFocus _RUM5;};
if (_key == _n6 OR _key == _NUM_6) then {call compile (buttonAction _RUM6);ctrlSetFocus _RUM6;};
if (_key == _n7 OR _key == _NUM_7) then {call compile (buttonAction _RUM7);ctrlSetFocus _RUM7;};
if (_key == _n8 OR _key == _NUM_8) then {call compile (buttonAction _RUM8);ctrlSetFocus _RUM8;};
if (_key == _n9 OR _key == _NUM_9) then {call compile (buttonAction _RUM9);ctrlSetFocus _RUM9;};
//if (_key == _n10) then {call compile (buttonAction _CP10);ctrlSetFocus _CP10;};
//if (_key == _n11 OR _key == _NUM_star) then {call compile (buttonAction _CP11);ctrlSetFocus _CP11;};

};
};

// Sets the displayeventhandler to react to keypresses while the display is up

(findDisplay _RUM_RadioScreen) displaySetEventHandler ["KeyDown", "nil = _this call RUM_CodePad_KeyCheck"];




Hope that makes it a little more clearer on what I am trying to accomplish.  

Thank you soooooooo much for your time and help!!!

P.S. I sent bedges a pm about my other account..  :good:
« Last Edit: 11 Apr 2010, 08:09:28 by Meatball0311 »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: displaying numbers pressed on a key pad in a dialog
« Reply #8 on: 11 Apr 2010, 21:18:08 »
Hi,

I already sort of answered this, but again:

Code: [Select]
class RUM_EnterButton : RUM_0Button
   {
      sizeEx = 0.0150;
      x = 0.4415;
      y = 0.4485;
      w = 0.02025;
      h = 0.01;
      text = "ENT";
      action = "[ctrlText 999] execvm ""EnterScript.sqf""";
   };

And then EnterScript.sqf:

Code: [Select]
_nr = _this select 0;

switch (_nr) do
{
case "12345" : {execvm "script1.sqf"};
case "49573" : {execvm "script2.sqf"};
case 991 : {hint "No use calling 991 sonny..."};
case default : {playsound "static"};
};


And that should pretty much do it. Just add all the possible different cases into the switch, and you should be golden. I'm not 100% sure about the case default thing, but I -think- it's the one that runs if none of the other fit, so in this case if you've dialled wrong, it'll play the static sound. You can also null the input field here if you want by adding ctrlSetText [999, ""] anywhere in the script, or whatever else you want to do :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Meatball0311

  • Members
  • *
Re: displaying numbers pressed on a key pad in a dialog
« Reply #9 on: 12 Apr 2010, 04:08:41 »
 :clap:

Wolfrug I really appreciate and am grateful for your help!  It is doing the job perfectly and thank you for having the patience in dealing with me.  So I now understand how to preset a "frequency" and when it is inputed correctly for it to execute the next phase or do what I am wanting it to do.  

It did nothing when I put in a different code or the wrong frequency
Quote
case default : {playsound "static"};

so I checked and the correct code for the default is
Quote
default {playsound "static"};

Once again thank you for your help and I am sorry to say but you probably can guarantee that I will have another question some time in the futue.. Thanks :good:

« Last Edit: 12 Apr 2010, 04:20:01 by Meatball0311 »