Zabaware Forums > Programming using the Ultra Hal Brain Editor

Pick And Pull Scripts

(1/2) > >>

onthecuttingedge2005:
I Started this thread so we can show off Tid Bit skills and helpful functions. please keep the
scripts small as possible.

'Also, I am not responsible for your mistakes in using any pick and pull scripts
'use at your own risk.

'here is another edge.


--- Code: ---
'Compliments of The Edge.
    'Tight little package for ending any further responses.
    'Exit Function does the same thing but when that becomes
    'illegal in a script this little Tid Bit can save ones butt.
    'this line goes to top of a routine or function.
    'it extracts stored variables for script transfer.
    EndResponse = HalBrain.ExtractVar(CustomMem, "EndResponse")
    'variable to end a script specifically as a priority.
    'if True then End Response.
    EndResponse = False
    'the magic bullets are here.
    If EndResponse = True Then OriginalSentence = ""
    If EndResponse = True Then UserSentence = ""
    'place our variables back into custom memory.
    'usually located at bottom of a function.
    CustomMem = HalBrain.EncodeVar(EndResponse, "EndResponse")


--- End code ---

'Example:
If SomeVariable <> "" Then
GetResponse = "" & SomeResponse & ""
'priority response
EndResponse = True
'no more GetResponse's will be given
'below this script line.
End If


Enjoy!
Happy Holidays.
Jerry 8)

onthecuttingedge2005:
'A Work of Art. for all you scrip-tors who like to scribe, lol
'This Script removes duplicate responses inside a full GetResponse.

'updated
'added punctuation adjustments for periods with no space trailing.

'The Script & help.

--- Code: ---
'Compliments of the Edge.
'Remove duplicate responses from full getresponse.
'Usually more effective near the bottom of all getresponses.
'This routine does work for all responses, PrevSent, PrevUserSent
'OriginalSentence and UserSentence i.e GetResponse.
HalString = GetResponse', <-- change this to what you want cleaned.
GetResponse = "" 'temporaraly suspend getresponse for cleaning.
Set oDict = CreateObject("Scripting.Dictionary")
oDict.CompareMode = vbTextCompare
For Each Sentence In Split(HalString, ". ")
    oDict(Sentence) = Null
Next
MasterResponse = Join(oDict.Keys, ". ")
'Adjust for punctuation.
MasterResponse = Replace(MasterResponse, "  ", " ", 1, - 1, vbTextCompare)
MasterResponse = Replace(MasterResponse, ".", ". ", 1, -1, vbTextCompare)
MasterResponse = Replace(MasterResponse, "  ", " ", 1, -1, vbTextCompare)
GetResponse = MasterResponse', <-- all duplicate entries in Getresponse
'are removed before the response is given.
GetResponse = GetResponse & vbCrLf
Set oDict = Nothing
HalBrain.DebugWatch MasterResponse, "MasterResponse"


--- End code ---

this script works best between Rem PLUGIN: PLUGINAREA7 and
Rem PLUGIN: CUSTOMMEM2 in the Hal Brain Editor. to catch as many
GetResponses as possible. assembled getresponses act differently because
of word assembly differences. if there is 1% difference between
compares the script will consider it as being different and not remove it
from the getresponse list. but it will be different.

always make a backup, even if you are experienced.

download below to your Ultra Hal 6 or 7 folder
choose plug in brain options.

Happy Holidays and Merry Christmas.
Jerry 8)

onthecuttingedge2005:
updated the GetResponse cleaner script.

1. temporarily clipped GetResponse during cleaning
and then re-insert GetResponse As Cleaned.

I'll probably make a plug for this soon. because it is a utility.
really, every script needs a janitor? C'mon.. lol

okay, I'll call it the Janitor, you happy, lol

okay, plug-in download is posted

Jerry 8)

Arkright:
Thank you OnTheCuttingEdge!
what would the world be without janitors of any kind.

onthecuttingedge2005:
thanks. I appreciate the boost.

Navigation

[0] Message Index

[#] Next page

Go to full version