Sunday, November 22, 2009

LoadScript() and PlayOn contacted me

In my last post I recommended using the new LoadScript() function to load a script from our autorun scripts. I'd like to rescind that, I completely forgot about 'exec:'.

From our VirtualFolder() or VideoResource() calls we already have the ability to execute scripts within the Scripts\ directory. Something like:
VirtualFolder("Run Script", "exec:NBC.lua");
will work great in our autorun scripts.

I was going to remove LoadScript() altogether but I decided to leave it in, currently we could do something like:

local file = GetCurrentPath().."\\Scripts\\NBC.lua";
local contents = OpenFile(file);

LoadScript() will make this easier

local file = GetCurrentPath().."\\Scripts\\NBC.lua";

However, there is one caveat, LoadScript() and RunScript() will report itself to the plugin as though it is the executing script and not the executed script. What this means is that GetScriptOptions() and SetScriptOptions() will not work as expected. To have those functions behave properly they need to be ran with 'exec:' from within a VirtualFolder() or VideoResource() call.

edit: ignore the crossed off stuff, LoadScript() will properly identify itself as the correct script.

PlayOn Interaction
I just want to thanks the other script developers for making the plugin as awesome as it is. In fact it's impact is such that PlayOn has contacted me and asked me to make some specific changes which is cool :)

1 comment:

  1. I'm not a developer, just an sysadmin who's been kicking PlayOn around for a while. The PlayOn Scripts plugin is, in my opinion, the very best plugin currently available for PlayOn... hands down. It seems to be THE unified platform on which many individuals are choosing to build their specialized scripts. I'm all for building standardization. Thanks for all your work. Keep it up!