Jump to content
simoffen

Blank UI? Blank/empty window?

Recommended Posts

How do I create a blank UI so the Mouse will be visible and working in a scenario? 
How will the code look like and where to put the code? I cant find anything about this. Is UI a blank/empty window? 
Hope to get some answers. 
Regards

Fredrik 

Share this post


Link to post
Share on other sites
createDialog "RscDisplayEmpty";

 

Share this post


Link to post
Share on other sites
3 minutes ago, 7erra said:

createDialog "RscDisplayEmpty";

 

Where do I put that code? 

Share this post


Link to post
Share on other sites

Wherever you need it? Debug console for example?

Share this post


Link to post
Share on other sites
12 minutes ago, 7erra said:

Wherever you need it? Debug console for example?

And where is that. I am a rokie as you understand. 

Share this post


Link to post
Share on other sites
1 hour ago, 7erra said:

Welcome to programming then! Google (or whatever search engine) is your best guide. https://community.bistudio.com/wiki/Arma_3_Debug_Console

I have searched the whole internet and still no answer where to put the code. 
Init.sqf or? Every guide shows a lot of code and so on. But no one tells where to put the code. 

Share this post


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

I have searched the whole internet and still no answer where to put the code. 
Init.sqf or? Every guide shows a lot of code and so on. But no one tells where to put the code. 

Where you put the code depends where and under what circumstances you want to run it.

So what exactly do you need this for?

Share this post


Link to post
Share on other sites
1 hour ago, target_practice said:

Where you put the code depends where and under what circumstances you want to run it.

So what exactly do you need this for?


Hi! Here Below you see the code I will use. But I don’t understand how to create a blank UI and where to put the code. 
So glad if you can help me with this. 
Regards

Fredrik 
 

//Create a camera 2m infront of the player cam = "camera" camCreate ( player getPos[ 2, getDir player ] ); //Set camera 2m off the ground cam setPosATL ( getPosATL cam vectorAdd[ 0, 0, 2 ] ); //Switch to the cameras static view cam cameraEffect[ "Internal", "Back" ]; //Create a blank UI so we can see the mouse pointer createDialog "RscDisplayCommon"; //On render update addMissionEventHandler[ "Draw3D", { //Max distance of intersect _maxDistance = 200; //Camera position _camPos = getPosATL cam; //Mouse screen position as world _worldPos = screenToWorld getMousePosition; //Direction( normalised ) from camera to mouse world position _vectorDir = _camPos vectorFromTo _worldPos; //Calculate line end position _lineEnd = _camPos vectorAdd ( _vectorDir vectorMultiply _maxDistance ); //Get first surface intersections between camera and line end lineIntersectsSurfaces[ ATLToASL _camPos, ATLToASL _lineEnd ] select 0 params[ [ "_pos", [] ] ]; //If we have an intersection if ( count _pos isEqualTo 3 ) then { //Check for nearby entities to the selected position _EntityToKill = (_pos nearEntities [["Man"], 5]) select 0; // kill nearest entitity _EntityToKIll setDamage 1; }else{ diag_log format[ "%1: No intersect position", time ]; }; }];

Share this post


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


Hi! Here Below you see the code I will use. But I don’t understand how to create a blank UI and where to put the code. 
So glad if you can help me with this. 
Regards

Fredrik 
 

//Create a camera 2m infront of the player cam = "camera" camCreate ( player getPos[ 2, getDir player ] ); //Set camera 2m off the ground cam setPosATL ( getPosATL cam vectorAdd[ 0, 0, 2 ] ); //Switch to the cameras static view cam cameraEffect[ "Internal", "Back" ]; //Create a blank UI so we can see the mouse pointer createDialog "RscDisplayCommon"; //On render update addMissionEventHandler[ "Draw3D", { //Max distance of intersect _maxDistance = 200; //Camera position _camPos = getPosATL cam; //Mouse screen position as world _worldPos = screenToWorld getMousePosition; //Direction( normalised ) from camera to mouse world position _vectorDir = _camPos vectorFromTo _worldPos; //Calculate line end position _lineEnd = _camPos vectorAdd ( _vectorDir vectorMultiply _maxDistance ); //Get first surface intersections between camera and line end lineIntersectsSurfaces[ ATLToASL _camPos, ATLToASL _lineEnd ] select 0 params[ [ "_pos", [] ] ]; //If we have an intersection if ( count _pos isEqualTo 3 ) then { //Check for nearby entities to the selected position _EntityToKill = (_pos nearEntities [["Man"], 5]) select 0; // kill nearest entitity _EntityToKIll setDamage 1; }else{ diag_log format[ "%1: No intersect position", time ]; }; }]; 

Could you please repost that code using code block object? Presently you've posted it onto a single line and made it extremely hard to read.
Even so, you still haven't said where you want this code to be run.

 

