• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Simple Dialog Hotkey Question

Status
Not open for further replies.
I've recently been wandering JASSCraft and I saw this function:
JASS:
native DialogAddButtonWithHotkeyBJ takes dialog whichDialog, string buttonText, integer hotkey returns button

I was wondering if I do this:
JASS:
call DialogAddButtonWithHotkeyBJ(dialog,"text",3)

Will I be able to press the dialog by pressing "3"?

If so, can I hide it and have it still apply:
JASS:
    call DialogAddButtonWithHotkeyBJ(dialog,"text",3)
    call DialogDisplay(Player(0), dialog, false)

Will that work?

Thanks for any help. :D
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Dialog Button hotkeys are ASCII. Also, you'll want to use DialogAddButton... DialogAddButtonWithHotkeyBJ is definately not a native.

JASS:
function DialogAddButtonWithHotkeyBJ takes dialog whichDialog, string buttonText, integer hotkey returns button
    set bj_lastCreatedButton = DialogAddButton(whichDialog, buttonText,hotkey)
    return bj_lastCreatedButton
endfunction

native DialogAddButton              takes dialog whichDialog, string buttonText, integer hotkey returns button

Since the button is in ASCII, 3 would be something like the escape char for lines or the beep button. To get them to press 3, it would be '3' (or 51), just like to get them to have to press W, it would be 'W' (or 87)
 
Status
Not open for further replies.
Top