warum wurde colormode(option) entfernt? jetzt rennt ein programm nicht mehr :-(

  • hallo

    wie kann ich colormode ersetzen?

    hier das script:

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    If @ScriptName <> 'mm.ItemReader.exe' Then
    MsgBox (0, "Incorrect script name", "mm.ItemReader is the real name of this script.")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Not compatible with Old OS.
    ; ===========================
    If @OSTYPE == 'WIN32_WINDOWS' Then
    MsgBox (0, "Incorrect operating system", "mm.BOT is not compatible with windows 95/98/Me. Sorry.")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $BotProcessPriority = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "BotProcessPriority", "High")
    Select
    Case StringInStr ($BotProcessPriority, "ormal")
    $BotProcessPriority = "Normal speed"
    ProcessSetPriority (@ScriptName, 2)
    Case StringInStr ($BotProcessPriority, "edium")
    $BotProcessPriority = "Medium speed"
    ProcessSetPriority (@ScriptName, 3)
    Case StringInStr ($BotProcessPriority, "igh")
    $BotProcessPriority = "High speed"
    ProcessSetPriority (@ScriptName, 4)
    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    $ACT = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "ACT", 1)
    $WName = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "WName", 'Diablo II')
    $ItemFocusDelay = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "ItemFocusDelay", 150)
    $IdingMouseSpeed = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "IdingMouseSpeed", 2)
    $HotKey = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "HotKey", 'SPACE')
    $ClipPush = IniRead (@SCRIPTDIR & "\mm.ItemReader.ini", "mm.ItemReader", "ClipPush", 0)

    [/autoit] [autoit][/autoit] [autoit]

    ; Set up HotKeys to pause or stop the bot.
    ; ========================================
    HotKeySet("{end}", "ExitIW")
    Func ExitIW()
    WinActivate($WName,"")
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{" & $HotKey & "}", "ItemWriter")
    Func ItemWriter()
    ToolTip('==> ...DONT MOVE MOUSE: READING STATS... <==',0,0)
    $Name = ItemDescBox(1)
    LogItem ($Name)
    $Stats = ItemDescBox(2)
    If StringLen($Stats) > 7 Then
    LogItem ($Stats)
    EndIf
    If $ClipPush == 1 Then
    ClipPut ( $Name & @CRLF & $Stats)
    EndIf
    LogItem ("=====================================")
    ToolTip("")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Colors definition
    ; =================
    ;Act1
    $XUNIQUES_Color = 6521492
    $SETS_Color = 65304
    $XRARES_Color = 6535902
    $MAGICS_Color = 11358546
    $GRAYS_Color = 5394770
    $WHITES_Color = 13027270
    $UNID_RED_Color = 3229109
    $XUNIQUES_Color_A2 = 5933724
    $SETS_Color_A5 = 1623816

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Options
    ;======================================
    AutoItSetOption ( "ColorMode", 1 )
    AutoItSetOption("WinTitleMatchMode", 3)
    AutoItSetOption("WinWaitDelay", 250)
    AutoItSetOption ("PixelCoordMode", 0)
    AutoItSetOption ("MouseCoordMode", 0)
    ;======================================

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $XDiff = 0
    $YDiff = 0

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; ************************* M A I N *********************************

    [/autoit] [autoit][/autoit] [autoit]

    WinActivate($WName)
    Winmove($WName,'',0,0)
    WinWaitActive($WName)
    Sleep (500)
    GetCalibrate()
    While 1
    sleep (200)
    Wend
    ; ************************* M A I N *********************************

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func GetCalibrate()
    $CPoint = PixelSearch ( 15, 565, 35, 585, 9750503 )
    If @error == 1 Then
    MsgBox (0,"error","error")
    Exit
    EndIf
    $Xbase = 23
    $Ybase = 574
    $XDiff = $CPoint[0] - $Xbase
    $YDiff = $CPoint[1] - $Ybase
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===========================================================================
    ; Scan the whole screen and read item description with mode option:
    ; $Mode = 1 : return itemQual, name, identified or not (fast), and Ethereal status
    ; $Mode = 2 : return all text for string validation purpose (slow)
    ; requirement: cursor must be on the item to show item description box.
    ; requirement: Y box of the item ([6] item Y top pos in inv (item token...)
    ; $ITIndex = index of current working on item. (item token)
    ;===========================================================================
    Func ItemDescBox($Mode)
    $X_Start = 3 + $XDiff ; Left side of searching area
    $X_Stop = 795 + $XDiff ; Right side of searching area
    $Y_Start = 25 + $YDiff ; Up side of searching area
    $Y_Stop = 615 + $YDiff ; Bottom side of searching area
    $X = 0 ; Base X while searching
    $Y = 0 ; Base Y while searching
    $Xleft = 0 ; Left X side of an item box
    $Xright = 0 ; Right X side of an item box
    $Ytop = 0 ; Top Y side of an item box
    $Apix = 0 ; Elementary pixel color value
    For $Y = $Y_Start to $Y_Stop Step 12
    For $X = $X_Start to $X_Stop Step 49
    $Apix = PixelGetColor($X, $Y)
    If (($Apix == $XUNIQUES_Color) OR ($Apix == $XRARES_Color)OR ($Apix == $MAGICS_Color) OR ($Apix == $SETS_Color) OR ($Apix == $GRAYS_Color) OR ($Apix == $WHITES_Color) OR ($Apix == $SETS_Color_A5) OR ($Apix == $XUNIQUES_Color_A2)) Then
    $Xleft = $X
    Do
    $Xleft = $Xleft - 1
    $BlockTest = PixelGetColor($Xleft, $Y)
    Until ($BlockTest <> $Apix)
    $Xright = $X
    Do
    $Xright = $Xright + 1
    $BlockTest = PixelGetColor($Xright, $Y)
    Until ($BlockTest <> $Apix)
    If $Xright - $Xleft > 45 Then
    $Ytop = $Y
    Do
    $Ytop = $Ytop - 1
    $BlockTest = PixelGetColor($X, $Ytop)
    Until ($BlockTest <> $Apix)
    $XSStart = $Xleft - 250
    If $XSStart < 0 Then
    $XSStart = 0
    EndIf
    $XSStop = $Xleft + 350
    If $XSStop > 800 Then
    $XSStop = 800
    EndIf
    Dim $Ys_DB[700]
    For $YSearch = ($Ytop + 30) To (625 + $YDiff) Step 2
    $Apix1 = PixelGetColor ($Xright - 52, $YSearch)
    $Apix2 = PixelGetColor ($Xright + 2, $YSearch)
    $Apix3 = PixelGetColor ($Xright + 20, $YSearch)
    $Ys_DB[$YSearch] = ($Apix1 & $Apix2 & $Apix3)
    Next
    ; Shot the screen with the box description
    ; X axe shot
    Dim $Xs_DB[805]
    For $XSearch = $XSStart To $XSStop Step 2
    $Apix1 = PixelGetColor ($XSearch, $Ytop - 15)
    $Apix2 = PixelGetColor ($XSearch, $Ytop + 8)
    $Apix3 = PixelGetColor ($XSearch, $Ytop + 30)
    $Xs_DB[$XSearch] = ($Apix1 & $Apix2 & $Apix3)
    Next
    ; Analyse the scren without the item box description
    $OldMousePos = MouseGetPos()
    HideMouse()
    Sleep ($ItemFocusDelay)
    ; found left box side
    For $XSearch = $XSStart To $XSStop Step 2
    $Apix1 = PixelGetColor ($XSearch, $Ytop - 15)
    $Apix2 = PixelGetColor ($XSearch, $Ytop + 8)
    $Apix3 = PixelGetColor ($XSearch, $Ytop + 30)
    If $Xs_DB[$XSearch] <> ($Apix1 & $Apix2 & $Apix3) Then
    ExitLoop
    EndIf
    Next
    $LeftBox = $XSearch + 1
    ; found right box side
    For $XSearch = ($Xleft + 80 ) To $XSStop Step 2
    $Apix1 = PixelGetColor ($XSearch, $Ytop - 15)
    $Apix2 = PixelGetColor ($XSearch, $Ytop + 8)
    $Apix3 = PixelGetColor ($XSearch, $Ytop + 30)
    If $Xs_DB[$XSearch] == ($Apix1 & $Apix2 & $Apix3) Then
    ExitLoop
    EndIf
    Next
    $RightBox = $XSearch - 2
    ; found bottom side
    For $YSearch = ($Ytop + 30) To (625 + $YDiff) Step 2
    $Apix1 = PixelGetColor ($Xright - 52, $YSearch)
    $Apix2 = PixelGetColor ($Xright + 2, $YSearch)
    $Apix3 = PixelGetColor ($Xright + 20, $YSearch)
    If $Ys_DB[$YSearch] == ($Apix1 & $Apix2 & $Apix3) Then
    ExitLoop
    EndIf
    Next
    $BottomBox = $YSearch - 2

    [/autoit] [autoit][/autoit] [autoit]

    MouseMove ($OldMousePos[0] + Random(-1,1),$OldMousePos[1] + Random(-1,1) , $IdingMouseSpeed)
    Sleep ($ItemFocusDelay)
    $DownLines = Int(($BottomBox - ($Ytop + 12)) / 16) ; number of text lines under item NAME
    $Ytop = $Ytop + 1

    [/autoit] [autoit][/autoit] [autoit]

    If ($Mode == 1) Then
    Select
    Case $Apix == $XUNIQUES_Color OR $Apix == $XUNIQUES_Color_A2
    $Qualname = "Unique "
    Case $Apix == $SETS_Color OR $Apix == $SETS_Color_A5
    $Qualname = "Set "
    Case $Apix == $XRARES_Color
    $Qualname = "Rare "
    Case $Apix == $MAGICS_Color
    $Qualname = "Magic "
    Case $Apix == $GRAYS_Color
    $Qualname = "Gray "
    Case $Apix == $WHITES_Color
    $Qualname = "White "
    Case Else
    $Qualname = "Unknow quality "
    EndSelect
    $ItemName = ReadLine(1, $Apix, $Ytop, $Xright, $RightBox)
    If StringInStr ($ItemName, " Rune", 1) Then
    $Qualname = ""
    EndIf
    Return $Qualname & $ItemName
    EndIf
    If ($Mode == 2) Then
    $LineInc = 1
    $Stats = ""
    Do
    $LineText = ReadLine(2, $MAGICS_Color, $Ytop + (16 * ($LineInc)), $LeftBox, $RightBox)
    If $LineText <> "" AND StringLen($LineText) > 7 Then
    $Stats = $Stats & $LineText & @CRLF
    EndIf
    $LineInc = $LineInc + 1
    Until ($LineInc > $DownLines)
    Return $Stats
    EndIf
    EndIf
    EndIf
    Next
    $X = $X_Start
    Next
    Return "Unidentifiable"
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func HideMouse()
    MouseMove (790,610,$IdingMouseSpeed)
    Sleep ($ItemFocusDelay)
    MouseMove (790,610,$IdingMouseSpeed)
    Sleep ($ItemFocusDelay)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;**********************************************************************************************
    ; Using the modified fonts will transmute codes into characters and characters into strings.
    ; Mode 1 is dedicated for Item name reading (remove some "?" and " " in string) and avoid
    ; the white line Check throught a pixel search. $MAGICS_Color is the Blue Color Code (var passed)
    ;**********************************************************************************************
    Func Readline($mode, $ColorFont, $YTOP_STR, $Xleft, $Xright)
    ; Avoid White lines
    If $mode > 1 Then
    $Apix = PixelSearch($Xleft + 20, $YTOP_STR + 11, $Xright - 20, $YTOP_STR + 11, $WHITES_Color)
    If NOT @error Then
    Return ""
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Avoid loosed space front of strings in item description box
    $Apix = PixelSearch($Xleft, $YTOP_STR + 11, $Xleft + 280, $YTOP_STR + 11, $ColorFont)
    If NOT @error Then
    $Xleft = $Apix[0]
    Else
    Return ""
    EndIF

    [/autoit] [autoit][/autoit] [autoit]

    Dim $Char[200]
    $Yread = $YTOP_STR + 11
    $Yreadsub = $YTOP_STR + 12
    $Xread = $Xleft
    $CharIndex = 1
    While 1
    $Space = 0
    $CodeA = ""
    $CodeB = ""
    $Xreadstart = $Xread
    While 1
    $Apix = PixelGetColor($Xread, $Yread)
    $Xread = $Xread + 1
    If $Apix <> $ColorFont Then
    $CodeA = $CodeA & "0"
    $Space = $Space + 1
    If $Space > 1 Then
    While StringRight($CodeA,1) == "0"
    $CodeA = StringTrimRight($CodeA,1)
    Wend
    If StringLen($CodeA) < 5 Then
    $Space = 0
    While 1
    $Apix = PixelGetColor($Xreadstart, $Yreadsub)
    $Xreadstart = $Xreadstart + 1
    If $Apix <> $ColorFont Then
    $CodeB = $CodeB & "0"
    $Space = $Space + 1
    If $Space > 1 Then
    While StringRight($CodeB,1) == "0"
    $CodeB = StringTrimRight($CodeB,1)
    Wend
    If $CodeB == "" Then
    $CodeB = "0"
    EndIf
    ExitLoop 2
    EndIf
    Else
    $CodeB = $CodeB & "1"
    $Space = 0
    EndIf
    Wend
    EndIf
    ExitLoop
    EndIf
    Else
    $CodeA = $CodeA & "1"
    $Space = 0
    EndIf
    Wend
    $Char[$CharIndex] = CodeToChar($CodeA, $CodeB)
    $CharIndex = $CharIndex + 1

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $Apix = PixelGetColor($Xread, $Yread)
    If $Apix <> $ColorFont Then ;AND $Apix <> $WHITES_Color Then
    $Xread = $Xread + 1
    $Space = $Space + 1
    If $Xread >= $Xright Then
    ExitLoop 2
    EndIf
    If $Space > 4 Then
    $Char[$CharIndex] = " "
    $CharIndex = $CharIndex + 1
    $Apix = PixelSearch($Xread, $Yread, $Xread + 20, $Yread, $ColorFont)
    If NOT @error Then
    If $Apix[0] >= $Xright Then
    ExitLoop 2
    Else
    $Xread = $Apix[0]
    ExitLoop
    EndIf
    Else
    ExitLoop 2
    EndIf
    EndIf
    Else
    ExitLoop
    EndIf
    Wend
    Wend

    [/autoit] [autoit][/autoit] [autoit]

    $TheString = ""
    For $i = 1 To $CharIndex - 1
    $TheString = $TheString & $Char[$i]
    Next
    If $mode > 1 Then
    While (StringRight($TheString ,1) == " ")
    $TheString = StringTrimRight($TheString ,1)
    Wend
    Else
    While (StringRight($TheString ,1) == " " OR StringRight($TheString ,1) == "?")
    $TheString = StringTrimRight($TheString ,1)
    Wend
    While (StringLeft($TheString ,1) == " " OR StringLeft($TheString ,1) == "?")
    $TheString = StringTrimLeft($TheString ,1)
    Wend
    EndIf
    Return $TheString
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;************************************************************
    ; Using the modified fonts will transmute code into character
    ;************************************************************
    Func CodeToChar($CodeA, $CodeB)
    If $CodeB <> "" Then
    If $CodeA == "11" Then
    Select
    Case $CodeB == "0"
    Return "i"
    Case $CodeB == "1"
    Return "'"
    Case $CodeB == "11"
    Return "j"
    Case $CodeB == "111"
    Return ":"
    EndSelect
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $CodeA == "1011" Then
    Select
    Case $CodeB == "0"
    Return "s"
    Case $CodeB == "1"
    Return "h"
    Case $CodeB == "1101"
    Return "3"
    Case $CodeB == "111"
    Return "6"
    Case $CodeB == "11"
    Return "7"
    Case $CodeB == "101"
    Return "8"
    Case $CodeB == "1111"
    Return "9"
    Case $CodeB == "11"
    Return "7"
    Case $CodeB == "1011"
    Return "z"
    EndSelect
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $CodeA == "111" Then
    Select
    Case $CodeB == "1"
    Return "1"
    Case $CodeB == "111"
    Return "("
    Case $CodeB == "11"
    Return "J"
    EndSelect
    EndIf
    If $CodeA == "101" Then
    Select
    Case $CodeB == "101"
    Return "-"
    Case $CodeB == "1"
    Return ")"
    Case $CodeB == "11"
    Return "I"
    EndSelect
    EndIf
    If $CodeA == "1111" Then
    Return "S"
    EndIf
    If $CodeA == "1101" Then
    Select
    Case $CodeB == "0"
    Return "B"
    Case $CodeB == "1"
    Return "F"
    EndSelect
    EndIf
    Return "?"
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Select
    Case $CodeA == "11101"
    Return "e"
    Case $CodeA == "10101011"
    Return "a"
    Case $CodeA == "1101101"
    Return "t"
    Case $CodeA == "1010111"
    Return "n"
    Case $CodeA == "10101111"
    Return "o"
    Case $CodeA == "111101"
    Return "d"
    Case $CodeA == "101101"
    Return "+"
    Case $CodeA == "1011111"
    Return "g"
    Case $CodeA == "111011"
    Return "c"
    Case $CodeA == "10110101"
    Return "m"
    Case $CodeA == "1010101"
    Return "r"
    Case $CodeA == "10101"
    Return "l"
    Case $CodeA == "11101011"
    Return "%"
    Case $CodeA == "11010111"
    Return "R"
    Case $CodeA == "10110111"
    Return "D"
    Case $CodeA == "1011011"
    Return "2"
    Case $CodeA == "101010101"
    Return "A"
    Case $CodeA == "101011"
    Return "k"
    Case $CodeA == "10111101"
    Return "u"
    Case $CodeA == "110111"
    Return "5"
    Case $CodeA == "101011011"
    Return "0"
    Case $CodeA == "1101111"
    Return "4"
    Case $CodeA == "11011"
    Return "f"
    Case $CodeA == "101011101"
    Return "M"
    Case $CodeA == "110101"
    Return "L"
    Case $CodeA == "11111"
    Return "p"
    Case $CodeA == "101111"
    Return "E"
    Case $CodeA == "11011011"
    Return "v"
    Case $CodeA == "1110101"
    Return "C"
    Case $CodeA == "11011101"
    Return "y"
    Case $CodeA == "10111111"
    Return "x"
    Case $CodeA == "10111"
    Return "b"
    Case $CodeA == "1011101"
    Return "P"
    Case $CodeA == "101011111"
    Return "O"
    Case $CodeA == "101111011"
    Return "U"
    Case $CodeA == "1110111"
    Return "H"
    Case $CodeA == "101110111"
    Return "w"
    Case $CodeA == "1101011"
    Return "/"
    Case $CodeA == "11011111"
    Return "N"
    Case $CodeA == "101101101"
    Return "T"
    Case $CodeA == "1111011"
    Return "K"
    Case $CodeA == "10111011"
    Return "q"
    Case $CodeA == "11010101"
    Return "G"
    Case $CodeA == "101111101011"
    Return "W"
    Case $CodeA == "101101111"
    Return "V"
    Case $CodeA == "10101101"
    Return "Z"
    Case $CodeA == "101101011"
    Return "Q"
    Case $CodeA == "101010111"
    Return "X"
    Case $CodeA == "11010111"
    Return "R"
    Case $CodeA == "101110101"
    Return "Y"
    EndSelect
    Return "?"
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;=================================
    ; Provide the bot events log
    ;=================================
    Func LogItem($String)
    $LogFile = FileOpen (@SCRIPTDIR & "\mm.ItemReader.txt", 1)
    If $LogFile = -1 Then
    Return
    EndIf
    FileWriteLine ($LogFile, $String)
    FileClose ($LogFile)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]

    Edit Mega: Spoiler!


    //edit... colormode wird in zeile 76 verwendet.

    Einmal editiert, zuletzt von Xenobiologist (23. Juni 2008 um 19:57)