How to import global functions for use in events in the properties window

Started by toast eating fiend, Wed 15/02/2012 14:35:57

Previous topic - Next topic

toast eating fiend

My script throws this error during runtime:
Error: prepare_script: error -18 (no such function in script) trying to run 'globalfunction' (Room 1)
[ACI version 3.12.1115]

I've defined this global function in GlobalScript.asc, and imported it in GlobalScript.ash.

When I try to call this function from within the room script, it works fine, but when I call it as an Event from the Properties Window, it gives me the above error.

Is there any way to import global functions for use in events?

Gudforby

I don't know if that's possible.

But a quick workaround is to create a new function in the room script, and run that from the event window.
In that function you can run your 'globalfunction'.

Works like shit!

toast eating fiend

I was rather hoping not to have to include an extra function in every room, but at least this way I can still update the function relatively easily. So I guess the header doesn't get imported into whatever script the events use? Thanks for your answer!

Khris

The header gets imported, but it seems like a room event can only be linked to a function that's defined in the room script.
Global events like inventory item or character interactions should be able to call your function fine.


SMF spam blocked by CleanTalk