Andre, For global commands, you have two choices: Inside handlers or outside. If you declare a global inside of a handler, each handler that wants to access that global needs to declare that same variable to get "access" to it. For example:
on DoStuff1 global gVar put 10 into gVar end DoStuff 1 on DoStuff2 put gVar end DoStuff2 -- > Puts nothing, since DoStuff2 doesn't know about gVar. If the handler was: on DoStuff2 global gVar put gVar end DoStuf2 -- > Puts "10" since it "knows" about gVar by declaring "global gVar" However, if you put it *outside* handlers in the script, all handlers already "know" about the global, so you could do this: global gVar on DoStuff1 put 10 into gVar end DoStuff1 on DoStuff2 put gVar end DoStuff 2 -- > Puts "10". Since global variables are "global", you can access that same gVar variable in another script entirely through one of the two methods above. So if in another script you had: on DoStuff3 global gVar put gVar end DoStuff3 -- Puts "10". Locals are the same as globals, except that they cannot have a scope outside of a single script. If you declare them inside of a handler, they apply only to that handler. If you declare them inside of a script, they are available to any handler in that script only. Other scripts don't "see" them. Hope this helps, Ken Ray Sons of Thunder Software Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ----- Original Message ----- From: "Andre Rombauts" <[EMAIL PROTECTED]> To: "revolution" <[EMAIL PROTECTED]> Sent: Sunday, November 10, 2002 4:01 PM Subject: Global /local variables > I do not understand the real meaning of global and local variables in > Revolution... The info about declaring variables outside a handler seems to > be equal in both cases... :-( > > >From the Olocal� entry in Revolution Help system: > >You can also use the local command in a script, outside any handlers in the > script. These local variables can be used by any handler in that script, without > needing to be declared in the handler itself, and their values are maintained > from handler to handler > > >From the Oglobal� entry in Revolution Help system: > > >You can also place a global command in a script, but outside any handlers in > the script. These globals can be used by any handler in that script, without > needing to be declared in the handler itself. > > Andr� > > _______________________________________________ > use-revolution mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/use-revolution > _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
