Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

PlayerTracker

By: a guest on Feb 28th, 2013  |  syntax: None  |  size: 3.68 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <GUIConstantsEx.au3>
  2. Global $tab, $msg, $setstate, $check, $track, $about, $name, $k, $d, $a, $role, $comment, $go, $nr, $kr, $dr, $ar, $rr, $cr, $sn, $sk, $sd, $sa, $sr, $sc, $sgo, $path = @MyDocumentsDir & "\PlayerTracker.ini", $nsn, $sds, $sks, $sas, $srs, $scs
  3. MainGUI()
  4.  
  5.  
  6. Func MainGUI()
  7.    
  8.    Call ("SGUI")
  9. EndFunc
  10. Func SGUI()
  11.    
  12.    GUICreate ("Spike's Player Tracker", 600, 300)
  13.    
  14.    $tab = GUICtrlCreateTab(1, 1, 598, 298)
  15.  
  16.  
  17.    $track = GUICtrlCreateTabItem ("Track")
  18.  GUICtrlCreateLabel ("Input Player Name:", 5, 30, 100, 20)
  19.  $name = GUICtrlCreateInput ("", 5, 50, 100, 20)
  20.  GUICtrlCreateLabel ("Input Player Score:", 120, 30, 100, 20)
  21.  GUICtrlCreateLabel ("Kills:", 120, 50, 40, 20)
  22.  $k = GUICtrlCreateInput ("", 170, 50, 40, 20)
  23.  GUICtrlCreateLabel ("Deaths: ", 120, 70, 50, 20)
  24.  $d = GUICtrlCreateInput ("", 170, 70, 40, 20)
  25.  GUICtrlCreateLabel ("Assists:", 120, 90, 50, 20)
  26.  $a = GUICtrlCreateInput ("", 170, 90, 40, 20)
  27.  GUICtrlCreateLabel ("Role:", 5, 90, 100, 20)
  28.  $role = GUICtrlCreateInput ("", 5, 110, 100, 20)
  29.  GUICtrlCreateLabel ("Comments:", 300, 30, 100, 20)
  30.  $comment = GUICtrlCreateInput ("", 300, 50, 295, 245)
  31.  $go = GUICtrlCreateButton ("Save", 100, 200, 100, 70)
  32.  
  33.    $check = GUICtrlCreateTabItem ("Check")
  34.  GUICtrlSetState(-1,$GUI_SHOW)
  35.  GUICtrlCreateLabel ("Search Player Name:", 5, 30, 100, 20)
  36.  $sn = GUICtrlCreateInput ($nsn, 5, 50, 100, 20)
  37.  GUICtrlCreateLabel ("Player Score:", 120, 30, 100, 20)
  38.  GUICtrlCreateLabel ("Kills:", 120, 50, 40, 20)
  39.  GUICtrlCreateLabel ("Deaths: ", 120, 70, 50, 20)
  40.  GUICtrlCreateLabel ("Assists:", 120, 90, 50, 20)
  41.  GUICtrlCreateLabel ("Role:", 5, 90, 100, 20)
  42.  GUICtrlCreateLabel ("Comments:", 300, 30, 100, 20)
  43.  $sgo = GUICtrlCreateButton ("Save", 100, 200, 100, 70)
  44.  
  45.  GUICtrlCreateInput ($sks, 170, 50, 40, 20)
  46.  GUICtrlCreateInput ($sds, 170, 70, 40, 20)
  47.  GUICtrlCreateInput ($sas, 170, 90, 40, 20)
  48.  GUICtrlCreateInput ($srs, 5, 110, 100, 20)
  49.  GUICtrlCreateInput ($scs, 300, 50, 295, 245)
  50.  
  51.    $about = GUICtrlCreateTabItem ("About")
  52.  GUICtrlCreateLabel ("I'm lazy, still have to do this", 5, 30, 500, 250)
  53.    GUICtrlSetState($check,$GUI_SHOW)
  54.    $setstate = GUISetState()
  55.    
  56. Call ("Open")
  57. Endfunc
  58.  
  59.  Func Save()
  60.    $nr = GUICtrlRead ($name)
  61.    $kr = GUICtrlRead ($k)
  62.    $dr = GUICtrlRead ($d)
  63.    $ar = GUICtrlRead ($a)
  64.    $rr = GUICtrlRead ($role)
  65.    $cr = GUICtrlRead ($comment)
  66.    
  67.    IniWriteSection ($path, $nr, "")
  68.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Name", $nr)
  69.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Kills", $kr)
  70.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Deaths", $dr)
  71.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Assists", $ar)
  72.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Role", $rr)
  73.    IniWrite (@MyDocumentsDir & "\PlayerTracker.ini", $nr, "Comments", $cr)
  74.    
  75. EndFunc
  76.  
  77. Func Search ()
  78.    
  79.    $nsn = GUICtrlRead ($sn)
  80.  
  81.    $sks = IniRead ($path, $nsn, "Kills", "XX")
  82.    $sds = IniRead ($path, $nsn, "Deaths", "XX")
  83.    $sas = IniRead ($path, $nsn, "Assists", "XX")
  84.    $srs = IniRead ($path, $nsn, "Role", "XXXXXX")
  85.    $scs = IniRead ($path, $nsn, "Comments", "XXXXXXXX")
  86.    GUICtrlDelete ($check)
  87.    GUICtrlDelete ($track)
  88.    GUICtrlDelete ($about)
  89.    if $sks = "XX" Then
  90.  MSGBox (0, "Not Found", "No Player Found!")
  91.    Else
  92.  msgbox (0, "Complete", "Search Complete! Press OK to show the results.")
  93.    Endif
  94.    GUIDelete()
  95.    Call ("SGUI")
  96.    
  97. EndFunc
  98. Func Open()
  99.    While $msg <> $GUI_EVENT_CLOSE
  100.         $msg = GUIGetMsg()
  101.         Select
  102. Case $msg = $go
  103. Call ("Save")
  104. Case $msg = $GUI_EVENT_CLOSE
  105. ExitLoop  
  106. Case $msg = $sgo
  107. Call ("Search")
  108.         EndSelect
  109.     WEnd
  110. Endfunc