You are not logged in.
Pages: 1
From my gmc topic: http://gmc.yoyogames.com/index.php?showtopic=475256
//get_value(Original Message, Default Value, Invalid Message)
var user_val, user_dig, val_mes;
user_dig = ""; val_mes = argument0;
while !(string_digits(user_dig) == user_dig && string_length(user_dig) > 0)
{
user_val = get_string(val_mes, argument1);
if (string_char_at(user_val, 1) == "-" || string_char_at(user_val, 1) == "+")
{
user_dig = string_replace(string_delete(user_val, 1, 1), ".", "");
}
else
{
user_dig = string_replace(user_val, ".", "");
}
val_mes = argument2;
}
return real(user_val);
This script does not cover exponential format so I decided not to call it get_real. Torigara did write an alternative using exps if you prefer that:
http://gmc.yoyogames.com/index.php?showtopic=466011
Offline
Nice, pretty slick error checking. This topic sure comes around a lot. It really should be built into Game Maker.
Abusing forum power since 1986.
Offline
Yes it really should be included, I wish I remembered to ask when GM8 was being made (though I'm doubting it would have been made). I've seen it being asked a lot recently which is why I decided to make a script for it.
Offline
Pages: 1