Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SpacePaw on Sat 27/02/2010 01:27:16

Title: AGS 3.2 RC3 import function in global script [SOLVED - FALSE ALARM]
Post by: SpacePaw on Sat 27/02/2010 01:27:16
I think the import function doesn't work for the global script in RC3.

Added in global script asc:

function Foo()
{
 //EMPTY
}

Added in global script ash:

import function Foo();

Added in new script asc:

function CallingFunction()
{
 Foo();
}

Result:

NewScript.asc(4): Error (line 4): Undefined token 'Foo'

Moving import line to new script .ash doesn't help - Script link error when running the compiled game...

Maybe you do things differently now? I didn't use AGS extensively for quite a long time now...
Title: Re: AGS 3.2 RC3 import function in global script not working?
Post by: Joe on Sat 27/02/2010 02:19:23
Functions in AGS must be defined from top to down so you won't be able to create a function in global script to be used in other scripts (the will be accesible from room scripts though) because AFAIK global script is always at the bottom of scripts list.
Title: Re: AGS 3.2 RC3 import function in global script not working?
Post by: RickJ on Sat 27/02/2010 02:49:59
Quote
Added in new script ...
What is new script, module or room?

Module scripts can't import functions from the global script, room scripts can as JNoe Carl explains. 
Title: Re: AGS 3.2 RC3 import function in global script not working? (SOLVED)
Post by: SpacePaw on Sat 27/02/2010 03:18:51
Ah god right -.- thanks I'm so dumb I totally forgot that