#Stonescript Wrong Error Reported

14 messages · Page 1 of 1 (latest)

novel ridge
#

When calling the function string.Equal, instead of the Mind Stone reporting that the method Equal doesn't exist (it's actually string.Equals), it instead reports that the object/variable string doesn't exist. This has also happened to me with misspelled methods of item.

flint knot
#

Yeah the errors can be a bit misleading.
Sometimes it is much worse than that.

vapid eagle
#

If you misspell a variable, it’s the same thing that variable doesn’t exist. It’s not gonna say whoops you spelled something wrong.

#

Working as intended, not a bug.

humble whale
#

it happens because string is not actually referencing an object with methods in stonescript.
string.Equals is actually the whole variable/function name. The native functions can have . as part of the name to emulate object methods.

fossil vault
#

It checks the native functions/vars and see it doesn't exist there, so it checks user made functions/vars and thinks string is meant to be an object

#

And doesn't think its text because of the .

novel ridge
#

Followup: is there a way to make the error more intuitive within the game itself?

fossil vault
#

To do so, it would have to know its a typo and not you trying to access a custom var/func thats part of an object

novel ridge
#

I hate to be pedantic, but a Trie would work great for that (or anything else that could allow a program to find minimum levenstein distances)

novel ridge
#

Wait... why isn't "string" just a built-in object already?

humble whale
#

its a datatype, but its not a stonescriptObject