Login
Remember
IF Answers
Ask a Question

# Cannot change name of element when not in edit mode?

0 votes
34 views
asked Jul 14 in Authoring by anonymous
edited Jul 14 by Alex

I cannot even get past the very first thing of character creation:

    msg ("CHARACTER CREATION:")
    msg ("What is your name?")
    get input {
      player.name = result
      msg ("Your name is " + player.name)
    }

When I go to test and enter a name, I get the error:
"Error running script: Cannot change name of element when not in edit mode"

- quest

## 1 Answer

0 votes
answered Jul 14 by Alex (486 points)

The name of the player element is always "player" (in fact, the name attribute of any element is always the name of the element).

If you want to store arbitrary data like the player's name, choose a different attribute name, like "playername".

For example:

    msg ("CHARACTER CREATION:")
    msg ("What is your name?")
    get input {
        player.playername = result
        msg ("Your name is " + player.playername)
    }

commented Jul 14 by hegemonkhan (161 points)
edited Jul 14 by hegemonkhan
just to add more commentary to Alex's post~answer:
the 'name' String Attribute is the 'ID' for the quest engine, so no two 'name' String Attributes can be the same, all 'name' String Attributes must be unique (just as no two organisms can have the exact same DNA). Once you create something and name it (or if it is already created and named, such as the built-in 'player' Player Object), you can't change its name (as in: you can't change the 'name' String Attribute of things).
As Alex has already said, you can always create your own (aka custom) Attributes (or for whatever else, whatever other Elements), such as 'playername', 'first_name', 'name1', or 'whatever_you_want_to_call_it'.
Most people use the built-in 'alias' String Attribute for a name, as this is what the person playing the game will see as the name of the thing. For the people playing the game, the name is the 'alias' String Attribute, and for the quest engine, the 'ID' name is the 'name' String Attribute.
Quest (generally) only cares about the 'name' String Attribute (as that is the ID for quest engine), so quest does (generally) not care about any other Attribute, like the 'alias' Attribute, as can be seen below with multiple things having the same 'alias' String Attribute.
A good practice is to use the 'name' String Attribute as your organization method, and use the 'alias' String Attribute for the names of the things for the person playing the game, for examples (in code, as the creation tag blocks):
------------
<object name="dragon_1">
<alias>fire dragon</alias>
</object>
<object name="dragon_2">
<alias>water dragon</alias>
</object>
<object name="dragon_99">
<alias>bahamut (King of Dragons)</alias>
</object>
----------
<object name="orc_1">
<alias>orc</alias>
</object>
<object name="orc_2">
<alias>orc</alias>
</object>
--------------
<object name="orc_1">
<alias>orc grunt</alias>
</object>
<object name="orc_2">
<alias>orc chief</alias>
</object>
<object name="orc_1">
<alias>orc king</alias>
</object>
----------
<object name="orc_grunt">
<alias>orc</alias>
</object>
<object name="orc_chief">
<alias>orc</alias>
</object>
<object name="orc_king">
<alias>orc</alias>
</object>
--------
using the 'alias' String Attribute would look like this:
msg ("CHARACTER CREATION:")
msg ("What is your name?")
get input {
player.alias = result
msg ("Your name is " + player.alias)
}

## Related questions

- In a Gamebook, how do I fix that the text processor is not working properly on my version of Quest (I think)?
- What's a good method when dealing with a ton of objects in Quest?
- Online version of Quest: How do I change the value of Status Attributes?
- How to restore previous versions in web version of quest.
- Show amount of gold in inventory

...