intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Dec 16, 2017 12:26 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: TWINE '(if:' problem
PostPosted: Sat Sep 02, 2017 8:45 am 
Offline

Joined: Sat Sep 02, 2017 4:55 am
Posts: 3
Hi,

I'm pretty much a noob at all this. so if i've posted in the wrong forum please let me know.

I'm creating my first story in TWINE 2.1.3 and i've come across a problem with one of my 'if' statements.

In my story, there are passages that will only give the player certain options depending on what they have picked up, e.g,

Code:
(if: $mothersbrooch is false) [ [[You have nothing to unlock cage with->hide camp]] ]
(if: $mothersbrooch is true) [ [[Using the pin on your Mother's Brooch, you attempt to unlock the cage->scage1unlock]] ]


This passage works fine. However, the passage before uses the same logic but does not work;

Code:
(if: $wineskin1 is true) [ [[Leave the wineskin for him to find->Drunk raider]] ]
(if: $wineskin1 is false) [ [[Unlock cage]] ]


The only real difference between the passages is that the one that doesn't work has one line of story on the line above the 'if' statement.

Any help on this would be really appreciated as i'm getting rather frustrated.

Thanks!


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: TWINE '(if:' problem
PostPosted: Sat Sep 02, 2017 9:39 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
Welcome to the forum! This is the right place to post this topic, no problem.

As for your inquiry, maybe it would help to post the full text of the passages from which those excerpts were drawn--this looks like something where the formatting of the line of story above it might be making a difference. (Though I'm a total Twine noob so I'm not the best person to ask.)


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: TWINE '(if:' problem
PostPosted: Sat Sep 02, 2017 10:05 am 
Offline

Joined: Sat Sep 02, 2017 4:55 am
Posts: 3
Thanks but i've found the problem, my $variable was set to $Wineskin1 but my 'if' was looking for $wineskin1! Feel like such a fool... is there anyway to delete this thread before anyone else see's it?


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: TWINE '(if:' problem
PostPosted: Sat Sep 02, 2017 10:11 am 
Offline

Joined: Tue Jul 28, 2015 1:05 pm
Posts: 1009
You should leave it; I didn't know that variables in Twine were case-sensitive, so this is actually helpful!

_________________
-My IFDB name is Mathbrush.

Anyone can make interactive fiction; if you've made a game and need a review on IFDB, let me know!


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: TWINE '(if:' problem
PostPosted: Sat Sep 02, 2017 11:18 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
I wonder if that's why I've never been able to get variables to work in Twine.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: TWINE '(if:' problem
PostPosted: Sun Sep 03, 2017 6:39 pm 
Offline

Joined: Tue Jun 06, 2017 2:38 pm
Posts: 4
Location: Pittsburgh
FYI, since (if:) is evaluating the provided expression into a boolean, you don't need to test a boolean variable against a boolean value. For example:

Code:
Assuming $var is either true or false:

-> GOOD
(if: $var)[
    Variable is true.
](else:)[
    Variable is false.
]

-> BAD
(if: $var is true)[...


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group