Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Tuesday, November 24, 2009

Setting the Date of a VideoResource()

New in 0.7.0.0 is the ability to set the the date of a VideoResource. In retrospect this is something I should have included from day one but unfortunately I didn't see the potential. I want to thank hottamale from the site for requesting this and reminding me that it actually exists.

So in order to make this available and preserve backwards compatibility I had to come up with a work around and so I decided to add a special XML tag to the description to handle it (I'm claiming the <special> tag)


local dateXML = '<special date="1.0"><year>2009</year><month>11</month><day>11</day></special>';

VideoResource("test", "video.mp4", "This is before the special tag"..dateXML.."and this is after", "", 100000);


The plugin will extrapolate the Date information and remove the data from the description before it ever gets to the user's screen. Just keep in mind that the format is very strict and will attempt to catch and throw an error if malformed but if not properly set you could end up with ugly tags being sent to the user.

Sunday, November 22, 2009

LoadScript() and PlayOn contacted me

LoadScript
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);
RunScript(contents);

LoadScript() will make this easier

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

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 :)