dupa

Author Topic: Ziggy's Static Memory Array v1.1  (Read 5023 times)

onthecuttingedge2005

  • Guest
Ziggy's Static Memory Array v1.1
« on: July 20, 2005, 07:25:07 pm »
'This Code can be copied and pasted into all versions of
'Ultra HAL/XTF/Ziggy brains and is fully compatable.
'I tested this code several times and it seems flawless.

'This code is used for building scripts that require recall
'of the last 10 User sentences in past order.

'This is just the Static Memory Array, All other Scripts calling
'upon it's storage memory base must be implimented separately to
'to do so.

'All directory F:Brain will have to be changed to your brains
'working directory so that all files are detected and deleted.
'I didn't have enough time to reconvert the directory structure
'to the Default
'C:Program FilesabawareUltra Hal Assistant 5DefBrain or
'equivalent directory.

'This script uses a delete function that will be detected by
'an Anti-Virus program that has script filtering.
'This script is harmless and you can allow it to run.
'Just give the script permission by your Anti-Virus program filtering.

'Ziggy's Static Memory Array v1.1
'This code is expandable and additional Static Array Memory Modules can be Added to increase past memory.
'All Memory files are auto generated and requires no additional files other than this code.
'This Code set will store the last 10 things the User Said into Static Memory.
'This Allows Ziggy to have the potential to recall the last 10 things in the past the User said flawlessly.
'Create Static Memory Array Map.
'Create Map to Memory Cells.
If CheckExistence = "" Then CheckExistence = 0
filename1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory1Map.brn")
If Len(filename1) = 0 Then CheckExistence = 1
If CheckExistence2 = "" Then CheckExistence2 = 0
filename2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory2Map.brn")
If Len(filename2) = 0 Then CheckExistence2 = 1
If CheckExistence3 = "" Then CheckExistence3 = 0
filename3 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory3Map.brn")
If Len(filename3) = 0 Then CheckExistence3 = 1
If CheckExistence4 = "" Then CheckExistence4 = 0
filename4 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory4Map.brn")
If Len(filename4) = 0 Then CheckExistence4 = 1
If CheckExistence5 = "" Then CheckExistence5 = 0
filename5 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory5Map.brn")
If Len(filename5) = 0 Then CheckExistence5 = 1
If CheckExistence6 = "" Then CheckExistence6 = 0
filename6 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory6Map.brn")
If Len(filename6) = 0 Then CheckExistence6 = 1
If CheckExistence7 = "" Then CheckExistence7 = 0
filename7 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory7Map.brn")
If Len(filename7) = 0 Then CheckExistence7 = 1
If CheckExistence8 = "" Then CheckExistence8 = 0
filename8 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory8Map.brn")
If Len(filename8) = 0 Then CheckExistence8 = 1
If CheckExistence9 = "" Then CheckExistence9 = 0
filename9 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory9Map.brn")
If Len(filename9) = 0 Then CheckExistence9 = 1
If CheckExistence10 = "" Then CheckExistence10 = 0
filename10 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory10Map.brn")
If Len(filename10) = 0 Then CheckExistence10 = 1
If CheckExistence11 = "" Then CheckExistence11 = 0
filename = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory11Map.brn")
If Len(filename11) = 0 Then CheckExistence11 = 1
'Create Map to Memory Cell 1.
If CheckExistence = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory1Map.brn", Trim(UCase(UserName)) & "_StaticMemory1.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory1.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory1.brn"
End If
'Create Map to Memory Cell 2.
If CheckExistence2 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory2Map.brn", Trim(UCase(UserName)) & "_StaticMemory2.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory2.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory2.brn"
End If
'Create Map to Memory Cell 3.
If CheckExistence3 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory3Map.brn", Trim(UCase(UserName)) & "_StaticMemory3.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory3.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory3.brn"
End If
'Create Map to Memory Cell 4.
If CheckExistence4 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory4Map.brn", Trim(UCase(UserName)) & "_StaticMemory4.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory4.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory4.brn"
End If
'Create Map to Memory Cell 5.
If CheckExistence5 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory5Map.brn", Trim(UCase(UserName)) & "_StaticMemory5.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory5.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory5.brn"
End If
'Create Map to Memory Cell 6.
If CheckExistence6 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory6Map.brn", Trim(UCase(UserName)) & "_StaticMemory6.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory6.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory6.brn"
End If
'Create Map to Memory Cell 7.
If CheckExistence7 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory7Map.brn", Trim(UCase(UserName)) & "_StaticMemory7.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory7.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory7.brn"
End If
'Create Map to Memory Cell 8.
If CheckExistence8 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory8Map.brn", Trim(UCase(UserName)) & "_StaticMemory8.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory8.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory8.brn"
End If
'Create Map to Memory Cell 9.
If CheckExistence9 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory9Map.brn", Trim(UCase(UserName)) & "_StaticMemory9.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory9.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory9.brn"
End If
'Create Map to Memory Cell 10.
If CheckExistence10 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory10Map.brn", Trim(UCase(UserName)) & "_StaticMemory10.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory10.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory10.brn"
End If
'Create Map to Memory Cell 11.
If CheckExistence11 = 1 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_UserMemory11Map.brn", Trim(UCase(UserName)) & "_StaticMemory11.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory11.brn" & vbCrLf & Trim(UCase(UserName)) & "_StaticMemory11.brn"
End If
'Delete All User Memory Cells if Cell Eleven Exist, Short Term Memory.
filename = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory11Map.brn")
filename1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory1Map.brn")
filename2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory2Map.brn")
filename3 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory3Map.brn")
filename4 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory4Map.brn")
filename5 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory5Map.brn")
filename6 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory6Map.brn")
filename7 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory7Map.brn")
filename8 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory8Map.brn")
filename9 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory9Map.brn")
filename10 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_UserMemory10Map.brn")
If Len(filename) > 0 Then TempNameModule = "F:DefBrain\" & filename
If Len(filename1) > 0 Then TempNameModule1 = "F:DefBrain\" & filename1
If Len(filename2) > 0 Then TempNameModule2 = "F:DefBrain\" & filename2
If Len(filename3) > 0 Then TempNameModule3 = "F:DefBrain\" & filename3
If Len(filename4) > 0 Then TempNameModule4 = "F:DefBrain\" & filename4
If Len(filename5) > 0 Then TempNameModule5 = "F:DefBrain\" & filename5
If Len(filename6) > 0 Then TempNameModule6 = "F:DefBrain\" & filename6
If Len(filename7) > 0 Then TempNameModule7 = "F:DefBrain\" & filename7
If Len(filename8) > 0 Then TempNameModule8 = "F:DefBrain\" & filename8
If Len(filename9) > 0 Then TempNameModule9 = "F:DefBrain\" & filename9
If Len(filename10) > 0 Then TempNameModule10 = "F:DefBrain\" & filename10
'CREATE SOME TRACKING VARIABLES TO DETECT EXISTANCE OF A FILE.
If CellA = "" Then CellA = 0
If CellB = "" Then CellB = 0
If CellC = "" Then CellC = 0
If CellD = "" Then CellD = 0
If CellE = "" Then CellE = 0
If CellF = "" Then CellF = 0
If CellG = "" Then CellG = 0
If CellH = "" Then CellH = 0
If CellI = "" Then CellI = 0
If CellJ = "" Then CellJ = 0
If CellK = "" Then CellK = 0
If FileSys.FileExists(TempNameModule1) Then CellA = 1
If FileSys.FileExists(TempNameModule2) Then CellB = 1
If FileSys.FileExists(TempNameModule3) Then CellC = 1
If FileSys.FileExists(TempNameModule4) Then CellD = 1
If FileSys.FileExists(TempNameModule5) Then CellE = 1
If FileSys.FileExists(TempNameModule6) Then CellF = 1
If FileSys.FileExists(TempNameModule7) Then CellG = 1
If FileSys.FileExists(TempNameModule8) Then CellH = 1
If FileSys.FileExists(TempNameModule9) Then CellI = 1
If FileSys.FileExists(TempNameModule10) Then CellJ = 1
If FileSys.FileExists(TempNameModule) Then CellK = 1
'DELETE ALL STATIC MEMORY CELLS IF CELL 11 EXISTS.
If CellK = 1 Or InStr(1, OriginalSentence, "RESET MEMORY", 1) > 0 Then
If CellA = 1 Then FS.DeleteFile TempNameModule1
If CellB = 1 Then FS.DeleteFile TempNameModule2
If CellC = 1 Then FS.DeleteFile TempNameModule3
If CellD = 1 Then FS.DeleteFile TempNameModule4
If CellE = 1 Then FS.DeleteFile TempNameModule5
If CellF = 1 Then FS.DeleteFile TempNameModule6
If CellG = 1 Then FS.DeleteFile TempNameModule7
If CellH = 1 Then FS.DeleteFile TempNameModule8
If CellI = 1 Then FS.DeleteFile TempNameModule9
If CellJ = 1 Then FS.DeleteFile TempNameModule10
If CellK = 1 Then FS.DeleteFile TempNameModule
If InStr(1, OriginalSentence, "RESET MEMORY", 1) > 0 Then
BlockSave = True
GetResponse = "Memory Has Been Reset."
End If
End If
'Create Memory Cell 1
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory1.brn")
DebugInfo = DebugInfo & "Static Memory 1: " & StaticMemory1 & vbCrLf
If CellA = 0 And CellB = 0 And CellC = 0 And CellD = 0 And CellE = 0 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory1.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 2.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory1.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory2.brn")
DebugInfo = DebugInfo & "Static Memory 2: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 0 And CellC = 0 And CellD = 0 And CellE = 0 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory2.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 3.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory2.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory3.brn")
DebugInfo = DebugInfo & "Static Memory 3: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 0 And CellD = 0 And CellE = 0 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory3.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 4.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory3.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory4.brn")
DebugInfo = DebugInfo & "Static Memory 4: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 0 And CellE = 0 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory4.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 5.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory4.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory5.brn")
DebugInfo = DebugInfo & "Static Memory 5: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 0 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory5.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 6.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory5.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory6.brn")
DebugInfo = DebugInfo & "Static Memory 6: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 0 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory6.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 7.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory6.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory7.brn")
DebugInfo = DebugInfo & "Static Memory 7: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 1 And CellG = 0 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory7.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 8.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory7.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory8.brn")
DebugInfo = DebugInfo & "Static Memory 8: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 1 And CellG = 1 And CellH = 0 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory8.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 9.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory8.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory9.brn")
DebugInfo = DebugInfo & "Static Memory 9: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 1 And CellG = 1 And CellH = 1 And CellI = 0 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory9.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 10.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory9.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory10.brn")
DebugInfo = DebugInfo & "Static Memory 10: " & StaticMemory2 & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 1 And CellG = 1 And CellH = 1 And CellI = 1 And CellJ = 0 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory10.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If
'Custom Memory Cell 11.
StaticMemory1 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory10.brn")
StaticMemory2 = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory11.brn")
DebugInfo = DebugInfo & "-----[Reset Static Memory when Cell 11 is filled]-----" & vbCrLf
If CellA = 1 And CellB = 1 And CellC = 1 And CellD = 1 And CellE = 1 And CellF = 1 And CellG = 1 And CellH = 1 And CellI = 1 And CellJ = 1 And CellK = 0 Then
'Here we have to save at least 3 of the same sentence to make it responsive in the memory trigger.
HalBrain.AppendFile WorkingDir & Trim(UCase(UserName)) & "_StaticMemory11.brn", Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence)) & vbCrLf & Trim(UCase(OriginalSentence))
End If

