Calling struct functions from external scripts

Started by nightmarer, 29 Apr 2021, 13:19

« previous - next »



I have an struct which have some methods on it and it can be used from any room of the game.

Code: ags
struct Actions{
  import static void Restablecer();

But now I am trying to call one of this method from another method not included in a room (in an external script) but AGS don't recognize it. And it says Error (linex): Undefined token 'Actions'
Code: ags
function HangUpPhone() {

How can resolve this?

Crimson Wizard

In AGS a struct or function is only seen in script where it is declared, or in scripts which are below in the list.

Dialog scripts and room scripts are considered to be below everything else, but do not see each other.

The solution is to reorganize your scripts in an order of dependency, or pick certain structs/functions out into a new script and move it above ones where you have to use these.

SMF spam blocked by CleanTalk