Text processor fun (using SELECT)

K.V.

{select:object.attribute:text 0:text 1:text 2}
{select:object.attribute:text 0|text 1|text 2}
Selects one text to display, based on the value of the object attribute (you can have as many sections as you like). Note that the attribute must be an integer (whole number), and the sections number from zero. The second form, with texts separated by vertical bars, allows additional text processor directives to be nested inside the select directive. This is new to Quest 5.7.


I always tried this backwards and thought it didn't work.

Example:

The game begins and room.countdownis 4.

Every turn, room.countdown is decreased by 1.

{select:room.countdown:text 0:text 1:text 2:text 3}

{select:room.countdown:text 0|text 1|text 2}

TRANSCRIPT BEGINS

tester

by tester maker

You are in a room.
You can see a distraction.
You can go south.
{select:room.countdown:text 0:text 1:text 2:text 3}

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.
{select:room.countdown:text 0:text 1:text 2:text 3}

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.
text 3

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.
text 2

text 2

> l
You are in a room.
You can see a distraction.
You can go south.
text 1

text 1

> l
You are in a room.
You can see a distraction.
You can go south.
text 0

text 0

> l
You are in a room.
You can see a distraction.
You can go south.
{select:room.countdown:text 0:text 1:text 2:text 3}

{select:room.countdown:text 0|text 1|text 2}

TRANSCRIPT ENDS



...but a wise man recently showed me that nesting was possible, so:

{if room.countdown<4:{if room.countdown>-1:{select:room.countdown:text 0:text 1:text 2:text 3}}}

{select:room.countdown:text 0|text 1|text 2}

TRANSCRIPT2 BEGINS

tester

by tester maker

You are in a room.
You can see a distraction.
You can go south.

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.
text 3

{select:room.countdown:text 0|text 1|text 2}

> l
You are in a room.
You can see a distraction.
You can go south.
text 2

text 2

> l
You are in a room.
You can see a distraction.
You can go south.
text 1

text 1

> l
You are in a room.
You can see a distraction.
You can go south.
text 0

text 0

> l
You are in a room.
You can see a distraction.
You can go south.

{select:room.countdown:text 0|text 1|text 2}

TRANSCRIPT2 ENDS



Also...

What of the | allowing additional text processor directives to be nested inside the select directive?

Room countdown: {room.countdown}
//The next line is just for fun, just to see what will happen (and it will do something I didn't expect)...
{select:room.countdown:text 0:text 1:text 2:This is {random:text 3 the new way:text 3 the normal way}}
{select:room.countdown:text 0|text 1|text 2|This is {random:text 3 the new way:text 3 the normal way}}

TRANSCRIPT3 BEGINS
tester

by tester maker

You are in a room.
You can see a distraction.
You can go south.
Room countdown: 4

text 3 the new way

{select:room.countdown:text 0|text 1|text 2|This is text 3 the new way}

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 4

text 3 the new way

{select:room.countdown:text 0|text 1|text 2|This is text 3 the new way}

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 3

This is {random

This is text 3 the new way

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 2

text 2

text 2

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 1

text 1

text 1

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 0

text 0

text 0

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: -1

{select:room.countdown:text 0:text 1:text 2:This is text 3 the new way}

{select:room.countdown:text 0|text 1|text 2|This is text 3 the normal way}

TRANSCRIPT3 ENDS


Now, let's stop playing around and do it correctly:

Room countdown: {room.countdown} {if room.countdown>-1:{if room.countdown<4:
{select:room.countdown:text 0|text 1|text 2|This is {random:text 3 the new way:text 3 the normal way}}}}

FINAL TRANSCRIPT BEGINS

tester

by tester maker

You are in a room.
You can see a distraction.
You can go south.
Room countdown: 4

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 4

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 3
This is text 3 the normal way

> undo
Undo: l

> undo
Undo: l

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 3
This is text 3 the new way

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 2
text 2

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 1
text 1

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: 0
text 0

> l
You are in a room.
You can see a distraction.
You can go south.
Room countdown: -1

FINAL TRANSCRIPT ENDS


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

Support

Forums