Jump to content
xjoker_

Problem with BIS_fnc_guiMessage

Recommended Posts

Hello,

 

This function allow us to ask the player a question, and take an action regarding his choice

https://community.bistudio.com/wiki/BIS_fnc_guiMessage

 

The problem is that if the player press ESC, It's exactly the same that if he presses the button on the right.

I would like to just close the dialog when when we press esc, without calling the action of the button.

 

Is there any way to do this without creating my own dialog ?

Share this post


Link to post
Share on other sites

The example provided at the wiki page crashes my game. Therefore I can't really help you.

Share this post


Link to post
Share on other sites

The problem is that if the player press ESC, It's exactly the same that if he presses the button on the right.

I would like to just close the dialog when when we press esc, without calling the action of the button.

This is correct it returns false the same as pressing cancel.

To cancel out without returning false you need to override two display events "unload" and "keydown" and the uinamespace variable "BIS_fnc_guiMessage_status" has to be made non nil.

The uinamespace variable "BIS_fnc_guiMessage_status" is also what gets returned as the result from the message box so this would have to be handled accordingly.

e.g

player addAction [ "mbox", {
		_nul = [] spawn {
			waitUntil { !isNull ( findDisplay 999 ) };

			( findDisplay 999 ) displayRemoveAllEventHandlers "keyDown";
			( findDisplay 999 ) displayRemoveAllEventHandlers "unload";
			
			( findDisplay 999 ) displayAddEventHandler [ "keyDown", {
				if ( _this select 1 == 1 ) then {
					uiNamespace setVariable ['BIS_fnc_guiMessage_status',"Escaped"];
					( findDisplay 999 ) closeDisplay 0;
				};
			}];
		};
		_result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_GUImessage;
		
		_msg = "";
		if ( typeName _result isEqualTo typeName true ) then {
			if ( _result ) then {
				_msg = format[ "You pressed OK\n%1", str _result ];
			}else{
				_msg = format[ "You pressed CANCEL\n%1", str _result ];
			};
		}else{
			_msg = format[ "You pressed Escape\n%1", _result ];
		};
		hint _msg;
	}
];
Returns true for OK, false for CANCEL and "Escaped" if you press the escape button.
  • Like 2

Share this post


Link to post
Share on other sites
On 25.10.2015 at 7:39 PM, Larrow said:

This is correct it returns false the same as pressing cancel.

 

