Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: selmiak on Thu 10/03/2011 19:02:23

Title: SOLVED: calling a function from within a function
Post by: selmiak on Thu 10/03/2011 19:02:23
is this even possible? I get an 'unknown token $functionname' error when trying to. Do I need to make the function I want to call from within the function global? If yes, how do I do this?
(http://t2.gstatic.com/images?q=tbn:ANd9GcTn4NDx76nSnoUKIYHHlt_hnHLNhzHsCBzeYO6VjJp8sHa57efS7-ZcGDU)
Title: Re: calling a function from within a function
Post by: Khris on Thu 10/03/2011 19:13:49
Not sure what you're trying to do; calling a function from within another function is of course possible, the important thing here is scope i.e. the function you're trying to call must have been declared already or must have been imported in the header if it is in another script.

Could you post the code you're using? Are you using any additional scripts / modules?
Title: Re: calling a function from within a function
Post by: Crimson Wizard on Thu 10/03/2011 19:42:56
In other words, you should make sure that function you are calling is positioned BEFORE the function you call it from.
Title: Re: calling a function from within a function
Post by: selmiak on Thu 10/03/2011 19:51:28
10 PRINT "THANKS, THIS WORKS!"
20 GOTO 10


RUN :D