PDA

View Full Version : Switching between groups for programs?



radish28
January 6th, 2004, 11:28 PM
How would i go about switching between groups, for example say the play, next, prev and stop buttons are all being used for one group, could i press a button (pause for example) to have one group disabled and another enabled for the same buttons as the previous group?

ParallaxTZ
January 7th, 2004, 02:04 AM
Yes you could. Rather easily in fact!! I've only had Girder for today and I've already got something like this working.

You'll need (the way I did it the second time, cleaner than the first) is the following:

TopLevelGroup or Group where you want to put this for your own organizing method
---Group (to house the entire switching functionality)
-------Group (to house the enable per program/device/etc)
------------MultiGroup (per program/device/etc)
-----------------Command (a disable group command per program/device/etc)
-----------------Command (the enable group command for the desired program/device/etc)
-----------------EventString (a GirderEvent named string for the ability to call from script)
-------Command (to house the script file)
------------EventString (your button press that will switch program/device/etc)

You'll need a group per program/device/etc that houses the sets of commands that you'll be sharing between them. This is the basic functionality that you seem to be asking for, and the skeleton to set it up with. I'll try to type out my gml file as best as i can in text, as an example. Mine includes a default command that will set a particular device up at Girder load. The purpose of my gml is to change the three volume keys (mute, up, down) on the RM-900 remote control to control each of my three sound cards. I can push the "EAX" button to switch between the sound cards. I also tried to organize this as best as possible, in a sort of object oriented way. Succesful or not is up to opinion.

Controllers (TopLevelGroup)
-----Creative RM-900 (Group)
----------Functions (Group)
---------------OnLoad (Group)
--------------------Make SB0090 Default (Command)
--------------------[Girder: Goto: "SB0090 Enable"]
-------------------------EventString
-------------------------[Girder Event: GirderOpen]
--------------------Switch Sound Card Volume Controls (Group)
-------------------------SubFunctions (Group)
------------------------------SB0090 Enable (MultiGroup)
-----------------------------------Disable SB0060 (Command)
-----------------------------------[Girder: Group Disable: "SB0060 5.1 (ID: 2)"]
-----------------------------------Disable ES1370 (Command)
-----------------------------------[Girder: Group Disable: "ES1370 (ID: 0)"]
-----------------------------------Enable SB0090 (Command)
-----------------------------------[Girder: Group Enable: "SB0090 10k2 (ID: 1)"]
-----------------------------------EventString
-----------------------------------[Girder Event: "SB0090_Enable"]
------------------------------SB0060 Enable (MultiGroup)
-----------------------------------Disable SB0090 (Command)
-----------------------------------[Girder: Group Disable: "SB0090 10k2 (ID: 1)"]
-----------------------------------Disable ES1370 (Command)
-----------------------------------[Girder: Group Disable: "ES1370 (ID: 0)"]
-----------------------------------Enable SB0060 (Command)
-----------------------------------[Girder: Group Enable: "SB0060 5.1 (ID: 2)"]
-----------------------------------EventString
-----------------------------------[Girder Event: "SB0060_Enable"]
------------------------------ES1370 Enable (MultiGroup)
-----------------------------------Disable SB0060 (Command)
-----------------------------------[Girder: Group Disable: "SB0060 5.1 (ID: 2)"]
-----------------------------------Disable SB0090 (Command)
-----------------------------------[Girder: Group Disable: "SB0090 10k2 (ID: 1)"]
-----------------------------------Enable ES1370 (Command)
-----------------------------------[Girder: Group Enable: "ES1370 (ID: 0)"]
-----------------------------------EventString
-----------------------------------[Girder Event: "ES1370_Enable"]
-------------------------Multi-line Code: Switch Sound Card Volume Controls
-------------------------[Girder: Variable Manipulation Script] {script will follow the tree}
------------------------------EventString
------------------------------[All: {"EAX" Button on RM-900}]
----------Controlling (Group)
---------------SB0090 10k2 (ID: 1) (Group)
--------------------Volume Up (Command)
--------------------[appropriate command] {all these commands removed b/c they call other parts of the tree, not necessary for this example}
-------------------------EventString
-------------------------[All: {"Vol Up" Button on RM-900}]
--------------------Volume Down (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Vol Down" Button on RM-900}]
--------------------Volume Mute (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Mute" Button on RM-900}]
---------------SB0060 5.1 (ID: 2) (Group)
--------------------Volume Up (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Vol Up" Button on RM-900}]
--------------------Volume Down (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Vol Down" Button on RM-900}]
--------------------Volume Mute (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Mute" Button on RM-900}]
---------------ES1370 (ID: 0) (Group)
--------------------Volume Up (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Vol Up" Button on RM-900}]
--------------------Volume Down (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Vol Down" Button on RM-900}]
--------------------Volume Mute (Command)
--------------------[appropriate command]
-------------------------EventString
-------------------------[All: {"Mute" Button on RM-900}]



if current_sound_card == 0 then
current_sound_card = 1
current_sound_card_text = "SB0090"
TriggerEvent("SB0090_Enable", 18)
else
if current_sound_card == 1 then
current_sound_card = 2
current_sound_card_text = "SB0060"
TriggerEvent("SB0060_Enable", 18)
else
if current_sound_card == 2 then
current_sound_card = 0
current_sound_card_text = "ES1370"
TriggerEvent("ES1370_Enable", 18)
else
current_sound_card = 1
current_sound_card_text = "SB0090"
TriggerEvent("SB0090_Enable", 18)
end
end
end


Obviously this requires quite a bit of work. It does work in the end, and it a lot nicer than a whole series of commands and multigroups calling each other. Hope this is understandable. If not, just ask, I'll try to explain better!

radish28
January 7th, 2004, 05:54 AM
yeah that is pretty complex... im only stuck on the scripting part, how would i figure out what functions to call and such? you use current_sound_card, SB0090, etc, how would i incorporate this into controls for winamp and power dvd and such?

Ron
January 7th, 2004, 06:54 AM
See the faq

http://www.girder.nl/help/faq.php#101

radish28
January 7th, 2004, 08:38 AM
thanks, sorry i didnt see the group disable option >.<. also i was wondering, using the scripting how do you call on commands, groups and multigroups? also to enable or disable is it something like enable == 1 or enable == 0?