Simple Myst-Like Application

Jim Ault JimAultWins at yahoo.com
Thu Aug 24 14:17:29 EDT 2006


As far as points not being duplicated, here are a couple ways you might do
it...  here is one of the simpler ways

First make all the points on a single card (scene) different, eg 9,11,13,5.
That is,  each card can have one object worth 5 points.
Second, use a global where each line of the global will correspond to the
number of a card
Third, put the points scored as a new item on the line for that card

global gUserScore

on addNewScore pointsToAdd
  put the number of this card into cdNum
  if pointsToAdd is not among the items of line cdNum of gUserScore then
    put comma & pointsToAdd after line cdNum of gUserScore
    get gUserScore
    replace cr with comma in it
    put sum(it) into fld totalScore --shared text
    --assumes shared text field "totalScore" is visible on all cards
  end if
end addNewScore

gUserScore
,5,8,6,12  < line 1
,5,12,2  < line 2
,9,4,5,2  < line 3

put sum(,5,8,6,12,,5,12,2,,9,4,5,2) --  70

Since gUserScore is a global, you will always have a point record, even if
they revisit a card and try to pick up more points.  Only new points will
work.

Jim Ault 
Las Vegas





On 8/24/06 7:34 AM, "Graeme Harlick" <pinch_from_spock at hotmail.com> wrote:

> 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
> 
> 
> _______________________________________________
> 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