function trigger_slot_24() /* entry=394 class_id=0x0A18 slot=0x24 */
{
  var
    referent, /* [BP+00h] type=0x69 */
    ref, /* [BP+0Ah] type=0x69 */
    qHi, /* [BP+0Ch] type=0x69 */
    npcNum, /* [BP+0Eh] type=0x69 */
    mapNum, /* [BP+10h] type=0x69 */
    baseLink, /* [BP+12h] type=0x69 */
    searchtype, /* [BP+14h] type=0x69 */
    scmd, /* [BP-02h] type=0x69 */
    cmd, /* [BP-04h] type=0x69 */
    a, /* [BP-06h] type=0x69 */
    b, /* [BP-08h] type=0x69 */
    c, /* [BP-0Ah] type=0x69 */
    d, /* [BP-0Ch] type=0x69 */
    item, /* [BP-0Eh] type=0x24 */
    aitem, /* [BP-10h] type=0x24 */
    newLink, /* [BP-12h] type=0x69 */
    distance, /* [BP-14h] type=0x69 */
    item2; /* [BP-16h] type=0x24 */

  set_info(0x021B, 0);
  newLink = baseLink;
  aitem = ref;
  cmd = (mapNum & 3);
  if (cmd == 0) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x3A */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
  }
  else if (cmd == 1) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x3A */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
  }
  else if (cmd == 2) {
    /* loopscr value_u8=0x24 */
    /* loopscr value_u8=0x3D */
    /* loopscr value_u8=0x3A */
    /* loopscr value_u8=0x25 */
    /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
    while (!condition) {
      /* loopnext  */
    }
  }
  else if (cmd == 3) {
    scmd = (qHi & 7);
    if (scmd == 0) {
      d = (qHi / 8);
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x40 */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (Item.getQLo(item) == baseLink) {
          a = Item.getNPCNum(item);
          c = (a & 15);
          b = Item.getMapArray(item);
          b = (((a & 0x00E0) * 8) + b);
          class_0A0C_slot_30(d, c, b, item);
        }
        /* loopnext  */
      }
    }
    else if (scmd == 1) {
      d = (qHi / 8);
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (Item.getQLo(item) == baseLink) {
          if (ref == item) {
            if (d == 31) {
              suspend;
            }
            else {
              c = Item.getFrame(item);
              b = Item.getShape(item);
              a = (b & 0x00FF);
              b = (b & 0x0700);
              b = (b / 8);
              b = (b + c);
              suspend;
              /* bit_not  */
            }
          }
        }
        /* loopnext  */
      }
    }
    else if (scmd == 2) {
      a = (qHi / 8);
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        /* loopnext  */
      }
    }
    else if (scmd == 3) {
      if (global[0x0040] == 100) {
        distance = 32;
      }
      else {
        distance = global[0x0040];
      }
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x3A */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (Item.getQLo(item) == baseLink) {
          if (ref == item) {
            a = (qHi / 8);
            spawn class_0A18_slot_22(a, item, arg_06);
          }
        }
        /* loopnext  */
      }
    }
    else if (scmd == 4) {
      a = (qHi / 8);
      newLink = (newLink + a);
    }
    else if (scmd == 5) {
      a = (qHi / 8);
      newLink = (newLink - a);
    }
    else if (scmd == 6) {
      d = (qHi / 8);
      /* loopscr value_u8=0x24 */
      /* loopscr value_u8=0x3D */
      /* loopscr value_u8=0x40 */
      /* loopscr value_u8=0x25 */
      /* loop current_var=0xF2 string_bytes=0x6 loop_type=0x2 */
      while (!condition) {
        if (Item.getQLo(item) == baseLink) {
          a = Item.getNPCNum(item);
          c = (a & 15);
          b = Item.getMapArray(item);
          b = (((a & 0x00E0) * 8) + b);
          if (b == 0) {
            if (Item.create(c, b, item2) == 1) {
              suspend;
            }
          }
        }
        /* loopnext  */
      }
    }
  }
  /* word_to_dword  */
  /* pop_result  */
  return;
}
