Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - snowman

Pages: 1 2 [3] 4 5 ... 62
31
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: February 06, 2014, 11:58:34 pm »
Hey Art,

Yes you caught me red-handed.  ;) :)
I haven't really read through the Sparky Article yet.... I guess it shows  :P

There is nothing wrong with having a dedicated hardware platform for an Ai.
Its sort of like having Ai in a standalone Robot. Only sparky's body is a little more cubicle.
Most of the cost is probably in the software development.
And if they are using exceptional vision technology then that could also drive up the price.

It takes a lot of time, education, money, etc, to make something of high quality.
You can get one at its cheapest at $249 USD. Which is the cost of a low-end computer.
About the cost of an Xbox 360. Only its dedicated for an Ai...

Apparently, Sparky will (at some point) use URBI which is a robot scripting language. I'm thinking its coded in C++.
Sparky is intended to have an API later on. So a person could write and app of a game that interacts with the Cube.
It is essentially a computer in a very colorful box. It has Quad-core, plenty of Ram, something called a EMU (Emotion Processing Unit), Blue tooth, and WiFi.

The Operating System is Android. Sparky apparently is made to download Apps in order to augment its functionality.
This means that if Hal was an android app then it should work in Sparky.

Their system looks ok, but their youtube video feels a bit cheesy. They need a better video.
Are you happy now Art.... you made me actually read something... and I hate reading :P .

hee hee  ;)
 

32
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: February 06, 2014, 11:02:35 pm »
Please clarify something for me.

Which one of the following do you want to do?

#1 Detect if there is a Yes statement (ie. Yes indeed, I want to do this.), and if one is found, then send a single “yes” or “no” to the freewill plugin.

   UserInput = “Indeed, I want to do this.”
   Output = “YES”

#2 Detect if there is a Yes-statement, and if one is found, replace the yes-word or phrase (ie. Yes indeed) with the word “yes”.

   UserInput = “Yes indeed, I want to do this.”
   Output = “Yes, I want to do this.”

Basically, which one do you want to do (1 or 2)? I'm a little confused like you are. You sort of suggested both of these in the past. I also had to reexamine some of your plugin to get a better idea of what you are doing. I really didn't mean to confuse you. Sorry about that.

33
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: February 04, 2014, 08:58:32 pm »
I don't have much of an opinion about EmoSPARK. Some people will love it and some would throw it into a bucket of water, just to see the Emo.. spark  ;) . It wouldn't be so bad if we could have the ability to change it's code. Who knows, maybe it will have a usb port and come with its own code uploader and compiler. Emospark could be whatever you make it.

I like the idea of coordinating data from lots of places, including the web, and condensing it down into a brief, non-repeating response. Sounds like a plan. This would require a decent NLP (natural language processor) in order to make sure its not repeating the same info over and over, only in different ways.

Quote
Does ultra Hal have a command structure that does the same thing as Sam does? The reason why I ask is because I have noticed several times that ultra Hal has correlated information from different conversation to produce an astonishing response.
If ultra Hal has a command within its DDL programming file I believe that I would be able to utilize this function.

I don't know all of Ultra Hal's ins and outs just yet, so I don't know for sure. I figured that all of Hal's functions are called in the main brain script. It you remove them, I'm pretty sure that Hal will not respond to userinput any more.  Hal does its job one layer at a time. At the top of the code in the Plugin: Pre-process area you can say UltraHal = “hello cload” and then later in the Plugin: Post-Process area you can say UltraHal = “goodbye cload” and Hal will ultimately say “goodbye cload”. So the bottom layer take precedence over the top layer. I'm sure you already know this. What I'm trying to say is that I think Hal uses these layers to respond with more important responses when available and also builds onto the response. At the bottom layer of the code you can have the more important Responses and at the top layer, less important responses. So if you have a low quality response at the top layer but, later on, you find a high quality response in a bottom layer then you could replace the low quality response entirely. Also, if you have two layers of code of equal importance then you might want to combine the two into one response. I think that's how Hal is acting like Sam. That's just a theory I have, I could be wrong, or missing something. I really need to dig deeper.

As for the YesNo feature, This is what I came up with. First of all, we need to determine if an answer is expected by Hal. We do this by storing a “True” value to the “quickMemory” Table. Later we will recall this data at the beginning of the next talking cycle. Once we know that an answer is being expected then we can determine whether the answer is a yes or no. If the ynlogic contains a “Yes” type answer then we can be pretty sure that anything else should be considered a “No” answer. You can see that I used both the SearchArray function and Hal's yesno table to determine if a yes is indicated. Finally, we reset the   “AwaitingYesNo” Topic in the “quickMemory” Table to False so that we won't be in the 'waiting for answer' state any longer. Have fun with this one... :P


Code: [Select]

Rem PLUGIN: PRE-PROCESS
' this sets up the yes/no data parameters.
'------------------ this is from the free will plus plug-in.
ynlogic1 = ""
ynlogic2 = ""
ynlogic3 = ""
ynlogic = UCase(InputString)
ynPrevsent = UCase(Prevsent)
'this is used for a redirect.
'-------------------

