Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Alrighty, I'm back! I've started putting all of your of the advice you've given to work, but I still haven't been able to get the If Statement to work. 

I used the show code to make sure that that score.text is receiving numbers properly, and I also used the floor function to make sure that there were no decimal points in the score, but that didn't seem to work either. I also tried switching the field to both Plain Text and Code, but that didn't seem to fix anything either.

One thing I have come to realize is that when i make it so that the score.text is supposed to be Less Than the given number, it will always activate regardless of the number larger or smaller. And it seems to work the opposite with Greater Than, with it never activating instead. (I also tried to set the number it's compared to to a negative one,  and the results were the same) If anyone has any ideas as to what is going on, please tell me cuz I'm getting a little desperate.

Anyways, thank you Screwtapello for the help. Even if I can't get that one system working, seeing my scores finally not have a bunch of little decimal numbers hanging off of the end has eased a sense of peace upon my soul, one which I cannot describe accurately with words alone. Your help is appreciated.

(+2)

The .text attribute of a field is a string. Comparing numbers to strings in Lil can have surprising results, because in this case Lil makes the comparison lexicographically:

3>"12"  # 1
3>12    # 0

To avoid this problem, you can use an arithmetic identity operation to coerce the string into a number before performing a comparison:

  myField.text  # "12"
0+myField.text  # 12

Alternatively, use the .data attribute of the field instead: this will ask Decker to interpret the contents of the field as LOVE (a superset of JSON):

myField.text     # "12"
myField.data     # 12
otherField.text  # "[11,22,33]"
otherField.data  # (11,22,33)

Yet another option would be to store numbers in Slider Widgets instead of fields; a slider's .value attribute is always a number. Does that help?

(+1)

I'll have to do some more research on what all this means, but I have gotten it working now. Thank you!I Like Your Funny Words, Magic Man - Meming Wiki