List Info

Thread: Passing global Variables Between Movies




Passing global Variables Between Movies
user name
2006-02-27 22:54:08
Hey guys,
I'm fairly new to Director, and don't fully understand
global 
variables.  I've used them before with some success, but I
always hack 
my way through it.  I'm now at a point where I actually
need to use 
them.

My game is a 7th Guest ( Myst) style game, where you
navigate around a 
prerendered mansion, finding a puzzle in each room.
The Game Engine navigates around the environment, and the
filename of 
the background image is stored in a variable.  When the
player finds a 
puzzle, the game engine jumps to a unique Director movie for
that 
puzzle.  When the puzzle movie is complete, it returns to
the game 
engine.
My trouble is that when the puzzle is complete, the last
image from the 
Game Engine is not stored.  The image displayed is the
opening image 
 from the game engine.  In essence, what happens visually is
that the 
game starts over after a puzzle is played.

I want to store the image filename/path in a global variable
and 
display that image when the puzzle is finished and the game
engine 
continues to play.

how do you declare a global variable?
Does it have to be in a specific handler?
How do you pass the variable to a different Director movie?

Any advice is greatly appreciated!  Thanks!
Ryan

http://www.t7g3.com
_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
Passing global Variables Between Movies
user name
2006-02-27 23:03:09
At 05:54 PM 27/02/2006, r67enaol.com wrote:

>how do you declare a global variable?

global <variable name>

i.e. global gImageLink

       gImageLink = <value>

>Does it have to be in a specific handler?

Nope.

>How do you pass the variable to a different Director
movie?

Declare the same global, then just start using it.


- Guy


--------------------------
Guy McLoughlin
New Media Developer
Toronto Ontario Canada
E: theguysympatico.ca
--------------------------- 

_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
Passing global Variables Between Movies
user name
2006-02-28 09:34:01
>and don't fully understand global
>variables

well maybe the best way to explain is
using objects.

and object can store variables in a property, wich is
basically the same as
a global variable but only working for that specific object.

this way you can have for example a property color for
object a
with a different value then the color property for object b

the name is the same: color.

this cannot be achieved by global variables

declaring a global variable color twice results in setting
the variable
to the last value declared.

now lets make an object quickly:
in the cast insert a new script from the window menu.

name it "object" without the quotes.

put this script in there:
-- from here
property mycolor
on new me
  mycolor="red"

  return me

end

-- to here



now type this in the message window

clearglobals
global Gcar
Gcar=new(script"object")


now you have declared a global wich holds an object.

verify this by typing this in the message window
put Gcar
-- <offspring "object" 2 234080>

now you can access the variable color wich became a property
of the global
Gcar
by typing:

put Gcar.mycolor


hope its not too ot.

W0uter

-----Original Message-----
From: dirgames-l-bouncesnuttybar.drama.uga.edu
[mailto:dirgames-l-bouncesnuttybar.drama.uga.edu]On
Behalf Of
r67enaol.com
Sent: Monday, February 27, 2006 11:54 PM
To: dirgames-lnuttybar.drama.uga.edu
Subject: [dirGames-L] Passing global Variables Between
Movies


Hey guys,
I'm fairly new to Director, and don't fully understand
global
variables.  I've used them before with some success, but I
always hack
my way through it.  I'm now at a point where I actually
need to use
them.

My game is a 7th Guest ( Myst) style game, where you
navigate around a
prerendered mansion, finding a puzzle in each room.
The Game Engine navigates around the environment, and the
filename of
the background image is stored in a variable.  When the
player finds a
puzzle, the game engine jumps to a unique Director movie for
that
puzzle.  When the puzzle movie is complete, it returns to
the game
engine.
My trouble is that when the puzzle is complete, the last
image from the
Game Engine is not stored.  The image displayed is the
opening image
 from the game engine.  In essence, what happens visually is
that the
game starts over after a puzzle is played.

I want to store the image filename/path in a global variable
and
display that image when the puzzle is finished and the game
engine
continues to play.

how do you declare a global variable?
Does it have to be in a specific handler?
How do you pass the variable to a different Director movie?

Any advice is greatly appreciated!  Thanks!
Ryan

http://www.t7g3.com
_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l

_______________________________________________
dirGames-L mailing list  -  dirGames-Lnuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )