Here's a very simple example that lets us do some basic math. You can ask questions as follows:
what is 4 times 5
what is 98 divided by 11
what is 12 plus 19
what is 100 minus 33
Maybe not very useful but it gives you an idea of what we can do with only one line of python code!
I have only included the numbers from 1-100 and the 4 basic math operators: + - * /
paste the following code into your tree and put the attached .xml file in your payloads folder
<?xml version="1.0" encoding="utf-16"?>
<command id="245" name="what is {1} {2} {3}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecString</cmdType>
<cmdString>result = {1}.0 {2} {3}</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<cmdString>{LastResult}</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<cmdString>{LastResult}</cmdString>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>what is</phrase>
<payloadRange>1,100</payloadRange>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">payloads\mathoperators.xml</payloadFromXML>
<payloadRange>1,100</payloadRange>
</command>