intfiction.org

The Interactive Fiction Community Forum
It is currently Mon May 20, 2013 1:08 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Mar 05, 2012 3:57 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
I am using the hint system in my game and would like to subtract a certain number of game points each time the hint system is accessed. Does anyone have any ideas how to go about doing this? I would like this to be enabled only after the first set of system hints has been viewed.

RonG


Top
 Profile Send private message  
 
PostPosted: Mon Mar 05, 2012 4:04 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
With the ability in 3.1 to call things from within single-quoted strings, this should be pretty easy. I would create an object called scoreKeeper that would do the actual arithmetic. I would then write hints like this:

Code:
++ Goal 'How can we get past the cyclops?'
    [
        '<<scoreKeeper.minusOne(cyclops)>>Oh, dear --- are you sure you want to try? ',
    ]
;

This assumes (a) that the cyclops is an actual game object, and (b) that scoreKeeper is set up something like this:

Code:
cyclopsReduced = nil
minusOne(obj) {
   if ((obj == cyclops) && (!cyclopsReduced)) {
       cyclopsReduced = true;
       scoreValue = scoreValue - 1;
   }
}

This insures that the score will be reduced only the first time that that hint is read. Note that this suggestion doesn't actually tell you how to reduce the score -- I haven't researched that. I'm just suggesting how you would set it up. Possibly you would want to use an Achievement object with a negative value.


Top
 Profile Send private message  
 
PostPosted: Mon Mar 05, 2012 4:13 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
Looks good! will give it a shot. Many thanks to you; as usual.

RonG


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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