[Solved.] Custom function triggering error.

Started by LRH, Mon 22/09/2014 01:27:38

Previous topic - Next topic

LRH

Situation is this:

I'm making a game which starts as a text adventure and sort of morphs into a graphical adventure.  As such, it would be really nice to have all kind of shortcut functions to throw into the script, as text adventures naturally have many repeating elements.

Global script has this before the game start function:

Code: ags

function repeat1()
  {
    Lbox1.AddItem("");
    aDoorbell.Play(eAudioPriorityHigh, eOnce);
    Lbox1.AddItem("The doorbell rings again.");
    Lbox1.AddItem("What did you do?");
  }



Room code has this:

Code: ags

else if (Parser.Said("look television"))
  {
    Lbox1.Clear();
    Lbox1.AddItem("Your eyes begin to glaze over...");
    repeat1();
  }


Getting undefined token error when trying to call this function in the room. I know this must be something incredibly basic, but I'm completely stumped.  This is the exact syntax I've used in other games without any issue.

Crimson Wizard

You need to declare the functions you want to use in other modules in the script header:
Code: ags

import function repeat1();

LRH

*Facepalm* -- of course I do.

Too much Lua, eh? :tongue:

Thank you very much for the help. I appreciate it.

SMF spam blocked by CleanTalk