You're new problem was at the end of a line that you checked char per char. If the last "word" was a variable, there was nothing that added the variable to your "dictionary counting system" and nothing to reset "$match = 1" to "$match = 0".

About NoVarsInStrings and NoMacrosInStrings.
For me, string is string. Anything written in a string should be interpreted as a string. If it works in another way, then it is just too confusing.
try this
Code:

Break On
? "NoVarsInStrings is Off"
? "$a = "
? "$$a = "
? "$ = "
? "$$ = "
$a = 5
$ = 7
? "$a = " + $a
? "$$a = " + $a
? "$ = " + $
? "$$ = " + $
? "Now we set NoVarsInStrings On"
Dim $RC
$RC = SetOption("NoVarsInStrings","On")
? "$a = " + $a
? "$$a = " + $a
? "$ = " + $
? "$$ = " + $


Do you see the difference? IMHO, good practice to get better code: NoVarsInStrings=On.
The same goes for NoMacrosInStrings. Will I invent an example script to make it clear? Or will you invent something?
About Explicit: there are some reasons to declare your vars.
  • Avoid typos
    you would notice type errors like in this question
  • All vars that you do not declare are global
    Just play with the semicolons in this script:
    Code:

    If NOT @LOGONMODE
    Break On
    Else
    Break Off
    EndIf
    Dim $RC
    ;$RC = SetOption("Explicit","On")
    $RC = SetOption("NoVarsInStrings","On")
    $RC = SetOption("NoMacrosInStrings","On")
    $RC = SetOption("WrapAtEOL","On")

    MakeGlobalVar
    ? $ThisIsAGlobalVar

    Function MakeGlobalVar()
    ;Dim $ThisIsAGlobalVar
    ;Global $ThisIsAGlobalVar
    $ThisIsAGlobalVar = "Do you really want this?"
    EndFunction



Now these are my preferences. You do not have to use them if you do not want to.

[Edit]
I see you added this to your Addtodict function
Code:

$Match = 0 $Var = "$"


IMHO it does not belong there and it is just working because you do not declare your vars. They are global.
You should also write your function in a way that you "feed" the things to your function. Look at CombSort().
Try this, play with the semicolons. I do not like MutliplyTwo
Code:

If NOT @LOGONMODE
Break On
Else
Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit","On")
$RC = SetOption("NoVarsInStrings","On")
$RC = SetOption("NoMacrosInStrings","On")
$RC = SetOption("WrapAtEOL","On")

Dim $a, $b, $c
;Global $a, $b, $c
$a = 3
$b = 4
$c = MultiplyOne($a, $b)
? $c
;? MultiplyTwo()

Function MultiplyOne($i, $j)
$MultiplyOne = $i * $j
EndFunction

;Function MultiplyTwo()
; $a * $b
;EndFunction


[/Edit]


Edited by Witto (2006-09-25 05:23 PM)