Author Topic: alternate to Python (or Iron Python) for custom coding  (Read 2097 times)

0 Members and 1 Guest are viewing this topic.

tobiastobindev

  • $upporter
  • Jr. Member
  • *****
  • Posts: 33
  • Karma: 1
    • View Profile
alternate to Python (or Iron Python) for custom coding
« on: April 30, 2015, 03:29:21 PM »
Hello,
As I have stated before, I am not a professional programmer, and I can always stand to learn more.  I first started scripting about 15 years ago.  First languages were Perl, PHP, VBScript, and Javascript.  I got a book on Python and read online.  I am surprised at how many times I have read that Python is a great beginner language.  IMHO, Python is different.  Aside from Python ettiquite, the way things are just really seem to make Python unique to me in comparison to what I just listed.  IMHO the four items I listed all share similarities.

I'm trying to get my wife on board with VoxCommando, home automation, having some fun with technology.  When I was testing the SR program SARAH I had made a learning multiplication tables speech program for the kids.  She would ask the what x times y is and then they would answer and get it right or wrong and be told the correct answer.  My wife wants to get involved more and I really want that to happen.  She wants to make speech math learning stuff for the kids.  I told her she would have to use Python (this was all yesterday).  She looked at Python and then on the way home we talked about it and she told me she didn't care for it and I shared my feelings.

I am wondering, without creating more work for the VC team, how additional scripting/programming support might be accomplished with VC.  When I was testing Castle OS it allowed for C# scripts.  That was great.  I believe that was accomplished by using Mono Develop.  Working with Sarah I was using Javascript.  That is fine.  I would prefer to use something script for most things.  Plus I have to teach my wife all of this (she will self learn too and she is smart so no problem).

Does anyone have any suggestions for me?  Know any paths I could take to use something other than Python?  If I have to use Python I will but I doubt my wife will want to mess with it and I won't really be enjoying it.

If I was asked to recommend... based on my limited knowledge I would lean towards C# script.  That will allow for the use of the .Net library with all the namespaces, importable items through nuget, and should be a very versatile and functional approach.  If not that, then something that can be extended with additional libraries fairly easily.  If someone makes a Wake-On-Lan library and puts it on GitHub, it would be nice to be using a language that would allow us to grab that and use it.

Those of you who are much more knowledgeable in this area may have better ideas or suggestions. 

Thank you,
tobias.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: alternate to Python (or Iron Python) for custom coding
« Reply #1 on: April 30, 2015, 05:00:53 PM »
For your times table scenario you probably don't need to use any scripting at all with VC. It's more a question of learning how VC works.

In general, sure, it's possible to use other scripting languages, though not as efficiently as using the Python plugin. You could probably use the various Launch actions to work wih a vbscript, for example.

http://voxcommando.com/mediawiki/index.php?title=Actions#Launch

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="582" name="launch vbscript" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <params>
      <param>Insert_your_filepath\hello_world.vbs</param>
      <param>{1} {2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Here is a message from</phrase>
  <payloadList>Maria, Caleb, Hakim</payloadList>
  <phrase>and</phrase>
  <payloadList>Sylvester, Porky, Daffy</payloadList>
</command>

I personally don't believe it would be more time-efficient/pleasant than spending the few weeks that are probably required to become familiar with the many tools that VC already provides, Python and otherwise.

The times table example probably could be done without any scripting, using some Payload XML and a bit of creativity.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

tobiastobindev

  • $upporter
  • Jr. Member
  • *****
  • Posts: 33
  • Karma: 1
    • View Profile
Re: alternate to Python (or Iron Python) for custom coding
« Reply #2 on: April 30, 2015, 05:29:58 PM »
Hi nime5ter,
Thank you for your response.  And what you said is fine.  I am ignorant, I admit.  While I do understand somethings in VC, I know there is a ton I don't.  It is not that I have not made an effort.  I think I just have difficultly sometimes understanding what is simplistic for you or others.

I'll give an example or two and probably make myself look like a fool. 

1) Adding a conditional - Unfortunately I'm at work and I don't have it up in front of me.  But something like (A)==(B).  I'm not sure that I understand what determines the values of A and B.  LastActionSuccess - what is that based on?  If I make a command to turn on a light, the command is sent, is VC always checking that the light or whatever else it might be, returned success? 

