Asked — Edited

Rss News

Hey guys, here is a script I have been working on. It reads the Rss News and after it is done with the first story it asks you if you want to continue. If you say "Yes" it will continue to the second story, and if you say "NO" it will end the script. I didn't know if this was posted already somewhere but I thought I would share it anyways . RSSNEWS.EZB:D


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

United Kingdom
#9  

Ill look when I get home, I guess you need to increment the story line variable or something:)

United Kingdom
#10  

I re-wrote the script, I just tested it and it moves to the next story too.

# RSS News Reading Script
# Author: Rich Pyke
# Version: 1.0.0
#
# RSS Script for reading news from RSS posts. Adapted from cafasarus
# script at https://synthiam.com/Community/Questions/3650

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews"

# Do not change these variables
$storyLn = 0

# Start the code
:begin
# Increment the story line by 1
$storyLn++
# Print the story number
Print($storyLn)
# Speak the story
SpeakRSSDescription($feedurl,$storyLn)
SayWait("Would you like me to continue?")
# Ask if it should continue to the next story
$response = WaitForSpeech(10,"YES","NO")
# If yes
IF ($response = "YES")
  # Go back to the start
  Goto(begin)
  # Otherwise
ELSE 
  # Say OK
  SayWait("Ok")
ENDIF 
  # End of script
Halt()

I uploaded it to the cloud too, click here to download

The RSS Feed URL is a variable at the start of the script, this can be changed for any valid RSS feed at the top of the script, just change the url in the quotes. No need to change the script other than that:)

The script is the only control in the project which should make importing it in to your current ARC project through the merge feature very simple to do.

Code is commented as per usual to help aid you in learning why the commands are there and what they do.

Enjoy:)

#11  

cafasaru and rich, thank you. That is an excellent addition to my Captain Ann Droid, along with the weather. I used the merge for the first time. There are so many talented people on EZB community. Thank You Steve S

United Kingdom
#12  

Steve, you should be able to use the code i posted to pick up any RSS, including the EZ-Robot forum RSS feed.

More is on the way too:)

United Kingdom
#13  

@Rich.

Reviving an old thread but this was an interesting one. I have a quick question I hope you can help with.

I tried out your script for the RSS news feed with a ControlCommand in a speech synthesis control and it worked well (had to add comma's to the url), except for one thing. When the speech synth says "would you like to continue" it then quickly says "ok" before I say anything, and when I do say yes, nothing happens. Any thoughts to remedy this?

United Kingdom
#14  

What commas did you need to add? The script syntax hasn't changed since this one was posted so it shouldn't need any changing other than the feed url (if required).

Also the script should work fine and wait for 10 seconds for a yes or no response at the line with WaitForSpeech() in it. If it's not then it indicates that it has heard something which resembles "no" or it is timing out hence it saying OK and ending. Check your speech recognition training, your microphone and any speech controls added to the project.

You could change the Else to an ElseIf($response = "NO") and then add a further Else before the EndIf with SayWait("An error has occured"), this would help pinpoint where the issue may lie...

Like this;


# RSS News Reading Script
# Author: Rich Pyke
# Version: 1.0.0
#
# RSS Script for reading news from RSS posts. Adapted from cafasarus
# script at https://synthiam.com/Community/Questions/3650

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews"

# Do not change these variables
$storyLn = 0

# Start the code
:begin
# Increment the story line by 1
$storyLn++
# Print the story number
Print($storyLn)
# Speak the story
SpeakRSSDescription($feedurl,$storyLn)
SayWait("Would you like me to continue?")
# Ask if it should continue to the next story
$response = WaitForSpeech(10,"YES","NO")
# If yes
IF ($response = "YES")
  # Go back to the start
  Goto(begin)
  # Otherwise
ELSEIF($response = "NO")
  # Say OK
  SayWait("Ok")
ELSE
  SayWait("An error has occured")
ENDIF 
  # End of script
Halt()

Also note that the project I uploaded to the cloud is not intended to be a stand alone project but one for the script to be merged from or copy and pasted from.

Another note, the forum is adding an extra ; in the feedurl line, it's not needed. Download the project from the cloud and adapt the script from there with the lines mentioned above.

United Kingdom
#15  

Thanks for getting back to me Rich. Below is the section of code I had to add the commas to.

# Define variables
$feedurl = "http://feeds.reuters.com/Reuters/domesticNews"
# Define variables
$feedurl = ("http://feeds.reuters.com/Reuters/domesticNews")

Without the commas, it wouldn't work for me and was coming up with an error. With commas added it worked fine (I also took out the ; you mentioned). I did also change the url the BBC news after a few try's which also worked great but still unable to continue.

The speech recognition couldn't have picked anything else up as the room I was in was in complete silence, and when it was saying "ok" it was instantly after it says would you like to continue, no time to hear anything anyway.

I admit that I did run the script as a stand alone with the exception of the speech recognition control, and set a ControlCommand to start the script control with the phrase "tell me the news" which worked really well. I only did this as a trial before I added it to my main project. I just wondered if the syntax might have changed as this posted a year ago. :)

#16  

Parentheses, not commas. You had us confused.

Alan