dupa

Author Topic: learning  (Read 377 times)

cyberjedi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 986
  • The Mighty Hal Machine
    • View Profile
    • Bringing the code
learning
« on: July 26, 2025, 06:55:33 pm »
LightSpeed : Lets start here.lol
The triggering on this will be unique




Rem Type= Plugin                     ' PRE-PROCESS ' We want this in upper memory just like the spell checker.
Rem Name= Remembering
Rem Author=Zabaware
Rem Host=All
Rem Version=2.0

HalBrain.ReadOnlyMode = True
'Determines that you are talking about mem
If InStr(1,InputString, "Remember this:",1) > 0 Then
 UltraHal = Getmem(HalCommands)
ElseIf InStr(1,InputString, "Remember this:",1) > 0 Then
 End If

    HalBrain.ReadOnlyMode = False
    UltraHal = Getmem(HalCommands)

Rem PLUGIN: PRE-PROCESS

Function Getmem(HalCommands)
Option Explicit
Dim Hal, fso, memoryFile, line, userInput, foundRecall, recentMemories
Dim memoryPath
Set Hal = CreateObject("HalBrain.1")
Set fso = CreateObject("Scripting.FileSystemObject")

memoryPath = "C:\UltraHal\Memory\memory_log.txt" ' Adjust path as needed

' Simulate Hal receiving input (replace this with Hal's actual input capture if plugin-based)
userInput = InputBox("You say to Hal:") ' i have to sort this out'

' Save user input to memory
If Not fso.FileExists(memoryPath) Then
    Set memoryFile = fso.CreateTextFile(memoryPath, True)
Else
    Set memoryFile = fso.OpenTextFile(memoryPath, 8, True) ' 8 = ForAppending
End If
memoryFile.WriteLine Now & " | " & userInput
memoryFile.Close

' Try to recall something relevant from memory
Set memoryFile = fso.OpenTextFile(memoryPath, 1) ' 1 = ForReading
foundRecall = False
recentMemories = ""

Do Until memoryFile.AtEndOfStream
    line = memoryFile.ReadLine
    If InStr(line, "dog") > 0 Or InStr(line, "car") > 0 Or InStr(line, "music") > 0 Then
        recentMemories = recentMemories & vbCrLf & line
        foundRecall = True
    End If
Loop

memoryFile.Close
'HalMenu.HalCommand "<SPEAK>" & text goes here & "</SPEAK>"  ' We need to cut this in anywhere we want hal to speak
If foundRecall Then
 '   MsgBox "Hal recalls:" & vbCrLf & recentMemories
    Hal.AddToBrain "I remember you said: " & recentMemories
'HalMenu.HalCommand "<SPEAK>" I remember you said:  "</SPEAK>"&recentMemories
Else
    Hal.AddToBrain "Thanks for telling me. I'll remember that."
'HalMenu.HalCommand "<SPEAK>" &Thanks for telling me. I'll remember that. & "</SPEAK>"
End If
 Exit Function
###############################################################
This is a work in progress
Each time the user says something, it?s saved in a memory file with a timestamp.
The script scans for keywords to simulate recall.
If relevant memories are found, Hal references them in conversation.
« Last Edit: July 28, 2025, 06:37:06 am by cyberjedi »
If i see a little farther then some its because i stand on the shoulders of giants