#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Help with plugin if statement


    I'm very new to programming. I am using this in a siriproxy plugin. Can someone help me? I can't pass the variable {station} in the nested "if" statement:

    listen_for /(Turn on the TV|Turn the TV on|Put on the TV|Put the TV on|Turn on the television|Turn the television on|Put the television on|Put on the television)/i do
    response = ask "Which one? Say upstairs or downstairs..." #ask the user for something

    if(response =~ /upstairs/i) #process their response
    say "Turning the Bedroom TV on"
    puts %x{/home/siri/SiriProxy/TriggerEvent.sh Entrance Upstairs TV}
    elsif(response =~ /downstairs/i) #process their response
    say "Turning the Living Room TV on"
    puts %x{/home/siri/SiriProxy/TriggerEvent.sh Entrance Downstairs TV}
    response = ask "Which Channel? Say the three letters of the station, such as NBC"
    if(response =~ /station ([A-Za-z]+))/i |station|
    say "Putting on: #{station}"
    puts %x{/home/siri/SiriProxy/TriggerEvent.sh Channel #{station} DN}
    elsif(response =~ /I don't know/i)
    say "Putting it on"
    puts %x{/home/siri/SiriProxy/TriggerEvent.sh Channel NBC DN}
    else
    say "That didn't make any sense"
    redo
    end
    else
    say "I didn't understand your response"
    redo

    request_completed #always complete your request! Otherwise the phone will "spin" at the user!
    end
    end
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0
    Have you defined the variable station first. and I don't think curly braces need to be inserted there.

IMN logo majestic logo threadwatch logo seochat tools logo