intfiction.org

The Interactive Fiction Community Forum
It is currently Mon May 20, 2013 10:04 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Scoring
PostPosted: Fri Apr 06, 2012 10:50 pm 
Offline

Joined: Fri Jun 10, 2011 2:04 pm
Posts: 25
How do I make a condition where after carrying out an action, the score is displayed.

_________________
INT FIC. nuff said


Top
 Profile Send private message  
 
 Post subject: Re: Scoring
PostPosted: Sat Apr 07, 2012 12:34 am 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
mike111 wrote:
How do I make a condition where after carrying out an action, the score is displayed.

Try this:
Code:
A banana is here.

After taking the banana:
   if the player carries the banana for the first time:
      increase the score by 3;
      continue the action;
   otherwise:
      continue the action.

Inform will automatically mention that the points have been awarded. And the total score appears by default in the status bar.


Top
 Profile Send private message  
 
 Post subject: Re: Scoring
PostPosted: Sat Apr 07, 2012 8:50 am 
Offline

Joined: Wed Feb 29, 2012 2:00 pm
Posts: 672
It's best to use a carry out rule here rather than an after rule, since carry out rules are "considered" rather than "abided by", so it won't stop the action prematurely. Also, the built in handled property, which is set when something is taken for the first time, comes in handy here.

Code:
"Test"

The Testing Room is A Room. A banana is in the testing room.

Carry out taking the banana:
if the banana is not handled, increase the score by 3.

Test me with "take banana / drop banana / take banana".


Hope this helps.

_________________
"Will you stop breaking the fourth wall? It's costing me an absolute fortune to replace it!"


Top
 Profile Send private message  
 
 Post subject: Re: Scoring
PostPosted: Sat Apr 07, 2012 5:10 pm 
Offline

Joined: Mon Mar 21, 2011 3:19 pm
Posts: 22
Quick question on this subject if I may ?

When using the command...

Code:
say "A hollow voice whispers in your ear 'All is now not as solid as it first seems'.";
   increase the score by 2;

The game works as expected but shows...

[Your score has just gone up by two points.]

...is it possible to stop the score notification ?


Top
 Profile Send private message  
 
 Post subject: Re: Scoring
PostPosted: Sat Apr 07, 2012 5:36 pm 
Offline

Joined: Wed Feb 29, 2012 2:00 pm
Posts: 672
It sure is. Try this.

Code:
say "A hollow voice whispers in your ear 'All is now not as solid as it first seems'.";
increase the score by 2;
consider the fix baseline scoring rule;


The fix baseline scoring rule is a standard rule that will set the last notified score to the same value as the score. You only get a score notification when the last notified score and the score are different.

Hope this helps.

_________________
"Will you stop breaking the fourth wall? It's costing me an absolute fortune to replace it!"


Top
 Profile Send private message  
 
 Post subject: Re: Scoring
PostPosted: Sat Apr 07, 2012 5:50 pm 
Offline

Joined: Mon Mar 21, 2011 3:19 pm
Posts: 22
Perfect!!!

Many thanks for your help on this.

Cheers.


Top
 Profile Send private message  
 
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