MOUSE CLICK (CM)
RECEIVER

Get/check/set info about mouse click. This receiver must follow after any !?CM trigger. (CM0/CM1/CM2/CM3/CM4)

 
!!CM:XXXX; Get/check/set info about mouse click

OPTIONS
A$1/$2; Absolute position of a cursor in pixels
   $1 - x
   $2 - y 
D$; Set/Check/Get a battlefield position
    $ is a number of position.
The hex grid follows the numbers we already have for it (0-186) in the docs for setting up the battlefields.
The background and outside the grid is number -1.
The left hero's number is 252. The right hero's number is 253.
There's also some 254 areas along the extreme right edge of the screen below the right side hero but it only goes down about half way and the rest is -1.
F$; Flags 
   0=Left mouse click
   1=Shift+Left mouse click
   4=Ctrl+Left mouse click
   32=Alt+Left mouse click
   512=Right mouse click

  Numbers may be combined to check for combinations of Shift, Ctrl and Alt with the Left mouse click. For example, to check if a player holds down Shift+Ctrl and makes a Left mouse click, the number would be 5 (1+4=5). A Right mouse click cannot be combined with any of these keys.
H$1/$2; Give the number of heroes with new command:
   $1 - Number of the left hero
   $2 - Number of the right hero
You can only check or get them.
You can also use this command for !?CM2; section to get the left hero as an active. The second one is a phantom (there is no second one).
I$;

Number with CM:I$

Adventure Screen
Town Screen

Hero Screen
Heroes visiting Screens
Combat Screen
  Now the CM:I command should always return a correct value in the town screen for town buildings, even if one structure overlaps another. Also it is set now to -1 if no structure is found under the cursor.

Mz#; Set the hint text in the town screen, replacing the default hint with your own
You can use global (z1..z1000) or local (z-1..z-10) z variables.

Comments
To get additional information on where the mouse is situated, you can use other !!CM commands: T, S, I, F, A.
(See MM1 Trigger)

Example:
!#VRz10:S^Hi, fellow!^;
!?MM1;
!!CM:Mz10;
P$1/$2/$3; Map position
   $1 - x
   $2 - y 
   $3 - Level 
Comments:
P command work only for items 1 (small map) and 37 (big map). 
R$; Enable/Disable standard reaction
    0 - Disable
    1 - Enable
Comments:
If you wanted a right-click on the adventure map to do something, you'd use a CM trigger to intercept it, then use CM:R to disable the standard do-you-want-to-leave-troops-here thing.
S$; Subtype of the action
Left mouse push (subtype=12), left mouse release (subtype=13) and right mouse push (subtype=14)
T$; Type of an action (usually 512)

Comments:
If you want to display a message box that doesn't remain on the screen (like the normal one when a player right-clicks the mouse), use IF:Q with the 4 option. This will create a message box with no buttons (no Okay or cancel button) that will only display while the mouse is held down. If you don't want a picture, use a value of -1 for type and subtype. See the Dialogue Box Receiver page for more information on IF:Q.

Number with CM:I

Adventure Screen
Town Screen

Hero Screen
Heroes visiting Screens
Combat Screen
Adventure Screen

   0 - area with no item number