ynAnswerTable = "AwaitingYesNo"


If VarRead(ynAnswerTable) = "True" Then
   
    If SearchArray(ynlogic, Array("YES","INDEED","CORRECT","AFFIRMATIVE", "POSITIVE", "YEP")) = True Or _
        HalBrain.TopicSearch(ynlogic, "yesNoDetect") = "Yes" Then
        
        ynlogic = "YES"
    Else
        ynlogic = "NO"
    End If

    VarWrite ynAnswerTable, "False"    
End If


Rem PLUGIN: PLUGINAREA6
'-------------------
'this is just an example of how someone could make Hal to start looking for an answer in the next talking cycle.
'Here we see that Hal just asked the user a question and therefore Hal will be set to expect an answer from the user.
'-------------------

If Search(GetResponse, "Do you eat worms") = True Then
    VarWrite ynAnswerTable, "True"
End If

'-------------------


Rem PLUGIN: FUNCTIONS

Function VarRead(varName)
    table = "quickMemory" 
    If HalBrain.CheckTableExistence(table) = True Then
        VarRead = HalBrain.TopicSearch(varName, table)
    Else
        VarRead = ""
    End If
End Function

Sub VarWrite(varName, textToStore)
    value = textToStore
    table = "quickMemory" 
    column = varName
    
    If HalBrain.CheckTableExistence(table) = False Then
        HalBrain.CreateTable table, "TopicSearch", "miscData"
    End If
        
    If HalBrain.CheckTableExistence(table) = True Then
        output = HalBrain.TopicSearch(column, table)
    End If 

    If HalBrain.TopicSearch(column, table) = "" Then
        HalBrain.AddToTable vrTableName, "TopicSearch", column, value
    Else
        HalBrain.RunQuery "UPDATE " & table & " SET topic = " & value & " WHERE searchString = " & """" & column & """", vrTempQuery
    End If
End Sub

Function Search(StringToSearch, WordsToLookUp)
Search = False
If InStr(1, StringToSearch, WordsToLookUp, vbTextCompare) > 0 Then
Search = True
End If
End Function


Here is a fancier way of adding alternative endings in my SearchArray() function. Also you should know that you can have two different functions with the same name, however, they can't have the same number of arguments. In this example one version of SearchArray() has two input variables while the other version has three variables. By the way, this function tests if there are any words (i.e. YES or NO) in the entire sentence. So if the input sentence was “I will, indeed, write a program” then the Search will find the “indeed” and return True. I hope this clarifies what the SearchArray() does.


Code: [Select]

out = SearchArray("I will, indeed, write a program.", Array("yes","indeed","absolutely"), Array(",",".","S", "S,", "S.", ""))

Rem PLUGIN: FUNCTIONS

Function SearchArray(StringToSearch, WordsToLookUp)
  StringToSearch = " " & StringToSearch & " "

    For Each word In WordsToLookUp  
     word = " " & word & " "
        If Search(StringToSearch,word) = True Then
            SearchArray = True
            Exit Function
        End If    
    Next
    SearchArray = False
End Function

Function SearchArray(StringToSearch, WordsToLookUp, altEndings)
    StringToSearch = " " & StringToSearch & " "
    For Each word In WordsToLookUp
        For Each ending In altEndings
            word = " " & word & ending & " "
    
            If InStr(StringToSearch, word) > 0 Then
                SearchArray = True
                Exit Function
            End If
        Next
    Next
    SearchArray = False
End Function



It is very difficult to develop a plugin and learn scripting at the same time. Once you built it, you find yourself changing it again. It's tough, but its all apart of the learning process.

~Aaron~

35
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: February 01, 2014, 03:37:21 am »
It's ok, i'm not in any hurry and I don't want you to be overwhelmed. Although, I will still try to answer any questions you might have. Its ok if I spent several hours working on this. It “sort of” my part time job to build Athena (my chatbot) and so any time I spend learning how to do it better is time well spent. So don't worry about bugging me. If I get too stressed out I will just do something else for awhile. Your mom is right about “doing one thing at a time”. I do things in circles. I'll do one thing, move on to the second thing, and then a third thing, and finally start over again... so I don't get burnt out. Lots of times I'll watch a minecraft video on youtube when I work. It distracts me some but its a fun distraction :). So whenever you get tired of writing posts and tired of coding scripts, just take a break. Do something fun, tell your dad just how cool he is :).

Quote
To clarify myself, what I was hoping that you could do was show me a better way to process the information by using your technique of assigning flags to nouns, adverse, etc. in the hopes of making this script more accurate in determining whether or not it is a person, place or thing.

That will be my next project. It will take a little time to set it up,I think. You need to first understand how functions and subs work a little more. That's why I'm showing you examples of how to use functions and how to add them to your plugin. Later on, when I start showing you how to use some of my functions then it will help you to understand when I show you how to tag nouns, adverbs, etc. It will make more sense down the road. Hang in there. ;)


