Jump to content
Elite IV

Trying to display global var in dialog

Recommended Posts

Hello everyone, 

 

I am having some trouble navigating the wiki sqf for displaying a global variable in a dialog.

 

What is the method for doing this? I've tried searching for any topics relating to this but cannot find. 

 

ignore all the disgusting capital prefixes. I use it to help distinguish my code in another framework (Tonic's Altis Life RPG) as I've been modifying it to the likes of my community.

 

onButtonClick = "[] spawn XTGALRPG_FARMING_SKILL_fnc_loadSkillStats;"; 

- player clicks button

 

- opens this script

createDialog "XTGALRPG_SKILLING_INTERFACE";

_farmingLevel = playerFarmingExpLevel;
(CONTROL(5374,537447)) ctrlSetText format [(localize "STR_skilling_farmingLevel")+ " $%1",[_farmingLevel] call life_fnc_numberText];

 

first param in control is set to my dialog and the second is the idd of the text box i created in adc. Prior to this code i created a local var to represent a global variable value to then be displayed and formatted with numberText function that was already in framework.

 

What am i missing? Am i meant to initialize something else these changes to take place? I open the dialog and nothing has changed. I just want to show a number in a dialog pulled from global var.

Share this post


Link to post
Share on other sites

Hello. Your question is vague. Do you have a little code you tested? Are you in SP or MP context?

  • Like 2

Share this post


Link to post
Share on other sites
2 minutes ago, pierremgi said:

Hello. Your question is vague. Do you have a little code you tested? Are you in SP or MP context?

 

Sorry yes I realized after I read my topic. I edited my topic with the code i am trying to use.

 

MP

Share this post


Link to post
Share on other sites
19 minutes ago, pierremgi said:

If your (CONTROL(5374,537447)) is OK (I can't say where you defined it), try with ctrlSetStructuredText

 

Oh my lord.. Hah, Control is a "macro" that I think tonic or the new developers of altis life rpg created. I used their snippet.

 

---------->           

#define CONTROL(disp,ctrl) ((findDisplay ##disp) displayCtrl ##ctrl)

 

the "macro.h" wasn't included into the script as I thought "CONTROL" was a arma 3 engine command. Still learning. Thank you, appreciate that.

It probably showed up in the RPTs as well I just did not think about "CONTROL" being user defined.

 

I didn't have to use ctrlSetStructuredText but I'll learn that one as I do see it in other dialogs so thanks for that.

 

Thank you. It's working now. 🙂 

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

×