Jump to content

Using a hotkey in the Lockpick menu won't work


Recommended Posts

Why won't this work?

begin MenuMode 1014
    if IsKeyPressed3 30   ; 'A'
        PrintC"Hotkeys Lockpick menu: a pressed"
        ClickMenuButton "#2" 1014
    endif
end

I want to make it so that if I press the 'a' key in the Lockpick menu (1014) it will cause the "Auto-attempt" button to get clicked.

The "#2" is the id of that button in Data\Menus\lockpick_menu.xml.

<include src="darn\button_short.xml"/>
            <id> 2 </id>
            <user0> <copy src="strings()" trait="_close"/> </user0>
            <depth> 7 </depth>
            <x>
                <copy src="lockpick_auto_attempt" trait="x"/>
                <add>
                    <copy src="lockpick_auto_attempt" trait="width"/>
                    <add> 15 </add>
                </add>
            </x>


I am seeing my PrintC message in the console. So the ClickMenuButton command is failing to work for this menu.

Thanks.

 

Link to comment
Share on other sites

That is weird, I tried to see if the fix would be a simple one but also failed to get it working. 😅 It seems as if the lockpick menu behaved differently somehow. I used the quest script below to reproduce it, it basically tries to click whatever element is under the cursor when in menu mode, regardless of the menu. In dialogue menus it works fine, for example, but for the lockpick buttons it just does not do anything.

scriptname LockpickQuestScript

float fQuestDelayTime

short bClicked
short bKeyPressed

short iMenuMode
int iComponentID
string_var svComponentName

begin _GameMode
    if (fQuestDelayTime != 0.1)
        ; Just to get the key to register faster...
        let fQuestDelayTime := 0.1
        PrintToConsole "Setting fQuestDelayTime to %0.2f" fQuestDelayTime
    endif
end

begin _MenuMode
    let bKeyPressed := IsKeyPressed3 30
    if (bClicked != bKeyPressed)
        if (bClicked)
            PrintToConsole "Button released"
            let bClicked := 0
        else
            let bClicked := 1
            let iMenuMode := GetActiveMenuMode
            let iComponentID := GetActiveUIComponentID
            let svComponentName := GetActiveUIComponentFullName
            PrintToConsole "Clicking in menu %0.0f button #%0.0f %q%z%q" iMenuMode iComponentID svComponentName
            ClickMenuButton svComponentName iMenuMode
            PrintToConsole "Clicking done, waiting for button release"
            sv_Destruct svComponentName
        endif
    endif
end

Maybe there is something really simple and obvious that is amiss somewhere...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...