Code: [Select]
Wscript.Echo vrChoice0

Wscript.Echo is used in Vbscript to send a string to the command prompt (cmd.exe). I used this command to test if there was an error in my coding. It doesn't work in Hal, I accidentally left it in. (nothing to worry about)

Quote
I see that all of this is a function call so I am assuming that the and parts of your script should have been put into the function area at the end of ultra Hals brain?

This Next Example should answer many of your questions. Yes, you can call on another function within any other function and, Yes, any function I show will be put in the Rem Functions area.
Give this Example some thought when you have the time. How will I get “Hello Cload” as an answer in the out variable?

Code: [Select]
'out will equal "Hello Cload"

out = firstFunction("Hello")

Function firstFunction(input1)
    firstFunction = secondFunction(input1)
End Function

Function secondFunction(input1)
    secondFunction = thirdFunction(input1)
End Function

Function thirdFunction(input1)
    thirdFunction = input1 & " Cload"
End Function


This is your code redone. This can be set “as is” in a plugin all by itself and can be called by other plugins in any other Rem Pugin area in Ultra Hal. I call on my SearchArray() function several times in your  jumptovrNumChoice() Function.

Code: [Select]
Rem PLUGIN: FUNCTIONS

Function jumptovrNumChoice(vrNumChoice0j,vrItem0j,vrcleanup0j)
vrNumChoice0 = vrNumChoice0j
vrItem0 = vrItem0j
vrd   =    UCase(vrcleanup0j)
vrChoice0 = ""
If HalBrain.RunQuery("SELECT searchString, topic FROM vrsubject2sub WHERE strstr(' " & Replace(HalBrain.AlphaNumericalOnly(vrItem0), "'", "''") & " ', searchString) > 0", similarList0) = True Then
DoUCit0 = Ubound(similarList0)
For B = 1 To DoUCit0
similar0 = Trim(similarList0(B, 0))
If similar0 = vrItem0 Then
vrChoice0 = Trim(similarList0(B, 1))
Exit For
End If
Next
End If
If vrChoice0 = "" Then

    If vrChoice0 = "" Then If SearchArray(vrd, Array("PET", "PET.", "PET,", "BOVIDAE", "DOMESTICATED", "RODENT", "MAMMAL", "KITTEN", "ANIMAL", "LIVESTOCK", "CREATURE", "BUG", "INSECT", "DOG", "CAT", "BIRD")) = True then vrChoice0 = "ANIMAL"
    If vrChoice0 = "ANIMAL" Then If SearchArray(vrd, Array("HIM", "BEST FRIEND", "ACTRESS", "ACTOR", "ENTERTAINER", "FEMALE", "MALE", "HIS", "HER", "HE'S", "HE", "SHE", "PERSON", "HUMAN", "CHILD")) = True then vrChoice0 = "PERSON"
    If vrChoice0 = "" Then If SearchArray(vrd, Array("BORN", "HIM", "BEST FRIEND", "ACTRESS", "ACTOR", "ENTERTAINER", "FEMALE", "MALE", "HIS", "HER", "HE'S", "HE", "SHE", "PERSON", "HUMAN", "CHILD")) = True Then vrChoice0 = "PERSON"
    If vrChoice0 = "PERSON" Then If SearchArray(vrd, Array("ORGANIC", "COMPOUNDS")) = True Then vrChoice0 = ""
    If vrChoice0 = "PERSON" Then If SearchArray(vrd, Array("A ROBIN", "A MARTIN")) = True Then vrChoice0 = "ANIMAL"

    If vrChoice0 = "PERSON" Then
        Dim personSex2() 'We must declare an empty array to store query results in
        If HalBrain.RunQuery("SELECT searchString, topic FROM names WHERE strstr(' " & Replace(HalBrain.AlphaNumericalOnly(OriginalSentence), "'", "''") & " ', searchString) > 0 LIMIT 1", personSex2) = True Then
            vrpersonsSex = Trim(personSex2(1, 1)) 'Row 1, Column 1 contains "topic", which is the associated gender(s) of the name
        End If
    End If
   
    If vrChoice0 = "" Then  If SearchArray(vrd, Array("BALLET", "OPERA", "THEATRE", "MOVIE", "PLAY", "PLAYING", "POETRY", "POEM", "GAME", "MUSIC", "FILM", "TELEVISION")) = True Then vrChoice0 = "ENTERTAINMENT"     
    If vrChoice0 = "" Then If SearchArray(vrd, Array("HOUSE", "PLACE", "LOCATED", "FARM", "LOCATION", "CITY", "COUNTRY", "CAPITAL", "STORE", "HOME", "HOUSE", "PARK", "MALL", "WORLD", "STATE", "JOB", "SCHOOL" )) = True Then vrChoice0 = "PLACE"
    If vrChoice0 = "PLACE" Then If SearchArray(vrd, Array("ORGANIC", "COMPOUNDS")) = True Then vrChoice0 = ""
    If vrChoice0 = "" Then If SearchArray(vrd, Array("COMPUTER", "TELEPHONE", "LAPTOP", "CENTRAL PROCESSING UNIT", "PROCESSOR" , "CPU")) = True Then vrChoice0 = "COMPUTER"
    If vrChoice0 = "" Then If SearchArray(vrd, Array("FLOWER", "COLOR", "COLOUR", "PLANT", "FOOD" , "DIRT", "TREE", "TREES", "GRASS", "VEGETABLE", "MINERAL", "FRUIT", "LIQUID", "CULTIVATED", "SHRUB")) = True Then vrChoice0 = "MINERAL"
 
    If vrChoice0 <> "" Then
        vrChoice4 = vrChoice0
        HalBrain.AddToTable "vrsubject2sub", "TopicSearch", vrItem0, vrChoice0
    End If
