I Wanna Be The Forums!

Please login or register.

Login with username, password and session length
Advanced search  

News:

Chat button has been eaten. Click here to join in the idling fun!

Author Topic: Easy thing on GM, but I have no idea how to do it...  (Read 1334 times)

Benxamix2

  • Sr. Member
  • ****
  • Posts: 387
  • INACTIVE
    • View Profile
Easy thing on GM, but I have no idea how to do it...
« on: September 21, 2011, 02:59:02 pm »

I need it to do this:

"Press " + string ( KEYNAME ) + " to Jump".

But I have no idea about how to get the key name from its keycode (for example 16 = "Shift")
How do I do that?
Are arrays the only way?
« Last Edit: September 21, 2011, 07:47:36 pm by Benxamix2 »
Logged

Ellipsis

  • Ellipsis
  • The Guy
  • *****
  • Posts: 1907
    • View Profile
    • If Not Equal Limited
Re: Easy thing on GM, but I have no idea how to do it...
« Reply #1 on: September 21, 2011, 02:59:55 pm »

Sorry but as far as I know, yes that's the only way.
Logged

El Barto

  • Newbie
  • *
  • Posts: 43
  • Getting owned by cherries and spikes.
    • View Profile
Re: Easy thing on GM, but I have no idea how to do it...
« Reply #2 on: September 21, 2011, 04:01:58 pm »

You can use YoSniper's controls script. Its called "controlIndex" and this is how it works: draw_text(x, y, "Press "+controlIndex( global.keyToPress )+" asshole!");

Code: [Select]
switch(argument0) {
    case vk_space: return "SPACE";
    case vk_shift: return "SHIFT";
    case vk_control: return "CONTROL";
    case vk_alt: return "ALT";
    case vk_enter: return "ENTER";
    case vk_up: return "UP";
    case vk_down: return "DOWN";
    case vk_left: return "LEFT";
    case vk_right: return "RIGHT";
    case vk_backspace: return "BACKSPACE";
    case vk_f1: return "F1";
    case vk_f3: return "F3";
    case vk_f4: return "F4";
    case vk_f5: return "F5";
    case vk_f6: return "F6";
    case vk_f7: return "F7";
    case vk_f8: return "F8";
    case vk_f9: return "F9";
    case vk_f10: return "F10";
    case vk_f11: return "F11";
    case vk_f12: return "F12";
    case vk_tab: return "TAB";
    case vk_numpad0: return "NUMPAD 0";
    case vk_numpad1: return "NUMPAD 1";
    case vk_numpad2: return "NUMPAD 2";
    case vk_numpad3: return "NUMPAD 3";
    case vk_numpad4: return "NUMPAD 4";
    case vk_numpad5: return "NUMPAD 5";
    case vk_numpad6: return "NUMPAD 6";
    case vk_numpad7: return "NUMPAD 7";
    case vk_numpad8: return "NUMPAD 8";
    case vk_numpad9: return "NUMPAD 9";
    default: return chr(argument0);
};
Logged

Benxamix2

  • Sr. Member
  • ****
  • Posts: 387
  • INACTIVE
    • View Profile
Re: Easy thing on GM, but I have no idea how to do it...
« Reply #3 on: September 21, 2011, 07:47:07 pm »

You can use YoSniper's controls script. Its called "controlIndex" and this is how it works: draw_text(x, y, "Press "+controlIndex( global.keyToPress )+" asshole!");

I didn't know that thing even exist. Anyway, I did solve this by myself using global variables. But thanks anyway.
« Last Edit: September 22, 2011, 09:39:34 am by Benxamix2 »
Logged