Jump to content
Sign in to follow this  
madrussian

Using ctrlMap commands on the Main Map? - SOLVED

Recommended Posts

There are several very useful commands, if only I could get them working on the Main Map:

However, they all require a Control as an input, which I'm assuming in many cases would be a custom dialog with an embedded map, etc. But it seems like these commands should work on the Main Map as well?

For instance, to latch onto the main display, you can use something like this:

(findDisplay 46) displayAddEventHandler ["keyDown", "_this call functionName_keyDown"];

Is there something similar to "find" the Main Map for use with these powerful map commands?

------------------------------------------

SOLVED:

To get the default Main Map control:

_defaultMainMapCtrl = (findDisplay 12) displayCtrl 51;

Best of all it actually works with all those powerful ctrlMap commands.

Thanks Das Attorney and PVPscene, wouldn't have gotten it without you guys!

btw- In future BIS games, the display and control IDs for the main map might change, but the method used to get them should be the same (see detection script in post below).

Edited by MadRussian

Share this post


Link to post
Share on other sites

Hey thanks Das Attorney.

I just fired up a quick mission and tried to trap a mouse press on the Main Map using findDisplay 12 like this:

waitUntil {!(isNull (findDisplay 12))};

_index=(findDisplay 12) displayAddEventHandler ["MouseButtonDown","hint ""Woohoo!"" "];

And guess what? It worked!!!

You the man! Btw- Now I wonder how UNN ever figured that out in the first place?!? :D Now I'm off to try it with those ctrlMap commands...

EDIT:

Just tried:

waitUntil {!(isNull (findDisplay 12))};

_ctrlMapScale = ctrlMapScale (findDisplay 12);

hint format ["_ctrlMapScale: %1", _ctrlMapScale];

And... No dice. :confused:

Hmmm... Now I'm wondering if there is an equivelent "find control" method similar to (findDisplay 12) to access the Main Map for these commands???

Edited by MadRussian

Share this post


Link to post
Share on other sites

Hey PvPScene, I sent you a PM on that. Sounds interesting, and I'll definitely check it out! Specifically I'm interested to know if MapReplacement retains the default map features, like moveable waypoints for the player group (when shown), which I need for my mission.

In the mean time, can anyone say with certainty that there is any way to get these ctrlMap commands working on the default main map? Hunches are welcome too. :)

Share this post


Link to post
Share on other sites

Nailed it!!! :yay:

For those who just want to know how to get the control for the default Main Map (which incedentially works with all the ctrlMap commands), just check the bottom of this post. For those interested, here's how I figured it out:

After cracking open PVPscene's MapReplacement code and having a look, I found the place where he latches onto his replacement map:

_fullscreenMapControl = (findDisplay PVPSCENE_IDD_FULLSCREENMAP) displayCtrl PVPSCENE_IDC_FULLSCREENMAP;

At this point it occurred to me that displayCtrl is the key, and the default Main Map is really just a control inside of a display (display #12 to be exact).

So, I then cracked open ui.pbo to try and locate idc #12, hoping to find the control of the main map inside, (doing a find in files on "idc = 12;"). Unfortunately, it's just not in there (or else I simply couldn't find it).

Not to be deterred, I thought up a brute force approach of locating the default Main Map inside "display #12". The idea was to check every idc against (findDisplay 12), and try ctrlMapScale on all valid Controls. Here's the script:

waitUntil {!(isNull (findDisplay 12))};

BUB_TestedMapControls = [];
BUB_TestedMapScales = [];

_testMapControl = {
_id = _this select 0;

BUB_TestedMapControls = BUB_TestedMapControls + [_id];
_displayCtrl = (findDisplay 12) displayCtrl _id;	

_scale = ctrlMapScale _displayCtrl;
BUB_TestedMapScales = BUB_TestedMapScales + [_scale];
};

_misses = 0;
_hits = 0;

_i = 0;
while { true } do
{
_displayCtrl = (findDisplay 12) displayCtrl _i;
_typeName = typeName _displayCtrl;

if ( (str _displayCtrl) == "NO CONTROL" ) then
{
	_misses = _misses + 1;
}
else
{
	_hits = _hits + 1;
	[_i] spawn _testMapControl;
};
hintSilent format ["_i: %1\n\n_displayCtrl: %2\n_typeName: %3\n\n_hits: %4\n_misses: %5\n\nBUB_TestedMapControls: %6\nBUB_TestedMapScales: %7", _i, _displayCtrl, _typeName, _hits, _misses, BUB_TestedMapControls, BUB_TestedMapScales];
_i = _i + 1;
sleep 0.001;
};

breakOut "ExitOut";

Turns out there are 32 unique and valid controls inside of (findDisplay 12). And #51 is the Holy Grail! :D

To get the default Main Map control:

_defaultMainMapCtrl = (findDisplay 12) displayCtrl 51;

Best of all it actually works with all those powerful ctrlMap commands.

btw- Thanks Das Attorney and PVPscene, wouldn't have gotten it without you guys! :)

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  

×