You are absolutely correct that I'm reaching for what I know rather than learning what I don't.  I think this is not the first time the message has been sent to me.  I think part of the issue is I've spent weeks trying to learn so many new things I'm getting lazy or tired. 

Thanks for the response.  I'll try to quit whining and just try harder and learning everything VC has to offer.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: alternate to Python (or Iron Python) for custom coding
« Reply #3 on: April 30, 2015, 05:55:38 PM »
Here is an example of how your wife can build math quizzes without any Python, once she has spent some time learning how to use VoxCommando.

This is just the 4 x table. It would be a fairly good introductory learning exercise to figure out how to expand the commands here to adapt to a full set of times tables.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.6-->
<commandGroup open="True" name="math magic" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="652" name="Practice our times tables" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Great idea. How about this one?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.GetRandomP</cmdType>
      <params>
        <param>payloads\math_4xtable.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>What is {Match.1}?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>What is {Match.1}?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.GetValue</cmdType>
      <params>
        <param>payloads\math_4xtable.xml</param>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>answer</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>question</param>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Give me a math challenge please</phrase>
  </command>
  <command id="672" name="Here is my answer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{1}&amp;&amp;{var.answer}</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>That's right! {var.question} = {var.answer}. </param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{var.question} = {var.answer}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Great job!|Nice work.|Good stuff.|You're on a roll.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Oops. {var.question} = {var.answer}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Whoops.|Not quite.|That's incorrect, unfortunately.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{var.question} = {var.answer}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>The answer is, My answer is, Here is my answer</phrase>
    <payloadRange>1,60</payloadRange>
  </command>
</commandGroup>

My suggestion would be that she learn how VC works and explore it independently, rather than trying to learn from you, since you are also learning. This way you can both probably teach each other things based on your varied interests.

We'd be happy to support her directly on the forum if she has any questions.

I'm really not trying to dismiss your frustrations. VoxCommando is a somewhat unusual program, and is also quite elaborate in its capabilities.

James has gone to great lengths to provide "out of the box" configurations and other support tools to help initiate new users, but it nonetheless is not a program that one is likely to master in short order.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: alternate to Python (or Iron Python) for custom coding
« Reply #4 on: April 30, 2015, 06:04:05 PM »
1) Adding a conditional - Unfortunately I'm at work and I don't have it up in front of me.  But something like (A)==(B).  I'm not sure that I understand what determines the values of A and B.  LastActionSuccess - what is that based on?  If I make a command to turn on a light, the command is sent, is VC always checking that the light or whatever else it might be, returned success? 

Quite coincidentally, I provide an example of If (A)==(B) in the math quiz example above. Maybe that will help.

I take it you've looked at the wiki entry, but don't find it expansive enough? http://voxcommando.com/mediawiki/index.php?title=Logic_Block

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: alternate to Python (or Iron Python) for custom coding
« Reply #5 on: May 01, 2015, 07:26:45 AM »
For those interested in a Python approach, this thread may provide a useful starting point. http://voxcommando.com/forum/index.php?topic=1735.msg15012#msg15012
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

tobiastobindev

  • $upporter
  • Jr. Member
  • *****
  • Posts: 33
  • Karma: 1
    • View Profile
Re: alternate to Python (or Iron Python) for custom coding
« Reply #6 on: May 01, 2015, 08:57:23 AM »
Hi nime5ter,
All helpful responses, and good starting point for my wife.  And I just looked at that wiki entry and yeah, it answers the question.  I don't know what to say.  I looked at forgot?  eeyeeyyyee.  Yeah, no issues there.

I've provided plenty of help and guidance to my question.  I appreciate the time you spent on this and I apologize for apparently forgetting or getting confused, or just being idiot.

I think I may benefit from not trying to half-way do 5 different things and stick to one thing and give it full attention.

If you don't hear from me for a while on here that's probably a good thing. 

Again, much help and I appreciate your time.  I agree with you that having my wife learn on her own we may be able to help each other.

Thanks,
tobias.