How to display the value of a counter on text (Quest)

0 votes
153 views
asked Jul 10 in Authoring by anonymous

The title says it all. Do I do {object.attributes} (I don't know how to use it)? Or something else? I don't know. Someone please explain it to me.

1 Answer

0 votes
answered Jul 11 by hegemonkhan (161 points)
edited Jul 11 by hegemonkhan
 
Best answer

the easiest way is to use the text processor commands ( http://docs.textadventures.co.uk/quest/text_processor.html ), as you already ask for in your question.

you just need to select this script:

(Element: GUI~Editor's Verbs, Commands, Functions, Turnscripts, Timers, etc) -> run as~a script -> add a~new script -> output -> 'print a message' Script -> (see below example)

print [expression] "Hi, my name is {player.alias}."
// pretend that we already setted the 'player.alias' String Attribute to the Value of: "HK"
// outputs: Hi, my name is HK.

the entire contents (your sentence~paragraph~s; aka your message), must be within the double quotes, and your text processor command must be within the curly brackets (see the link above for the diferent text processor commands available and how to write them in properly: their syntax, ask if you need any help with it). Also, do make sure that you do choose [expression] and not [message] (as the [message] is for straight text only, no VARIABLE usage, which text processor commands use, for example my example of using the 'player.alias' Attribute VARIABLE)


also, make sure that you actually CREATED~ADDED the Attribute that you want to use as your VARIABLE for your text processor command~s ... (you can't use, what doesn't exist, lol)

for my example above:

'player' Player Object -> 'Attributes' Tab -> Attributes -> add -> (see below)

(Object Name: player)
Attribute Name: alias
Attribute Type: string
Attrbiute Value: HK

err... you can also just use the 'alias' text box under the leftmost Tab 'setup' too for your 'player' Player Object, typing in your 'alias', of (for my example above): HK


a bit more explanation:

this is how I like to convey the various general syntax for Attributes:

(look up what the desired text processor command uses ~ ask if you need help ~ if you don't understand)

Object_name.Attribute_name

Object_name.Attribute_name = Value_or_Expression

examples:

.1. Object Name: player
Attribute Name: alias
(Attribute Type: string)
Value or Expression (Value): HK

player.alias

player.alias = "HK"

print [expression] "Hi, my name is {player.alias}."

print [expression] "{if player.alias="HK": HK is so awesome!} {if not player.alias="HK": Sorry, but you're not as awesome as HK.}"

.2. Object Name: game
Attribute Name: static_greeting
(Attribute Type: string)
Value or Expression (Expression): "Hi, my name is HK."

game.static_greeting

game.static_greeting = "Hi, my name is HK."

print [expression] "{game.static_greeting}"

.3. Object Name: orc
Attribute Name: dead
(Attribute Type: boolean)
Value or Expression (Value): false
~or~
Value or Expression (Value): true

orc.dead
// the above is actual the understood, by the quest engine, as the shortened form of: orc.dead = true, ya it gets a bit confusing, there's lots of these rules-things you got to remember~be aware of, sighs.

orc.dead = false
~or~
orc.dead = true

print [expression] "{if orc.dead: The orc is dead.} {if not orc.dead: The orc is alive.}"


ask if you got any questions on any of this stuff, or if you need anything explained.

This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...