Jump to content
Sign in to follow this  
TRexian

Issue with exiting from special dialog

Recommended Posts

We are working on updating and improving Pingu's claymore addon for A1. Been making good progress, but have encountered a problem (well, several, but this is the most debilitating).

For those of you who may not remember, he had a function that allowed you to "sight in" the claymore. It consisted of a (realistically) simple peep sight. I can get to the peep sight, but can't escape from it. Nothing works. I've got absolutely no experience with dialogs so have no real clue where to go with this. (I added the disableserialization based on a suggestion from a BI error message.)

Here is the script:

#define CW 0
#define CCW 1
#define UP 2
#define DOWN 3
disableSerialization;

_arguments = _this select 3;
_claymore = _arguments select 0;

_camera = "camera" camCreate position _claymore;
_camera cameraEffect ["internal", "back"];
cutrsc ["claymore_peep_sight", "PLAIN DOWN"];

peep_sight_events = compile loadFile "\JTD_mines\scripts\peep_sight_events.sqf";
peep_sight_right = false;
peep_sight_left = false;
peep_sight_forward = false;
peep_sight_backward = false;
peep_sight_nvg = false;


createDialog "peep_sight";
_disp = (findDisplay 55001);

_disp displaySetEventHandler["KeyDown", '["KeyDown",_this] call peep_sight_events'];
_disp displaySetEventHandler["KeyUp", '["KeyUp",_this] call peep_sight_events'];

while {dialog} do
{
if (peep_sight_right) then
{
	[_claymore, CW] execVM "\JTD_mines\scripts\rotate.sqf";
};
if (peep_sight_left) then
{
	[_claymore, CCW] execVM "\JTD_mines\scripts\rotate.sqf";
};
if (peep_sight_forward) then
{
	[_claymore, UP] execVM "\JTD_mines\scripts\rotate.sqf";
};
if (peep_sight_backward) then
{
	[_claymore, DOWN] execVM "\JTD_mines\scripts\rotate.sqf";
};

_camera setVectorDirAndUp [vectorDir _claymore, vectorUp _claymore];
camUseNVG peep_sight_nvg;
_camera camCommit 0.1;
sleep 0.05;
};

_camera cameraEffect ["terminate", "back"];
cutrsc ["default", "PLAIN DOWN"];
camDestroy _camera;

I'm tempted to try to code in a "q" keypress that breaks out of the while {dialog} loop, but it seems like that is just a workaround for a more fundamental issue.

Thanks for any help!

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
Sign in to follow this  

×