Jump to content
Sign in to follow this  
gizz46

help bind dialog to a key

Recommended Posts

hey there :),

im working on a mod for the community . basically its a dialog to select and toggle between your weapon and loadout.

im new to all that scripting stuff but i alredy got all scripting commands togehter and my dialog shows up when i use _ok = createDialog and works fine.

now im trying to bind the dialog to a key (in focus the f key). i've already searched in the biki forum, opfec forum and found some stuff too. but it all dindt work.

im try to get it work with the displaySetEventHandler from the biki.

please help me, im stucked to this problem for days now:( .

when i get this problem solved i can release this little mod very soon .

my init.sqf

disableSerialization;

sleep 0.2;

keyspressed = compile preprocessFile "keyspressed.sqf";

_display = findDisplay 46;

_display displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressed.sqf

private['_handled'];

_handled = false;

switch (_this select 1) do

{

//F key

case 33:

{

player execVM "comR.sqf"; ///////// i actually dont realy know what to write here ????????????

_handled = true;

};

};

_handled;

my dialog comR.sqf

class comR

{

idd = 3500;

movingEnable = 0;

controlsBackground[] = {};

name = "mybutton";

objects[] = {};

controls[] = {Control_1,Control_2};

class Control_1 : Base_Static

{

idc = 1500;

style = ST_HUD_BACKGROUND;

x = 0.159;

y = 0.163;

w = 0.684;

h = 0.677;

colorText[] = {0.000,0.000,0.000,1.000};

colorBackground[] = {1.000,1.000,1.000,0.463};

font = "Zeppelin33";

sizeEx = TextSize_normal;

};

class Control_2 : Base_Activetext

{

idc = 1600;

style = ST_PICTURE;

action = player execVM "handgun.sqf";

text = "weapon_hud_button.paa"; //// create my own button. as I said the dialog works

x = 0.392;

y = 0.205;

w = 0.237;

h = 0.217;

colorText[] = {0.000,0.000,0.000,0.573};

colorBackground[] = {0.000,0.000,0.000,0.000};

sizeEx = TextSize_normal;

};

};

---------- Post added at 01:08 PM ---------- Previous post was at 11:11 AM ----------

ok problem solved

i used ArmaScriptTrace and found the mistake. now i can start finishing this mod.

Share this post


Link to post
Share on other sites

Hi gizz46, welcome to the Forum!

Please, can you post your solution? These days i searched for keypressing a script myself. But i can´t get it to work.

Was it this:

"_this call keyspressed"

Edited by Baraka

Share this post


Link to post
Share on other sites
Hi gizz46, welcome to the Forum!

Please, can you post your solution? These days i searched for keypressing a script myself. But i can´t get it to work.

Was it this:

"_this call keyspressed"

depending on what you want start i used the displayeventhandler

ini.sqf

disableSerialization;

sleep 0.2;

keyspressed = compile preprocessFile "keyspressed.sqf";

_display = findDisplay 46;

_display displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressed.sqf

private['_handled'];

_handled = false;

switch (_this select 1) do

{

//F key

case 33: ///////////////////////////the number for the key

{

player execVM "-------.sqf"; //////here you add your own .sqf file

_handled = true;

};

};

_handled;

in your sqf file you have to use createDialog or depending on what for a script you have to use a start command.

you can search in the biki for different eventhandlers.

i hope this will help you.

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
Sign in to follow this  

×