Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Changing aliases

A topic by ChristopherMerriner created Jun 10, 2020 Views: 115 Replies: 11
Viewing posts 1 to 2

Is is possible to change the alias for an object during the game? At the  moment I'm creating different objects and switching them, but that feels a bit unwieldy. For an example: you talk to Mrs Smith and discover that her name is Jennifer. After which, you see Jennifer rather than Mrs Smith. If I could just change the alias from Mrs Smith to Jennifer (rather than having to create a new object with the same attributes but a different alias), that would be handy.

Host

Your current approach is the only one that would work in 8-bit compatibility mode.

But if you were not in that mode, and for curiosities sake, other than swapping objects, there is only one other method of achieving this .. by using a reference to a string in the object text. 

This doesn't actually allow you to change the aliases at runtime, and you would have to allow the player to use jennifer or smith from the beginning of the game, which generally speaking is fine, unless the player is a mind reader or has played the game before.

Adventuron allows dynamic descriptions of objects via the following mechanism:

objects{
   /* jennifer is defined as an alias for smith in the vocab section */
   jennifer : scenery "{jennifername}" noun="jennifer";
}
strings {
   jennifername : string "Mrs Smith"; 
}
vocabulary {
  : noun / aliases = [smith, jennifer]
}
on_command {
   : if_examine "jennifer" {
      : print "She is wearing a badge, it says \"Jennifer.\"";
       : set_string var="jennifer" value="Jennifer";
      : press_any_key;
      : redescribe;
   }
}
Submitted

Wouldn't you be better off starting out with an object id of mrs_smith so that you can refer to her as Mrs Smith (adjective = mrs, noun = smith)? Then you can refer to her as Jennifer, Smith, Mrs Jennifer or Mrs Smith. Or is the 'Mrs' ignored if it's not defined anywhere in the vocabulary? So I can refer to her as 'old lady Smith' or 'Granny Smith' or 'blah Smith' and it's still understood.

Host

Correct, mrs is ignored if not defined anywhere.

Submitted

That might explain why my noun2 sometimes ends up being noun1 with disastrous consequences. That is so wrong.

Host

Show me an example of this and I'll resolve it.

Generally speaking, if a standard preposition occurs between a verb and a known noun, then the next noun is noun2.

Host

e.g. 

If the player enters:

put blah foo jimmy in cupboard

Where:

  • put is a known verb
  •  blah, foo, and jimmy are non dictionary words
  • 'in' is a standard preposition
  •  cupboard is a known noun

Adventuron would parse as :

  • verb = put
  • noun1 = undefined (empty)
  • noun2 = cupboard
Submitted

Well, just as an example, there's that one I asked you about offline a couple of days ago. GET BLAH FROM POCKET resulted in s1 = pocket and s2 = pocket. It would help if we knew what the standard prepositions were.

Based on what you said here, I did a bit of experimenting and worked out that if I use a test like :if (preposition_is "from" && noun2_is "pocket") {}, that seems to fix it. Am I on the right track?

Host(+1)

You could add propositions in the vocabulary {} section.

The issue you reported the other day was a bug, and was fixed.

I just added an issue to the issue tracker to document the standard verbs and prepositions.

Submitted

I wondered about that. I had added [in, into, inside] and [on, onto] (because I think I'll need them). The others I'm likely to need are [about], [from] and [with]. I've just added them. It looks like it's okay to have one word in the array. It certainly doesn't complain.

Host

Yes, one word in an array is fine.

Thanks - that's useful to know.