title: How to convert string to binary representation in game maker?
body: <p>I found a script that converts binary to string but how can I input a string and get the binary representation? so say I put in "P" I want it to output 01010000 as a string.</p>
  
  <p>I have this but it is not what I am trying to do - it converts a string containing a binary number into a real value of that number:</p>
  
  <pre><code>///string_to_binary(string)
  var str = argument0;
  var output = "";
  for(var i = 0; i &lt; string_length(str); i++){
  if(string_char_at(str, i + 1) == "0"){
      output += "0";
  }
  else{
      output += "1";
  }
  }
  return real(output);
  </code></pre>