PDA

View Full Version : Long time Girder user needs some basic lua help



benbell
March 13th, 2008, 05:28 PM
Hello,

I've been using Girder for at least 6-7 years now. I'm using version 3.2.6b with the serial plugin to control my Home Theater (lighting, projector, receiver and of course HTPC). The system is rock solid and Girder is at the center of it all. It's an amazing application.

It's come time for me to upgrade the home theater and HTPC. I've been playing with the trial version of Girder 4 and see that lots of stuff has changed. For one, the serial plugin now requires Lua programming. I think I can figure this out as there are some demo scripts included. However, one thing that I am having great difficulty with is DVD-Spy (or MCE-Spy - same problem with both).

My problem is as follows: I will be using MCE and would like actions triggered based upon play states (eg. pause, stop, playing etc). I've figured out how to make changes in play states trigger a girder event (eg. WMP.PlayState event is seen by Girder), but since the event is the same regardless of play state, I can't figure out how to trigger an even if the play state is changed to pause or stop or play, etc. From what I understand, the play state is passed to a variable, pld1 but how to I tell girder to do action X if pld1 is "Playing" and action Y if pld1 is "Paused"?

Thanks for your help and great application,

Ben

Rob H
March 14th, 2008, 06:56 AM
Create a scripting action and use something like the following code



if pld1 == 'Playing' then
gir.TriggerEvent('DoActionX', 18)
elseif pld1 == 'Paused' then
gir.TriggerEvent('DoActionY', 18)
else
print('Unexpected state', pld1)
end

Replace the 'DoActionX' and 'DoActionY' with something that makes sense for your GML, but note that they must be strings.

Add the WMP.PlayState event to this - hint in Girder 4 and 5 the easiest way to do this is drag the event from the Logger window/pane to the action.

Trigger the WMP.PlayState event in MCE so that you get both the DoActionX and DoActionY events in the logger and drag those events to the relevant actions in your GML.

benbell
March 14th, 2008, 10:47 AM
Thanks very much for your help. Works great!

Ben