intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Dec 17, 2017 6:19 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: if and otherwise...
PostPosted: Thu Dec 07, 2017 9:17 am 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 238
Why won't this work as intended...(just an example)

Code:
Instead of opening the boss's door when the player is in Boss Office:
       if the boss is in the location:
             say "As you turn to the door, the boss shouts, 'Hey, you, I'm still talking!  And I didn't say you could go for refreshments!'  Intimidated, you sheepishly step back to the desk.";
       otherwise:
             say "As you slowly open the door and take a peek, the secretary outside gives you a hard stare through her spectacles.  'He'll be back soon for your grilling, he's just gone for refreshments!'  The implication is that you stay.  You are sufficiently intimidated, and close the door.";
       now the player is intimidated.


I notice that if I put an instruction after an 'otherwise:', and lined up with it(assuming it will be followed under either condition), it seems to be ignored...?? Is there a reason for this? I notice that I can simply move the 'now' up to before the 'if..:', and it will work, or I can type it after, and lined up with, each 'say'. I just don't know why I can't just have it at the bottom, after the conditions are addressed...??

Thanks


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: if and otherwise...
PostPosted: Thu Dec 07, 2017 10:10 am 
Offline

Joined: Mon Dec 15, 2014 9:15 am
Posts: 224
It should work, and does for me.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: if and otherwise...
PostPosted: Thu Dec 07, 2017 10:14 am 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 238
Okay, maybe I made up a bad example....but under what conditions would an assertion be ignored if it were placed under an 'otherwise:' and lined up with it..??

Thanks


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: if and otherwise...
PostPosted: Thu Dec 07, 2017 10:30 am 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2496
Location: The Midwest
The only one that comes to mind is if your "if" and "otherwise" include an "instead", which is effectively a "return false". It stops the rest of the rule from executing. (For instance if you had 'say "The boss shouts at you!" instead'.)

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: if and otherwise...
PostPosted: Thu Dec 07, 2017 10:52 am 
Offline

Joined: Sat May 07, 2016 5:57 pm
Posts: 238
Thanks Draconis, but I think I may have found the real problem. I think I was assuming that 'now the boss's door is locked' would automatically close the door. The example above was something I made up on the spot. The problem rule that I had included a 'now the boss's door is locked;' but not a matching 'now the boss's door is closed;'. In testing I was baffled that I was able to walk through a locked door, because I locked the door(with a keyless unlocking rule that did not include a 'now the door is closed'), without it being closed. I thought it was because I had put that assertion at the end of the rule, lined up with an 'otherwise:' near the end.

Thanks, sorry I wasted your time...


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 7 guests


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:  
cron
Powered by phpBB® Forum Software © phpBB Group