To download, click that button.
Lately in GM, I've lacked motivation to make any actual games, so I decided a basic string to binary script would be cool. So here it is, my str_to_bin script that takes the specified string, and returns it in 8bit binary form (as a string).
//Returns the string (argument0) in 8bit binary form...
var _str, _bin, _i, _j, _tempA, _tempB, _tempC;
_str = string(argument[0]);
_bin = "";
for(_i = 1; _i < string_length(_str) + 1; _i += 1)
{
_tempA = real(ord(string_char_at(_str, _i)));
_tempB = "";
_tempC = 0;
for(_j = 7; _j >= 0; _j -= 1)
{
if(power(2, _j) + _tempC <= _tempA)
{
_tempC += power(2, _j);
_tempB += "1";
}else
{
_tempB += "0";
}
}
_bin += _tempB + " ";
}
return string_copy(_bin, 1, string_length(_bin) - 1);Please remember this is merely for entertainment purposes only, so I did not use the fastest or most efficient way possible (in the example GM6 file, I do not recommend using it how I did). I also realise that this isn't extending GM, but the rules state any script can be posted.
If you encounter any errors with my code, please let me know. Anyways, enjoy!



Find content
Not Telling