Share this post


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

Could you please repost that code using code block object? Presently you've posted it onto a single line and made it extremely hard to read.
Even so, you still haven't said where you want this code to be run.

 

I cant paste the code in that way. Have tryed everything. Even tryed to write a pm to you with the code. But same thing there. Just one sentence of all text. Very strange. 
I dont understand what you mean when you say ”where the code to be run” In the scenario I guess. Very confused. But can code be runned in different places? 
I have put the code in Init.sqf and it works. Almost everything works, but no bullet shoots when i click the mouse. 
And I think that depends of the lack of the blank UI. 
why cant i paste the formatted code? I copy it inside this forum.   

Share this post


Link to post
Share on other sites
1 minute ago, simoffen said:

I cant paste the code in that way. Have tryed everything. Even tryed to write a pm to you with the code. But same thing there. Just one sentence of all text. Very strange. 
I dont understand what you mean when you say ”where the code to be run” In the scenario I guess. Very confused. But can code be runned in different places? 
I have put the code in Init.sqf and it works. Almost everything works, but no bullet shoots when i click the mouse. 
And I think that depends of the lack of the blank UI. 
why cant i paste the formatted code? I copy it inside this forum.   

Try this link. https://forums.bohemia.net/forums/topic/227978-enable-mouse-cursorcursortargetcursorobject-during-cutscene/?do=findComment&comment=3402728

 

Share this post


Link to post
Share on other sites

What exactly are you trying to do? Start there. Do you just want a blank empty screen while playing (realism)? You can turn Off everything in the Settings.

 

You can run code from numerous places. It gets complicated... You can run code from .sqf files in your mission folder(s).

 

Some Examples:

- init.sqf (runs automatically at game start)

- anyname.sqf (needs to be called to execute - example from a Trigger, etc)

- Triggers can run code right inside them, by themselves

- Objects have a box you can insert code into (double-click to open)

- Debug Console (press ESC, paste/type code, then press Local, etc)

- Mods/Addons (way too complicated to explain here)

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, simoffen said:

why cant i paste the formatted code? I copy it inside this forum. 

I suggest you try pasting it in something like Notepad++ first, see if that helps.

 

3 minutes ago, Von Quest said:

What exactly are you trying to do? Start there. Do you just want a blank empty screen while playing (realism)? You can turn Off everything in the Settings.

Bloody hell you beat me to it. :icon_biggrin:

 

To corroborate with @Von Quest though, given that you seem to be enough of a scripting novice to not even know how to really use your code, we'll need to know exactly what you desire to achieve here in order to give the right advice 

Share this post


Link to post
Share on other sites

Yes!

If getting into the ArmA hobby, I HIGHLY suggest using Notepad++ for coding. Its Free and easy to use. You can also get a plugin to colorize the ArmA (sqf) code...

 

Notepad++

https://notepad-plus-plus.org/downloads/

 

KK's plug-in

http://killzonekid.com/arma-2-arma-3-hybrid-syntax-highlighter-for-notepad/

Share this post


Link to post
Share on other sites

 

//Create a blank UI so we can see the mouse pointer createDialog "RscDisplayCommon"; 

 

The code above is my problem. Where to put the code? 
And is this code enough to create a blank UI? 
 

Share this post


Link to post
Share on other sites

I have got some code to make static game  so I can use a laser gun to shoot at a Arma 3 scenario. But I cant get the code below to work (Blank UI) I dont know what to do or where to put the code below. The rest of the code is in the Init.sqf and seems to work. You can see in the video what I try to do. The video is from VBS 3. Please give me some advice or if possible send me an example. 


//Create a blank UI so we can see the mouse pointer createDialog "RscDisplayCommon"; 

Share this post


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

The code above is my problem. Where to put the code? 

It depends in what context you want to this blank UI to appear. You can put the code in numerous different places, all of which affect when and where (as in, on what machine in a multiplayer session) it is run.

 

2 hours ago, simoffen said:

And is this code enough to create a blank UI?

Yes, but as I've already told you, a blank UI alone will not allow you to recreate that firing range/free aiming thing from VBS. That requires more work.

Share this post


Link to post
Share on other sites

@simoffen,

This is the codeblock in a readable format,

Spoiler


