ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

variables and location descriptions

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

variables and location descriptions

Postby Krc25811 » Sat Jan 13, 2018 2:30 pm

Hey there.

I'm working on a project using adrift that needs the program to output different things in the location description based on the settings of various variables.

For instance:

Imagine a wall of description text here.
If variable A = 1 I want it to output this additional text.
If variable B = 0 I want it to output this additional text
If variable C > 5 I want it to output this additional text

These things need to be independent of one another.
Is there a simple way to incorporate these if/then statements in adrift that I'm missing, or is this actually shockingly hard for this program?

Either way, how do I do it?

Thank you!
Krc25811
 
Posts: 3
Joined: Sat Jan 13, 2018 6:50 am
Points: 10

Re: variables and location descriptions

Postby P/o Prune » Sat Jan 13, 2018 3:52 pm

Hey... Welcome to Adrift.

As for your question regarding additional text I would think that this should be possible by the use of the alternate text tab under the location window.
If you click it you'll be able to insert restrictions so your additional text will only be shown if the variable has a certain value.
D-Day V.5 in progress 86Kb (On backburner)
Anno 1700 Submitted to the 2018 IFComp.
User avatar
P/o Prune
Site Admin
 
Posts: 4188
Joined: Mon Jun 24, 2002 8:18 am
Location: Denmark
Points: 23

Re: variables and location descriptions

Postby Krc25811 » Sat Jan 13, 2018 4:23 pm

Hi. Thank you!
This is not my first run at adrift but it's been since before 5 was a twinkle in Mr. Wylde's eye.

The problem I'm having is that the alt descriptions could work but it's an enormous hassle from a practical standpoint.

Imagine I have 5 different variables. Pretend they're binary.
Any of them could be 1s
Any could be 0s.

I'd need to write an alt description for 00000, 00001, 00010, 00100, 01000, 10000, 00011, etc.
That is an enormous amount of work and double checking that I didn't mess it up.

I'm hoping that there is a command that basically says insert %textvariable% IF another variable=1 or something like that.
That way I could just put them in order of importance and it'll display whatever text I need based on what variables values are.

I've thought about doing this with hidden objects as switches. But that doesn't solve any non binary issues so I figured it would be better to see if variables could be better integrated from the get go.
Krc25811
 
Posts: 3
Joined: Sat Jan 13, 2018 6:50 am
Points: 10

Re: variables and location descriptions

Postby Denk » Sat Jan 13, 2018 7:42 pm

Krc25811 wrote:I'd need to write an alt description for 00000, 00001, 00010, 00100, 01000, 10000, 00011, etc.
That is an enormous amount of work and double checking that I didn't mess it up.

You do not have to write as many alternative descriptions as there are combinations if you utilize the option "append this to previous". In this way you only need 1 alternative description for each different sentence. Anyway, you also have the option of using IF-sentences in code, e.g. a room description could be something like:

You are standing in your living room. <#IF(%a% = 0, "It is cold in here.", "It is warm in here.")#>

You can have multiple if-sentences in the same description. Hope that helps.
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 129
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 16

Re: variables and location descriptions

Postby Krc25811 » Sat Jan 13, 2018 8:10 pm

YES! Thank you! I just couldn't figure out how to write IF/THEN code in the program.

Is there a page which shows these and other code sentences that ADRIFT understands that you can link to?
I am just having trouble finding such a thing.

You rock, Denk!
Krc25811
 
Posts: 3
Joined: Sat Jan 13, 2018 6:50 am
Points: 10

Re: variables and location descriptions

Postby Denk » Sat Jan 13, 2018 8:29 pm

You can find several examples at: http://help.adrift.co/

If you search for "expressions" you will get a relevant page with additional links.
In addition it is good to know the ADRIFT-wiki: wiki.adrift.co/

Anyway, the documentation could be better, so just ask if you get stuck. :)
-----------------------------------------------------------------------------------------
Out now: The Royal Puzzle, The Way Home & The Dragon Diamond
-----------------------------------------------------------------------------------------
Denk
 
Posts: 129
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 16


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 7 guests