'The Very best to all and have fun with Ziggy's Short Term Memory Brain Cells.

'Jerry [8D]

'Note!
'Download the script here, The above script is missing
'important directory characters so use the script from
'from this downloadable file.

Download Attachment: ZiggyStaticArray.txt
18.24 KB
« Last Edit: July 20, 2005, 07:51:28 pm by onthecuttingedge2005 »

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Ziggy's Static Memory Array v1.1
« Reply #1 on: July 20, 2005, 08:54:09 pm »
Thanks OTCE, thats going to take some digesting[:p].


onthecuttingedge2005

  • Guest
Ziggy's Static Memory Array v1.1
« Reply #2 on: July 20, 2005, 09:15:37 pm »
'Here is one of the things you can do with
'Ziggy's Static Array Memory v1.1

'IF A SUBJECT IS NOT KNOWN THEN ASK THE USER ABOUT SOMETHING THEY RECENTLY SPOKE ABOUT.
'BASED OFF OF SHORT TERM MEMORY OF ZIGGY'S STATIC MEMORY ARRAY AS A POSSIBLE RESPONSE.
If Len(GetResponse) = 0 Then
Spinner = RND*100
If (Spinner > 0 And Spinner <= 10) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory1.brn")
If (Spinner > 10 And Spinner <= 20) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory2.brn")
If (Spinner > 20 And Spinner <= 30) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory3.brn")
If (Spinner > 30 And Spinner <= 40) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory4.brn")
If (Spinner > 40 And Spinner <= 50) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory5.brn")
If (Spinner > 50 And Spinner <= 60) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory6.brn")
If (Spinner > 60 And Spinner <= 70) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory7.brn")
If (Spinner > 70 And Spinner <= 80) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory8.brn")
If (Spinner > 80 And Spinner <= 90) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory9.brn")
If (Spinner > 90 And Spinner <= 100) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory10.brn")
Dim LastDiscussed
If Len(LastDiscussed) > 0 Then
Select Case (Int(Rnd * 10) + 1)
             Case 1
               GetResponse = "You said earlier" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 2
               GetResponse = "You said something earlier" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 3
               GetResponse = "I recall earlier that you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 4
               GetResponse = "I recall you saying" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 5
               GetResponse = "What did you mean when you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 6
               GetResponse = "Could you explain why you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 7
               GetResponse = "Please explain why you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 8
               GetResponse = "Can you tell me why you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 9
               GetResponse = "When you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf
             Case 10
               GetResponse = "What did you mean when you said" & ", " & LastDiscussed & ", " & " What did you mean" & "? " & vbCrLf    
          End Select
