Click Race, della serie non ho un c***o da fare xD

« Older   Newer »
  Share  
Lahace
CAT_IMG Posted on 24/1/2010, 17:51     +1   -1




ecco un programmino che permette di misurare quanti click riuscite a fare in un tot di tempo!
si lo so è una cosa inutile ma non avevo altro da fare xD

SPOILER (click to view)
CODICE
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>

;// Declaring variables
Const $IniPath = @ScriptDir & "opt.ini"
Const $TimeSection = "Time"
Const $TimeKey = "Time"
Const $DefTime = "10"
Const $MSec = "000"
Const $ClickSec = "Click"
Const $RecordKey = "Record"
Const $GuiSec = "Gui"
Const $XKey = "X"
Const $YKey = "Y"
Const $BXS = "BXS"
Const $BYS = "BYS"
Const $BWS = "BWS"
Const $BHS = "BHS"
;// End variables

If Not FileExists($IniPath) Then
       _FileCreate($IniPath)
       IniWrite($IniPath , $TimeSection , $TimeKey , $DefTime)
       IniWrite($IniPath , $ClickSec , $RecordKey , '0')
       IniWrite($IniPath , $GuiSec , $XKey , "-1")
       IniWrite($IniPath , $GuiSec , $YKey , "-1")
EndIf

;// Other Variables
$time = IniRead($IniPath , $TimeSection , $TimeKey , $DefTime)
$Rtime = $time & $MSec
$XCoord = IniRead($IniPath , $GuiSec , $XKey , "-1")
$YCoord = IniRead($IniPath , $GuiSec , $YKey , "-1")
$BXC = IniRead($IniPath , $GuiSec , $BXS , 110)
$BYC = IniRead($IniPath , $GuiSec , $BYS , 40)
$BWC = IniRead($IniPath , $GuiSec , $BWS , 141)
$BHC = IniRead($IniPath , $GuiSec , $BHS , 121)
$state = False
$Value = 0
;// End

$gui = GUICreate("ClickRace!", 371, 245, $XCoord , $YCoord)
$Button1 = GUICtrlCreateButton("Clicca per iniziare!", $BXC , $BYC , $BWC , $BHC, 0)
$MenuItem1 = GUICtrlCreateMenu("&Opzioni")
$MenuItem2 = GUICtrlCreateMenuItem("Tempo max", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Grandezza Pulsante", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Record", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Crediti", $MenuItem1)
$Label1 = GUICtrlCreateLabel("Tempo Rimanente:", 215, 5, 91, 17)
$Label2 = GUICtrlCreateLabel($time , 310 , 5 , 100)
GUISetState(@SW_SHOW)

While 1
       $nMsg = GUIGetMsg()
       Switch $nMsg
               Case $GUI_EVENT_CLOSE
                       $guicoord = WinGetPos($gui)
                       IniWrite($IniPath , $GuiSec , $XKey , $guicoord[0])
                       IniWrite($IniPath , $GuiSec , $YKey , $guicoord[1])
                       Exit
               Case $MenuItem4
                       $width = InputBox("Width" , "Inserisci la larghezza del pulsante (per la larghezza standard non scrivere niente)")
                       If $width = "" Then
                               $width = 141
                       ElseIf $width > 370 Then
                               $width = 370
                       EndIf
                       $height = InputBox("Height" , "Inserisci l'altezza del pulsante (per la larghezza standard non scrivere niente)")
                       If $height = "" Then
                               $height = 121
                       ElseIf $height > 200 Then
                               $height = 200
                       EndIf
                       GUICtrlSetPos($Button1 , 110 , 40 , $width , $height)
                       $CRD = CenterControl($gui , $Button1)
                       IniWrite($IniPath , $GuiSec , $BXS , $CRD[0])
                       IniWrite($IniPath , $GuiSec , $BYS , $CRD[1])
                       IniWrite($IniPath , $GuiSec , $BWS , $width)
                       IniWrite($IniPath , $GuiSec , $BHS , $height)
               Case $MenuItem2
                       $time = InputBox("Tempo Massimo" , "Inserisci il tempo a disposizione per la sfida in secondi")
                       If $time <> "" Then
                               IniWrite($IniPath , $TimeSection , $TimeKey , $time)
                               GUICtrlSetData($Label2 , $time)
                               $Rtime = $time & $MSec
                       EndIf
               Case $MenuItem3
                       MsgBox(0 , "Crediti" , "ClickRace - " & @CR & "Creato da Lahace XD")
               Case $MenuItem5
                       MsgBox(0 , "Il tuo record è di" , IniRead($IniPath , $ClickSec , $RecordKey , '0') & "!!")
               Case $Button1
                       While 1
                               If $state = False Then
                                       $timer = TimerInit()
                               EndIf
                               $state = True
                               $timen = TimerDiff($timer)
                               If $timen > 10000 Then
                                       $tr = StringTrimRight($timen , StringLen($timen)-2)
                               ElseIf $timen > 100000 Then
                                       $tr = StringTrimRight($timen , StringLen($timen)-3)
                               ElseIf 1000 < $timen < 10000 Then
                                       $tr = StringTrimRight($timen , StringLen($timen)-1)
                               ElseIf $timen <= 1000 Then
                                       $tr = 1
                               EndIf
                               GUICtrlSetData($Label2 , $tr)
                               Switch GUIGetMsg()
                                       Case $button1
                                               $Value += 1
                                               GUICtrlSetData($Button1 , $Value)
                                       Case -3
                                               Exit
                               EndSwitch
                               If $timen >= $Rtime and $state = True then
                                       GUICtrlSetState($button1 , 128)
                                       MsgBox(0 , "Tempo" , "Tempo Scaduto! Totale click: " & $Value)
                                       If $value > IniRead($IniPath , $ClickSec , $RecordKey , "0") Then
                                               IniWrite($IniPath , $ClickSec , $RecordKey , $value)
                                       EndIf
                                       $value = 0
                                       GUICtrlSetData($Button1 , "Clicca per iniziare!")
                                       $state = False
                                       GUICtrlSetState($button1 , 64)
                                       ExitLoop
                               EndIf
                       WEnd
       EndSwitch
WEnd

Func CenterControl($gui , $control)
       $wgp = WinGetPos($gui)
       $g = ControlGetPos($gui , "" , $control)
       $left = (($wgp[2]-$g[2])/2)-3
       $top = ($wgp[3]-$g[3])/3
       GUICtrlSetPos($control , $left , $top)
       Dim $FCoord[2] = [$left , $top]
       Return $FCoord
EndFunc
 
Top
SuperAntani
CAT_IMG Posted on 24/1/2010, 22:31     +1   -1




442!!
Con un bot di mia produzione, circa 15 stringhe xD
Comunque del giochetto, utile per passare quei 10 minuti di pura follia!!!
Divertente, a presto.
 
Top
1 replies since 24/1/2010, 17:51   105 views
  Share