Note: some areas won't even register when right-clicked and others have the
no item number (value 0).
   1 - world map (mini map)
   2 - border of hero information square
   3 - kingdom overview button
   4 - surface/underworld button
   5 - quest log button
   6 - sleep/wake hero button
   7 - move hero button
   8 - cast spell button
   9 - adventure options button
   10 - system options button
   11 - next hero button
   12 - end turn button
   13 - hero list: scroll up arrow
   14 - hero list: scroll down arrow
   20 - hero list: move bar for hero #1
   21 - hero list: move bar for hero #2
   22 - hero list: move bar for hero #3
   23 - hero list: move bar for hero #4
   24 - hero list: move bar for hero #5
   25 - hero list: mana bar for hero #1
   26 - hero list: mana bar for hero #2
   27 - hero list: mana bar for hero #3
   28 - hero list: mana bar for hero #4
   29 - hero list: mana bar for hero #5
   30 - town list: scroll up arrow
   31 - town list: scroll down arrow
   32 - town list: town #1
   33 - town list: town #2
   34 - town list: town #3
   35 - town list: town #4
   36 - town list: town #5
   37 - adventure map
   38 - rollover bar (messages/chat etc.)
   39 - hero list: hero #1
   40 - hero list: hero #2
   41 - hero list: hero #3
   42 - hero list: hero #4
   43 - hero list: hero #5
   1000 - resource/date bar (edges)
   1001 - wood value
   1002 - mercury value
   1003 - ore value
   1004 - sulphur value
   1005 - crystal value
   1006 - gems value
   1007 - gold value
   1008 - date (month/day/week)
   1009 - wood icon
   1010 - mercury icon
   1011 - ore icon
   1012 - sulphur icon
   1013 - crystal icon
   1014 - gems icon
   1015 - gold icon
   2000 - hero information square
   2001 - hero info square: portrait
   2002 - hero info square: name
   2003 - hero info square: attack value
   2004 - hero info square: defence value
   2005 - hero info square: power value
   2006 - hero info square: knowledge value

 