Do you know maybe how to do the same only with that message from the game? (if it's even possible). This message box, called RscDisplayCommonMessage appears when you try save the game,

 

 


3T5eKIi.jpg
 

 

 

but there are too many saves and it asks you to select save, which you want to override and that confirmation dialog appears (see screen). I tried to detect it with 999 id, but no luck.

 

 

5luZpWA.jpg



 

 

 

Tried that but it doesn't work:

 

waitUntil {uiSleep 0.01;!isNull (finddisplay 49)};
private _Save = (finddisplay 49) displayCtrl 103;

_Save ctrlSetEventhandler ["ButtonClick",
"
[] spawn
{
	uiSleep 0.2;
	if (!isNull (finddisplay 49)) then
	{
		_but = ((finddisplay 154) displayCtrl 1);
		_but ctrlsettext 'GOT IT';

		_but ctrlSetEventhandler ['ButtonClick',
		'
			[] spawn {uiSleep 0.5;((findDisplay 999) displayCtrl 235106) ctrlsettext ""DETECTED""}
		'];
	}
}
"
];

You have any ideas..? Maybe it's the wrong dialog with wrong id

Share this post


Link to post
Share on other sites
On 25/10/2015 at 7:14 AM, R3vo said:

The example provided at the wiki page crashes my game. Therefore I can't really help you.

 

You need to test it outside the console. For example, as simple test, I delay the message for 3 sec, sufficient enough to close the console. (up to you to call it when you need)

 

0 = [] spawn {

  sleep 3;

  _result = ["hello","test", "oki doki","na! forget!",nil, false, false] call BIS_fnc_guiMessage;

  hint str _result

}

 

The return  is true for Ok (left) button,  false for escape or cancel (right) button.

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, pierremgi said:

_result = ["hello","test", "oki doki","na! forget!",nil, false, false] call BIS_fnc_guiMessage;

 

Well you call the function by yourself. In my case this is a dialog window which appears from 'game menu'

Share this post


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

 

Well you call the function by yourself. In my case this is a dialog window which appears from 'game menu'

Not sure to understand "by yourself". Anyway, you can specify a parameter:   parent (Optional): Display - parent display as 5th param.

And useParentBox (Optional): Boolean - try to use control inherited from "RscMessageBox" in parent instead of creating a new one (default: false). This is also useful to let the parent display opened. 

 

Example: for game on pause (idd 49):

 

0 = [] spawn {

  waitUntil {!isNull findDisplay 49};

  _result = ["Suicide?","Boring scenario", "oki doki","na! forget!",findDisplay 49,true, false] call BIS_fnc_guiMessage;

  if (_result) then {player setDamage 1};

};

 

You can run this code at start. To make it repeatable, do a loop.

 

Share this post


Link to post
Share on other sites
Just now, pierremgi said:

Not sure to understand "by yourself"

 

Read again please my post

 

On 04.11.2018 at 6:29 PM, jts_2009 said:

but there are too many saves and it asks you to select save, which you want to override and that confirmation dialog appears (see screen). I tried to detect it with 999 id, but no luck.

 

The point is to catch that confirmation dialog which appears from game menu

Share this post


Link to post
Share on other sites

Ah OK.your request has no link with your title and the BI function. Please change it for something more accurate. You want to override a button control for skipping a confirmation (if I'm right).

Share this post


Link to post
Share on other sites
10 hours ago, pierremgi said:

You want to override a button control for skipping a confirmation (if I'm right).

 

I want to set an eventhandler on that button. But this confirmation message seems to be not a display type (checked with allDisplays command and it was not available). 

Share this post


Link to post
Share on other sites

Yes, OK, the only thing I succeed in so far is to override the "save" button itself, not the sub-display if full list of saved mission.

Share this post


Link to post
Share on other sites
On 06.11.2018 at 3:29 PM, pierremgi said:

the "save" button itself

 

Well, if you know how manually make a 'save'... :grinning: (No, I don't mean 'autosave') :hehe:ю

 

I also monitored all variables on that moment when this confirmation dialog appears. Here they are so far. Not all, game can't copy more to clipboard:

 



["bis_fnc_registercuratorobject_meta","bis_fnc_curatorautomatic_meta","bis_fnc_curatorchallengegetinvehicle","bis_fnc_loop","bis_fnc_paramreviveunconsciousstatemode_meta","bis_fnc_easeout","bis_fnc_activateaddons","bis_fnc_setheight","bis_fnc_isloading_meta","bis_fnc_setservervariable","cup_fnc_moveincargo","bis_fnc_vrcourseballistics3","cba_fnc_vectadd","bis_fnc_guieditor","bis_fnc_displayname","bis_fnc_storeparamsvalues_meta","bis_fnc_decodeflags8_meta","bis_fnc_respawngroup","bis_fnc_dbclassremove","bis_fnc_dbclassid_meta","bis_fnc_animalsitespawn_meta","bis_fnc_vrcourseballistics4","bis_fnc_zoomunlock_meta","cba_fnc_getitemconfig","cba_fnc_registerkeybind","cba_fnc_inject_meta","rscdisplaymission_script","cba_ui_fnc_initdisplaypassword","bis_fnc_unitcapture","bis_fnc_ambientplanes_meta","bis_fnc_switchlamp_meta","bis_fnc_invremove_meta","bis_fnc_fixdate_meta","bis_fnc_execfsm","bis_fnc_versioninfo_meta","bis_fnc_camera_edenconnectionchanged_meta","bis_fnc_cargoturretindex_meta","bis_fnc_moduledamage","bis_fnc_modulecuratorsetcoefs","bis_fnc_vrcourseheliweapons3_meta","bis_fnc_reviveenabled","bis_fnc_getobjectbbd","cba_fnc_maprelpos","cba_fnc_addkeybindtofleximenu_meta","cba_fnc_ismusicplaying","cba_fnc_addclasseventhandler","display3deneditattributes_script","cba_help_verscript","bis_fnc_execvm_meta","bis_fnc_convertunits_meta","bis_fnc_magnitude_meta","bis_fnc_rankparams","bis_fnc_richcurve_setorientationmode","bis_fnc_infotext_meta","bis_fnc_richcurve_getkeys_meta","bis_fnc_returnchildren","bis_fnc_callscriptedeventhandler","bis_fnc_moduleobjectiveracecp","bis_fnc_modulehvtobjectives_meta","bis_fnc_egobjectivevisualizer_meta","bis_fnc_carrier01catapultactionremove","bis_fnc_scaleandtranslate","rscdisplaydynamicgroups_script","rscstaminabar","bis_fnc_orbatsetgroupparams","bis_fnc_sideid","bis_fnc_controlpoint_edenunregisteredfromworld_meta","bis_fnc_spawngroup_meta","bis_fnc_isinsidearea_meta","bis_fnc_version","bis_fnc_deletetask_meta","bis_fnc_version_meta","bis_fnc_camera_edendeleted_meta","bis_fnc_modulechat","bis_fnc_modulesector_meta","bis_fnc_skirmishtrigger_meta","cup_fnc_spawnweapons","bis_fnc_planeaieject","cba_fnc_deletenamespace","cba_fnc_registerchatcommand_meta","cba_fnc_getmusicplaying","bis_fnc_dbclasscheck","bis_fnc_showrespawnmenuposition_meta","bis_fnc_settopairs","bis_fnc_getcfgdata","bis_fnc_getrespawnmarkers_meta","bis_fnc_3den_onkeydown_meta","bis_fnc_roundnum","bis_fnc_endloadingscreen","bis_fnc_isposblacklisted","bis_fnc_getangledelta_meta","bis_fnc_3denexportterrainbuilder_meta","bis_fnc_exp_camp_lobby_updatemilitaryefficiency_meta","bis_fnc_carrier01edeninit","cba_fnc_createtrigger","rscdisplaymain_spotlighttime","bis_fnc_timeline_getcurrenttime","bis_fnc_richcurve_getpreviouskey","bis_fnc_diagwiki_meta","cup_fnc_towcondition_meta","bis_fnc_cpfindemptyposition","rscdisplayattributesmodulemissionname_script","bis_fnc_geometricmean_meta","bis_fnc_sethitpointdamage_meta","bis_fnc_radiosetplaylist_meta","bis_fnc_richcurve_edencomputenearestsegment","bis_fnc_vectorfromxtoy","bis_fnc_timeline_cleanup","bis_fnc_advhintcredits_meta","bis_fnc_blackin","bis_fnc_keypointsexport","bis_fnc_showrespawnmenuinventoryloadout_meta","bis_fnc_fadeeffect","bis_fnc_subclasses_meta","bis_fnc_setrespawndelay","bis_fnc_hatchclose_meta","bis_fnc_moduleobjectivetarget","bis_fnc_vrtimer_meta","bis_fnc_reviveenabled_meta","bis_fnc_initinspectable_meta","cba_fnc_getobjectconfig","rscstaminabar_script","bis_fnc_moduletimetrial","bis_fnc_movein","bis_fnc_getcfgdatabool","bis_fnc_crows","bis_fnc_spawnenemy","bis_fnc_destroycity_meta","bis_fnc_arrayshuffle_meta","bis_fnc_doorclose","cup_fnc_door_open","bis_fnc_modulemptypedefense","bis_fnc_exportinventory_meta","bis_fnc_vreffectkilled","bis_fnc_moduleslingload_meta","cba_fnc_isalive","cba_fnc_registerchatcommand","cba_fnc_shuffle","rscdisplaympscoretable_script","bis_fnc_fps_meta","bis_fnc_texttiles","bis_fnc_moduletriggers_meta","bis_fnc_curatorchallengefireweapon","bis_fnc_deletecounter","bis_fnc_respawnmanager_meta","bis_fnc_supplydrop","bis_fnc_titletext_meta","bis_fnc_getlinedist_meta","bis_fnc_moduleunlockobject_meta","bis_fnc_tracebullets_meta","bis_fnc_egspectatordraw2d_meta","bis_fnc_firedbombdemine_meta","cba_fnc_turretpath","cba_fnc_getarea_meta","rscdisplayorbat_script","rscdisplaychooseeditorlayout_script","bis_fnc_timeline_isplaying","bis_fnc_shutdown_meta","bis_fnc_keycode","bis_fnc_dbvalueremove","bis_fnc_respawngroup_meta","bis_fnc_key_getleavecontrolpoint","bis_fnc_aligntabs","bis_fnc_camera_getfov","bis_fnc_addrespawnposition","bis_fnc_modulegenericradio_meta","cup_fnc_lock_meta","bis_fnc_moduleweather_meta","bis_fnc_vreffectkilled_meta","bis_fnc_exp_camp_lobby_uioverlaymanager","bis_fnc_destroyer01edendelete_meta","cba_fnc_objectrandom_meta","bis_fnc_getcfgdatapool","bis_fnc_unpackstaticweapon","bis_fnc_showrespawnmenuinventorymetadata_meta","bis_fnc_numberdigits_meta","bis_fnc_displayresize","bis_fnc_dbvalueindex_meta","bis_fnc_diagmacrossimpleobject","bis_fnc_loadentry","bis_fnc_kmlimport_meta","bis_fnc_weaponaddon_meta","bis_fnc_livefeedmoduleinit","bis_fnc_moduleammo","bis_fnc_exp_camp_initclasses","bis_fnc_ejectionseatrelease","bis_fnc_cpinit_meta","cba_fnc_registerfeaturecamera_meta","cba_fnc_modelheaddir_meta","cba_fnc_addmagazine","cba_fnc_getposfromstring","cba_fnc_find","rscrespawncounter_script","display3densave","bis_fnc_drawcuratordeaths_meta","bis_fnc_blackout_meta","bis_fnc_interpolateweather_meta","bis_fnc_richcurve_edendrawcontrolpoints3d_meta","bis_fnc_tridentexecute","cup_fnc_emissivelights","bis_fnc_moduletracers","bis_fnc_initvehiclekart","cba_fnc_addmagazine_meta","cba_fnc_hashrem_meta","cba_settings_fnc_check","rscdisplayorbat","bis_fnc_timeline_gettimeleft","bis_fnc_respect_meta","bis_fnc_displayname_meta","bis_fnc_filterstring","bis_fnc_debugconsoleexec","bis_fnc_genericsentence","cup_fnc_createvehiclecargo_meta","cup_fnc_foldrotor_meta","bis_fnc_moduleobjectivegetin_meta","bis_fnc_modulespawnai_meta","bis_fnc_exp_camp_addtickets","cba_fnc_removebackpackcargo_meta","rscdisplayteamswitch_script","bis_fnc_setdate","bis_fnc_playersidefaction_meta","bis_fnc_wpsuppress_meta","bis_fnc_findoverwatch","bis_fnc_texturemarker_meta","cup_fnc_spawnlights_meta","cba_fnc_hashrem","cba_fnc_compilemusic","cba_fnc_playmusic_meta","rscdisplayattributesmoduleweather_script","bis_fnc_customgpsvideo_meta","bis_fnc_taskattack_meta","bis_fnc_flameseffect","bis_fnc_singlemissionconfig_meta","bis_fnc_scriptedmove_meta","bis_fnc_dirteffect_meta","bis_fnc_respawnmenuposition_meta","cup_fnc_attachtow","bis_fnc_modulesfx_meta","bis_fnc_moduleradiochannelcreate_meta","bis_fnc_removevirtualmagazinecargo","bis_fnc_vrcourseheliadvanced1_meta","bis_fnc_initlistnboxsorting_meta","bis_fnc_destroyer01handledamage","cba_fnc_substring","cba_fnc_strlen_meta","cba_fnc_scalevect","rscdisplaycurator_script","cba_events_fnc_initdisplaymainmap","bis_fnc_paramguerfriendly","bis_fnc_scenerotate","bis_fnc_modulecurator","bis_fnc_modulearsenal","bis_fnc_zoomlock","rscdisplayfilter_script","rscdisplayloading_progress","bis_fnc_effectfiredflares_meta","bis_fnc_quinticinoutvector_meta","bis_fnc_vectordivide","bis_fnc_magazinesentitytype_meta","bis_fnc_colorrgbatotexture","bis_fnc_enemytargets_meta","bis_fnc_spawnenemy_meta","bis_fnc_scenesetanimationsforgroup_meta","bis_fnc_modulecuratorsetattributes_meta","bis_fnc_removevirtualweaponcargo","bis_fnc_savevehicle_meta","bis_fnc_cpfindemptyposition_meta","cba_fnc_removemagazinecargo_meta","cba_fnc_compilefinal_meta","cba_fnc_getuisize_meta","bis_fnc_isinsidearea","bis_fnc_timeline_edenconnectionchanged","bis_fnc_maxdiffarray","bis_fnc_ambientanim","bis_fnc_addrespawninventory_meta","bis_fnc_controlpoint_edenconnectionchanged","bis_fnc_bounceinout","bis_fnc_modulecuratoraddaddons_meta","bis_fnc_exp_camp_lobby_structuredtext_meta","rds_fnc_sight_bmp2_meta","cba_statemachine_fnc_addeventtransition","bis_fnc_exporteditorpreviews","bis_fnc_bitwiseand_meta","bis_fnc_respawnwave_meta","bis_fnc_rankparams_meta","bis_fnc_noflyzonesexport_meta","bis_fnc_scriptedwaypointtype_meta","bis_fnc_invadd","bis_fnc_ambientboats","bis_fnc_modulerespawnvehicle","cup_fn

 

But none of them seems to fit

Share this post


Link to post
Share on other sites

0 = [] spawn {

  while {true} do {

    waitUntil {!isNull (findDisplay 49)};

    (findDisplay 49 displayCtrl 103) ctrlSetEventHandler ["buttonClick", "skiptime 15;true"];

  }

};

 

Now you skip time instead of saving the mission. I guess you can elaborate some missionSave or not with a condition. I have no clue how to pick the number of saved files. Perhaps a counter could do the trick.

Share this post


Link to post
Share on other sites

The point is that I try to catch somehow that confirmation dialog is that I want to save data into profileNamespace when Host exit the game. In multiplayer there is a button "Save and exit" where the same dialog confirmation dialog appears (I think). In eden editor it's just "Return to eden editor", so I try to catch it though the save button. So if Host press "Save and exit" and then confirms "OK", the data must be saved. Override or disable original save button doesn't make sense, because it you can't control when Host exit the game. He can save the game, but after 10 mins leave the game (Save & exit button). So your data is actually outdated with saved game. I had also idea, where the data is saved while the game is being saved. I execute custom autosave and then close display 46, so that the mission ends. But it saves the closing of display too, even with little delay so if you load the game after save, the game will finish -). That means that the the time while saving is not stopped, the game is just freezing. So I try to catch that confirmation dialog and set an eventhandler on that "OK" button, so the data will be saved, while the game makes the save

Share this post


Link to post
Share on other sites

Ok, I catched it! But thats related to the "save" button. Now I have to test if this confirmation dialog differs from if I try it on "Save and exit" button. Here is technical example if anyone need it:

 

// HERE I HAVE EVENTHANDLER SET ON SAVE BUTTON, IDC 103

[] spawn
{
	uiSleep 0.2;
	if (!isNull (finddisplay 49)) then
	{
		_but = ((finddisplay 154) displayCtrl 1);
		_lb = ((finddisplay 154) displayCtrl 101);
		_but ctrlsettext 'GOT IT';
		_lb ctrlEnable false;
		_lb lbSetcursel (lbSize _lb);

		_but ctrlSetEventhandler ['ButtonClick',
		'
			[] spawn
			{
				uiSleep 0.5;
				systemchat format [""%1"", uiNamespace getVariable ""RscMsgBox""]; // Confirmation dialog IDC is 235
				_ctr = uiNamespace getVariable ""RscMsgBox""; // get display
				hint format [""%1"", allControls _ctr]; // output all controls
				_b = _ctr displayCtrl 1; // catch OK button
				_b ctrlsettext ""YEP""; // Manipulate OK button
			}
		'];
	}
}

 

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

×