Game Maker help - Printable Version +- The VG Resource (https://www.vg-resource.com) +-- Forum: Discussion Boards (https://www.vg-resource.com/forum-133.html) +--- Forum: Help me! (https://www.vg-resource.com/forum-137.html) +--- Thread: Game Maker help (/thread-28997.html) |
Game Maker help - Gors - 03-30-2016 Hey everyone. I'm having trouble coding something, figured I could get some help basically it's an app that tests if the number I inserted is even or odd. The coding in GML goes as follows: Code: var number = get_integer("Type a Number.",0); the exact problem i'm having is that currently, I am able to type a word and since GML considers words as "0", the app gives out the even message when it is clearly not even (it's not even a number!!) If there was a way to limit the input somehow I'd be very grateful. RE: Game Maker help - Rhyme - 03-30-2016 Googling a little points me to string_digits(number) strips all letters out for the sake of testing, have it print out what string_digits(number) returns, if it's completely empty or a 0, if it's completely empty just slap another if in too lazy to write gamemaker but basically the code after that would look like >please give numbers (code to get numbers) >(if using string_digits(number)) hey this isn't a number shithead >(if it passes, if for even and odd and all that) |