Simple Myst-Like Application

Graeme Harlick pinch_from_spock at hotmail.com
Thu Aug 24 10:34:18 EDT 2006


Gordon,

So what I do is:

In the Stack script I put:

global gUserpoints

on openStack
   put 0 into gUserpoints
end openStack

Then on the top of every Card script:

global gUserpoints

And if it is a point awarding card:

global gUserpoints
add 10 to gUserpoints

And if its a point awarding button

on mouseDown
add 10 to gUserpoints
end mouseDown

Then I have a field at the bottom of the screen where the score adds up, so 
I set the contents of that field to gUserpoints? Would you know how to do 
this?  Also in the last example, how could I make it work only ONE time, so 
that the user won't click on it again and get 20,30,40 pts....and so on.

Thanks

Graeme


>From: Gordon Tillman <got at mindspring.com>
>Reply-To: How to use Revolution <use-revolution at lists.runrev.com>
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Subject: Re: Simple Myst-Like Application
>Date: Wed, 23 Aug 2006 22:06:28 -0500
>
>Howdy Graeme,
>
>On Aug 23, 2006, at 21:34, Graeme Harlick wrote:
>
>>How and where would I put the code so that the points don't get  lost 
>>going from screen to screen, and also what code would I use to  set 
>>variables so that users can explore freely and find hidden  areas 
>>non-sequentially?
>
>
>No worries!  One way would be to declare a global variable at the top  of 
>each card's script that needs to access your points.   By  convention, you 
>would name the variable starting with a letter  "g" (for global).  For 
>example:
>
>At the top of  your stack script:
>
>global gUserPoints
>
>Then in your on preOpenStack handler or on openStack handler:
>
>put 0 into gUserPoints
>
>If you store the values away somewhere when they exit and come back  into 
>the game, you can set a different value into your variable:
>
>put pointsSoFar into gUserPoints
>
>Then, at the top of each of your card scripts that need to access  this 
>variable again use:
>
>global gUserPoints
>
>So the user now does something on this card to earn 10 additional  points:
>
>add 10 to gUserPoints
>
>You get the point....
>
>--gordy
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your 
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list