Using Alias's in the Ask command?


This might be on the forum maybe but i've been trying to figure out how to get alias's to work on the ask command.

I have alias's on NPC's so that the player can name them and then I want them to be able to ask that NPC about another NPC by using the name that they called them so having them type the name instead of typing like Player1.alias in the text field.



It should work without doing anything extra.

Quest will normally check the aliases just like it checks the actual object names.


No, I misunderstood you.

You want to allow the player to set an alias during play then have that string be recognized in another NPC's "Ask about" script.


Let's say you have an object called NPC1, and the player can set that object's alias during play.

You also have an NPC2 object, and you want the player to be able to ASK NPC2 ABOUT NPC1, but you want the player to be able to use NPC1's alias.

You might be able to put {NPC1.alias}as the key in NPC2's ask about script, but I can't test that right now.


Just tested. That doesn't work.

Yeah that's what I initially tested to see if I can you know let the player input the ask which would then you know get it to work there should be a way to get it to work.


You are in a room.
You can see a puppy and KV.

> ask kv about the puppy
"It's kinda cute," says KV.

> ask kv about spot
He does not reply.

> name the puppy
Enter the puppy's new name:
You have named the puppy "Spot".

> ask kv about spot
"It's kinda cute," says KV.

> ask kv about the puppy
"It's kinda cute," says KV.

<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Name the Puppy">
    <feature_asktell />
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    <object name="puppy">
      <inherit name="editor_object" />
      <assignname type="script">
        msg ("Enter the puppy's new name:")
        get input {
          old_alias = GetDisplayAlias(puppy)
          puppy.alias = result
          msg ("You have named the puppy \"" + result + "\".")
          // Search for every object with the "ask" attribute with the old alias as a key, and copy that entry with a key for the new alias.
          foreach (o, AllObjects()) {
            if (HasAttribute(o, "ask")) {
              if (DictionaryContains(o.ask, old_alias)) {
                revision = DictionaryItem(o.ask, old_alias)
                dictionary add (o.ask, result, revision)
    <object name="KV">
      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <ask type="scriptdictionary">
        <item key="puppy">
          msg ("\"It's kinda cute,\" says KV.")
    <defaultexpression>"You can't name " + object.article + "."</defaultexpression>

Aha!! Thank you!


You are welcome!

...but do note that might make a conversation-based game go a little off track, depending on how it all works. Like, if you have lots of NPCs who would have no way to know what the new name would be...

...or if the player can change the alias numerous times, this code would add each new nickname (without deleting any of the others).

So, depending on the situations during play, making all the NPCs know what the alias has been changed to may seem unrealistic, and it's more like adding a name the NPCs can be asked about than it is changing the name. You can use DictionaryRemove(o.ask, old_alias) if you'd like to remove the old alias after a name change.

This topic is now closed. Topics are closed after 60 days of inactivity.