stopsoftwarepatents.eu petition banner

AutoIt Français

Communauté Francophone AutoIt
* Connexion   * M’enregistrer

Heures au format UTC + 1 heure


Règles du forum

Poster un nouveau sujet Répondre au sujet  [ 6 messages ] 
Auteur Message
Hors ligne
Niveau 6
Niveau 6
Avatar de l’utilisateur
Inscription: Sam 10 Oct 2009 09:15
Messages: 202
Age: 22

Dernier message
Sujet du message: [EX] La Dernière Carte
MessagePosté: Lun 26 Juil 2010 09:33 

bonjours voici un petit jeu de carte très simple a jouer
consiste a retourner une première carte et de la placer a la place de celle qui ce trouve a la bonne colonne et la bonne ligne comme ci vous étaler un jeux de carte dans l'ordre

Ligne 1 = Cœur
Ligne 2 = Carreau
Ligne 3 = Trèfle
Ligne 4 = Pic

bonne Chance !

Pour fonctionner , le script a besoin du jeu de carte ci-dessous.

Le lien ci-dessous contient le script et le jeu de carte, tout est prêt à l'emploi.
Sereur HTTP N° 1 (GELDROC)

Le lien ci-dessous ne contient que le jeu de carte, (au cas ou le premier serveur tombe) qu'il faudra placer dans le repertoire de votre script pour que tout marche. Il est donc à coupler avec le script ci-après:

Sereur HTTP N° 2 (Timmalos)

Et voici le code:
Spoiler pour Hmmm ... le code :
Code
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.2.0
 Author:         GELDROC

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <StaticConstants.au3>
#include <Date.au3>

;#include <_Set_Color_Pix_Image.au3>
Opt("GUIOnEventMode", 1)


Global $Win = "Seven"
Global $DesktopWidth = @DesktopWidth, $DesktopHeight = @DesktopHeight

Global $GUIW , $GUIH
If $Win = "Seven" Then
    $GUIW = $DesktopWidth - 14
    $GUIH = $DesktopHeight - 92
EndIf

Global $Carte_L = 10, $Carte_T = 0
Global $Carte_W = 146 , $Carte_H = 198
$aCarteSize = _Calculate_Carte_Size($GUIW, $GUIH, $Carte_W, $Carte_H, $Carte_L, 13)
$Carte_W = $aCarteSize[0]
$Carte_H = $aCarteSize[1]
$Carte_T = ($GUIH-(($Carte_H+10)*4))-150
Global $JeuxDir = @ScriptDir&"\52\"
Global $Jeux = 7

Global $GUI0, $LABEL1, $PIC[999][999][3]

Global $Carte[999][2], $Crono[2], $Main[2]



;_SetBKColor_Carte($JeuxDir, 0xFF0A7D32)
;Exit

_La_Derniere_Carte()



