GM:S 1.4 Compile Error, Unsuccessful at fixing

Discussion in 'Legacy GameMaker Community Tech Support' started by MGSting, Jan 12, 2019.

  1. MGSting

    MGSting Member

    Joined:
    Jul 18, 2018
    Posts:
    20
    So I've been using someone's platformer template for GMS and this is the script he created for character inputs
    Code:
    ///key_check(key, event)
    
    /* This script appropriately handles player input, given a key and event.
     * We use this to make support for multiple input types (gamepads) easier.
     * key: K_LEFT, K_RIGHT, K_UP, K_DOWN, K_JUMP, K_FIRE, K_START
     * event: E_PRESS, E_DOWN, E_RELEASE
     */
    
    key   = argument0;
    event = argument1;
    
    // Define the default keyboard controls for each player.
    switch (PLAYER_NUMBER) {
      case 1: {
        k_left = vk_left;
        k_right = vk_right;
        k_up = vk_up;
        k_down = vk_down;
        k_jump = ord("Z");
        k_fire = ord("X");
        k_start = vk_enter;
        break;
      }
      case 2: {
        k_left = ord("A");
        k_right = ord("D");
        k_up = ord("W");
        k_down = ord("S");
        k_jump = ord("T");
        k_fire = ord("Y");
        k_start = ord("Q");
        break;
      }
      default: {
        assert("Default keyboard controls for player #" + string(PLAYER_NUMBER) + " haven't been specified.");
        break;
      }
    }
    
    // Handle an event based on the given key.
    switch (key) {
      case K_LEFT: {
        return handle_event(k_left);
        break;
      }
      case K_RIGHT: {
        return handle_event(k_right);
        break;
      }
      case K_UP: {
        return handle_event(k_up);
        break;
      }
      case K_DOWN: {
        return handle_event(k_down);
        break;
      }
      case K_JUMP: {
        return handle_event(k_jump);
        break;
      }
      case K_FIRE: {
        return handle_event(k_fire);
        break;
      }
      case K_START: {
        return handle_event(k_start);
        break;
      }
      default: {
        assert("Unable to handle unrecognized key: " + string(key));
        break;
      }
    }
        
    So I went into the code to try and change the inputs to make it more comfortable on a keyboard. The problem is when I tried testing it I got the compile error message and that I had to go into the compile error window to see what went wrong. Not knowing where the compile error window was, I tried just changing the code back to what it originally was, however that didn't work either. So what am I missing here? Thanks in advance.
     
  2. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    708
    Without any error to look at, I'm taking a guess here. But I cannot see any command called assert() in the manual. Is this a special function that is being called? Your compile window should just be another window in the IDE. I thought you could actually click a button on the error window to display it, but I could be mistaken as I haven't used 1.4 for a couple of years.

    What does the compile error message actually say other than telling you to look at the compile error window?
     
  3. MGSting

    MGSting Member

    Joined:
    Jul 18, 2018
    Posts:
    20
    it says "Compile Failed - Please check the Compile Window for any additional information"
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    3,690
    The so-called "Compile Window" is the text-only pane that should be on the bottom-right of the IDE window. If you closed it, go to the menu bar and select Window > Show Compile Form. If it's too stubby, copy everything out onto a text editor and read it there.
     

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