Using Pronouns in Quest: object.gender VS object.article

K.V.

I just learned something.


Let's say you're scripting a message to print, and you're using an attribute for an NPC object in the script.

I have Tom, Dick, and Harry in a hypothetical game. (Oh, heck! Let's throw Sally in, just for good measure!)

Now, I'll make a command:


Command name: say_stuff_to_npc_cmd
say "#text#" to #object#;say, "#text#" to #object#;say, #text# to #object#;say #text# to #object#

// We have a few choices.

msg (CapFirst(GetDisplayName(object)) + " ignores you.")

msg (CapFirst(object.gender) + " ignores you.")

msg ("You say, \"" + text + "\" to " + object.article + ".")

msg ("You say, \"" + text + "\" to "+ GetDisplayName(object) + ", but "+ object.gender +" doesn't respond to anything you say to " + object.article +" these days.")

Let's look at the output:

image


So:

GetDisplayName(object) returns what the game would print out as the object's description. This would be the object's alias, if the object had one.

So, why not just use object.alias? Well, that would throw an error if you didn't set an alias on the object, while GetDisplayName(object) will default to the name if there is no alias. (It also throws in the prefix for you.)


I make sure to always begin sentences that start with variables with CapFirst(), just to be proper and stuff.


When your variable (or attribute) is the subject, use object.gender, which will return "he", "she", "it", or "they".


When your variable (or attribute) is the object, use object.article, which will give you "him", "her", "it", or "them".


http://docs.textadventures.co.uk/quest/functions/string/capfirst.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayname.html
http://docs.textadventures.co.uk/quest/tutorial/anatomy_of_a_quest_game.html
http://docs.textadventures.co.uk/quest/using_attributes.html
http://docs.textadventures.co.uk/quest/tutorial/custom_commands.html
http://docs.textadventures.co.uk/quest/expressions.html


Well, what are you still doing here?!?

Go write something!!!


There is also object.possessive, for "his" and "her".

Also, remember to set plural objects as plurals on the Setup tab, so Quest will use "they" , "them" and "their" with, for example, a pair of shoes.

Oh, and you can use Conjugate with a verb so it is modified depending on whether the thing is singular or plural.


there's also the 'male' and 'female' (and 'it/thing' ???) Object Types, which I think the 'article', 'gender', and etc (and the underlying parser for this noun grammer type of stuff) ... uses

http://docs.textadventures.co.uk/quest/elements/object.html (see the bottom of the page, for the Object Types: male, female, maleplural, femaleplural, plural, namedmale, namedfemale)


http://docs.textadventures.co.uk/quest/attributes/article.html
http://docs.textadventures.co.uk/quest/attributes/gender.html


http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayname.html
http://docs.textadventures.co.uk/quest/functions/corelibrary/getdisplayalias.html


but Pixie can probably go into more detail and accurate detail on this stuff.


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

Support

Forums