As a studio plugin, how would I detect the currently-open script?

So, I’m interested in making a small upgrade for my toolkit plugin that would detect when a script has been modified while the developer wasn’t editing it, and then fire a notification warning the developer that scripts were changed.

To do this I would like to detect which script is being actively edited by the developer, so that I could detect when other scripts were changed under their nose.

This is because I know a few less-experienced developers who are more likely to install infected plugins that will automatically backdoor their games, but I don’t have a whole lot of one-on-one time with them to help them out.

The problem is, I am having a hard time finding plugin documentation on how to detect the script currently open in the script editor.

If anybody knows about this, that would help me out.

3 Likes

Hmmm, well if its for defense against malicious plugins then that might be tricky. What I would do is design a malicious plugin first and attempt to detect any changes that creates. Plugins do have access to source reading source code and therefore detecting changes, but it does become the trick when determining player changes vs plugin changes.
There is a property which tracks developers editing script in team create CurrentEditor

But it might also be worth looking into detecting events on plugin instances.

1 Like

It took a bit, but I found what I was after.

7 Likes

How can i make a script so something happens when a plugin is enabled