Simple Myst-Like Application
Gordon Tillman
got at mindspring.com
Wed Aug 23 23:06:28 EDT 2006
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
More information about the use-livecode
mailing list