Attribute assignment/retrieval?

Foxxpaw
11 Oct 2022, 06:33

After assigning an Attribute with game.pov.ATTRIBUTE = SOMETHING I can call them again using player.ATTRIBUTE but cannot call them again using game.pov.ATTRIBUTE.

It feels like I somehow switched the player object but I've also confirmed the Player object is set to "player" so I'm completely lost at this point.

Help?

Details:
In Objects > game > Scripts > Start script, I've assigned the name and background with the following:

game.pov.alias = "Test"
game.pov.background = "Scholar"

In a test room, I'm trying to call these attributes (in text, not script) with:

Name: {game.pov.alias}
Background: {game.pov.background}

Name: {player.alias}
Background: {player.background}

The output I get from this is:

Name: 
Background: 

Name: Test
Background: Scholar

mrangel
11 Oct 2022, 11:59

The text processor (which is responsible for handling stuff in {/}) only looks at the first dot in a name, so it will be trying to find an attribute named pov.alias on the game object. This is a weird issue in the text processor.

You can work around this by using the text processor _Eval function, which treats all the characters inside it as a Quest expression. So you could write {=game.pov.alias} and game.pov.alias will be treated as a Quest expression. (You can also use {= to call the _Eval function if you want do maths or call functions; so you could do something like {=game.pov.strength * 2} or {=GetDisplayNameLink(game.pov, "object")}. It allows your text to include arbitrary bits of script, as long as they return a value.