Forum Jump :

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#1 Posted at 2015-10-31 02:46        
     
Hello, I need help in my turn. I used to script with draw3D and cutRsc's but this time, i need to add a dialog box with click actions. The reason why i'm trying to use createDialog for the first time.
I can create a dialog box with workable buttons (and changing texts). Say a green/red button to addAction or remove it.
No problem so far, everything trigger and variable (button status) is saved, (0 for red, 1 for green) as far as dialog is open. I can even save variable in profileNameSpace and i recover it each time i launch Arma, with the saved value.
BUT
i don't know how to display the right current status of the button when re-opening the dialog.
For example: default status is off, button is red, attached variable is 0.
I click on the button, it becomes green, attached variable is 1. Toggling works fine, but say i close dialog with button "on" green. my variable is set to 1. OK
When I open once again the dialog, i always return to default button "red" declared in my dialog class.
That means, variable remains at 1 but dialog always start with button "off" red and that doesn't match anymore to the saved variable. How to start dialog with correct value for button?

NB: I have two pictures for button, one red, one green, toggling while dialog is open works fine. When closing it, I reset my button with the "red picture default value". How to avoid that? Thanks.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 23
In-game name: Wak

 
#2 Posted at 2015-10-31 10:05        
     
In the button config, just make it get the variable from profileNamespace. You could also have an onLoad script, but if you're just modifying button colors this method is the best.

I don't know if you're using colorBackground[], but it's a good example:
/*
 * By default the button will be red since there is no value for the variables in the profileNamespace
 * But whenever the button is pressed, you can set the values of 'MGI_ButtonRedTone' and 'MGI_ButtonGreenTone' as opposite.
 * So next time button is shown it'll find a value and make the button that color.
 */
colorBackground[] = {
	"(profileNamespace getVariable ['MGI_ButtonRedTone', 1])",
	"(profileNamespace getVariable ['MGI_ButtonGreenTone', 0])",
	0, //This is blue
	1 //This is alpha, we don't need to change these two
};

EDIT: If you have to do this with multiple buttons, this should also work (untested):
#define prefsGetRedVar "(profileNamespace getVariable ['MGI_ButtonRedTone', 1])"
#define prefsGetGreenVar "(profileNamespace getVariable ['MGI_ButtonGreenTone', 0])"
colorBackground[] = {
	prefsGetRedVar,
	prefsGetGreenVar,
	0, //This is blue
	1 //This is alpha, we don't need to change these two
};

This post was edited by 654wak654 (2015-11-01 10:58, ago)

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Advertisement


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#3 Posted at 2015-10-31 15:53        
     
Excellent! I tested also the on load script for other displays (cursors) and it works.
To conclude, I use createDialog for click action, in onLoad of my general resource (which is not a title/ cutRsc display) I set the (uiNameSpace) variable calling my box AND I add a script to refresh the displays with the proFileNameSpace variables. Then I save a lot of lines with color/alfa background preset variables. Thanks Wak

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 23
In-game name: Wak

 
#4 Posted at 2015-10-31 16:41        
     
There is lot more to this than button colors, was this for MGI Tactical Glasses?

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#5 Posted at 2015-10-31 16:55        
     
Yes, i'm writing a new version with clickable menu to choice displays and some parameters, (often based on difficulty setting). Extended with some tools for admin or SP. All ideas are welcome. I try to make it versatile for most of players.

Added 3 hours 22 minutes later:

By the way, I added RSCbuttonMenuOK and RSCbuttonMenuCancel but there is no explanation in BI about the way they work! You can click on it and then? No script available, no data saved, so what? At this time, clicking OK, cancel or striking ESC do the same thing. ESC is more reliable for closing the main dialog!

In the case of they could be smart, that flies far above my patience and comprehension!

This post was edited by Pierre MGI (2015-10-31 20:18, ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 23
In-game name: Wak

 
#6 Posted at 2015-10-31 21:57        
     
I think those only have BI specific usage, because I have no idea what they do. I sometimes use RSCbuttonMenu when I need that "black is cool" look, but that's all. You'll have to make your own buttons with your own action code if you want to save stuff or close the dialog, like you said it's more reliable. Wak_RscButton for life!

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage