GM:S 1.4 keyboard_check for ; ' , . /

Discussion in 'Programming' started by Fixer90, Jul 4, 2017.

  1. Fixer90

    Fixer90 Member

    Joined:
    Nov 17, 2016
    Posts:
    142
    I tried using ord(",") and ord(".") and etc., but none of them worked.
     
  2. icuurd12b42

    icuurd12b42 TMC Founder GMC Elder

    Joined:
    Apr 22, 2016
    Posts:
    1,839
  3. Fixer90

    Fixer90 Member

    Joined:
    Nov 17, 2016
    Posts:
    142
  4. Murzy

    Murzy Member

    Joined:
    Jul 28, 2016
    Posts:
    24
    Like this. Use the $ character to denote a hex value in game maker. I know, this isn't quite standard. I had to google it myself too :D

    Code:
    var keycode_comma = $BC;
    
    if(keyboard_check_pressed(keycode_comma)) {
        show_message("keycode_comma");
    }
    
     
    Guest User likes this.
  5. icuurd12b42

    icuurd12b42 TMC Founder GMC Elder

    Joined:
    Apr 22, 2016
    Posts:
    1,839
    Yeah I totally hate gml's hex system
     
  6. hogwater

    hogwater Member

    Joined:
    Jun 22, 2017
    Posts:
    635
    zendraw likes this.
  7. Fixer90

    Fixer90 Member

    Joined:
    Nov 17, 2016
    Posts:
    142
    Got it to work, thanks for all the help guys!
     
  8. zendraw

    zendraw Member

    Joined:
    Jun 20, 2016
    Posts:
    1,366
    another approach is checking a string in a switch statement
    switch (last char in keyboard string)
    {
    case '.'://do staffa
    case ';'://do stuff
    }

    i do it this way but the suggestion hogwater is better perhaps, more flexible.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice