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
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:
RUM_Radio_action = SPT_Actual addAction ["R.U.M. PRC-117","RUM\Dialog\RUM_Radio.sqf",[], 6, false, false, "", "_target == player"];
description.ext
#include "RUM\RUM_Common.hpp"
#include "RUM\Dialog\RUM_Radio.hpp"
RUM_Common.hpp
just the common constants
RUM_Radio.hpp
// 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
_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..