Author Topic: Chuck Norris Facts (VC tellling jokes)  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Chuck Norris Facts (VC tellling jokes)
« on: April 10, 2016, 10:48:42 PM »
there is an old thread about VC telling jokes (http://voxcommando.com/forum/index.php?topic=665.15). the only issue was, one must populate it with jokes....

here is another command that retrieve a Chuck Norris fact from the internet. it avoids telling the joke twice ...
it is a bit rough, but have lot of potential .. (i.e. you can use replace to replace "Chuck Norris" with a name of a friend !). the db offer few options as well ...
and if someone know how to set up a similar DB online, maybe we can populate it with jocks so all vc users can access it ...

enjoy, and report bugs so we send them to Chuck Norris !!!!

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.7-->
<command id="824" name="Chuck Norris Facts" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="{ &quot;type&quot;: &quot;success&quot;, &quot;value&quot;: { &quot;id&quot;: 302, &quot;joke&quot;: &quot;Chuck Norris doesn't go on the internet, he has every internet site stored in his memory. He refreshes webpages by blinking.&quot;, &quot;categories&quot;: [] } }&#xD;&#xA;">
  <action>
    <cmdType>Map.CreateTable</cmdType>
    <params>
      <param>ChuckNorrisFacts</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://api.icndb.com/jokes/random?limitTo=[nerdy]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>"type":\s"(.*?)".*?"id":\s(.*?),.*?"joke":\s"(.*?)".*?"categories":\s\[(.*?)\] </param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="True">
    <ifType>(A)==(B)</ifType>
    <ifParams>{Match.1.1}&amp;&amp;success</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>oops I forgot it !</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>Map.Get</cmdType>
    <params>
      <param>ChuckNorrisFacts</param>
      <param>{Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>hmm, I think I told you this one. let me think of another.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.Pause</cmdType>
        <params>
          <param>1000</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>here is another one ...</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>ChuckNorrisFacts</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>{Match.1.3}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Map.Set</cmdType>
        <params>
          <param>ChuckNorrisFacts</param>
          <param>{Match.1.2}</param>
          <param>{ShortDate}</param>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>tell me, tell us</phrase>
  <phrase optional="true">a</phrase>
  <phrase>Chuck Norris</phrase>
  <phrase>fact, joke</phrase>
  <event>ChuckNorrisFacts</event>
</command>
« Last Edit: April 10, 2016, 11:39:36 PM by Haddood »
When Voice command gets tough, use hand gestures

PegLegTV

  • $upporter
  • Hero Member
  • *****
  • Posts: 500
  • Karma: 43
    • View Profile
Re: Chuck Norris Facts (VC tellling jokes)
« Reply #1 on: April 11, 2016, 02:08:44 AM »
I was bored and thought I would take a look at the joke problem from another angle and got lucky, here's a command that I made using an RSS feed I found of random jokes,

I made it skip the joke and tell you that its to long if its over 600 letters long, (I got stuck listing to one that was over 5000 letters, and it wasn't even funny  >:()

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.6-->
<command id="1230" name="Tell me a Random Joke" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://www.jokesareawesome.com/rss/random/</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>&lt;br /&gt;</param>
      <param><![CDATA[ ]]></param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;content:encoded&gt;&lt;!\[CDATA\[(.*?)\]\]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then />
    <else>
      <action>
        <cmdType>Results.RegExSingle</cmdType>
        <params>
          <param>&lt;content:encoded&gt;&lt;!\[CDATA\[(.*?)\]\]</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>Joke</param>
      <param>{Match.1.1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>\w</param>
      <param />
      <param>{Match.1.1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{#M}&amp;&amp;600</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>{Var.Joke}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>{Var.Joke}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>ask me for another joke the last one was far to long and I didn't want to bore you</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Tell me a Random Joke</phrase>
</command>

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Chuck Norris Facts (VC tellling jokes)
« Reply #2 on: April 11, 2016, 12:59:11 PM »
...
and if someone know how to set up a similar DB online, maybe we can populate it with jocks so all vc users can access it ...

Nime5ter has been there, and done that:

http://voxcommando.com/forum/index.php?topic=1586.msg13869#msg13869
« Last Edit: April 11, 2016, 01:10:03 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Chuck Norris Facts (VC tellling jokes)
« Reply #3 on: April 11, 2016, 12:59:53 PM »
Personally I'm a bit afraid of anything that is populated with jocks, but I guess it's better than being populated with jock straps.  :o

PegLegTV

  • $upporter
  • Hero Member
  • *****
  • Posts: 500
  • Karma: 43
    • View Profile
Re: Chuck Norris Facts (VC tellling jokes)
« Reply #4 on: April 11, 2016, 01:01:45 PM »
 ::hmm  :biglaugh  :biglaugh