View Full Version : Sage slow motion: got it outlined but need some help please?
silkshadow
February 2nd, 2005, 12:23 AM
I would like to create a button to do slow motion in Sage TV however I am not so good with Girder. What I am looking to do is be able to press a button and start a script and press the same button again to stop it. I am ok if, say, I need to press the play button to stop the script as well. The script I need goes like this:
button press - activates
send command - pause
send command - toggle info
send command - toggle info
goto top
Loop till button (preferably the same button) pressed again.
All the 'send commands' above I already have commands for so I don't need help with, but I need some guidance on how to:
1) Start a script with a button and end it with the same button
2) how to write a script like outlined above.
3) time the IR sends so that I can configure a good slow motion rate (if possible, this is more of a dream-type thing ;))
I set up a group switching script following another example so I can do that. Is there an example or two someone could point out that could help me do this? Thanks!
Promixis
February 2nd, 2005, 07:16 AM
Do you just want your group to pause?
If so, goto window/wait and enter a time out value.
birty
February 2nd, 2005, 09:28 AM
i think he wants his script to continuosly send pause commands to sage until he presses the button again when it would stop
silkshadow
February 2nd, 2005, 01:09 PM
Thanks for the replies!
Do you just want your group to pause?
Actualy, no. Birty is spot on. :D I would like to press a button which executes the script and keeps looping it untill I press a button again. Preferably the same button but, if it has to be another button, thats ok with me.
The thing is, I need the thing to loop through three IR commands. I need it to send the "pause" command, then the "toggle info" command and then the "toggle info" command again. I currently have a button script, that looks like this:
Multi command group:
-event trigger: my remote's record button
-command: pause
-command: toggle info
-command: toggle info
And thats been kind of workig (the flashing bars are a bit irritating). I am not sure why two "toggle infos" are needed, maybe its beause the multi-command group is sending out all the commands at once? I am not good enough with Girder to know. Maybe a proper script of some kind would fix this? Anyway, I have to keep pressing that button to get slow-mo replay and it goes way too slow. I would like the commands to loop untill I press the same button again. However, I don't know how to make it loop or how to stop the loop with an event trigger. And thats my question: How to make a script loop and how to stop the loop with an event trigger?
Mostly I am using this for sports replays and the Superbowl is comming up so would like to have this working before then. :D BTW I am using USB-uirt and the USB-uirt plugin if that makes any difference. Thank you!
danward79
February 4th, 2005, 11:14 AM
Are you using the defualt sage gml?
silkshadow
February 4th, 2005, 03:03 PM
No, actually I set girder up while I was a trial user and didn't know anything about how it worked. So I just manualy created commands from Sage's list of keyboard hotkeys to commands and then went through it all and assigned an IR command to them. But basically, I think its the same as the gml but I am using hotkeys instead of the windows message comands. I have a few things like a script to sleep sage and return focus to meedio and a couple of 'tie to other programs' type commands/scripts like that in my Sage group. However, to get this working before the superbowl, I'll switch to the standard GML, no prob.
I have the loop thing working now. Discovered the goto command and that seems to be working, though (its a bit hard to tell because I still can't figure out how to break the loop at all. Or what I really want to do, how to break the loop via a button press. Is there a way to tie a goto command to another script that checks for an event trigger? Or maybe a command that I can tie to an event trigger whch will terminate or send 'stop processing' to a multigroup? Thanks!
danward79
February 4th, 2005, 03:16 PM
I was thinking that you could use a bit of lua and a timer to send the command. the winluax plugin has this timer. you can then have amulti group with states to set or stop the timer.
if you have the timer set to 200ms, it would send the command to sage 5 times a second.
silkshadow
February 4th, 2005, 04:00 PM
Thanks Dan! That sounds very good. Could you possibly point me to some links to get me started? I will need the winluax plugin and I did some reading on the timer earlier today. I didn't come close to thinking on using it this way (very creative!) so just passed over it but, from what I read, I should be able to handle using it. The multi group using states to set and stop the timer is where I am a bit lost.:D Is there a good place where I can see an example GML or do some reading on how to get it working? I will happily tackle this tomorrow. I'm about to goto bed :right now, its quite late here :D. Thank you very, very much Dan!
danward79
February 4th, 2005, 04:32 PM
As far as state are concerned there are some examples around the forum, I beleive it is in the girder docs as well.
For the timer, the plugin Doc's contain what you need. There are plenty of examples around as well, I can't remember, but I think there may be a demo file with the plugin.
Here is the basis of what you need.
--Creates Timer
SlowMotionTimer = TIMER_CreateObject()
SlowMotionTimer.Create("", "TriggerEvent('Sage.Pause',18)", "", 1)
SlowMotionTimer.Arm(200) --Time interval
This starts the timer, it triggers an event called "Sage.Pause" every 200ms
--Kills the timer and deletes the variable from memory
SlowMotionTimer.Cancel ()
SlowMotionTimer = nil
collectgarbage ()
This kills the timer.
So what you need to do is create a multi group, with two variable manipulation scripts and place the first bit of code above in the first script, and the second in the second script. Then apply the states. to each of the scripts etc. ( I will leave you to figure out that bit!) :wink:
You will also need to add a girder event name to your pause command called "Sage.Pause"
Let us know how you go. If you get too stuck post your gml or that section of your gml, and we can go from there.
silkshadow
February 5th, 2005, 12:08 AM
Thank you very much, Dan!! I will start working on this right after I finsh lunch. Will definately post, hopefully, when its working or, most likely, if I have more questions :D.
Mark F
February 5th, 2005, 05:02 AM
Dan -
Sorry for barging into this discussion; but, Girder states are not the most intuitive thing to use. :( Wouldn't you agree? Since LUA is part of the solution, why not use the existance of the global variable to decide what to do, instead?
Make a single variable manipulation script command that is triggered by the remote control button. Press the button once to start, press the same button again to stop. Here is the entire script for the command: (notice it is a minor mod to the two scripts above)
-- Does the timer already exist?
if (SlowMotionTimer ~= nil) then
--Kills the timer, deletes the variable and releases the resources
SlowMotionTimer.Cancel ()
SlowMotionTimer = nil
collectgarbage ()
else
--Creates Timer
SlowMotionTimer = TIMER_CreateObject()
-- trigger immediately, at the end of the timer interval and repeat
SlowMotionTimer.Create("TriggerEvent('Sage.Pause',18)", "TriggerEvent('Sage.Pause',18)", "", 1)
SlowMotionTimer.Arm(200) --Time interval
end
silkshadow
February 5th, 2005, 05:35 AM
Wow, thank you very much! I was just checking in to get the link for the Lua book and see if I could pick it up in quickly (it was a real long shot that i would be able to :D). I will give this a go right now. Thanks again!.
Edit: Wow, thank you both so very much! You gave me everything working awsome!! Just took me some time to get up to speed on the basic stuff. In the process, I learned a bit how Lua works. Enough that I am interested to learn more. Thanks again for making my HTPC fully functional for the Superbowl party! Hey, you guys know where to get some good Buffalo Wings in Manila (thats my next issue to tackle, lol)? :D :D
If any other Sage users would like to use this, I attached the final commands here.
Dan and Mark, thank you!
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.