Forum Jump :

Author Message


Posts: 24
Rank:


Level: Member

Country: se
Location:
Occupation: Soldier
Age: 29
In-game name: Bauerhousebourne

 
#1 Posted at 2015-08-07 06:26        
     
Hi!

I have just started to learn the basics of creating dialogs and I stumbled upon a problem.
Is there any way to change the image of Rscpicture? For example, something like:


class bar: RscPicture
{
idc = 1200;
text = "rsc\image.jpg";
sleep 5;
text = "rsc\image2.jpg";
sleep 5;
text = "rsc\image3.jpg";
x = 0.391146 * safezoneW + safezoneX;
y = 0.335 * safezoneH + safezoneY;
w = 0.240625 * safezoneW;
h = 0.044 * safezoneH;
};

Looked elsewhere for an answer but could not find any.

Thanks in advance! :)

It's only funny until someone gets hurt, then it's hilarious!

Author Message


Posts: 1589
Rank:


Level: Member

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

 
#2 Posted at 2015-08-07 08:25        
     
No! you can't write sleep in config classes.
So, there is two separate kind of files:
- You can script functions in sqf files, and by the way "schedule" them with functions such as "sleep" under certain conditions ("spawning parallel" script and not "calling" sub-functions which halts the main script);
- on the other hand, config.cpp or description.ext enable you to declare own classes (with inheritance with common Arma classes). Your class bar:RscPicture is a kind of subclass (of rscPicture) already declared in engine.
With that, you can "control" via idc (as ident control) your resource (rsc) picture.

So you can parameter text via control (idc) with a variable, but don't forget your global display (idd)

class my_display
	{
	idd = -1;
	duration = 100000; // to be displayed as long as you want
	fadein = 0;
	fadeout = 0;
	name="the_name_of_display"; // what u like
	onLoad = "uiNamespace setVariable ['important_variable_here', _this select 0]";
	controls[]= {my_picture};

		class my_picture: RscPicture
		{
		idc = 2200; // what u want but never the same
		text = ""; // in blanc but feed is provided by variable above
		colorText[] = {0,0,0,0};
		x = 0.391146 * safezoneW + safezoneX;
		y = 0.335 * safezoneH + safezoneY;
		w = 0.240625 * safezoneW;
		h = 0.044 * safezoneH;
		};
         };
This display class (my_display) belongs on its turn to RscTitles. You need t owrap it in:
class RscTitles
{
titles[] = {"my_display"};
// ALL ABOVE HERE
};

Then, in a sqf file, you can script what you want:
_handling_variable = (uiNameSpace getVariable "important_variable_here") displayCtrl 2200;// call the good control!
_handling_variable ctrlSetText "rsc\image.jpg";// not sure all jpg work. Try paa file instead
_handling_variable ctrlSetBackgroundColor [1, 1, 1, 1 ]; // example for white , no transparency (just background)

then sleep...
then
_handling_variable ctrlSetText "rsc\image2.jpg";
...
and of course, you must call your RscTitle to make it displayed: 0 cutRsc ["my_display","PLAIN",0,false];

Sometimes Rsc controls and scheduled script with sleep are working weird, depending on CPU load. For better results you need to "onEachFrame" the control. You can find all documentation on BIKI.

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

Advertisement


Author Message


Posts: 24
Rank:


Level: Member

Country: se
Location:
Occupation: Soldier
Age: 29
In-game name: Bauerhousebourne

 
#3 Posted at 2015-08-07 08:40        
     
Thanks Pierre. I'll try it out! :)

Added 5 hours 45 minutes later:

Well I got it working :D

Here's what I did:

I added several dialog classes into the dialogs.hpp, class my_dialog, class my_dialog2 etc.
In every new dialog I kept all the settings but I changed picture, text = "rsc\loading.jpg"; , text = "rsc\loading2.jpg"; etc.

Then, I created triggers that called upon each dialog idividually.
inside Script1.sqf , I put _handle=createdialog "my_dialog"; and on the second trigger I put closeDialog 0; and then _handle=createdialog "my_dialog2";

The transition was seamless and works out great. I am happy with this solution but there is still one problem.

The dialog opens up for all players. Is there an easy way to make this appear only for the player who activates the trigger?
It fires upon an addAction by the way.

This post was edited by Bauerhousebourne (2015-08-07 14:26, ago)

It's only funny until someone gets hurt, then it's hilarious!

Author Message


Posts: 1589
Rank:


Level: Member

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

 
#4 Posted at 2015-08-07 19:58        
     
AddAction should not be the problem, because it's a local function. CreateDialog has a local effect. Triggers are global and that's the reason why you opens dialog for each units concerned by the trigger if edited on map.
The solution is to "createTrigger" in script. Since V1.43, you can make local the trigger.
see: https://community.bistudio.com/wiki/createTrigger

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

Author Message


Posts: 24
Rank:


Level: Member

Country: se
Location:
Occupation: Soldier
Age: 29
In-game name: Bauerhousebourne

 
#5 Posted at 2015-08-07 21:29        
     
I tried doing that but I can't get it working for some reason.
Do you think you could provide me with a step-by-step example? :-[ The bistudio-wiki never did make much sense to me

It's only funny until someone gets hurt, then it's hilarious!

Author Message


Posts: 1589
Rank:


Level: Member

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

 
#6 Posted at 2015-08-08 00:05        
     
I hope this will help you to understand BIKI. _trg1 and _trg2 are just local handling variables to refer at the triggers you create. There is no need to globalize them if you don't want to use them in other scripts. Triggers are created and will work from your server (this script/code is to be on server (in init.sqf for example).
A trigger is always an emptyDetector.
triggerpos is whatever trigger position you want. For example, placer a marker on the map, say mark1 (invisible or not), and replace triggerpos by getmarkerpos "mark1"
radius1 ...to 4, the axis' lenght in meter of your triggers.
handle1 & 2 are two handles here. Make them global here, as you recall them to close them.
Don't forget to close the second dialog. For instance when player leaves (deact) the 2nd trigger.

_trg1 = createTrigger ["EmptyDetector", triggerpos, false];
_trg1 setTriggerArea [radius1, radius2, 0, false];
_trg1 setTriggerActivation ["BLUFOR", "PRESENT", true];
_trg1 setTriggerStatements ["this", "handle1=createdialog 'my_dialog' ", ""];

_trg2 = createTrigger ["EmptyDetector", triggerpos, false];
_trg2 setTriggerArea [radius3, radius4, 0, false];
_trg2 setTriggerActivation ["BLUFOR", "PRESENT", true];
_trg2 setTriggerStatements ["this", "closeDialog handle1;handle2=createdialog 'my_dialog2' ", "closeDialog handle2"];

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

Author Message


Posts: 24
Rank:


Level: Member

Country: se
Location:
Occupation: Soldier
Age: 29
In-game name: Bauerhousebourne

 
#7 Posted at 2015-08-08 07:45        
     
Great, that makes much more sense. Gonna give it a try :) Thanks a lot Pierre!

Added 4 minutes later:

I created a new mission just to try this out.

Firstly, I created a marker named triggerpos1 and a trigger in the editor that calls for null = [] execVM "script1.sqf"; when activated.

I put this code inside sqript1.sqf:

_trg1 = createTrigger ["EmptyDetector", getmarkerpos "triggerpos1", false];
_trg1 setTriggerArea [15, 15, 0, false];
_trg1 setTriggerActivation ["CIV", "PRESENT", true];
_trg1 setTriggerStatements ["this", "hint 'Civilian spotted'", ""];

Works like a charm, but the trigger hint is still visible for every unit *SCRATCH*

This post was edited by Bauerhousebourne (2015-08-08 09:19, ago)

It's only funny until someone gets hurt, then it's hilarious!

Author Message


Posts: 1589
Rank:


Level: Member

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

 
#8 Posted at 2015-08-08 18:17        
     
Not sure to understand why.
The effect should be local and hint is a local function.
Question is who own your units when you run this script? Could you tell me how you test your MP mission?

Try to add if (!isServer) exitwith {}; at start of the script, before the lines for the triggers. Tell me if that works, i can't test in MP.

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