Item (area) of the Town Screen
numbers returned by !!CM:I when clicking on various spots on a town screen. This will eventually find its way into the ERM docs but for anyone who needs the information now, here it is. (Much of it is the same as the information listed under the CA Receiver as the numbers generally match up.) Some notes follow the item list.

   0: Level 1 Mage Guild
   1: Level 2 Mage Guild
   2: Level 3 Mage Guild
   3: Level 4 Mage Guild
   4: Level 5 Mage Guild
   5: Tavern
   6: Shipyard (Castle, Fortress, Necropolis)
   7: Fort
   8: Citadel
   9: Castle
   10: Village Hall
   11: Town Hall
   12: City Hall
   13: Capitol
   14: Marketplace
   15: Resource Silo
   16: Blacksmith
   17: Special Building: Mystic Pond (Rampart), Cover of Darkness    (Necropolis), Artifact Merchant (Tower, Dungeon and Conflux), Escape Tunnel (Stronghold), Cage of Warlords (Fortress), Lighthouse (Castle)
   18: Horde Building: Miner's Guild (Rampart), Griffin Bastion (Castle), Mushroom Rings (Dungeon), Unearthed Graves (Necropolis), Birthing Pools (Inferno), Garden of Life (Conflux), Sculptor's Wings (Tower), Mess Hall (Stronghold), Captain's Quarters (Fortress)
   19: Upgraded Dwelling with Horde Building (see 18 for particulars).
   21: Special Building: Glyths of Fear (Fortress), Necromancy Amplifier (Necropolis), Lookout Tower (Tower), Mana Vortex (Dungeon), Stables (Castle), Brimstone Stormclouds (Inferno), Fountain of Fortune (Rampart), Freelancer's Guild (Stronghold), Magic University (Conflux)
   22: Special Buildings: Ballista Yard (Stronghold), Portal of Summoning (Dungeon), Blood Obelisk (Fortress), Library (Tower), Skeleton Transformer (Necropolis), Treasury (Rampart), Brotherhood of the Sword (Castle), Castle Gate (Inferno), NFA: Waterfall (Conflux)
   23: Special Building: Battle Scholar Academy (Dungeon), Order of Fire (Inferno), Wall of Knowledge (Tower), Hall of Valhalla (Stronghold), NFA: Waterfall (Castle), NFA: Little Huts (Rampart), NFA: Swamp (Fortress), NFA: Graveyard (Necropolis), NFA: Much of the foreground area that isn't built on (Conflux)
   24: Horde Building 2: Dendroid Saplings (Rampart), Cages (Inferno)
   25: Upgraded Dwelling with Horde Building 2 (see 24 for particulars)
   26: Grail Building
   27: NFA: Waterfall (Stronghold)
   28: NFA: Area just in front of the Resource Silo and Marketplace in Necropolis.
   29: NFA: Much of the in-between foreground area of Conflux once buildings have been built.
   30: Level 1 Dwelling (Basic)
   31: Level 2 Dwelling (Basic)
   32: Level 3 Dwelling (Basic)
   33: Level 4 Dwelling (Basic)
   34: Level 5 Dwelling (Basic)
   35: Level 6 Dwelling (Basic)
   36: Level 7 Dwelling (Basic)
   37: Level 1 Dwelling (Upgraded)
   38: Level 2 Dwelling (Upgraded)
   39: Level 3 Dwelling (Upgraded)
   40: Level 4 Dwelling (Upgraded)
   41: Level 5 Dwelling (Upgraded)
   42: Level 6 Dwelling (Upgraded)
   43: Level 7 Dwelling (Upgraded)
   115: Garrison Creature Slot 1
   116: Garrison Creature Slot 2
   117: Garrison Creature Slot 3
   118: Garrison Creature Slot 4
   119: Garrison Creature Slot 5
   120: Garrison Creature Slot 6
   121: Garrison Creature Slot 7
   123: Garrison Hero Slot
   125: Visiting Hero Slot
   140: Visiting Hero Creature Slot 1
   141: Visiting Hero Creature Slot 2
   142: Visiting Hero Creature Slot 3
   143: Visiting Hero Creature Slot 4
   144: Visiting Hero Creature Slot 5
   145: Visiting Hero Creature Slot 6
   146: Visiting Hero Creature Slot 7
   147: Town Screen Background (no specific object)
   148: Below Town Screen Background (between slots and icons)
   149: Town Name
   150: Town Icon Picture
   151: Rollover Bar (hint messages)
   152: Town List Scroll Up Arrow
   153: Town List Scroll Down Arrow
   154: Split Creature Stack Button
   155: 1st (top) Town in Town List
   156: 2nd (middle) Town in Town List
   157: 3rd (bottom) Town in Town List
   158: Hall Icon
   159: Castle Icon
   160: Daily Income (produced by town)
   164: Level 1 Troop Icon
   165: Level 2 Troop Icon
   166: Level 3 Troop Icon
   167: Level 4 Troop Icon
   168: Level 5 Troop Icon
   169: Level 6 Troop Icon
   170: Level 7 Troop Icon
   171: Extra Troop Icon (Portal of Summoning)
   172: Level 1 Troop Daily Growth
   173: Level 2 Troop Daily Growth
   174: Level 3 Troop Daily Growth
   175: Level 4 Troop Daily Growth
   176: Level 5 Troop Daily Growth
   177: Level 6 Troop Daily Growth
   177: Level 7 Troop Daily Growth
   179: Extra Troop Daily Growth (Portal of Summoning)
   1001: Player's Total Wood
   1002: Player's Total Mercury
   1003: Player's Total Ore
   1004: Player's Total Sulphur
   1005: Player's Total Crystal
   1006: Player's Total Gems
   1007: Player's Total Gold
   1008: Date (Month/Week/Day)
   1009: Wood Icon
   1010: Mercury Icon
   1011: Ore Icon
   1012: Sulphur Icon
   1013: Crystal Icon
   1014: Gems Icon
   1015: Gold Icon
   30720: OK Button (Checkmark)

Notes:
1. NFA stands for Non Functional Area. These are areas of the Town Screen that produce a distinct number when clicked, but have no actual game function. NFAs vary between different town types and not every town has them. They sometimes occur in a town that doesn't have a special building using that number.
2. Many buildings numbers overlap each other. For example, the lower part of the Mage Guild in the Rampart has the Hall on the right (#10, 11 or 12) and the NFA huts on the left (#23) and clicking will often produce these numbers instead of the Mage Guild number. In a few cases, it may even be impossible to produce the actual building number when clicking due to the overlaps.
3. The number produced by clicking on a Mage Guild is always for the highest level of guild currently build. Likewise, an upgraded Dwelling number replaces a basic Dwelling number when the upgraded dwelling is built. Furthermore, the number of a horde building (when built) replaces that of the corresponding Dwelling. Other upgrades behave the same, such as the Castle's Tavern (#5) being replaced by the Brotherhood of Sword (#22) when built.

 

Hero Screen

0 Empty Areas
1 Name
2 Head Slot
3 Shoulder Slot
4 Neck Slot
5 Right Hand Slot
6 Left Hand Slot
7 Torso Slot
8 Right Ring Slot
9 Left Ring Slot
10 Feet Slot
11 Misc. Slot 1
12 Misc. Slot 2
13 Misc. Slot 3
14 Misc. Slot 4
15 Ballista Slot
16 Ammo Cart Slot
17 First Aid Tent Slot
18 Catapult Slot
19 Spell Book Slot
20 Misc. Slot 5
40 Backpack Slot 1
41 Backpack Slot 2
42 Backpack Slot 3
43 Backpack Slot 4
44 Backpack Slot 5
45 Hero Portrait
46 Attack (value)
47 Defence (value)
48 Power (value)
49 Knowledge (value)
50 Attack Icon
51 Defence Icon
52 Power Icon
53 Knowledge Icon
68 Troop Slot 1
69 Troop Slot 2
70 Troop Slot 3
71 Troop Slot 4
72 Troop Slot 5
73 Troop Slot 6
74 Troop Slot 7
77 Backpack Scroll Left Arrow
78 Backpack Scroll Right Arrow
79 1st Skill Icon
80 2nd Skill Icon
81 3rd Skill Icon
82 4th Skill Icon
83 5th Skill Icon
84 6th Skill Icon
85 7th Skill Icon
86 8th Skill Icon
87 1st Skill Name
88 2nd Skill Name
89 3rd Skill Name
90 4th Skill Name
91 5th Skill Name
92 6th Skill Name
93 7th Skill Name
94 8th Skill Name
95 1st Skill Level
96 2nd Skill Level
97 3rd Skill Level
98 4th Skill Level
99 5th Skill Level
100 6th Skill Level
101 7th Skill Level
102 8th Skill Level
103 Attack (text)
104 Defence (text)
105 Power (text)
106 Knowledge (text)
107 Blessings and Curses Icon
108 Experience (text)
109 Spell Points (text)
110 Quest Log (text)
111 Dismiss Hero (text)
112 Experience
113 Spell Points
115 Rollover Bar (hint text)
116 Morale Icon
117 Luck Icon
118 Specialty Icon
119 Experience Icon
120 Spell Points Icon
122 Loose Combat Formation Button
124 Tight Combat Formation Button
126 Disable/Enable Tactics Button
127 Split Creature Stack Button
128 Quest Log Button
129 Dismiss Hero Button
130 1st Hero in Hero List
131 2nd Hero in Hero List
132 3rd Hero in Hero List
133 4th Hero in Hero List
134 5th Hero in Hero List
135 6th Hero in Hero List
136 7th Hero in Hero List
137 8th Hero in Hero List
138 Current Hero in Hero List (regardless of position)
139 God Bonus Icon
140 Level and Class
141 Flag above Hero List
30720 OK Button (Checkmark)

 

Heroes visiting Screens

Common
0 Empty Areas
115 Attack Icon
116 Defence Icon
117 Power Icon
118 Knowledge Icon
300 Rollover Bar (hint text)
301 Central Area with Double Arrows
30720 OK Button (Checkmark)

Left Hero
1 Hero Portrait
3 Attack
4 Defence
5 Power
6 Knowledge
13 1st Troop Slot
14 2nd Troop Slot
15 3rd Troop Slot
16 4th Troop Slot
17 5th Troop Slot
18 6th Troop Slot
19 7th Troop Slot
27 Head Slot
28 Shoulder Slot
29 Neck Slot
30 Right Hand Slot
31 Left Hand Slot
32 Torso Slot
33 Right Ring Slot
34 Left Ring Slot
35 Feet Slot
36 Misc. Slot 1
37 Misc. Slot 2
38 Misc. Slot 3
39 Misc. Slot 4
40 Ballista Slot
41 Ammo Cart Slot
42 First Aid Tent Slot
43 Catapult Slot
44 Spell Book Slot
45 Misc. Slot 5
65 Number of Troops in Slot 1
66 Number of Troops in Slot 2
67 Number of Troops in Slot 3
68 Number of Troops in Slot 4
69 Number of Troops in Slot 5
70 Number of Troops in Slot 6
71 Number of Troops in Slot 7
81 Experience
83 Spell Points
85 Quest Log Button
87 Name, Level and Class
89 Backpack Slot 1
90 Backpack Slot 2
91 Backpack Slot 3
92 Backpack Slot 4
93 Backpack Slot 5
99 Backpack Scroll Left Arrow
101 Backpack Scroll Right Arrow
103 Split Creature Stack Button
105 Specialty Icon
107 Morale Icon
109 Luck Icon
111 Experience Icon
113 Spell Points Icon
200 1st Skill Icon
201 2nd Skill Icon
202 3rd Skill Icon
203 4th Skill Icon
204 5th Skill Icon
205 6th Skill Icon
206 7th Skill Icon
207 8th Skill Icon

Right Hero
2 Hero Portrait
8 Attack
9 Defence
10 Power
11 Knowledge
20 1st Troop Slot
21 2nd Troop Slot
22 3rd Troop Slot
23 4th Troop Slot
24 5th Troop Slot
25 6th Troop Slot
26 7th Troop Slot
46 Head Slot
47 Shoulder Slot
48 Neck Slot
49 Right Hand Slot
50 Left Hand Slot
51 Torso Slot
52 Right Ring Slot
53 Left Ring Slot
54 Feet Slot
55 Misc. Slot 1
56 Misc. Slot 2
57 Misc. Slot 3
58 Misc. Slot 4
59 Ballista Slot
60 Ammo Cart Slot
61 First Aid Tent Slot
62 Catapult Slot
63 Spell Book Slot
64 Misc. Slot 5
72 Number of Troops in Slot 1
73 Number of Troops in Slot 2
74 Number of Troops in Slot 3
75 Number of Troops in Slot 4
76 Number of Troops in Slot 5
77 Number of Troops in Slot 6
78 Number of Troops in Slot 7
82 Experience
84 Spell Points
86 Quest Log Button
88 Name, Level and Class
94 Backpack Slot 1
95 Backpack Slot 2
96 Backpack Slot 3
97 Backpack Slot 4
98 Backpack Slot 5
100 Backpack Scroll Left Arrow
102 Backpack Scroll Right Arrow
104 Split Creature Stack Button
106 Specialty Icon
108 Morale Icon
110 Luck Icon
112 Experience Icon
113 Spell Points Icon
208 1st Skill Icon
209 2nd Skill Icon
210 3rd Skill Icon
211 4th Skill Icon
212 5th Skill Icon
213 6th Skill Icon
214 7th Skill Icon
215 8th Skill Icon

 

Combat Screen Mouse click
0 Background and spaces outside the Hex Grid plus some spaces near the edge of the Hex Grid
1 Hex Grid spaces (except some have a value of 0)
2000 Border Area around Buttons
2001 Surrender Button
2002 Retreat Button
2003 Combat Options Button
2004 Auto Combat Button
2005 Combat Text Window
2006 Scroll Up Arrow for Combat Text Window
2007 Scroll Down Arrow for Combat Text Window
2008 Cast Spell Button
2009 Wait Button
2010 Defend Button
2200 Statistics/Active Spell Box
2205 Primary Skills in Statistics/Active Spell Box
2207 Primary Skills in Statistics/Active Spell Box
2214 Troop Picture in Statistics/Active Spell Box
2216 Middle Slot in Statistic/Active Spell Box
2217 Lower Slot in Statistics/Active Spell Box
2218 Upper Slot in Statistics/Active Spell Box

Notes:
1. The Statistics/Active Spell Box only appears if this option is selected in the Combat Options screen. The box is rather tricky to click on and probably not of much use in this fashion. The information for parts of the box is probably incomplete due to the almost impossible nature of clicking on all parts of it.