End If
End If


'Have fun
'Jerry [8D]
« Last Edit: July 20, 2005, 11:25:41 pm by onthecuttingedge2005 »

onthecuttingedge2005

  • Guest
Ziggy's Static Memory Array v1.1
« Reply #3 on: July 21, 2005, 02:25:14 am »
Here is another module that I wrote that can be plugged into Ziggy's Static Memory Array v1.1

'Ziggy's Master recollection from short term memory.
If MasterRecall = "" Then MasterRecall = 0
If InStr(1, OriginalSentence, "WHAT DID I SAY", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT DID I JUST SAY", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "TELL ME WHAT I JUST SAID", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT THE HELL DID I JUST SAY", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT DID I JUST TELL YOU", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT THE HELL WAS I JUST SAYING", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "TELL ME SOMETHING WE JUST TALKED ABOUT", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "DO YOU REMEMBER WHAT WE WERE TALKING ABOUT", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT WAS IT WE WERE TALKING ABOUT", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "I CAN'T REMEMBER WHAT WE WERE TALKING ABOUT", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "WHAT WAS IT THAT WE WERE TALKING ABOUT", 1) > 0 Then MasterRecall = 1
If InStr(1, OriginalSentence, "DO YOU REMEMBER OUR RECENT DISCUSSION", 1) > 0 Then MasterRecall = 1
Spinner = RND*100
If MasterRecall = 1 Then
If (Spinner > 0 And Spinner <= 10) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory1.brn")
If (Spinner > 10 And Spinner <= 20) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory2.brn")
If (Spinner > 20 And Spinner <= 30) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory3.brn")
If (Spinner > 30 And Spinner <= 40) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory4.brn")
If (Spinner > 40 And Spinner <= 50) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory5.brn")
If (Spinner > 50 And Spinner <= 60) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory6.brn")
If (Spinner > 60 And Spinner <= 70) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory7.brn")
If (Spinner > 70 And Spinner <= 80) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory8.brn")
If (Spinner > 80 And Spinner <= 90) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory9.brn")
If (Spinner > 90 And Spinner <= 100) Then LastDiscussed = HalBrain.ChooseSentenceFromFile(WorkingDir & Trim(UCase(UserName)) & "_StaticMemory10.brn")
If LastDiscussion = "" Then LastDiscussion = 0
If Len(LastDiscussed) > 0 Then LastDiscussion = 1
If Len(LastDiscussed) > 0 Then
Select Case (Int(Rnd * 5) + 1)
             Case 1
               GetResponse = "You said earlier" & ", " & LastDiscussed & ", " & " why" & "? " & vbCrLf
             Case 2
               GetResponse = "You said something earlier" & ", " & LastDiscussed & ", " & " why" & "? " & vbCrLf
             Case 3
               GetResponse = "I recall earlier that you said" & ", " & LastDiscussed & ", " & " why do you ask" & "? " & vbCrLf
             Case 4
               GetResponse = "I recall you saying" & ", " & LastDiscussed & ", " & " is that what you were referring too" & "? " & vbCrLf
             Case 5
               GetResponse = "You mean when you said" & ", " & LastDiscussed & "? " & vbCrLf  
          End Select
End If
End If
'If Master Recollection has no response then tell the user that I forgot.
If MasterRecall = 1 And LastDiscussion = 0 Then
Select Case (Int(Rnd * 5) + 1)
             Case 1
               GetResponse = "I don't remember."
             Case 2
               GetResponse = "I think I forgot." & vbCrLf
             Case 3
               GetResponse = "I'm sorry, I don't remember." & vbCrLf
             Case 4
               GetResponse = "I recall you saying" & vbCrLf
             Case 5
               GetResponse = "Please forgive, I forgot what you said." & vbCrLf  
          End Select
          End If


'Enjoy
'Jerry [8D]
« Last Edit: July 21, 2005, 02:54:39 am by onthecuttingedge2005 »

onthecuttingedge2005

  • Guest
Ziggy's Static Memory Array v1.1
« Reply #4 on: July 21, 2005, 02:34:08 am »
All these scripts are from my Ziggy Pro Chat Bot Series.
There are many more.

Jerry.

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Ziggy's Static Memory Array v1.1
« Reply #5 on: July 22, 2005, 02:04:56 pm »
For temporary storage of arrays, I think it would be easier to use real vb arrays and store them using the split and join commands into custommem.

The following code keeps track of Hal's last 10 sentences in an array.
Code: [Select]
SentArray = HalBrain.ExtractVar(CustomMem, "SentArray") 'Extract string from custommem
If SentArray = "" Then SentArray = "[%,%][%,%][%,%][%,%][%,%][%,%][%,%][%,%][%,%][%,%]" 'Initialize to 10 entries
SentenceArray = Split(SentArray, "[%,%]") 'Extract array from string
'Shift sentences down by 1
For i = 0 To 9
    SentenceArray(i) = SentenceArray(i + 1)
Next i
'Store latest response in array
SentenceArray(9) = PrevSent

So now you can reference SentenceArray(x) where x is a number from 0 to 9. 9 means Hal's previous response, 8 means 2 responses ago, 7 is 3 responses ago, etc.

At the end of the script, you have to store the array back to custommem like this:
Code: [Select]
'Join array back into string
SentArray = Join(SentenceArray, "[%,%]")
CustomMem = CustomMem & HalBrain.EncodeVar(SentArray, "SentArray")
Robert Medeksza

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Ziggy's Static Memory Array v1.1
« Reply #6 on: July 23, 2005, 01:08:52 am »
Robert,
Interesting, although still not ideal, it will suffice. I still long for multidimensional static arrays. I know, call me fussy.


=vonsmith=
 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Ziggy's Static Memory Array v1.1
« Reply #7 on: July 23, 2005, 11:41:50 am »
I'm a little slim on VBScript specifics as you might have guessed, does it not allow DIMentioned arrays?

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Ziggy's Static Memory Array v1.1
« Reply #8 on: July 23, 2005, 05:13:12 pm »
freddy888,
At first glance I don't think so. Try it out. I think the same principle can be applied to any variables that can be represented by a string value. So using the same principle, with a little work, it could be used for multidimensional arrays. It bothers me a little to rely on using the CustomMem function to pass a lot of variables around. It is a work-around and theoretically not very efficient. Like I said though, it will suffice.


=vonsmith=
 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Ziggy's Static Memory Array v1.1
« Reply #9 on: July 25, 2005, 09:33:06 am »
hhmm, I know what you mean there, I found cutommem really handy for a few things I did, but held back on using it for anything like arrays as I didn't know how much it is set up to handle.

I suppose you could use the database like you would an array, but  not so effeciently.

I'll get around to checking out the DIM thing at some point and will let you know, I'm not currently working on the brains..