Making Descriptions that Vary (2 min)

A library of video tutorials for ADRIFT 5.0.
Post Reply
ElliotM
Posts: 1227
Joined: Tue Apr 17, 2007 9:04 pm
Points: 13
Location: The Midwest in the USA

Making Descriptions that Vary (2 min)

Post by ElliotM »



Let's say you need to describe something that changes. For example, if you had a traffic object that varies to simulate moving traffic, you can use the One Of expression by putting the following into your traffic object's description textbox:

Code: Select all

You see a <# OneOf("yellow","blue","red","green") #> car drive by.
The One Of expression will randomly choose one of these four colors to use in this description. One Of doesn't require a variable but you won't be able to refer to the chosen value later you could with a variable.

An alternative would be to set a color variable equal to the One Of expression in a task action:

Code: Select all

Set variable 'color' to OneOf("yellow","blue","red","green")
This will allow us to use the chosen color later and keep that value until we decide to change it. To make use of that variable in text, you put the following in the description of the taxi object:

Code: Select all

A %color% taxi is waiting here.
While the traffic color will vary each time we see its description, the taxi color will remain consistent until we update it with a task action.
Random Color.taf
Demonstrates using the OneOf expression to vary object descriptions each time they are seen. Also shows how to store the output of OneOf so it can be reused until you decide to update it with a task.
(15.45 KiB) Downloaded 279 times
User avatar
Denk
Posts: 1003
Joined: Mon Feb 22, 2016 6:21 pm
Points: 346
Location: Hjørring, Denmark

Re: Making Descriptions that Vary (2 min)

Post by Denk »

The original video link stopped working, so here is a new one:

"Making descriptions that vary" by ElliotM:
https://www.youtube.com/watch?v=hk3PVEYJSKQ
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
Post Reply