Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: MachineElf on Wed 16/07/2003 15:23:44

Title: Declaring functions
Post by: MachineElf on Wed 16/07/2003 15:23:44
It's possible to import functions to room scripts, but is it also possible to declare a function in the top of my global script so I don't have to care about the order I write the functions?

example:
// top of script:
function addition (int,int);

//further down:
function addition (int para1, int para2)
{
return para1+para2
}

This would sometimes be pretty helpful...
Title: Re:Declaring functions
Post by: TerranRich on Wed 16/07/2003 16:02:04
No, you'd have to import it in the script header, ,then declare it normally in the global script. I don't think there's any other way...or is there? :)
Title: Re:Declaring functions
Post by: Pumaman on Wed 16/07/2003 18:42:46
Forward references are not currently supported due to the way the compiler works. You can declare it in the script header, but it won't let you use it before it's defined in the global script.
Title: Re:Declaring functions
Post by: MachineElf on Wed 16/07/2003 20:21:19
Ok, thanks!
Any chance that will change in the future?
Not a big thing, really, but it could help a little...