you_lightZapper=[]spawn {
cam = "camera" camCreate ( player getPos[ 2, getDir player ] );
cam setPosATL ( getPosATL cam vectorAdd[ 0, 0, 2 ] );
cam cameraEffect[ "Internal", "Back" ]; 
createDialog "RscDisplayCommon";	//Create a blank UI so we can see the mouse pointer 
addMissionEventHandler[ "Draw3D", {
_maxDistance = 200;
_camPos = getPosATL cam;
_worldPos = screenToWorld getMousePosition;
_vectorDir = _camPos vectorFromTo _worldPos;
_lineEnd = _camPos vectorAdd ( _vectorDir vectorMultiply _maxDistance );
lineIntersectsSurfaces[ ATLToASL _camPos, ATLToASL _lineEnd ] select 0 params[ [ "_pos", [] ] ];
	if ( count _pos isEqualTo 3 ) then {
		position _EntityToKill = (_pos nearEntities [["Man"], 5]) select 0;
		_EntityToKIll setDamage 1;
	}else{
			diag_log format [ "%1: No intersect position", time ];
		};
	}
];
};

All I did was wrap it in cages and name the process. I don't know if a) the original code will work, b) I didn't make a mistake-- can paste in init properties dialog or debug console to find out.

Have fun!

Share this post


Link to post
Share on other sites
15 hours ago, target_practice said:

It depends in what context you want to this blank UI to appear. You can put the code in numerous different places, all of which affect when and where (as in, on what machine in a multiplayer session) it is run.

 

Yes, but as I've already told you, a blank UI alone will not allow you to recreate that firing range/free aiming thing from VBS. That requires more work.

There is more code. But that code seems to work. The only part of the code I dont understand is the code above. 

Share this post


Link to post
Share on other sites
14 hours ago, wogz187 said:

@simoffen,

This is the codeblock in a readable format,

  Hide contents


you_lightZapper=[]spawn {
cam = "camera" camCreate ( player getPos[ 2, getDir player ] );
cam setPosATL ( getPosATL cam vectorAdd[ 0, 0, 2 ] );
cam cameraEffect[ "Internal", "Back" ]; 
createDialog "RscDisplayCommon";	//Create a blank UI so we can see the mouse pointer 
addMissionEventHandler[ "Draw3D", {
_maxDistance = 200;
_camPos = getPosATL cam;
_worldPos = screenToWorld getMousePosition;
_vectorDir = _camPos vectorFromTo _worldPos;
_lineEnd = _camPos vectorAdd ( _vectorDir vectorMultiply _maxDistance );
lineIntersectsSurfaces[ ATLToASL _camPos, ATLToASL _lineEnd ] select 0 params[ [ "_pos", [] ] ];
	if ( count _pos isEqualTo 3 ) then {
		position _EntityToKill = (_pos nearEntities [["Man"], 5]) select 0;
		_EntityToKIll setDamage 1;
	}else{
			diag_log format [ "%1: No intersect position", time ];
		};
	}
];
};

All I did was wrap it in cages and name the process. I don't know if a) the original code will work, b) I didn't make a mistake-- can paste in init properties dialog or debug console to find out.

Have fun!

I’m not by my computer right now. But do you think this code will work in Init.sqf or where to put the code? 

Share this post


Link to post
Share on other sites
On 6/6/2020 at 9:43 AM, simoffen said:

I’m not by my computer right now. But do you think this code will work in Init.sqf or where to put the code? 

 

On 6/5/2020 at 7:04 PM, wogz187 said:

@simoffen,

This is the codeblock in a readable format,

  Reveal hidden contents


you_lightZapper=[]spawn {
cam = "camera" camCreate ( player getPos[ 2, getDir player ] );
cam setPosATL ( getPosATL cam vectorAdd[ 0, 0, 2 ] );
cam cameraEffect[ "Internal", "Back" ]; 
createDialog "RscDisplayCommon";	//Create a blank UI so we can see the mouse pointer 
addMissionEventHandler[ "Draw3D", {
_maxDistance = 200;
_camPos = getPosATL cam;
_worldPos = screenToWorld getMousePosition;
_vectorDir = _camPos vectorFromTo _worldPos;
_lineEnd = _camPos vectorAdd ( _vectorDir vectorMultiply _maxDistance );
lineIntersectsSurfaces[ ATLToASL _camPos, ATLToASL _lineEnd ] select 0 params[ [ "_pos", [] ] ];
	if ( count _pos isEqualTo 3 ) then {
		position _EntityToKill = (_pos nearEntities [["Man"], 5]) select 0;
		_EntityToKIll setDamage 1;
	}else{
			diag_log format [ "%1: No intersect position", time ];
		};
	}
];
};

All I did was wrap it in cages and name the process. I don't know if a) the original code will work, b) I didn't make a mistake-- can paste in init properties dialog or debug console to find out.

Have fun!

Doesent work at all....... I have put all the code in Init.sqf and I get Errormessage all the time.... What is "you_lightZapper=[]spawn" I dont understand???? 

Share this post


Link to post
Share on other sites

 

Doesent work at all....... I have put all the code in Init.sqf and I get Errormessage all the time.... What is "you_lightZapper=[]spawn" I dont understand???? 


@wogz187

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

×