PDA

View Full Version : No programming skill - Need help with script



Jlee
April 1st, 2004, 12:06 AM
Like Mastiff I知 no programmer and can just about get by with this stuff, sometimes with a little help. I read the thread about sending events to girder to change TV channels and though I知 very new to this and not as technical as most here I think I understand it but just need a bit of help changing the script in girder.

I知 using Sky Digital in the UK so all TV channels are 3 digits long (always). I think I need to do this:

- For each channel in my CCF, set the IR command to 5001 0000 0000 0002 ffff 0000 0001 0000 and the name of the command to TV.Chan(nnn) (where nnn is the 3-digit channel number)
- Set up commands in girder to send out IR signals for each of my buttons 0-9 with a girder event trigger like sky1, sky2 etc
- Set up a girder command that responds to the TV.Chan event with a Variable Manipluation Script (is VMS the correct girder action?)

If I知 right so far I just need some help with the example script I picked up from the other thread. This script handles both 1 and 2 digit channel numbers and as mine is always 3 digits I知 hoping that it will be simpler. Would someone be kind enough to alter it for me:


local digit
if (strsub(pld2,1,1) == '0') then
TriggerEvent("Pana_Digit"..strsub(pld2,2,2), 18)
else
TriggerEvent("Pana_TwoDigits", 18)
digit = strsub(pld2,1,1)
TriggerEvent("Pana_Digit"..digit, 18)
digit = strsub(pld2,2,2)
TriggerEvent("Pana_Digit"..digit, 18)
end

Also, will girder (or my USB-UIRT) send these signals out one by one or do I need some sort of wait command in there? If I need a wait in between each signal how do I accomplish that?

Thanks for any help you can give.

ebariaux
April 1st, 2004, 07:22 PM
If you're certain it's always 3 digits, just do something like this:


local digit
digit = strsub(pld2,1,1)
TriggerEvent("sky"..digit, 18)
digit = strsub(pld2,2,2)
TriggerEvent("sky"..digit, 18)
digit = strsub(pld2,3,3)
TriggerEvent("sky"..digit, 18)
end

pld2 in Girder always receives the "parameter" you pass to your "call", in your case what's between the () when using TV.Chan(nnn).
The script just takes a substring out of it representing each digit, append it to your "base event name" in Girder (sky in your case) and triggers the event.

For the wait, not sure you'll need to do anything. There are checkboxes and delay settings somewhere in Girder but I don't recall where exactly, so you will need to take a look around in ther Girder UI.

Jlee
April 2nd, 2004, 03:29 AM
If you're certain it's always 3 digits, just do something like this:


local digit
digit = strsub(pld2,1,1)
TriggerEvent("sky"..digit, 18)
digit = strsub(pld2,2,2)
TriggerEvent("sky"..digit, 18)
digit = strsub(pld2,3,3)
TriggerEvent("sky"..digit, 18)
end

pld2 in Girder always receives the "parameter" you pass to your "call", in your case what's between the () when using TV.Chan(nnn).
The script just takes a substring out of it representing each digit, append it to your "base event name" in Girder (sky in your case) and triggers the event.

For the wait, not sure you'll need to do anything. There are checkboxes and delay settings somewhere in Girder but I don't recall where exactly, so you will need to take a look around in ther Girder UI.

Thanks eric. That's just what I needed. I'll have to wait and see what happens with the trigger events as I don't understand how it works when triggered from a script. I just had visions of it triggering all 3 events synchronously. Hopefully girder or the UIRT is able to sort that out by itself.

Thanks for your help again.