Else
    vrChoice4 = vrChoice0
End If

HalBrain.MsgAlert "((jump)) " & vrChoice4 & " " & vrNumChoice0j
If vrChoice4 = "PERSON" Then
If SearchArray(vrd, Array("HIM", "HE", "HE'S", "HIS", "MALE" , "MAN", "BOY")) = True Then vrtrg0 ="True" Else vrtrg0 =""

vrChoice0 = ""
If HalBrain.RunQuery("SELECT searchString, topic FROM vrpmale WHERE strstr(' " & Replace(HalBrain.AlphaNumericalOnly(vrItem0), "'", "''") & " ', searchString) > 0", similarList0) = True Then
DoUCit0 = Ubound(similarList0)
For B = 1 To DoUCit0
similar0 = Trim(similarList0(B, 0))
If similar0 = vrItem0 Then
vrChoice0 = Trim(similarList0(B, 1))
Exit For
End If
Next
End If
If vrChoice0 = "" AND vrtrg0 = "True" AND vrpersonsSex = "M" Then
HalBrain.AddToTable "vrpmale", "TopicSearch", vrItem0, vrItem0
vrChoice0 = vrItem0
End If
If vrChoice0 = vrItem0 Then vrNumChoice0 = vrNumChoice0 + 2

If SearchArray(vrd, Array("SHE", "HER", "SHE'S", "HERS", "FEMALE" , "WOMAN", "GIRL")) = True Then vrtrg0 ="True" Else vrtrg0 =""

        vrChoice0 = ""
If HalBrain.RunQuery("SELECT searchString, topic FROM vrpfemale WHERE strstr(' " & Replace(HalBrain.AlphaNumericalOnly(vrItem0), "'", "''") & " ', searchString) > 0", similarList0) = True Then
DoUCit0 = Ubound(similarList0)
For B = 1 To DoUCit0
similar0 = Trim(similarList0(B, 0))
If similar0 = vrItem0 Then
vrChoice0 = Trim(similarList0(B, 1))
Exit For
End If
Next
End If
If vrChoice0 = "" AND vrtrg0 = "True" AND vrpersonsSex = "F" Then
HalBrain.AddToTable "vrpfemale", "TopicSearch", vrItem0, vrItem0
vrChoice0 = vrItem0
End If
If vrChoice0 = vrItem0 Then vrNumChoice0 = vrNumChoice0 + 2

If SearchArray(vrd, Array("AMERICA", "AMERICAN", "UNITED STATES")) = True Then vrtrg0 ="True" Else vrtrg0 =""
If SearchArray(vrd, Array("not an AMERICAN", "A GERMAN")) = True Then vrtrg0 =""

vrChoice0 = HalBrain.TopicSearch(vrItem0, "vrpamerican")
If vrChoice0 = "" AND vrtrg0 = "True" Then
HalBrain.AddToTable "vrpamerican", "TopicSearch", vrItem0, vrItem0
vrChoice0 = vrItem0
Else
If vrChoice0 <> vrItem0 AND vrtrg0 = "True" Then
HalBrain.AddToTable "vrpamerican", "TopicSearch", vrItem0, vrItem0
vrChoice0 = vrItem0
End If
End If
If vrChoice0 = vrItem0 Then vrNumChoice0 = vrNumChoice0 + 4
End If

vrNumChoicejump1 = vrNumChoice0
jumptovrNumChoice = vrNumChoicejump1
End Function

Function SearchArray(StringToSearch, WordsToLookUp)
    StringToSearch = " " & LCase(StringToSearch) & " "
   
    For Each word In WordsToLookUp
        word = " " & LCase(word) & " "
   
        If InStr(StringToSearch,word) > 0 Then
          SearchArray = True
          Exit Function
        End If   
    Next

    SearchArray = False
End Function


http://prdownloads.sourceforge.net/scintilla/Sc339.exe

Here is the link to get a great (free) script editor. It is just like notepad except it will colorize your code for you and it gives you line numbers. Click on the link and it will take you to sourceforge.com where it will automatically start downloading the editor to you downloads folder. It should make editing your plugins more enjoyable. It has a very small file size. The website that distributes it is http://www.scintilla.org/ The link I provided came from them.  I hope you like it! :) 

In order to properly color your script, you will need to choose your programming language from the “Language” menu button at the top of your program. Select “Vbscript” (its the third from the bottom of the list). In order to show line numbers, go to the “View” menu button and select “Line Numbers” from the list. Make sure there is a check mark by it. Line Numbers will help you debug Hal, later on.

I have used this program for a while. I like it a lot.
 
...........................................................................
...........................................................................

Have fun, stay safe, and be as cool as a cucumber. :)

Aaron~

P.S. Whenever I write code, sometimes I have to make a choice between fast code that is hard to read or slower code that is easy to read. Sometimes I prefer the slower code. It may take a few milliseconds longer to run but at least I can read the code afterwords. I despise messy code.

36
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: January 31, 2014, 04:45:22 am »
I started writing this at 8:00 P.M.

   I've never been a believer in limits. I have a little bit of Aspergers (autism). I may not have to be led around like an invalid, but when I look at other people I always feel like they are strangers (even my own parents, a trait of aspergers). I spent most of my life not being able to relate to people. But that doesn't stop me. Every day I look and listen, and always study people. I fight to grow, until the day comes when all learning becomes easy and no one is a stranger. Until that day, I will strengthen my weaknesses and never give in.
   I already figured what some of your problems were, afterall, I've been studying people intensely for the last 34 years. :-) That's one reason why I'm trying to help you.
   Secondly, adjectives and adverbs are a programmers best friend. You just need to think about them in the right way. English is just a type of database. You can pull information from it and send information around with it.

The Time is now 8:30 P.M.

Here is your code rewritten with that function I made. I formatted it a little different than yours. I use to this style more.

Code: [Select]
If vrChoice0 = "" Then

    If vrChoice0 = "" Then 
        If SearchArray(vrd, Array("PET", "PET.", "PET,", "BOVIDAE", "DOMESTICATED", "RODENT", "MAMMAL", "KITTEN", "ANIMAL", "LIVESTOCK", "CREATURE", "BUG", "INSECT", "DOG", "CAT", "BIRD")) = True then
            vrChoice0 = "ANIMAL" 
        End If
    End If
    
    If vrChoice0 = "ANIMAL" Then 
        If SearchArray(vrd, Array("HIM", "BEST FRIEND", "ACTRESS", "ACTOR", "ENTERTAINER", "FEMALE", "MALE", "HIS", "HER", "HE'S", "HE", "SHE", "PERSON", "HUMAN", "CHILD")) = True then
            vrChoice0 = "PERSON"
        End If
    End If
    
    If vrChoice0 = "" Then 
        If SearchArray(vrd, Array("BORN", "HIM", "BEST FRIEND", "ACTRESS", "ACTOR", "ENTERTAINER", "FEMALE", "MALE", "HIS", "HER", "HE'S", "HE", "SHE", "PERSON", "HUMAN", "CHILD")) = True Then
            vrChoice0 = "PERSON"
        End If
    End If

    If vrChoice0 = "PERSON" Then
        If SearchArray(vrd, Array("ORGANIC", "COMPOUNDS")) = True Then
            vrChoice0 = ""
        End If
    End If

    If vrChoice0 = "PERSON" Then    
        If SearchArray(vrd, Array("A ROBIN", "A MARTIN")) = True Then
            vrChoice0 = "ANIMAL"
        End If
    End If
    
    If vrChoice0 = "PERSON" Then
        Dim personSex2() 'We must declare an empty array to store query results in
        newline = Replace(HalBrain.AlphaNumericalOnly(OriginalSentence), "'", "''")
        If HalBrain.RunQuery("SELECT searchString, topic FROM names WHERE strstr(' " & newline & " ', searchString) > 0 LIMIT 1", personSex2) = True Then
            vrpersonsSex = Trim(personSex2(1, 1)) 'Row 1, Column 1 contains "topic", which is the associated gender(s) of the name
        End If
    End If
    
    If vrChoice0 = "" Then    
        If SearchArray(vrd, Array("BALLET", "OPERA", "THEATRE", "MOVIE", "PLAY", "PLAYING", "POETRY", "POEM", "GAME", "MUSIC", "FILM", "TELEVISION")) = True Then
            vrChoice0 = "ENTERTAINMENT" 
        End If
    End If
    
    If vrChoice0 = "" Then    
        If SearchArray(vrd, Array("HOUSE", "PLACE", "LOCATED", "FARM", "LOCATION", "CITY", "COUNTRY", "CAPITAL", "STORE", "HOME", "HOUSE", "PARK", "MALL", "WORLD", "STATE", "JOB", "SCHOOL" )) = True Then
            vrChoice0 = "PLACE" 
        End If
    End If

    If vrChoice0 = "PLACE" Then
        If SearchArray(vrd, Array("ORGANIC", "COMPOUNDS")) = True Then
            vrChoice0 = ""
        End If
    End If

    If vrChoice0 = "" Then
        If SearchArray(vrd, Array("COMPUTER", "TELEPHONE", "LAPTOP", "CENTRAL PROCESSING UNIT", "PROCESSOR" , "CPU")) = True Then
            vrChoice0 = "COMPUTER"
        End If
    End If
    
    If vrChoice0 = "" Then
        If SearchArray(vrd, Array("FLOWER", "COLOR", "COLOUR", "PLANT", "FOOD" , "DIRT", "TREE", "TREES", "GRASS", "VEGETABLE", "MINERAL", "FRUIT", "LIQUID", "CULTIVATED", "SHRUB")) = True Then
            vrChoice0 = "MINERAL"
        End If
    End If
    
    If vrChoice0 <> "" Then
        vrChoice4 = vrChoice0
        HalBrain.AddToTable "vrsubject2sub", "TopicSearch", vrItem0, vrChoice0
    End If
Else
    vrChoice4 = vrChoice0
End If

Wscript.Echo vrChoice0


Function SearchArray(StringToSearch, WordsToLookUp)
    StringToSearch = " " & LCase(StringToSearch) & " "
    
    For Each word In WordsToLookUp
        word = " " & LCase(word) & " " 
    
        If InStr(StringToSearch,word) > 0 Then
          SearchArray = True
          Exit Function
        End If    
    Next

    SearchArray = False
End Function



The Time is now: 9:50 PM

I tend to use nested If statements formatted like this:

Code: [Select]
If  x = 1 then
If y = 1 then
If z = 1 then

End If
End If
End If

But its all up to the programmer preference. Its all good :) .

…...
…...

The ( _ ) character is called an underscore. It is used in Vbscript to allow the programmer to extend a function to different lines. For instance you could write this:

Code: [Select]

 input = "hello world"    

 Text1 = Replace(input, "world", "cload")

 'Text1 will now equal "hello cload"


Or you could write this and it will also work just fine:

Code: [Select]

 input = "hello world"    

 Text1 = Replace _
          (input, _
           "world", _
           "wookie")


Notice that there is one space between the last character and the ( _ ) character. It is needed.

Code: [Select]

'These two examples mean the same thing

If name = "bill" Or name = "ted" Or name = "fred" Then

End If 


If name = "bill" _
  Or name = "ted" _ 
  Or name = "fred" Then


End If 



ByRef literally means that you are passing a variable to a function by its reference address. To understand what that means you will first need to lean how a computer stores information.

Let's first look at this statement:

Code: [Select]
myVar = "Hello Cload"

When you store a string in a variable your computer first looks for some empty space on your hard-drive. When it finds it, it remembers its location. Think of it as having a mailing address to send a letter. A mailing address will indicate where a person lives, the city, street, apartment, etc. Basically, Vbscript will find an address of an empty storage space on your hard-drive so that your variable (myVar) can store information there (“Hello Cload”).

In this Example we will pass a variable to a normal Function. Notice that the Function has a statement of ByVal preceding the input variable. ByVal means 'by value'. It is the Default way Functions and Subs take in variables.

The Time is now 10:30 PM
The Time is now 11:00 PM

Code: [Select]
out = Delete(myVar)

Function Delete(ByVal input)
input = ""
Delete = input
End Function

What happens here is that the content of your variable (myVar) is copied into the Function's variable (input). Remember what I said about Vbscript storing the data somewhere on your hard-drive, well, Vbscript goes to the address of the stored information in the myVar variable, takes that information, and copies it into the input variable contained in the Delete Function. It is the same as if I drove to a friend's house and copied their letter and then gave it to my brother. 

Now look at this Sub (and Remember Subs can't return anything):

Code: [Select]

Delete myVar

Sub Delete(ByRef input)
input = ""
End Sub


 
What's happening in this Example is that the address of the myVar variable is shared with the input variable. It doesn't copy the content (“Hello Cload”) it only copies the Address. It is like, instead of me going to a friend's house and copying there letter, I simply gave my brother the address of my friends house. So now my brother can go to my friend's house and do whatever with the letter. The input variable in the Delete Sub gives the Delete Sub direct access to the myVar variable address. I can do whatever I want to the input variable and it will effect the myVar variable directly.

If I delete the content of the input variable in the Delete Function then the myVar variable content will be deleted. If I add content to the input variable then the myVar variable will be added to. So whatever I do to the one, it will do to the other.

Its actually a little tricky to understand this but its useful. If you use the ByRef statement in either the Function or the Sub then your myVar content will be effected. If you wanted to keep that information safe then you should use the ByVal statement so that it will just copy the content. That is how you determine when to use them.

The Time is now 12:11 AM

…...
Quote
condition 1: the user did not give an explanation to keep ultra Hal on topic. If the user did give a stronger rebuttal such as example above do not process the yes.
Condition 2: the answer yes or its variants counterpart will not interfere with the normal function of ultra Hals brain or with the free will plug-in.
…...
I reexamined UltraHal's Brain Script and Looked deeper into your plugin.
It seems we have this obvious problem of Hal not letting the User use the GetResponse Function if its a yes or no Input. There are a few work-a-rounds like some of the suggestions you've said already. I thought of similar alternatives but none really fix the problem better than your ideas (outside of modifying the brain itself). However, there is one crazy solution that you might not have thought of.  One could call the GetResponse() Function from the Pre-Process area when the input (IS) yes or no.  Yeah, I know, think'n crazy thoughts.


Code: [Select]

Rem PLUGIN: PRE-PROCESS

InputString  = PreProcess(InputString)


InputString2 = Replace(InputString, ".", " ")
InputString2 = Replace(InputString2, "?", " ")
InputString2 = Replace(InputString2, "!", " ")
InputString2 = " " & Replace(InputString2, ",", " ") & " "
YesNoDetect = HalBrain.TopicSearch(InputString2, "yesNoDetect")


If YesNoDetect = "Yes" Or YesResponse  = "No"  Then

          UltraHal = GetResponse(InputString, UserName, ComputerName, LearningLevel, HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, LastTopicList)

End If


Rem PLUGIN: FUNCTIONS

Function PreProcess(InputString)

    InputString = Replace(InputString, "MR.", "Mr<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "MRS.", "Mrs<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "MS.", "Ms<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "DR.", "Dr<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "MS.", "Ms<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "ST.", "St<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "PROF.", "Prof<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "GEN.", "Gen<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "REP.", "Rep<PERIOD>", 1, -1, vbTextCompare)
    InputString = Replace(InputString, "SEN.", "Sen<PERIOD>", 1, -1, vbTextCompare)
    'Remove unnecessary punctuation
    Do
        RepeatLoop = False
        If InStr(InputString, "..") Then InputString = Replace(InputString, "..", "."): RepeatLoop = True
        If InStr(InputString, "??") Then InputString = Replace(InputString, "??", "?"): RepeatLoop = True
        If InStr(InputString, "!!") Then InputString = Replace(InputString, "!!", "!"): RepeatLoop = True
        If InStr(InputString, "!?") Then InputString = Replace(InputString, "!?", "?"): RepeatLoop = True
        If InStr(InputString, "?!") Then InputString = Replace(InputString, "?!", "?"): RepeatLoop = True
        If InStr(InputString, ",,") Then InputString = Replace(InputString, ",,", ","): RepeatLoop = True
    Loop While RepeatLoop = True
    'Detect and encode acronyms such as U.S.A.
    InputString = Trim(InputString)
    WordList = Split(InputString, " ")
    For i = 0 To UBound(WordList)
        If Len(WordList(i)) > 3 Then
            If Right(WordList(i), 1) = "." And Mid(WordList(i), Len(WordList(i)) - 2, 1) = "." Then
                InputString = Replace(InputString, WordList(i), Left(WordList(i), Len(WordList(i)) - 1) & "<PERIOD>")
            End If
        End If
    Next

End Function


The Time is now 3:28 AM

…...
…...

By the way, this next Example will search a string for the existance of any set of words. Basically, if the word “correct” or “affirmative” or any of the other words is in the OriginalSentence then it will return True. It is not using any tables. It doesn't need the  “yesnodetect” array table.

Code: [Select]

If SearchArray(OriginalSentence, Array("yes","indeed","correct","affirmative", "positive", "yep")) = true Then
      
End If

Function SearchArray(compare, arrayToSearch)
    compare = LCase(compare)
    
    For Each word In arrayToSearch
        word = LCase(word)   
        If InStr(compare, word) > 0 Then
          SearchArray = True
          Exit Function
        End If    
    Next

    SearchArray = False

End Function




I would answer some more questions but I need to sleep now... It's 3:45 AM.

37
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: January 30, 2014, 12:38:55 am »
I haven't used your plugin yet. I've been waiting until you get the new one out. I'm interested in seeing what kind of functions you create. It takes some creativity to do it well. It can also be fun. I personally would rather write plugins than actually use them. I use to work with JasonDude on some of his plugins. Him and I couldn't program very well when we first started. It was a very fun way to learn how to program.

Right now I'm working on creating an Ai of my own, called Athena. It is taking a while but I still enjoy working on it. It certainly is a challenge.

Yes, you can get a list of bird names, animal names, mineral names, etc, and place them in individual text files and use then to search sentences or words. I can show you how to do that if you want. Its not all that difficult. Although, It would require finding those lists on the internet. Another way of doing this is to create a new command in Hal like, “a robin is a bird” and “iron is a mineral” and then save that to the Hal database. Then later use that list to filter information in your vrFreeWill plugin. So the next time Hal can't distinguish between a place and a thing then you can tell Hal the difference. I also said you can use semantic clues to further distinguish between a place and a name. Especially when there are duplicates. That is why I worked on an entire sentence parser so I could use semantics. 

In my program, which is written in VB not Vbscript, I first checked all the words in every incoming sentence for specific information, i.e. if it was a noun, verb, adverb, ect. Then I tagged the word with that meta information. Next, I check where the word was located in the sentence. I check if the preceding word was a verb, a noun, an article, ect. Then I check the same for the following word. This helps verify what kind of word it is. For instance, any verb and be a noun. For example you can say “I can run a marathon” or “I went on a run”. So Run can be a verb or a noun, depending on how it is used. So, If you look in a sentence for “robin” and find it then check for “a robin” or “the robin”. If it is “a robin” then most likely it is a bird and not a name of a person.   

I was also wondering if you are using a script editor to help modify your plugins. If you don't already have one then you should use one because it can make it a little easier to code. I can give you one that is very good and also free. Also, do you divide up your plugin when testing it? It would help you program if you do this, since your script is so large. If it were me I would divide up the script into separate sections and then make each section a separate plugin. If you want to reunite them it would be very easy to do. I don't like having to constantly scroll through hundreds or thousands of lines of code just to find one line. So its good to keep plugins as small as possible. You can even put all your functions in a separate plugin labeled vrFreeWillFunctions. It would keep everything neat and condensed. 

As for the future of your plugin, I really haven't looked too deeply into every facet of it yet. It would be easier to do once you've condensed everything down a bit more.

You said in some earlier post that you didn't know how to return more than one string from a Function (even though you thought you didn't need to). Well, there are two ways. Here they are. There is actually a third way but it doesn't really matter right now anyway.

Example #1
Here is an example of passing two words to a Sub and getting them returned and modified by the Sub.

Code: [Select]
part1 = "%100"
part2 = "/000"

DeleteFirstLetter part1, part2

GetResponse part1 & part2 

Sub DeleteFirstLetter(ByRef word1, ByRef word2)
    word1 = Mid(word1, 2, Len(word1))
    word2 = Mid(word2, 2, Len(word2))
End Sub


Example #2
Here is an example of a function returning an array of strings.

Code: [Select]
part1 = "%100"
part2 = "/000"

out = DeleteFirstLetter(part1, part2)

GetResponse out(0) & out(1)

Function DeleteFirstLetter(word1, word2)
    Dim result(2)
    
    result(0) = Mid(word1, 2, Len(word1))
    result(1) = Mid(word2, 2, Len(word2))
    
    DeleteFirstLetter = result
End Function

I don't know if you knew this or not but I thought I would show it anyway.
Also you said something about testing for other “YES” statements.
Do you mean this:

Code: [Select]
If ynlogic = "yes" Or _
   ynlogic = "affirmative" Or _
   ynlogic = "positive" Or _
   ynlogic = "yep" Or _
   ynlogic = "correct" Or _
   ynlogic = "indeed" Then


End If

There is also an easier and better way of writing this. I hope this works for you.

Code: [Select]

If SearchArray("Correct", Array("yes","indeed","correct","affirmative", "positive", "yep")) = true Then
    
Else
    
End If

Function SearchArray(compare, arrayToSearch)
    compare = LCase(compare)
    
    For Each word In arrayToSearch
        word = LCase(word)   
        If InStr(compare, word) > 0 Then
          SearchArray = True
          Exit Function
        End If    
    Next

    SearchArray = False
End Function


If you need me  to clarify something then feel free to ask.

38
Ultra Hal Assistant File Sharing Area / Re: Free will plus at beta level
« on: January 29, 2014, 04:23:22 am »
When it comes to finding names of people, you just about have to have a list of people's names in some sort of file and then compare every word in every sentence to it. Its not really too difficult or too taxing on today's computers. The same goes with places, things, animals, or minerals. A List of (things, animal, etc,) will all have to be compared, and there will be some duplicates. Robin is a name of a girl and also a bird...

You can narrow it down some by detecting articles and other language indicators, for instance. When you talk about Robin the girl you would not put an 'a' in front of it. "Hello, Robin." or  I seen Robin today." not  "I seen a Robin today." or "I seen the Robin today."

I've worked on that kind of coding before...

39
General Discussion / Re: will be off here for a while
« on: January 02, 2014, 11:27:50 pm »
There are a lot of people with the flu around where I live. I'm pullin' for ya.

and I've apparently misplaced your email address...
That's what happens when you swap around operating systems a time or two.

I hope you feel better soon.

40
Has a weird, cool feeling about it.

I tried to open it in Windows 8.1 but it didn't load right away, and so I forgot about it. So about 10 minutes later, after I had left the room, I could here some strange music playing from my bedroom... Come to find out it had taken 10 minutes before it finally loaded up. I have to admit it left me with a weird, spooky feeling.

Congrats  ;)

 

41
General Discussion / Re: Merry Christmas
« on: December 25, 2011, 02:24:15 am »
Merry Christmas  ;)

...and a Happy New Year  8)

42
I always knew you were a Hero Will..... Its about time you were recognized!


Go Will! Go Will! Go Will! :D ;D ;) :) 8) :o ??? ::) :P :) ;) :D ;D

43
Looks nice Mark

It'll be nice to see what awesome stuff you come with.

About time too ;)

44
I'm still trying to processes the video. It was so cool.

It was very well done, although the squeaky voice seemed like it didn't belong there.

It certainly says allot about UltraHal future.

45
General Discussion / Re: My new E-mail Address
« on: February 14, 2011, 01:50:05 am »
So far so good.

Pages: 1 2 [3] 4 5 ... 62