Results 1 to 6 of 6

Thread: Cannot disable ENTER key whie creating the marker

  1. #1

    Cannot disable ENTER key whie creating the marker

    The first

    Code:
    (findDisplay 46) displayAddEventHandler ["keyDown", "if (((_this select 1) == 28) && visibleMap) then {hint 'ENTER pressed'; true}"];
    doesn't work if you Double Click on the map and quckly (very quickly) hit ENTER. You'll see "ENTER pressed" hint but ENTER will work like it wasn't disabled. Why?

    (_this select 0) tells me that event has been recieved from display #46, not #54 (map marker) for some reasons. If I press ENTER key after double clicking on the map, I shouldn't see any messages, because no EH attached to display #54 but I can see.

    For example
    Code:
    (findDisplay 46) displayAddEventHandler ["keyDown", "if (((_this select 1) == 53) && visibleMap) then {hint 'SLASH pressed'; true}"];
    works fine. It disables the "/" key on the Map Screen.

    The second strange thing, keyDown event is fired earlier than mouseButtonDblClick event. Simple code below demonstrates that behaviour:

    Code:
    (findDisplay 46) displayAddEventHandler ["keyDown", "player sideChat 'Key pressed!'"];
    ((findDisplay 12) displayCtrl 51) ctrlSetEventHandler ["mouseButtonDown", "player sideChat 'Double Click on the map!'"];
    If you VERY quickly hit Double LBM and then ENTER you'll get
    Key pressed!
    Double Click on the map!
    Why?
    It should be
    Double Click on the map!
    Key pressed!
    I need to completly disable ENTER key on the Map Screen and I need script-based solution, with no addons (for some reasons I cant use addons in my situation).
    Last edited by Prodavec; Jun 29 2012 at 22:59.

  2. #2
    So your saying your getting errors when creating a marker and then hitting enter?
    but what Im missing is whats the point of hitting enter when you have to then go back
    and edit the marker names and other info if any for it.

    If you VERY quickly hit Double LBM and then ENTER you'll get
    Key pressed!
    Double Click on the map!
    Why?
    It should be
    Double Click on the map!
    Key pressed!
    When I put a marker down thats it I dont get messages, I edit them right away and am done.

    Idk but seems to me your creating drama about something that works fine, I never had any issues with markers and I use them all the time,
    other then if the marker is big then trying to find the center is a pain when put together with other markers.

    Hosting Missions for Invasion-1944, Iron Front: Liberation 1944, & Hell in the Pacific

    WarMod Series - Massive Addon & Mod Customizable Compilation Mods for Arma1, Arma2, & Arma2CO
    WarMod | A2WarMod |A2WarModACE | COWarMod | COWarModACE | COWarModI44 |COSLX

  3. #3

  4. #4
    Quote Originally Posted by Günter Severloh View Post
    So your saying your getting errors when creating a marker and then hitting enter?
    Nope, I'm not getting errors. I can't disable ENTER key on the map screen because of some strange behaviour of the keyDown Event Handler, it's only related to the ENTER key.

    PvPscene
    I'm working on the script which adds nickname to the created map marker. For example you want to place marker with text: "This is our location" and after pressing ENTER marker becames "Prodavec: This is our location". And that script must work with no downloadable addons.

    I found next algorythm to approach my goal (I used it to disable "Respawn" key, and Valhalla by WINSE used it too):

    1. Add event handler mouseButtonDblClick to the map control on mission init.

    2. When user double click on the map, mouseButtonDblClick EH begins to search marker display (it's Display #54). Searching loop works until Display #54 will be found, also it has timeout, just for case, 2 seconds for search, if not found => exit. Loop is under SPAWN command, so it's in scheduled script environment and may be delayed if mission has a lot of other running script in parallel (see below).

    3. After searching Display #54, loop using exitWith adds keyUp EH to the Display #54. That event handler can process user keys when he types in the text field of the map marker.

    4. When user presses ENTER, keyUp EH gets Control #101 of the Display #54 and changes control's text to the
    Text = <player name> + Text

    It works fine and doesn't require addon to change RscDisplayInsertMarker class.

    But there's a problem related to SPAWN command: if you hit ENTER very quickly after Double Click, the searching loop will not find Displat #54 (the marker). I fully understand mechanics why it happens and my solution is to disable ENTER key after Double Clicking on the map for few milliseconds.

    mouseButtonDblClick EH disables ENTER key, searching loop enables ENTER when Display #54 will be found and KeyUp EH installed, or by timeout (just for case).

    I found that if you presses ENTER very-very quickly the "keyDown" event is recieved from Display #46 (not Display #54), so I just added new EH to the Display #46 with simple code: if (key == ENTER && disableEnterKey) {... Ignore ENTER ...} else {... process ENTER normally...}

    But ENTER still works. Maybe Display #54 and Display #46 firing "keyDown" event at the same time, is it possible?

    The second thing: keyDown EH is being fired BEFORE mouseButtonDblClick fired. I don't understand why? So even you will set disableEnterKey = true via mouseButtonDblClick (non-scheduled part) the keyDown event under else {...process ENTER normally...} scope will be processed anyway.

    How do I disable ENTER key or may be you have better solution?

    Thank you.
    Last edited by Prodavec; Jun 30 2012 at 07:56.

  5. #5
    Without the full (current) code I may get a wrong idea, but here are my thoughts:

    # Why do you add DEH to main display and not to map display?
    # My approach would be to *replace the map display with a scripted one. See:
    http://forums.bistudio.com/showthrea...=1#post1807292

    With scripted markers and catching player keyboard input, one should be able to replicate the current map marker completely,
    and more important add more features like yours. Its more effort, but not too much I think and should be more/fully reliable.
    Last edited by .kju [PvPscene]; Jun 30 2012 at 09:27.

  6. #6
    Thank you for helping me guys.

    PvPscene
    Thank you, I think you're right, I should completly rebuild map marker (and create new one, scripted version), it's more reliable and protect against programms like AutoHotkey.

    Topic may be closed, credits will be given in my script file / mission header.

Similar Threads

  1. Globaly disable the ability of players to enter enemy vehicles.
    By BL1P in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Feb 26 2012, 05:35
  2. Cant enter servers key disabled
    By mutley321 in forum ARMA 2 & OA - TROUBLESHOOTING
    Replies: 1
    Last Post: Oct 8 2009, 15:02
  3. Creating Marker's
    By Doppe in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Jul 16 2007, 14:28
  4. how do i re-enter my armed assult cd key?
    By angrysquirrel in forum ARMA - TROUBLESHOOTING
    Replies: 7
    Last Post: Apr 28 2007, 19:39
  5. bind a key to enter vehicle
    By colligpip in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Apr 2 2007, 13:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •