Need help with a error
Squished2gether
16 Feb 2017, 22:33I am trying to make it so that when you pick up an item it adds a number to your score. It was working fine a few days ago but today when I tested the game it kept giving me an error. I didn't change anything since it was working so I have no idea why it just stopped working.
Here is my error, hope someone can help me.
Error running script: Error compiling expression 'player.score + 1928': ArithmeticElement: Operation 'Add' is not defined for types 'Object' and 'Int32'

onimike
16 Feb 2017, 22:43What does the code look like for this function?
hegemonkhan
16 Feb 2017, 22:45there's an issue with your 'player.score', either:
-
you don't have a 'player' Player Object (either deleted it, renamed it, toggled it off from being a Player Object - well actually this wouldn't cause the error, so nevermind on this last thing about toggling your 'player' Object from not being a Player Object)
-
you don't have a 'score' Integer Attribute (either you deleted it or you toggled it off in the GUI/Editor, look under the 'game' Game Setting object's 'Features' Tab, I think) on your 'player' Player Object. If you have a 'player' Player Object, then under its 'Attribute' Tab, at the bottom of the screen is the Attributes box, look in it for a 'score' Attribute, and if you have it, make sure it's type is that of an 'int (integer)'.
-
otherwise, maybe it's an issue with your scripting syntax, in that you didn't do-it-right/set-it-right (in code, it should look like this: player.score = player.score + 1928, in GUI/Editor, like this: set variable player.score = [EXPRESSION] player.score + 1928)
The Pixie
17 Feb 2017, 07:58It is number 2. on HK's list; the score attribute does not exist.

crystalwizard
18 Feb 2017, 22:33did you not save your file after you got the code working the other day?