Jump to content
meatball

Good GUI Editor Box Showing the Value of a Variable?

Recommended Posts

Anyone know of a good tutorial on A3's GUI Editor? I don't need to do anything fancy, I just want to create a small GUI box that stays on the players screen all the time with some static text and the value of a variable that'll change during a mission.

Edited by Meatball

Share this post


Link to post
Share on other sites

I'd recommend these resources:

KillzoneKid's Tutorial

The VBS wiki page (documentation is neater and a little more fleshed out)

The Biki page equivelent (some of the ARMA 3 stuff is more up to date over there)

Since you want the element to be on screen at all times you'll want to use the cutRsc method as that overlays a display onscreen (the only difference from a regular dialog is that you retain control of the game instead of taking control of the cursor). If you have any follow up questions, fire away - I recently learnt how to make dialogs/displays myself and the documentation isn't currently the greatest if you have no past experience with it like I did.

Edited by SilentSpike

Share this post


Link to post
Share on other sites

Yeah, I went through KK's tutorial and most of the wiki's and came up with some basic idea on how to do most of it with the exception of adding in the variable.

I can basically do exactly what I want with a hint using the following format, but can't figure out how to put that into the cutRsc text:

hint format ["Region Owned: %1%2",controlledVariable,"%"];

Share this post


Link to post
Share on other sites
Yeah, I went through KK's tutorial and most of the wiki's and came up with some basic idea on how to do most of it with the exception of adding in the variable.

I can basically do exactly what I want with a hint using the following format, but can't figure out how to put that into the cutRsc text:

hint format ["Region Owned: %1%2",controlledVariable,"%"];

YourDialogVariable = createDialog "yourdialoghere";
_dialog = getDisplay YourDialogVariable;
_str = format ["%1",yourVariableHere];
_dialog ctrlSetText [yourIDChere,_str];

might work. not tested so I got no clue. You could get rid of the str variable and just stick it inside the command under it as it is, but that will make it a bit messy.

Share this post


Link to post
Share on other sites

Why not use dynamic control creation?

[color="#FF8040"][color="#191970"][b]with[/b][/color] [color="#191970"][b]uiNamespace[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] 
   MyRscText [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]findDisplay[/b][/color] [color="#FF0000"]46[/color] [color="#191970"][b]ctrlCreate[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"RscText"[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] 
   MyRscText [color="#191970"][b]ctrlSetPosition[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0.2[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0.1[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] 
   MyRscText [color="#191970"][b]ctrlSetTextColor[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] 
   MyRscText [color="#191970"][b]ctrlSetFontHeight[/b][/color] [color="#FF0000"]0.05[/color][color="#8B3E2F"][b];[/b][/color] 
   MyRscText [color="#191970"][b]ctrlSetBackgroundColor[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]1[/color][color="#8B3E2F"][b],[/b][/color][color="#FF0000"]0.3[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] 
   MyRscText [color="#191970"][b]ctrlCommit[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] 
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] 


KK_fnc_blinkMyRscText [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b]{[/b][/color] 
   [color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#0000"][b]_this[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] 
       [color="#191970"][b]with[/b][/color] [color="#191970"][b]uiNamespace[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] 
           MyRscText [color="#191970"][b]ctrlSetText[/b][/color] [color="#191970"][b]format[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Blink #%1"[/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_i[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] 
           MyRscText [color="#191970"][b]ctrlShow[/b][/color] [color="#0000"][b]true[/b][/color][color="#8B3E2F"][b];[/b][/color] 
           [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.5[/color][color="#8B3E2F"][b];[/b][/color] 
           MyRscText [color="#191970"][b]ctrlShow[/b][/color] [color="#0000"][b]false[/b][/color][color="#8B3E2F"][b];[/b][/color] 
           [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]0.5[/color][color="#8B3E2F"][b];[/b][/color] 
       [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] 
   [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] 
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] 

[color="#FF0000"]15[/color] [color="#191970"][b]spawn[/b][/color] KK_fnc_blinkMyRscText[color="#8B3E2F"][b];[/b][/color][/color]

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

I actually made a very similar display recently, here's my RscTitles for it:

class RscTitles
{
   class VictoryPoints
   {
       idd = -1;
       duration = 999999999999;
       onLoad = "\
           ((_this select 0) displayCtrl 201) ctrlSetText ('NATO: ' + str(missionNamespace getVariable ['SPIKE_PointsWEST',paramsArray select 1]) + ' Victory Points');\
           ((_this select 0) displayCtrl 202) ctrlSetText ('CSAT: ' + str(missionNamespace getVariable ['SPIKE_PointsEAST',paramsArray select 1]) + ' Victory Points');\
       ";
       class controls
       {
           class NatoPoints: RscText
           {
               idc = 201;
               style = 2;
               colorBackground[] = {"profileNamespace getVariable ['Map_BLUFOR_R',0]","profileNamespace getVariable ['Map_BLUFOR_G',0.3]","profileNamespace getVariable ['Map_BLUFOR_B',0.6]",0.5};
               x = SafeZoneX + 0.85*SafeZoneW;
               y = SafeZoneY + 0.2*SafeZoneH;
               w = 0.15*SafeZoneW;
               h = 0.025*SafeZoneH;
           };
           class CsatPoints: NatoPoints
           {
               idc = 202;
               colorBackground[] = {"profileNamespace getVariable ['Map_OPFOR_R',0.5]","profileNamespace getVariable ['Map_OPFOR_G',0]","profileNamespace getVariable ['Map_OPFOR_B',0]",0.5};
               y = SafeZoneY + 0.2255*SafeZoneH;
           };
       };
   };
};

I simply re-open it on each client with PV eventhandlers (tied to the victory point variables) and re-open it on the server (if !isDedicated) when the points change. Edit: And it must be re-opened on the same layer each time to prevent a stack of them on-screen.

Edited by SilentSpike
Fixed typo

Share this post


Link to post
Share on other sites

G'day Gents,

 

I see this thread is quite old, but, it looks like it has exactly what I'm looking for.

 

I recently grabbed a GUI from t-800a and its very nice, does everything I would like and more. The only edit I would like to make is; not have it freeze the player, that is, once the player interacts with the laptop, the GUI shoots up and downloads data then closes. While the download is occurring the player should be able to go off and fight enemies with the GUI off to the side of the screen doing its thing.

 

Reading @silentspike's reply, it looks like I want to use the cutRsc, but I'm not sure where I would go in the linked script to make the necessary changes. Please help :)

 

Cheers!

Share this post


Link to post
Share on other sites
2 hours ago, SHIFTY_TFD said:

G'day Gents,

 

I see this thread is quite old, but, it looks like it has exactly what I'm looking for.

 

I recently grabbed a GUI from t-800a and its very nice, does everything I would like and more. The only edit I would like to make is; not have it freeze the player, that is, once the player interacts with the laptop, the GUI shoots up and downloads data then closes. While the download is occurring the player should be able to go off and fight enemies with the GUI off to the side of the screen doing its thing.

 

Reading @silentspike's reply, it looks like I want to use the cutRsc, but I'm not sure where I would go in the linked script to make the necessary changes. Please help :)

 

Cheers!

Looks like createDisplay will do what you want.

 

Cheers

Share this post


Link to post
Share on other sites

Awesome, so looking at the createDisplay, it is used to call this download data GUI? yes?

 

so would I want something like this?

_ComputerDisplay = findDisplay -1 createDisplay "T8L_fnc_addActionLaptop";

because I couldn't get that to work...

 

Or do I need to change something in the hpp?

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

×