So every time I enable this script, it floods my chat window with an infinite loop WITHOUT me using the macro.  I cannot figure this behavior out, and it's been 3 days off and on.  What's supposed to happen?   I click the macro button to remove HP from "The Ship" in Stars Without Number.  I enter an amount to subtract from shipAC (basic custom attr).   Script checks to see if the msg is a good one, then gets the current HP, and sees if the damage is >= shipHP.  If the damage is >= than the current shipHP, it sets shipHp to 0, sets token sides to 0, and sends a "you died" message.  Else, it subtracts from shipAC, and changes currentside by 1.   What happens   I enable the script and NOTHING ELSE (never touch the macro at all, just enable the script)  It runs the else infinitely with this output:                There was an error parsing the damage macro params               Current HP is undefined               Damage is undefined    HELP!      The Macro !ShipDamage ?{Amount|0}      The CODE     on ( "ready" ,  function () {       sendChat ( "api" , "!token-mod --config players-can-ids|on" );       on ( "chat:message" , function ( msg ){           if ( msg . type == "api"  &&  msg . content . indexOf ( "!ShipDamage" )== 0 ){               var   args  =  msg . content . split ( " " );               var   damage  =  parseInt ( args [ 1 ], 10 );               var   currentHP  =  getShipHP ();               var   adj  =  currentHP  -  damage ;               setHP ( currentHP , damage )          }           else {               let   current  =  `Current HP is   ${  currentHP  }  ` ;               sendChat ( "TEST" , current );               let   dmg  =  `Damage is   ${  damage  }  ` ;               sendChat ( "TEST" , dmg );               sendChat ( "TEST" , "There was an error parsing the damage macro params" );               return ;          }                });       function   setHP ( currentHP , damage ){           if ( damage  >=  currentHP ){               sendChat ( "api" , "!modattr --name Ship --shipHP|0" );               sendChat ( "api" , "!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NmhzxkuwfkUhKcGXkuq --set currentside|0" );               sendChat ( "api" , "!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -Nmhlw3OUp-m0eUxoo6w --set currentside|0" );               sendChat ( "api" , "The Ship has been destroyed!" );          }           else {               for ( i = 0 ; i < damage ; i ++){                   let   msg  =  `Reducing HP by 1 for count   ${  i  }   of   ${  damage  }  .` ;                   sendChat ( "api" , msg );                   sendChat ( "api" , "!modattr --name Ship --shipHP|-1" );                   sendChat ( "api" , "!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -NmhzxkuwfkUhKcGXkuq --set currentside|-1" );                   sendChat ( "api" , "!token-mod --api-as -NgLL39aMVMGSgYa69Tq --ids -Nmhlw3OUp-m0eUxoo6w --set currentside|-1" );              }          }      }        function   getShipHP (){           var   Ship  =  findObjs ({  type  :   'character' ,  name  :   'Ship'  })[ 0 ];           var   hitPoints  =  findObjs ({  type  :   'attribute' ,  characterid  :   Ship . id ,  name  :   'shipHP'  })[ 0 ];           var   hpValue  =  parseInt ( hitPoints . get ( 'current' ));           return   hpValue ;      }  });