Results 1 to 3 of 3

Thread: Long time Girder user needs some basic lua help

  1. #1

    Question Long time Girder user needs some basic lua help

    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

  2. #2
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Create a scripting action and use something like the following code

    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.
    --Rob

  3. #3

    Default

    Thanks very much for your help. Works great!

    Ben

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •