List of stuff that goes in expressions.

CheeseMyBaby
30 Apr 2018, 21:08Ok, I'm super tired. I'll try to make sense but I'm afraid I'll fail horribly.
So this."Bla bla " + object.article + " blaaaah!"
Is there a list with stuff like the object.article
and other stuff that can go in an expression available?
A list that also explains what it means?
I've been playing around with expressions but constantly find myself unsure of what I should type to make what I want to happen... happen.
I've been searching for such a list but without luck.

K.V.
30 Apr 2018, 21:12You probably just need to know which attribute you want.
http://docs.textadventures.co.uk/quest/attributes.html
Note that they are listed on that main page with the first letter capitalized, but Quest is case-sensitive and every letter in an attribute is usually lower case.
Another good trick is opening the debugger during a game and checking everything out:

K.V.
30 Apr 2018, 21:20You can also use GetAttributeNames to list all the attributes for an object.
// Using True for the second parameter lists ALL attributes, even inherited, unused attributes.
list = GetAttributeNames(game.pov, true)
msg ("Attributes for the player object:")
DisplayList(list, true)
View the list:
Attributes for the player object:
- name
- elementtype
- type
- parent
- external_gender
- external_article
- pov_alt
- pov_used
- alias
- alt
- look
- gender
- article
- feature_player
- visible
- displayverbs
- inventoryverbs
- take
- use
- givesingle
- drop
- possessive
- wornmodifier
- isopen
- open
- close
- container
- descprefix
- objectslistprefix
- exitslistprefix
- contentsprefix
- description
- implementation_notes
- scenery
- hidechildren
- listchildren
- usedefaultprefix
- volume
- price
- dark
- lightstrength
- darklevel
- grid_width
- grid_length
- grid_fill
- grid_border
- grid_borderwidth
- grid_bordersides
- grid_render
- grid_label
- grid_label_colour
- grid_parent_offset_auto
- grid_parent_offset_x
- grid_parent_offset_y
- pov_alias
- pov_look
- pov_gender
- pov_article
- pov_possessive
- feature_usegive
- feature_container
- feature_switchable
- feature_edible
- feature_lightdark
- visited
- hasbeenmoved
- timesexamined
- not_all
- changedparent
- changedisopen
- changedlocked
- changedswitchedon
If you were really crazy, you could print off every attribute for every object in the game, with the value.
foreach (o, AllObjects()) {
msg ("<hr/>Attributes for "+ GetDisplayName(o)+":")
list = GetAttributeNames(o, true)
foreach (att, list) {
if (HasAttribute(o,att)) {
msg (att + ": " + GetAttribute(o,att))
}
}
}
View the results of one object (the stick):
Attributes for a stick:
name: stick
elementtype: object
type: object
parent: Game: game
take: True
feature_usegive: True
givesingle: True
look: Script: msg ("You see nothing special about "+this.article+".")
giveto: Dictionary: Ralph = Script: JS.console.log ("Running the 'giveto' script':")msg ("You give "+this.article+" to Ralph.")JS.console.log (this)
generatedverbslist: List:
visible: True
displayverbs: List: Look at; Take;
inventoryverbs: List: Look at; Use; Drop;
use: False
drop: True
gender: it
article: it
possessive: its
wornmodifier: worn
isopen: False
open: False
close: False
container: False
descprefix: You are in
objectslistprefix: You can see
exitslistprefix: You can go
contentsprefix: containing
description:
implementation_notes:
scenery: False
hidechildren: False
listchildren: False
usedefaultprefix: True
volume: 0
price: 0
dark: False
lightstrength:
darklevel: False
grid_width: 1
grid_length: 1
grid_fill: White
grid_border: Black
grid_borderwidth: 1
grid_bordersides: 15
grid_render: False
grid_label:
grid_label_colour: Black
grid_parent_offset_auto: True
grid_parent_offset_x: 0
grid_parent_offset_y: 0
pov_alias: me
pov_alt: List: me; myself; self;
pov_look: Looking good.
pov_gender: you
pov_article: yourself
pov_possessive: your
feature_container: False
feature_switchable: False
feature_edible: False
feature_player: False
feature_lightdark: False
visited: False
hasbeenmoved: False
timesexamined: 0
not_all: False
changedparent: Script: if (game.pov = this) { if (IsDefined("oldvalue")) { OnEnterRoom(oldvalue) } else { OnEnterRoom(null) } if (game.gridmap) { MergePOVCoordinates } }
changedisopen: Script: if (this.isopen and HasScript(this, "onopen")) { do (this, "onopen") }if (not this.isopen and HasScript(this, "onclose")) { do (this, "onclose") }
changedlocked: Script: if (this.locked and HasScript(this, "onlock")) { do (this, "onlock") }if (not this.locked and HasScript(this, "onunlock")) { do (this, "onunlock") }
changedswitchedon: Script: if (this.switchedon and HasScript(this, "onswitchon")) { do (this, "onswitchon") }if (not this.switchedon and HasScript(this, "onswitchoff")) { do (this, "onswitchoff") }

