Advertisement
Aareon

Salty Bets Bot

May 13th, 2015
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.98 KB | None | 0 0
  1. #Include <File.au3>
  2. #Include <MsgBoxConstants.au3>
  3.  
  4. Global $file = @ScriptDir & "\saltlick.txt"
  5.  
  6. getFighters()
  7.  
  8. Func getFighters()
  9.     Global $leftChoose = InputBox("Find a fight","Who is fighting on the left side?")
  10.     Global $rightChoose = InputBox("Find a fight","Who is fighting on the right side?")
  11.     Global $search = $leftChoose&"*"&$rightChoose
  12.     Global $src = 0
  13.     Global $srcnum = 1
  14.         Global $fileLines = _FileCountLines($file)
  15.     Global $revFlag = 0
  16.     setSearch()
  17. EndFunc
  18.  
  19. Func setSearch()
  20.     If $src == 0 Then
  21.          FileOpen($file, $FO_READ)
  22.          search()
  23.     EndIf
  24. EndFunc
  25.  
  26. Func search()
  27.     Do
  28.          $sFileRead = FileReadLine($file, $srcnum)
  29.          If StringInStr($sFileRead, $search) Then ;;If the string fragment is found in the file
  30.              $aSpl = StringSplit($sFileRead, "+") ;;Split everything before probability
  31.              If $revFlag == 1 Then ;;If the string has been reversed, reverse the everything else
  32.                 $aRevSpl = StringSplit($aSpl[2], ":")
  33.                 If $aSpl[3] == "R" Then
  34.                     $aSpl[3] = "L"
  35.                 Else
  36.                     $aSpl[3] = "R"
  37.                 EndIf
  38.                 MsgBox($MB_SYSTEMMODAL, "Odds", "Left: "&$leftChoose&"   |   Right: "&$rightChoose&@CRLF&"Win        Probability: "&$aRevSpl[2]&":"&$aRevSpl[1]&@CRLF&"Historical outcome: "&$aSpl[3]&@CRLF&@CRLF&"Date recorded: "&$aSpl[4])
  39.              Else
  40.                 MsgBox($MB_SYSTEMMODAL, "Odds", "Left: "&$leftChoose&"   |   Right: "&$rightChoose&@CRLF&"Win Probability: "&$aSpl[2]&@CRLF&"Historical outcome: "&$aSpl[3]&@CRLF&@CRLF&"Date recorded: "&$aSpl[4])
  41.             EndIf
  42.         ElseIf $srcnum == $fileLines AND $revFlag = 0 Then ;;If string isn't in the file and string hasn't been reversed
  43.             $revFlag = 1 ;;Flag to reverse the search string
  44.             $srcnum = 1
  45.             $search = $rightChoose&"*"&$leftChoose
  46.             setSearch()
  47.             ExitLoop
  48.         Else
  49.              $srcnum+=1
  50.              search()
  51.         EndIf
  52.     Until 1
  53. EndFunc
  54.  
  55. ;;Try this out, let me know what you think. If you can figure out how to scrape the text from the Salty Bets webpage (www.saltybet.com), then please let me know. Thanks :) - /u/Bloody_Spork
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement