ThePix / QuestJS

A major re-write of Quest that is written in JavaScript and will run in the browser.
MIT License
66 stars 12 forks source link

Confused about how pronouns work #75

Closed ImaBuggyMess closed 2 years ago

ImaBuggyMess commented 2 years ago

Sorry if this is the wrong place to write, if I can be directed to the right place (perhaps DM's), do tell me.

I am confused about how pronouns work. My problem is really simple. I am trying to make an object belong to a player or an NPC, like a phone, and have the pronoun show up. I know that the easy way is to just make everything a massnoun and then just change the alias of the object to whoever it belongs to (or your if it belongs to you, change it to "your"), but I'm really trying to use pronouns.

For example, if your phone is in your room, it should read "you see your phone." If someone elses phone is in your room, it should read "(Random Name) phone" or "his/her phone" if (only they are in) the room with you.

TL;Dr

How do I make a pronoun possessive to the player? E.g "your phone" instead of "a phone" without removing indefinite article and naming the object "your phone".

ThePix commented 2 years ago

There is a forum here: http://textadventures.co.uk/forum/questkit

However, this is an interesting issue that probably deserves to be here anyway.

I have uploaded a new version of lang/lang-en.js. You can now set the "owner" attribute to the name of the character who owns the item, and lang.getName (and hence the text procerssor) will behave accordingly. I am not sure if it will need to refining, so I will leave this open for a while.

The unit tests look like this (Buddy is the player), which might give some idea of how it works:


  test.assertEqual("the book", lang.getName(w.book, {article:DEFINITE}));
  test.assertEqual("A book", lang.getName(w.book, {article:INDEFINITE, capital:true}));
  w.book.owner = 'Buddy'
  test.assertEqual("your book", lang.getName(w.book, {article:DEFINITE}));
  test.assertEqual("Your book", lang.getName(w.book, {article:INDEFINITE, capital:true}));
  w.book.owner = 'Kyle'
  test.assertEqual("Kyle's book", lang.getName(w.book, {article:DEFINITE}));
  test.assertEqual("Kyle's book", lang.getName(w.book, {article:INDEFINITE, capital:true}));
ThePix commented 2 years ago

No further feedback, so I am assuming this is revolved satisfactorily.