CheeseMyBaby
30 Apr 2018, 21:55Indeed you're right, like always =)
One more question.
If I do this
"You throw " + this.name + " in the dumpster."
... and this.name
refers to a guitar the result would be:
You throw guitar in the dumpster.
Is there an easy way to get the prefix into the string so that it prints "You throw the guitar in the dumpster"?

K.V.
30 Apr 2018, 21:56This may be helpful, too:
list = Split("Fred;Barney;Wilma;Betty")
this = PickOneString(list)
create (this, "npc_type")
this = GetObject(this)
this.parent = game.pov.parent
if ((this.name = "Fred") or this.name = "Barney") {
this.article = "him"
this.gender = "he"
this.possessive = "his"
}
else {
this.article = "her"
this.gender = "she"
this.possessive = "hers"
}
this.look = CapFirst(this.gender)+" looks just like the character from The Flinstones!"
this.takemsg = "You can't take "+this.article+"."
this.speak => {
msg (CapFirst(this.gender)+" ignores you.")
}

K.V.
30 Apr 2018, 22:01msg ("You throw " + GetDisplayName(this) + " in the dumpster.")
The (minor) issue:
Your guitar's prefix is probably "a". It definitely is if you are using the default prefix (guitar.usedefaultprefix
). So, this will print:
"You throw a guitar in the dumpster."
If you uncheck "use default prefix", it will just say "guitar" (not "a guitar" or "the guitar") when it prints something concerning the guitar.
This is what I do (and it's dirty):
msg ("You throw " + Replace(GetDisplayName(this), "a ", "the ") + " in the dumpster.")

CheeseMyBaby
30 Apr 2018, 22:11Dirty or not, it works!
Thanks a lot!
hegemonkhan
30 Apr 2018, 23:55KV has already covered and explained/help with most of this stuff, so this is just additional info/comments by me
here's most/all of an Object's built-in Attributes:
http://docs.textadventures.co.uk/quest/elements/object.html
and here's most/all of the special 'game' Object's built-in Attributes:
http://docs.textadventures.co.uk/quest/elements/game.html
these two links above are found within this link's location:
http://docs.textadventures.co.uk/quest/elements/
there's global/game-wide controls/options (Attributes, and Object Types and their Inherited Attributes) for prefix/suffix/etc within the special 'game' Object (in the GUI/Editor and/or using its built-in Attributes directly in code/scripting yourself)
also, you can set the prefix/suffix/etc on individual Objects as well within the GUI/Editor and/or via code/scripting yourself
and there's many other methods as well via scripting, such as string+concatenation usage
The Pixie
01 May 2018, 06:49This is what I do (and it's dirty):
msg ("You throw " + Replace(GetDisplayName(this), "a ", "the ") + " in the dumpster.")
If the object is an apple, the p[refix will (hopefully) be "an"...

CheeseMyBaby
01 May 2018, 08:53here's most/all of an Object's built-in Attributes:
and here's most/all of the special 'game' Object's built-in Attributes:
these two links above are found within this link's location:
Thanks HK!
I guess the problem (well, ONE of the problems) with me is that I don't really know what to ask for.
"An object's built-in attributes" etc. I'd never think to ask for that xD
I've seen the pages you linked before but there's so many of them and when I'm looking for something specific most (highly informative!) pages like that blur and I'm just dumbfounded.
@K.V, HK, Pix, mrangel
I've always learned best when someone explains something to me (not by just reading about it), hence all my questions here on the forum.
And seriously, you guys, you've been a tremendous help!
If the Quest world had Oscar's you should all get them. Truckloads of them!
Thanks!
mrangel
01 May 2018, 09:17I prefer something like (off the top of my head):
<function name="GetDefiniteArticle" parameters="object">
if (game.enablehyperlinks) {
result = "{object:"+object.name+"}"
}
else {
result = GetDisplayAlias (object)
}
if (not result = GetDisplayName(object)) {
result = "the "+result
}
return (result)
</function>
That way, even for other possible prefixes (like "some", or "your") it gets replaced with "the". The only case where it doesn't add "the" is where the prefix is blank. In the test cases I can think of, that reads more naturally.
(if the prefix is "some", the Dumpster statement sounds better to me with "the". In the "your" example, I think it works either way)
The Pixie
01 May 2018, 14:51I guess the problem (well, ONE of the problems) with me is that I don't really know what to ask for.
There is a more general problem that it is not obvious where this should be documented even.

K.V.
01 May 2018, 14:58I changed the name to GetTheDisplayName
, though. (I hope you don't mind.)