Jump to content

Ivanw

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ivanw's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Sorry i just came back from out of town , and to long to reply @ Volly. Sorry if you think so. But I don't think so. I didn't cheat to steal chip from that site. I just play a bot that will not always win , it can lost too. @JohnOne. Yes it is a texas holdem poker bot written by cornernote. @ zedna. Would you give me a simple example script for prospeed. I already serach in the example script for prospeed, but i didn't found one. Example: I have a.tiff picture to compare with the picture in area (x1,y1) to (x2,y2) Could you give a a simple script for that situation? Thanks in advance.
  2. Hi, Could somebody give me advice how to read the poker card in online game? I am new in programmer, and my english is not very good. Sorry. BTW this is my case. I have already a script from my friend, it use pixelcheksum. but it seems that not every same type card has the same pixelcheksum. here is the code : ;================================================================= ; Read the Cards ;================================================================= #include-once #Include "vendor/ScreenCapture/ScreenCaptureFixed.au3" #Include "Table.au3" Global $logScreenCard = Int(IniRead(@ScriptDir & "\settings.ini","Log","log_screen_card", 0)) Global $oCardDictionary = ObjCreate("Scripting.Dictionary") Global $oSuitDictionary = ObjCreate("Scripting.Dictionary") Global $sDataPath = '..\data' Global $sLogPath = '..\log' Global $aTop[2] Func _Cards($iSeat) Local $aCards[7], $aSuits[7] If $aTop[0] == False Then Return False EndIf If $iSeat < 1 Then Return False EndIf ; table card locations Local $aTableCard1_XY[2] Local $aTableCard2_XY[2] Local $aTableCard3_XY[2] Local $aTableCard4_XY[2] Local $aTableCard5_XY[2] ; seat card locations Local $aSeatCard1_XY[9][2] Local $aSeatCard2_XY[9][2] ; seat 1 $aSeatCard1_XY[0][0] = 527 $aSeatCard1_XY[0][1] = 33 $aSeatCard2_XY[0][0] = 552 $aSeatCard2_XY[0][1] = 33 ; seat 2 $aSeatCard1_XY[1][0] = 637 $aSeatCard1_XY[1][1] = 83 $aSeatCard2_XY[1][0] = 662 $aSeatCard2_XY[1][1] = 83 ; seat 3 $aSeatCard1_XY[2][0] = 647 $aSeatCard1_XY[2][1] = 205 $aSeatCard2_XY[2][0] = 672 $aSeatCard2_XY[2][1] = 205 ; seat 4 $aSeatCard1_XY[3][0] = 527 $aSeatCard1_XY[3][1] = 278 $aSeatCard2_XY[3][0] = 552 $aSeatCard2_XY[3][1] = 278 ; seat 5 $aSeatCard1_XY[4][0] = 402 $aSeatCard1_XY[4][1] = 283 $aSeatCard2_XY[4][0] = 427 $aSeatCard2_XY[4][1] = 283 ; seat 6 $aSeatCard1_XY[5][0] = 182 $aSeatCard1_XY[5][1] = 277 $aSeatCard2_XY[5][0] = 207 $aSeatCard2_XY[5][1] = 277 ; seat 7 $aSeatCard1_XY[6][0] = 62 $aSeatCard1_XY[6][1] = 205 $aSeatCard2_XY[6][0] = 87 $aSeatCard2_XY[6][1] = 205 ; seat 8 $aSeatCard1_XY[7][0] = 61 $aSeatCard1_XY[7][1] = 82 $aSeatCard2_XY[7][0] = 86 $aSeatCard2_XY[7][1] = 82 ; seat 9 $aSeatCard1_XY[8][0] = 182 $aSeatCard1_XY[8][1] = 33 $aSeatCard2_XY[8][0] = 207 $aSeatCard2_XY[8][1] = 33 ; table card 1 $aTableCard1_XY[0] = 287 $aTableCard1_XY[1] = 134 ; table card 2 $aTableCard2_XY[0] = 327 $aTableCard2_XY[1] = 134 ; table card 3 $aTableCard3_XY[0] = 367 $aTableCard3_XY[1] = 134 ; table card 4 $aTableCard4_XY[0] = 407 $aTableCard4_XY[1] = 134 ; table card 5 $aTableCard5_XY[0] = 447 $aTableCard5_XY[1] = 134 ; get the numbers $aCards[0] = _CardNumber($aTop[0]+$aSeatCard1_XY[$iSeat-1][0],$aTop[1]+$aSeatCard1_XY[$iSeat-1][1]) $aCards[1] = _CardNumber($aTop[0]+$aSeatCard2_XY[$iSeat-1][0],$aTop[1]+$aSeatCard2_XY[$iSeat-1][1]) $aCards[2] = _CardNumber($aTop[0]+$aTableCard1_XY[0],$aTop[1]+$aTableCard1_XY[1]) $aCards[3] = _CardNumber($aTop[0]+$aTableCard2_XY[0],$aTop[1]+$aTableCard2_XY[1]) $aCards[4] = _CardNumber($aTop[0]+$aTableCard3_XY[0],$aTop[1]+$aTableCard3_XY[1]) $aCards[5] = _CardNumber($aTop[0]+$aTableCard4_XY[0],$aTop[1]+$aTableCard4_XY[1]) $aCards[6] = _CardNumber($aTop[0]+$aTableCard5_XY[0],$aTop[1]+$aTableCard5_XY[1]) ; get the suits $aSuits[0] = _CardSuit($aTop[0]+$aSeatCard1_XY[$iSeat-1][0],$aTop[1]+$aSeatCard1_XY[$iSeat-1][1]) $aSuits[1] = _CardSuit($aTop[0]+$aSeatCard2_XY[$iSeat-1][0],$aTop[1]+$aSeatCard2_XY[$iSeat-1][1]) $aSuits[2] = _CardSuit($aTop[0]+$aTableCard1_XY[0],$aTop[1]+$aTableCard1_XY[1]) $aSuits[3] = _CardSuit($aTop[0]+$aTableCard2_XY[0],$aTop[1]+$aTableCard2_XY[1]) $aSuits[4] = _CardSuit($aTop[0]+$aTableCard3_XY[0],$aTop[1]+$aTableCard3_XY[1]) $aSuits[5] = _CardSuit($aTop[0]+$aTableCard4_XY[0],$aTop[1]+$aTableCard4_XY[1]) $aSuits[6] = _CardSuit($aTop[0]+$aTableCard5_XY[0],$aTop[1]+$aTableCard5_XY[1]) ;$aCards = _CardStringCheck(_CardCount()) ; convert to card string $sCards = _CardString($aCards,$aSuits) ;_ToolTip($sCards) Return $sCards EndFunc Func _CardChecksum($x,$y) Local $iChecksum ;$aCard = _CardsPosition($iCard) $iChecksum = PixelChecksum($x,$y,$x+6,$y+6) Return $iChecksum EndFunc Func _CardSuitChecksum($x,$y) Local $iChecksum ;$aCard = _CardsPosition($iCard) $iChecksum = PixelChecksum($x,$y+20,$x+6,$y+20+6) Return $iChecksum EndFunc Func _CardChecksumSave($x,$y) Local $iChecksum, $sFilename $iChecksum = _CardChecksum($x,$y) $sFilename = $sDataPath&'\card\'&$iChecksum If FileExists($sFilename&'.txt') Then Return EndIf Filewrite($sFilename&'.txt',$iChecksum) EndFunc Func _CardSuitChecksumSave($x,$y) Local $iChecksum, $sFilename $iChecksum = _CardSuitChecksum($x,$y) $sFilename = $sDataPath&'\suit\'&$iChecksum If FileExists($sFilename&'.txt') Then Return EndIf Filewrite($sFilename&'.txt',$iChecksum) EndFunc Func _CardNumber($x,$y) Local $iChecksum, $sFilename $iChecksum = _CardChecksum($x,$y) ;Load from dictionary If IsObj($oCardDictionary) And $oCardDictionary.Exists($iChecksum) Then Return $oCardDictionary.Item($iChecksum) EndIf ;Load from TXT If FileExists($sDataPath&'\card\empty\'&$iChecksum&'.txt') Then If IsObj($oCardDictionary) Then $oCardDictionary.Add($iChecksum,False) EndIf Return False EndIf Local $aFolders[13] = ["2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"] For $i = 0 to 12 If FileExists($sDataPath&'\card\'&$aFolders[$i]&'\'&$iChecksum&'.txt') Then $iCards = $aFolders[$i] If IsObj($oCardDictionary) Then $oCardDictionary($iChecksum,$iCards) EndIf Return $iCards EndIf Next ;Load from TIF If FileExists($sDataPath&'\card\empty\'&$iChecksum&'.tif') Then FileWrite($sDataPath&'\card\empty\'&$iChecksum&'.txt','empty') ;Save to txt If IsObj($oCardDictionary) Then $oCardDictionary.Add($iChecksum,False) EndIf Return False Endif Local $aFolders[13] = ["2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"] For $i = 0 to 12 If FileExists($sDataPath&'\card\'&$aFolders[$i]&'\'&$iChecksum&'.tif') Then $iCards = $aFolders[$i] FileWrite($sDataPath&'\card\'&$aFolders[$i]&'\'&$iChecksum&'.txt',$iCards) If IsObj($oCardDictionary) Then $oCardDictionary($iChecksum,$iCards) EndIf Return $iCards EndIf Next ;not found ;$aCard = _CardsPosition($iCard) If $logScreenCard <> 0 Then _ScreenCapture_Capture($sDataPath&'\card\'&$iChecksum&'.tif',$x-2,$y-2,$x+10,$y+14,False) EndIf Return False EndFunc ; get a suit based on a x/y location Func _CardSuit($x,$y) Local $iChecksum, $sFilename $iChecksum = _CardSuitChecksum($x,$y) ;Load from dictionary If IsObj($oSuitDictionary) And $oSuitDictionary.Exists($iChecksum) Then Return $oSuitDictionary.Item($iChecksum) EndIf ;Load from TXT If FileExists($sDataPath&'\suit\empty\'&$iChecksum&'.txt') Then If IsObj($oSuitDictionary) Then $oSuitDictionary.Add($iChecksum,False) EndIf Return False EndIf Local $aFolders[4] = ["c","d","h","s"] For $i = 0 to 3 If FileExists($sDataPath&'\suit\'&$aFolders[$i]&'\'&$iChecksum&'.txt') Then $sSuit = $aFolders[$i] If IsObj($oSuitDictionary) Then $oSuitDictionary($iChecksum,$sSuit) EndIf Return $sSuit EndIf Next ;Load from TIF If FileExists($sDataPath&'\suit\empty\'&$iChecksum&'.tif') Then FileWrite($sDataPath&'\suit\empty\'&$iChecksum&'.txt','empty') ;Save to txt If IsObj($oSuitDictionary) Then $oSuitDictionary.Add($iChecksum,False) EndIf Return False Endif Local $aFolders[4] = ["c","d","h","s"] For $i = 0 to 3 If FileExists($sDataPath&'\suit\'&$aFolders[$i]&'\'&$iChecksum&'.tif') Then $sSuit = $aFolders[$i] FileWrite($sDataPath&'\suit\'&$aFolders[$i]&'\'&$iChecksum&'.txt',$sSuit) If IsObj($oSuitDictionary) Then $oSuitDictionary($iChecksum,$sSuit) EndIf Return $sSuit EndIf Next ;not found ;$aCard = _CardsPosition($iCard) If $logScreenCard <> 0 Then _ScreenCapture_Capture($sDataPath&'\suit\'&$iChecksum&'.tif',$x-10,$y+20-10,$x+6+10,$y+20+6+10,False) EndIf Return False ;Local $iChecksum = PixelChecksum($x,$y+20,$x+6,$y+20+6) ;If IsObj($oSuitDictionary) And $oSuitDictionary.Exists($iChecksum) Then ; Return $oSuitDictionary.Item($iChecksum) ;EndIf ;Local $sSuit = IniRead($sDataPath & "\suit.ini","SuitChecksum",$iChecksum,'-') ;If $sSuit <> '-' Then ; If IsObj($oSuitDictionary) Then ; $oSuitDictionary.Add($iChecksum,$sSuit) ; EndIf ; Return $sSuit ;EndIf ; unknown suit ;If $logScreenCard <> 0 Then ; $sImageFilename = $sLogPath&'\suit\'&$iChecksum ; _ScreenCapture_Capture($sImageFilename&'.tif',$x-10,$y+20-10,$x+6+10,$y+20+6+10,False) ;EndIf ;If IsObj($oSuitDictionary) Then ; $oSuitDictionary.Add($iChecksum,False) ;EndIf ;Return False EndFunc Func _CardString($aCards,$aSuits) Local $sCards If ($aCards[0]<>False And $aCards[1]<>False) Or ($aCards[2]<>False) Then If $aCards[0]<>False And $aCards[1]<>False Then $sCards = $aCards[0] & $aSuits[0] & ' ' & $aCards[1] & $aSuits[1] Else $sCards = '-- --' EndIf If $aCards[2]<>False And $aCards[3]<>False And $aCards[4]<>False Then $sCards = $sCards & ' ' & $aCards[2] & $aSuits[2] & ' ' & $aCards[3] & $aSuits[3] & ' ' & $aCards[4] & $aSuits[4] If $aCards[5]<>False Then $sCards = $sCards & ' ' & $aCards[5] & $aSuits[5] If $aCards[6]<>False Then $sCards = $sCards & ' ' & $aCards[6] & $aSuits[6] EndIf EndIf EndIf EndIf Return $sCards EndFunc Func _CardNumbersArray($sCards) Local $aCards[7] Local $aCardsTmp = StringSplit($sCards,' ',1) For $i = 0 To UBound($aCardsTmp)-1 If $i>0 Then $aCards[$i-1] = StringLeft($aCardsTmp[$i],1) EndIf Next Return $aCards EndFunc Func _CardSuitsArray($sCards) Local $aSuits[7] Local $aSuitsTmp = StringSplit($sCards,' ',1) For $i = 0 To UBound($aSuitsTmp)-1 If $i>0 Then $aSuits[$i-1] = StringRight($aSuitsTmp[$i],1) EndIf Next Return $aSuits EndFunc So the script is make a tiff image everytime it can't read the cards. and we just put that image to the proper folder (2,3,4,5..,K,J,Q,A). I have already at least 30 image in every folder. But the bot only read about 10% of the cards. While the bot running and can't recognize the cards it make tiff image and at that time I manually directly put that image in the proper folder, then the bot can read the card instanly. And in the next period it can't read the cards again. Maybe the online poker game give different colour cards even for the same type card (Ex.: As for round one diff. with As for round two). But for the suit is not a problem. Is the pixelcheksum can't handle in this situation? Or must use imagesearch? Thanks for anyone could help.
×
×
  • Create New...