Advertisement

Using the same variables withing different scripts.

Started by August 04, 2008 03:37 AM
1 comment, last by WitchLord 16 years, 3 months ago
I was doing if it was possible to actually have a variable in script A and have script B access that same variable even though they are running in different modules. That way when one script makes changes to that variable, the other script can see the changes. I know i can get this done if i have them in the same module, but i was wondering if there is a way to do the same thing when The two script do not share the same module.
That depends on where that variable is set.
If you've registered it in the application, then it can be accessed throughout every module (unless you set a restriction). Otherwise (if you declare the variable in a script), I've heard (somewhere in this subforum, I think witchlord said that) that it's not directly possible. You will have to write functions that change and return the variables (they can also return a handle, so you only need 1 function) and import them where you need them.
Advertisement
Sis-Shadowman is correct.

A global variable declared in one module cannot be imported into another module. You'll have to write some functions to access the value of the variable, and then import those functions instead.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement