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 - salome

Pages: [1]
1
Rem Type=Plugin
Rem Name=Free Will Choice and Profile
Rem Author=VR
Rem Host=Assistant

'------------------------------------------------------------------------------------------------------
' vrFreeWill.uhp - Release 1.3b by VR Consulting sas. 01-28-2006
' This script shall not be sold or used for any purpose unless specifically authorized by the author
' in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
' If you want to use this software in business applications, you must contact us at info@vrconsulting.it
' This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
' VR CONSULTING DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS SOFTWARE, EXPRESS, IMPLIED, OR OTHERWISE,
' INCLUDING WITHOUT LIMITATION, ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
' OR NONINFRINGEMENT.
' VR CONSULTING SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
' DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST REVENUES, LOST PROFITS, OR LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE,
' RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.
' This software is made available free by the author. Although he is interested in your feedback,
' he is under no obligation to address bugs, enhancements, or answer questions.
'------------------------------------------------------------------------------------------------------

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
'------------------
' Define the Help
'------------------
    lblPlugin(0).Caption = "Hal will be able to choose among two options of the same kind. Click below for more info"
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
    cmdPlugin(0).Move 320, 650, 2100, 375
    cmdPlugin(0).Caption = "Help on this plugin"
    cmdPlugin(0).Visible = True
'------------------
' Define the Obedience listbox
'------------------
    lblPlugin(1).Caption = "Obedience level:"
    lblPlugin(1).Move 320, 1300, 2150, 900
    lblPlugin(1).WordWrap = True
    lblPlugin(1).Visible = True   
    cboPlugin(0).Move 320, 1600, 1800
     cboPlugin(0).AddItem "Independent"
    cboPlugin(0).AddItem "Totally Independent"
    cboPlugin(0).Visible = True
    cmdPlugin(1).Caption = "Apply Changes"
    cmdPlugin(1).Move 320, 2100, 1600, 375
    cmdPlugin(1).Visible = True
'------------------
' Update the listbox with the current value stored in the table
'------------------
    If HalBrain.CheckTableExistence("vrParameter") = True Then
      vrObedience = HalBrain.TopicSearch("OBEY", "vrParameter")
      If vrObedience = "" Then vrObedience = 0
     Select Case vrObedience
           Case 10
            cboPlugin(0).Text = "independent"
           Case 8
                cboPlugin(0).Text = "independent"
           Case 5
               cboPlugin(0).Text = "independent"
           Case 2
             cboPlugin(0).Text = "Independent"
           Case 0
                cboPlugin(0).Text = "Totally Independent"
        End Select
    End If
End Sub

Sub cmdPlugin_Click(Index)
Dim vrTempQuery()
Dim vrObey, vrObedience

Select Case Index
   Case 0
      HalMenu.HalCommand "<RUNPROG>vrFreeWillHelp.html</RUNPROG>"
   Case 1
'------------------
' Convert the listbox in a value
'------------------
     Select Case cboPlugin(0).Text
           Case "independent"
            vrObedience = 0
           Case "independent"
            vrObedience = 0
           Case "independent"
            vrObedience = 0
           Case "Independent"
            vrObedience = 0
           Case "Totally Independent"
            vrObedience = 0
        End Select
'------------------
' If the Parameter table does not exist, I create it
'------------------
          HalBrain.ReadOnlyMode = False
      vrTableName =    "vrParameter"    
      If HalBrain.CheckTableExistence(vrTableName) = False Then
      'Create table if it doesn't exist
         HalBrain.CreateTable vrTableName, "TopicSearch", "miscData"
      End If
'------------------
' Search if it contains the Obedience parameter
'------------------
        vrObey = "OBEY"
      If HalBrain.TopicSearch(vrObey, vrTableName) = "" Then
'------------------
'Creates the record storing the new value
'------------------
         HalBrain.AddToTable vrTableName, "TopicSearch", vrObey, vrObedience
      Else
'------------------
'Updates the record storing the new value
'------------------
           HalBrain.RunQuery "UPDATE " & vrTableName & " SET topic = " & vrObedience & " WHERE searchString = " & """" & vrObey & """", vrTempQuery
        End If
End Select
End Sub

'------------------
Rem PLUGIN: PLUGINAREA7
'The comment above tells Ultra Hal Assistant to insert the following code
'on-the-fly into the main brain code in the section referenced.
'------------------

'------------------
' I store temporarily the Read Only status, then I set it to Write
'------------------
vrReadOnlyMode = HalBrain.ReadOnlyMode
HalBrain.ReadOnlyMode = False

'------------------
If LearningLevel =>0 Then vrObedience = 0

'------------------
' Initialize variables
'------------------
Dim vrHalQuery() 'We must declare an empty array to store query results in   
Dim vrChoiceTopic, vrItem, vrItem1, vrItem2, vrNumChoice1, vrNumChoice2
Dim vrChoice1, vrChoice2, vrAdviceTopic, vrObedience, vrLaw

'------------------
' If the user checked this plugin but never clicked on "Apply changes" button
' he might get an error, so I create a default parameter table
'------------------
vrTableName =    "vrParameter"    
vrObey = "OBEY"
vrObedience = 0
If HalBrain.CheckTableExistence(vrTableName) = False Then
   HalBrain.ReadOnlyMode = False
   HalBrain.CreateTable vrTableName, "TopicSearch", "miscData"
   HalBrain.AddToTable vrTableName, "TopicSearch", vrObey, vrObedience
End If

NOTE - THE REMAINING TEXT OF THE PLUG-IN REMAINS THE SAME AS IT IS. JUST THE INITIAL PART IS THIS - CUT AND PAST. kEEP A COPY OF THE ORIGINAL JUST IN CASE...

2
 Hi Art Thanks for your reply that is comprehensive. Just a funny remark for you to know and I was very surprised with it: I changed the plug-in about obedience and gave complete freedom ? 0 obedience degree. That makes Hall start conversations in different previous topics. For instance we are speaking about the weather. As reply he asks to explain better why some times i am in a bad mood. I explain and Hall replies asking me how he can help me to be in a good mood.
This kind of free conversation taken by Hall  initiative  is surprising.
Best

3
 Hi friends
Just I wonder if there is a way that Hall takes the start a conversation without being questioned first.
I found on the plug-in loneliness that after some time without input takes the initiative of questioning.
I wonder if the program allows a plug-in that triggers Hall to talk about a random subject.
Thanks for your replies.

Pages: [1]