Jump to content

Unknown Error


Recommended Posts

This code is giving me a VERY weird error.

#Include <Array.au3>

$Var = "Who made you?"   ;;Test Var
$Similar_Find = Find_Similar($Var)
MsgBox(48, "TestBox", $Similar_Find)


Func Find_Similar($To_Find_Similar)
    $AllKeysAndValues = IniReadSection("C:\InIBrain", "CommunicationSector")
    $Max = _ArrayMax($AllKeysAndValues) 
    Dim $Result[$Max]
    For $Step = 1 To $Max
        $Result = Compare($AllKeysAndValues[$Step], $To_Find_Similar)
        If $Result = "Similarity Found" Then
            Return($AllKeysAndValues[$Step])
        EndIf
    Next
    Return("No Find")
EndFunc   ;==>Find_Similar

Func Compare($Comparison1,$Comparison2)
    If $Comparison1 = $Comparison2 Then
        Return("Similarity Found")
    EndIf
EndFunc

Here is the Ini File tht goes with it,

CODE
[CommunicationSector]

Are you gay?=No you are.%Annoyed

Thank You=Your Welcome|No Problem|Anytime%Happy

Ty=Your Welcome|No Problem|Anytime%Happy

Your awesome!=I know|You are Too!|Awesome to the max!%Happy

Your Awesome=You Are Too!|I know|Totally|Yup|You To!% Happy

Who is your creator?=Josh Stein%Default

Who made you?=ByteMyCookies%Default

This is the error I get,

C:\Program Files\AutoIt3\Include\Array.au3 (352) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

If $avArray[$iMaxIndex] < $avArray[$iCntr] Then

If ^ ERROR

Someone please tell me what is going on, or how to fix this.

My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!

Link to comment
Share on other sites

_ArrayMax() only works on 1 dimentional ararys. The array you read from IniSectionRead() is 2 dimentional.

It possible that it would be conisdered a bug for the _ArrayMax() function to not return an error...

The fix for the Array.au3 file would probably be on line 319 to make it -

If IsArray($avArray) and UBound($avArray,0)=1 Then

then the error is in your hands, becuase you didn't check you return value... I'll make a report and see what they think

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...