Global functions...

Started by monkey0506, Wed 15/02/2006 22:40:38

Previous topic - Next topic

monkey0506

I don't suppose it's possible to import a function into one header (a script header) and actually define it in a different script?  It's giving me errors when I try to do this.  Any help would be appreciated.

RickJ

I'm not sure I correctly understand what you're asking but here is what I know about the subject:

Global functions must be defined in the Global Script file.  They can then be imported into all of the room script file by placing the appropiate import statement in the Script Header file.  Alternatively the import statement can be placed in each Room Script file where it is used.  AFIK you can't define a function in one Room Script file and then import it into another Room Script or Global Script file.


Gilbert

For obvious reasons, the engine does not load all the rooms upon start (and the editor won't load another room CRM to look for functions when saving a room file or compiling the global script), and rooms data will be considered unloaded whenever the game changes room.

monkey0506

I was referring to script modules.  I wanted to put the import statement in one module but define the function elsewhere.

SSH

Maybe if you explain what you are trying to achieve, we can make some suggestions?
12

strazer

If at all, I think you can only import functions from modules placed before in the module manager. Same way you can't call functions from the global script in modules because modules are processed before the global script & header.

monkey0506

By "elsewhere" I meant the global script.  I wanted to import a function from the global script into a module header.  But with some thought, I've found a different (better) way of achieving the same thing.

SMF spam blocked by CleanTalk