[web version] How does status attributes work?
IzyaboiCallume
25 Oct 2020, 10:05I tried to follow the tutorial but it didnt seem to work, here is the code that i typed in. I put this code in the start script as the tutorial told me to do.
set (you, "statusattributes", 0) set (you, "statusattributes", NewStringDictionary()) dictionary add (you.statusattributes, "score", "Score: !/10")
also, additional question, how do i increase the score?
Pertex
25 Oct 2020, 16:30Could you post the link of the tutorial page where you found this code?
mrangel
25 Oct 2020, 20:38I assume that is meant to be:
set (you, "statusattributes", 0)
set (you, "statusattributes", NewStringDictionary())
dictionary add (you.statusattributes, "score", "Score: !/10")
with some line-breaks in.
I don't think this came from a good tutorial, as the first line is completely useless. The same thing could be written more simply as:
you.statusattributes = NewStringDictionary()
dictionary add (you.statusattributes, "score", "Score: !/10")
I also assume that you
is the name of the player object.
Using the name of the player in code is a bad habit to get into. It would be better to use game.pov
(which refers to the player object regardless of its name).