Func _La_Derniere_Carte()
    Local $Y1 = 0
    $Crono[0] = 0
    $GUI0 = GUICreate("La Derniere Carte", $GUIW, $GUIH, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor(0x0A7D32, $GUI0)
    GUISetState()
    $LABEL1 = GUICtrlCreateLabel("", 10, 10, 100, 30)
    _Melange()
    For $X1 = 1 to 4
        For $X2 = 1 To 13
            $Y1 = $Y1 + 1
            $PIC[$X1][$X2][0] = GUICtrlCreatePic($JeuxDir&"0_"&$Jeux&".bmp", $Carte_L+(($Carte_W+$Carte_L)*($X2-1)), $Carte_T+(($Carte_H+10)*($X1-1)), $Carte_W, $Carte_H)
        GUISetState()
        GUICtrlSetOnEvent($PIC[$X1][$X2][0],"_Pic")
        $PIC[$X1][$X2][1] = $Carte[$Y1][0]
        $PIC[$X1][$X2][1] = 0
        Next
    Next
   
   
   
    While 1
Sleep(100)
       
    WEnd
EndFunc



Func _Pic()
    Local $_Pic, $X
    Select
        Case $Crono[0] = 0
            $Crono[1] = TimerInit()
            AdlibRegister("_Crono", 700)
            $_Pic = (@GUI_CTRLID-$PIC[1][1][0])+1
            $X = StringSplit(_N_Carte($_Pic), "_", 1)
            GUICtrlDelete($PIC[$X[1]][$X[2]][0])
            $PIC[$X[1]][$X[2]][0] = GUICtrlCreatePic($JeuxDir&$Carte[$_Pic][1]&".bmp", 200, 70, $Carte_W, $Carte_H)
            GUISetState()
            $PIC[$X[1]][$X[2]][2] = 1
            $Main[0] = $_Pic
            $Main[1] = $_Pic
            $Crono[0] = 1
        Case $Crono[0] = 1
            $_Pic = (@GUI_CTRLID-$PIC[1][1][0])+1
            If $Carte[$Main[1]][0] = $_Pic Then
                $X = StringSplit(_N_Carte($Main[0]), "_", 1)
                GUICtrlDelete($PIC[$X[1]][$X[2]][0])
                $PIC[$X[1]][$X[2]][0] = GUICtrlCreatePic($JeuxDir&$Carte[$_Pic][1]&".bmp", 200, 70, $Carte_W, $Carte_H)
                GUISetState()
                $PIC[$X[1]][$X[2]][1] = $Carte[$_Pic][0]
                $X = StringSplit(_N_Carte($_Pic), "_", 1)
                _SetCarte($X[1], $X[2], $JeuxDir&$Carte[$Main[1]][1]&".bmp")
                $PIC[$X[1]][$X[2]][1] = $Carte[$Main[1]][0]
                $PIC[$X[1]][$X[2]][2] = 1
                $Main[1] = $_Pic
            EndIf
        EndSelect
        If $Crono[0] = 1 And $Carte[$Main[1]][0] = $Main[0] Then
                    MsgBox(0, "", "Fini")
                    For $X1 = 1 To 52
                        $X = StringSplit(_N_Carte($X1), "_", 1)
                        GUICtrlDelete($PIC[$X[1]][$X[2]][0])
                    Next
                    AdlibUnRegister("_Crono")
                _Score()
                ;_La_Derniere_Carte()
               
        EndIf
EndFunc

func _Score()
Local $Temps, $Poinnt = 0, $Nbr_Carte = 0
Local $Stime, $Time, $Hour, $Mins, $Secs

    For $X1 = 1 To 52
        $X = StringSplit(_N_Carte($X1), "_", 1)
        If $PIC[$X[1]][$X[2]][2] = 1 then
                $Poinnt = $Poinnt+_Point($PIC[$X[1]][$X[2]][1])
                $Nbr_Carte = $Nbr_Carte+1
        EndIf
    Next
    _TicksToTime(Int(TimerDiff($Crono[1])), $Hour, $Mins, $Secs)
    $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Temps = $Time
    MsgBox(0, "Score", "Nombre de Carte retourner = "&$Nbr_Carte&@CRLF&@CRLF&"Point = "&$Poinnt&@CRLF&@CRLF&"Temp de Jeux = "&$Temps)
   
EndFunc

Func _Point($Carte)
    Select
        Case $Carte = 1 Or $Carte = 14 Or $Carte = 27 Or $Carte = 40
            Return 100
        Case $Carte = 2 Or $Carte = 15 Or $Carte = 28 Or $Carte = 41
            Return 2
        Case $Carte = 3 Or $Carte = 16 Or $Carte = 29 Or $Carte = 42
            Return 3
        Case $Carte = 4 Or $Carte = 17 Or $Carte = 30 Or $Carte = 43
            Return 4
        Case $Carte = 5 Or $Carte = 18 or $Carte = 31 or $Carte = 44
            Return 5
        Case $Carte = 6 Or $Carte = 19 Or $Carte = 32 Or $Carte = 45
            Return 6
        Case $Carte = 7 Or $Carte = 20 Or $Carte = 33 Or $Carte = 46
            Return 7
        Case $Carte = 8 Or $Carte = 21 Or $Carte = 34 Or $Carte = 47
            Return 8
        Case $Carte = 9 Or $Carte = 22 Or $Carte = 35 Or $Carte = 48
            Return 9
        Case $Carte = 10 Or $Carte = 23 Or $Carte = 36 Or $Carte = 49
            Return 20
        Case $Carte = 11 Or $Carte = 24 Or $Carte = 37 Or $Carte = 50
            Return 30
        Case $Carte = 12 Or $Carte = 25 Or $Carte = 38 Or $Carte = 51
            Return 50
        Case $Carte = 13 Or $Carte = 26 Or $Carte = 39 Or $Carte = 52
            Return 70
    EndSelect


EndFunc
Func _Crono()
    Local $Stime, $Time, $Hour, $Mins, $Secs
    _TicksToTime(Int(TimerDiff($Crono[1])), $Hour, $Mins, $Secs)
    $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    If $sTime <> $Time Then GUICtrlSetData($LABEL1, $Time)
EndFunc

Func _Melange()
    Local $Y1 = 0, $R, $Y2 = 0, $N = 1
    While 1
        $R = Random(2, 53, 1)-1
        $Y2 = 0
        For $X1 = 1 to 52
            If $R = $Carte[$X1][0] Then
                $Y2 = 1
                $X1 = 52
            EndIf
        Next
        If $Y2 = 0 Then
            $Carte[$N][0] = $R
            $Carte[$N][1] = _N_Carte($R)
            If $N = 52 Then ExitLoop
            $N = $N + 1
        EndIf
    WEnd
EndFunc

Func _N_Carte($N)
    Local $X1, $X2, $X3
    Select
    Case $N = 1
        $X1 = 1
        $X2 = 1
    Case $N = 2
        $X1 = 1
        $X2 = 2
    Case $N = 3
        $X1 = 1
        $X2 = 3
    Case $N = 4
        $X1 = 1
        $X2 = 4
    Case $N = 5
        $X1 = 1
        $X2 = 5
    Case $N = 6
        $X1 = 1
        $X2 = 6
    Case $N = 7
        $X1 = 1
        $X2 = 7
    Case $N = 8
        $X1 = 1
        $X2 = 8
    Case $N = 9
        $X1 = 1
        $X2 = 9
    Case $N = 10
        $X1 = 1
        $X2 = 10
    Case $N = 11
        $X1 = 1
        $X2 = 11
    Case $N = 12
        $X1 = 1
        $X2 = 12
    Case $N = 13
        $X1 = 1
        $X2 = 13
    Case $N = 14
        $X1 = 2
        $X2 = 1
    Case $N = 15
        $X1 = 2
        $X2 = 2
    Case $N = 16
        $X1 = 2
        $X2 = 3
    Case $N = 17
        $X1 = 2
        $X2 = 4
    Case $N = 18
        $X1 = 2
        $X2 = 5
    Case $N = 19
        $X1 = 2
        $X2 = 6
    Case $N = 20
        $X1 = 2
        $X2 = 7
    Case $N = 21
        $X1 = 2
        $X2 = 8
    Case $N = 22
        $X1 = 2
        $X2 = 9
    Case $N = 23
        $X1 = 2
        $X2 = 10
    Case $N = 24
        $X1 = 2
        $X2 = 11
    Case $N = 25
        $X1 = 2
        $X2 = 12
    Case $N = 26
        $X1 = 2
        $X2 = 13
    Case $N = 27
        $X1 = 3
        $X2 = 1
    Case $N = 28
        $X1 = 3
        $X2 = 2
    Case $N = 29
        $X1 = 3
        $X2 = 3
    Case $N = 30
        $X1 = 3
        $X2 = 4
    Case $N = 31
        $X1 = 3
        $X2 = 5
    Case $N = 32
        $X1 = 3
        $X2 = 6
    Case $N = 33
        $X1 = 3
        $X2 = 7
    Case $N = 34
        $X1 = 3
        $X2 = 8
    Case $N = 35
        $X1 = 3
        $X2 = 9
    Case $N = 36
        $X1 = 3
        $X2 = 10
    Case $N = 37
        $X1 = 3
        $X2 = 11
    Case $N = 38
        $X1 = 3
        $X2 = 12
    Case $N = 39
        $X1 = 3
        $X2 = 13
    Case $N = 40
        $X1 = 4
        $X2 = 1
    Case $N = 41
        $X1 = 4
        $X2 = 2
    Case $N = 42
        $X1 = 4
        $X2 = 3
    Case $N = 43
        $X1 = 4
        $X2 = 4
    Case $N = 44
        $X1 = 4
        $X2 = 5
    Case $N = 45
        $X1 = 4
        $X2 = 6
    Case $N = 46
        $X1 = 4
        $X2 = 7
    Case $N = 47
        $X1 = 4
        $X2 = 8
    Case $N = 48
        $X1 = 4
        $X2 = 9
    Case $N = 49
        $X1 = 4
        $X2 = 10
    Case $N = 50
        $X1 = 4
        $X2 = 11
    Case $N = 51
        $X1 = 4
        $X2 = 12
    Case $N = 52
        $X1 = 4
        $X2 = 13
   
       
       
    EndSelect
    $X3 = $X1&"_"&$X2

    Return $X3
EndFunc

Func _Exit()
    Exit
EndFunc

Func _SetCarte($X1, $X2, $img)
        GUICtrlDelete($PIC[$X1][$X2][0])
        $PIC[$X1][$X2][0] = GUICtrlCreatePic($img, $Carte_L+(($Carte_W+$Carte_L)*($X2-1)), $Carte_T+(($Carte_H+10)*($X1-1)), $Carte_W, $Carte_H)
        GUISetState()
EndFunc 
   
Func _Calculate_Carte_Size($GUIW, $GUIH, $Carte_W, $Carte_H, $Carte_L, $Type = 13)
    Local $aCarteSize[2], $aCarteSizeS
    $aCarteSize[0] = (($GUIW-$Carte_L)-($Carte_L*$Type))/$Type
    $aCarteSize[1] = $Carte_H/($Carte_W/$aCarteSize[0])
    $aCarteSizeS = StringSplit($aCarteSize[0], ".", 1)
    $aCarteSize[0] = $aCarteSizeS[1]
    $aCarteSizeS = StringSplit($aCarteSize[1], ".", 1)
    $aCarteSize[1] = $aCarteSizeS[1]
    Return $aCarteSize
EndFunc

Func _SetBKColor_Carte($Carte, $Color)
Global $Pix[999][2]

;;;;;;;;;
$Pix[1][0] = 0
$Pix[1][1] = 0
$Pix[2][0] = 0
$Pix[2][1] = 1
$Pix[3][0] = 0
$Pix[3][1] = 2
$Pix[4][0] = 0
$Pix[4][1] = 3
$Pix[5][0] = 0
$Pix[5][1] = 4

$Pix[6][0] = 1
$Pix[6][1] = 0
$Pix[7][0] = 1
$Pix[7][1] = 1
$Pix[8][0] = 1
$Pix[8][1] = 2
$Pix[9][0] = 1
$Pix[9][1] = 3

$Pix[10][0] = 2
$Pix[10][1] = 0
$Pix[11][0] = 2
$Pix[11][1] = 1
$Pix[12][0] = 2
$Pix[12][1] = 2

$Pix[13][0] = 3
$Pix[13][1] = 0
$Pix[14][0] = 3
$Pix[14][1] = 1

$Pix[15][0] = 4
$Pix[15][1] = 0
;;;;;;;;;;
$Pix[16][0] = 141
$Pix[16][1] = 0

$Pix[17][0] = 142
$Pix[17][1] = 0
$Pix[18][0] = 142
$Pix[18][1] = 1

$Pix[19][0] = 143
$Pix[19][1] = 0
$Pix[20][0] = 143
$Pix[20][1] = 1
$Pix[21][0] = 143
$Pix[21][1] = 2

$Pix[22][0] = 144
$Pix[22][1] = 0
$Pix[23][0] = 144
$Pix[23][1] = 1
$Pix[24][0] = 144
$Pix[24][1] = 2
$Pix[25][0] = 144
$Pix[25][1] = 3

$Pix[26][0] = 145
$Pix[26][1] = 0
$Pix[27][0] = 145
$Pix[27][1] = 1
$Pix[28][0] = 145
$Pix[28][1] = 2
$Pix[29][0] = 145
$Pix[29][1] = 3
$Pix[30][0] = 145
$Pix[30][1] = 4
;;;;;;;;;;
$Pix[31][0] = 141
$Pix[31][1] = 197

$Pix[32][0] = 142
$Pix[32][1] = 196
$Pix[33][0] = 142
$Pix[33][1] = 197

$Pix[34][0] = 143
$Pix[34][1] = 195
$Pix[35][0] = 143
$Pix[35][1] = 196
$Pix[36][0] = 143
$Pix[36][1] = 197

$Pix[37][0] = 144
$Pix[37][1] = 194
$Pix[38][0] = 144
$Pix[38][1] = 195
$Pix[39][0] = 144
$Pix[39][1] = 196
$Pix[40][0] = 144
$Pix[40][1] = 197

$Pix[41][0] = 145
$Pix[41][1] = 193
$Pix[42][0] = 145
$Pix[42][1] = 194
$Pix[43][0] = 145
$Pix[43][1] = 195
$Pix[44][0] = 145
$Pix[44][1] = 196
$Pix[45][0] = 145
$Pix[45][1] = 197
;;;;;;;;;
$Pix[46][0] = 0
$Pix[46][1] = 193
$Pix[47][0] = 0
$Pix[47][1] = 194
$Pix[48][0] = 0
$Pix[48][1] = 195
$Pix[49][0] = 0
$Pix[49][1] = 196
$Pix[50][0] = 0
$Pix[50][1] = 197

$Pix[51][0] = 1
$Pix[51][1] = 194
$Pix[52][0] = 1
$Pix[52][1] = 195
$Pix[53][0] = 1
$Pix[53][1] = 196
$Pix[54][0] = 1
$Pix[54][1] = 197

$Pix[55][0] = 2
$Pix[55][1] = 195
$Pix[56][0] = 2
$Pix[56][1] = 196
$Pix[57][0] = 2
$Pix[57][1] = 197

$Pix[58][0] = 3
$Pix[58][1] = 196
$Pix[59][0] = 3
$Pix[59][1] = 197

$Pix[60][0] = 4
$Pix[60][1] = 197

$Pix[0][0] = 60

For $X1 = 1 to 4
    For $X2 = 1 To 13
        _Set_Color_Pix_Image($Color, $Pix, @ScriptDir&"\52Default\"&$X1&"_"&$X2&".bmp", $Carte&$X1&"_"&$X2&".bmp")
       
    Next
Next
For $X3 = 1 To 7
    _Set_Color_Pix_Image($Color, $Pix, @ScriptDir&"\52Default\"&0&"_"&$X3&".bmp", $Carte&0&"_"&$X3&".bmp")
Next
EndFunc

 


Dernière édition par timmalos le Mer 28 Juil 2010 11:48, édité 10 fois.
Correction orthographique, Rajout d'explications



Team MSGI http://autoitscript.fr/forum/viewtopic.php?f=6&t=5685

 Profil  
 
AutoIt Français
Hors ligne
Modérateur
Modérateur
Avatar de l’utilisateur
Inscription: Ven 02 Mai 2008 13:54
Messages: 1507
Age: 19

Localisation: Bruxelles
Sujet du message: Re: [EX] La Dernière Carte
MessagePosté: Lun 26 Juil 2010 09:41 

Bonjour,

Est-il possible d'avoir un exemple d'utilisation. Merci.



Balise [..] devant votre requête en cours, [R] quand résolu | Pas de message concernant les bots !

Merci

 Profil  
 
AutoIt Français
Hors ligne
Modérateur
Modérateur
Avatar de l’utilisateur
Inscription: Dim 18 Mai 2008 14:16
Messages: 1216
Age: 18
Sujet du message: Re: [EX] La Dernière Carte
MessagePosté: Mar 27 Juil 2010 11:53 

Sujet nettoyé

Je laisse le mirroir du jeu de carte au cas ou votre serveur tombe en rade:
http://malossane.fr/usb-file-535.html



http://malossane.fr : Votre clef-usb Online gratuite, utilisez le logiciel Malossane USB Suite disponible gratuitement.
Essayez, vous ne serez pas déçus.

 Profil  
 
AutoIt Français
Hors ligne
Niveau 6
Niveau 6
Inscription: Sam 11 Oct 2008 13:44
Messages: 267
Sujet du message: Re: [EX] La Dernière Carte
MessagePosté: Ven 06 Aoû 2010 17:54 

J'obtiens une erreur à la compilation !

Code
D:\Program Files\Ride Runner\Skins\Carwings_Dynamic_pm_new\Scripts\GameCard\La Derniere Carte.au3(540,114) : ERROR: _Set_Color_Pix_Image(): undefined function.
        _Set_Color_Pix_Image($Color, $Pix, @ScriptDir&"\52Default\"&$X1&"_"&$X2&".bmp", $Carte&$X1&"_"&$X2&".bmp")

 Profil  
 
AutoIt Français
Hors ligne
Niveau 6
Niveau 6
Avatar de l’utilisateur
Inscription: Sam 10 Oct 2009 09:15
Messages: 202
Age: 22
Sujet du message: Re: [EX] La Dernière Carte
MessagePosté: Sam 07 Aoû 2010 20:08 

Verifier que la ligne _SetBKColor_Carte($JeuxDir, 0xFF0A7D32) soit bien commenter par ; sinon supprimer totalement cette fonction qui de sert a rien pour le moment



Team MSGI http://autoitscript.fr/forum/viewtopic.php?f=6&t=5685

 Profil  
 
AutoIt Français
Hors ligne
Niveau 6
Niveau 6
Inscription: Sam 11 Oct 2008 13:44
Messages: 267

Haut
Sujet du message: Re: [EX] La Dernière Carte
MessagePosté: Dim 29 Aoû 2010 16:07 

C'est la fonction _Set_Color_Pix_Image() qui n'existe pas dans le script

 Profil  
 
Afficher les messages postés depuis:  Trier par  

Poster un nouveau sujet Répondre au sujet  [ 6 messages ] 

Heures au format UTC + 1 heure


Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités


Vous ne pouvez pas poster de nouveaux sujets
Vous ne pouvez pas répondre aux sujets
Vous ne pouvez pas éditer vos messages
Vous ne pouvez pas supprimer vos messages
Vous ne pouvez pas joindre des fichiers

Rechercher:
Aller à:  
cron

AutoIt Français
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group, Sniper_Blue phpBB-3.0 Style © 2007 Sniper_E
Traduction par: phpBB-fr.com