Jump to content
Sign in to follow this  
quantenfrik

display variables/values in dialog?

Recommended Posts

Hello,

I'm sorry if this question is really dumb, but i'm new to scripting and after 2 hours of googling and trying i didn't find a solution: All I want is to display variables with their values in my dialog. I've read through this thread (http://forums.bistudio.com/showthread.php?154084-Values-and-Variables-in-Dialog-RscText), and it works fine if I just want to directly access one parameter, in this case my location, but I also need to be able to do some calculations with it.

my dialogs.hpp

class test_dialog

{

idd = 1200;

movingenable = true;

onMouseButtonDown = "_this call test_dialog_Load";

class Controls

[...]

class test_buttonno: RscButton

{

idc = -1;

text = "no"; //--- ToDo: Localize;

x = 0.5 * safezoneW + safezoneX;

y = 0.751 * safezoneH + safezoneY;

w = 0.06375 * safezoneW;

h = 0.085 * safezoneH;

action = "_nil =[]ExecVM""hello2.sqf""";

};

class test_text: RscText

{

idc = 1000;

text = ""; //--- ToDo: Localize;

x = 0.1175 * safezoneW + safezoneX;

y = 0.789 * safezoneH + safezoneY;

w = 0.25375 * safezoneW;

h = 0.085 * safezoneH;

{

my hello2 script the only way it works, gives me my position in the dialog

test_dialog_Load = {((_this select 0) displayCtrl 1000) ctrlSetText format ["pos: %1", getPos player]};

my hello2 script how I would like it to work:

test_dialog_Load = {

_number = 12+1; //just some simple calcuation

{((_this select 0) displayCtrl 1000) ctrlSetText format ["pos: %1", _number]};

};

in the latter case it won't show up at all in my dialog.

anybody got an idea how to solve this?

thanks in advance

Share this post


Link to post
Share on other sites

Try removing the 'onMouseButtonDown' from test_dialog and then changing your hello2.sqf file to:

_number = 12 + 1;
_dialog = findDisplay 1200;
_ctrl = _dialog displayCtrl 1000;
_ctrl ctrlSetText format ["pos: %1", _number];

In you button you have the action executing the script file. So, when you press the button it should run the code instead of compiling a function like you had previously.

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  

×