You are not logged in.
Pages: 1
No, it still leaks.
Yes, but many newer users get confused if trying to cut an animation short with "if(image_index == whatever)".
Testing for image_index == 3 fails. floor(image_index) == 3 works fine.
EDIT: This is related to the confusing fact that score is a signed integer.
This appears to be present in at least GM7 and GM8, though most likely earlier.
Unexpectedly, image_index is a floating-point decimal. This can make debugging a nightmare, as I found out. You cannot directly test image_index == value; instead you must use floor(image_index) == value. The help file states that it can have a fractional part, but it fails to mention that unless image_speed also does not have a fractional part, image_index will be expressed as a floating-point decimal.
/*
** Usage:
** my_str = crypt(str)
**
** Arguments:
** str String to encrypt, string
**
** Returns:
** my_str Result of encryption, string
**
** Notes:
** This script works for both encryption and decryption.
**
** GMLscripts.com
*/
{
var str, str2, i;
str = argument0;
str2 = '';
for(i = 1; i <= string_length(str); i += 1) {
str2 += chr(~ord(string_char_at(str, i)));
}
return str2;
}
The above is a simple encryption script using the bitwise NOT operator designed to be easy to use but effective.
Input: PlasticineGuy
Output: ¯¸
I have also designed a file encryption script:
/*
** Usage:
** file_crypt(file)
**
** Arguments:
** file String to encrypt, file ID
**
** Returns:
** 1 Returns a value to avoid odd behaviour described by Xot.
**
** Notes:
** This script works for both encryption and decryption.
**
** GMLscripts.com
*/
{
var buffer, buffer2, fp, fn, i;
buffer = "";
buffer2 = "";
fn = argument0;
fp = file_bin_open(fn, 2);
while(file_bin_position(fp) != file_bin_size(fp)){
buffer += chr(file_bin_read_byte(fp));
}
file_bin_close(fp);
for(i = 1; i <= string_length(buffer); i += 1) {
buffer2 += chr(~ord(string_char_at(buffer, i)));
}
fp = file_text_open_write(fn);
file_text_write_string(fp, buffer2);
file_text_close(fp);
return 1;
}
EDIT: Fixed to follow specification.
Pages: 1