Belini (Adm) 233 Report post Posted July 1, 2016 (edited) Estou com um problema que a pricípo parece simples de resolver porém já estou nisto a horas e não consigui terminar, é o seguinte eu tenho 6 imagens que preciso movimentar e preciso que sempre que chegue na ultima volte na primeira, até agora consegui o movimento em 5 mas a primeira e a segunda se reptem toda vez ou seja uma das imagens fica fora do movimento quando chega no final das 6 posições, alguém tem alguma idía de como resolver isto? Baixar script e imagens para teste: https://mega.nz/#!NBMGETKa!2vV7Bov5uMA04twm6p_d9ks0GVox-c0sEGwu_kBzFuM Edited July 1, 2016 by Belini Share this post Link to post Share on other sites
mutleey (MVP) 98 Report post Posted July 1, 2016 só tinha um pequeno erro. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $movimentar = 0, $liber_mover = 0, $imagens = 0, $imagens_mover[7], $pic_grade[7] $imagens_mover[1] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[2] = @ScriptDir & "\Cereja.bmp" $imagens_mover[3] = @ScriptDir & "\Laranja.bmp" $imagens_mover[4] = @ScriptDir & "\Limão.bmp" $imagens_mover[5] = @ScriptDir & "\Maçã.bmp" $imagens_mover[6] = @ScriptDir & "\Morango.bmp" interface() While 1 Sleep(20) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch movimenta_imagens() WEnd Func interface() Local $gui = GUICreate("Form1", 665, 136, -1, -1) GUISetBkColor(0x000000, $gui); muda a cor do fundo $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 8, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 118, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 228, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 338, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 448, 16, 100, 100) $pic_grade[6] = GUICtrlCreatePic($imagens_mover[6], 558, 16, 100, 100) GUISetState(@SW_SHOW) EndFunc ;==>interface Func movimenta_imagens() $liber_mover += 1 If $liber_mover >= 30 Then $liber_mover = 0 For $i = 0 To 6 $movimentar += 1 If $movimentar > 6 Then $movimentar = 1 $imagens += 1 If $imagens > 6 Then $imagens = 0 GUICtrlSetImage($pic_grade[$imagens], $imagens_mover[$movimentar]) TrayTip($movimentar, $imagens_mover[$movimentar], 5) Next EndIf EndFunc ;==>movimenta_imagens Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 1, 2016 @Mutleey acredita que eu não achei nem mesmo depois que vc mexeu no script!!! Onde estava o erro? Share this post Link to post Share on other sites
mutleey (MVP) 98 Report post Posted July 1, 2016 (edited) quando vc chama a função para criar as pics uma delas vc dá o nome da variavel de $pic_grade[0] e quando vc manda atualizar as imagens a primeira variavel $imagens já começa com o valor 1 ou seja a $pic_grade[$imagens] que foi criada com "0" nunca vai atualizar. só renomeei $pic_grade[0] = GUICtrlCreatePic($imagens_mover[1], 8, 16, 100, 100) $pic_grade[1] = GUICtrlCreatePic($imagens_mover[2], 118, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[3], 228, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[4], 338, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[5], 448, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[6], 558, 16, 100, 100) para $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 8, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 118, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 228, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 338, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 448, 16, 100, 100) $pic_grade[6] = GUICtrlCreatePic($imagens_mover[6], 558, 16, 100, 100) Edited July 1, 2016 by mutleey 1 Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 1, 2016 (edited) Não acredito que era só isto! Quem tá de fora vê mesmo as coisas hein! Edited July 1, 2016 by Belini Share this post Link to post Share on other sites
Frezan 13 Report post Posted July 1, 2016 (edited) Quando fui postar vi que o Mutleey tinha chegado primeiro então resolvi dar algumas modificadas no teu script.Deixei a troca de imagens um pouco mais rápida e adicionei um desacelerador de velocidade (para parecer uma roleta).[importante] comentei a função TrayTip("...") para evitar travamentos no sistema.Segue abaixo o código: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $movimentar = 0, $liber_mover = 0, $imagens = 0, $imagens_mover[7], $pic_grade[7] Global $desacelerar = 1, $time = 400 $imagens_mover[0] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[1] = @ScriptDir & "\Cereja.bmp" $imagens_mover[2] = @ScriptDir & "\Laranja.bmp" $imagens_mover[3] = @ScriptDir & "\Limão.bmp" $imagens_mover[4] = @ScriptDir & "\Maçã.bmp" $imagens_mover[5] = @ScriptDir & "\Morango.bmp" interface() AdlibRegister("movimenta_imagens", 100) While 1 Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE AdlibUnRegister("movimenta_imagens") Exit EndSwitch WEnd Func interface() Local $gui = GUICreate("Form1", 665, 136, -1, -1) GUISetBkColor(0x000000, $gui); muda a cor do fundo $pic_grade[0] = GUICtrlCreatePic($imagens_mover[0], 8, 16, 100, 100) $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 118, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 228, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 338, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 448, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 558, 16, 100, 100) GUISetState(@SW_SHOW) EndFunc ;==>interface Func movimenta_imagens() $desacelerar += 2 $time = $time - 60 + $desacelerar if $time > 800 Then AdlibUnRegister("movimenta_imagens") Sleep($time) $liber_mover += 1 If $liber_mover >= 30 Then $liber_mover = 0 For $i = 0 To 6 Step 1 $movimentar += 1 If $movimentar > 5 Then $movimentar = 0 GUICtrlSetImage($pic_grade[$i], $imagens_mover[$movimentar]) ;TrayTip($movimentar, $imagens_mover[$movimentar], 5) Next EndIf EndFunc ;==>movimenta_imagens [Edit] Desfiz uma modificação que eu fiz para funcionar aqui. Coloquei o sinal como estava. If $liber_mover >= 30 Then Edited July 1, 2016 by Frezan Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 1, 2016 (edited) @Frezan ficou legal demais só que eu precisava deixar este movimento contínuo até que eu pare de chamar a função e não posso usar o AdlibRegister() porque já tenho outros sendo executados que por algum motivo interfere nas funções de hotkey quando habilito vários ao mesmo tempo, tem como fazer este movimento que vc fez ficar repetitivo e usando apenas o loop com sleep de 10 milisegundos como está no script? EDITADO: Mais uma coisa não pode ter sleep() dentro da função movimenta_imagens() difícil né!!! Edited July 1, 2016 by Belini Share this post Link to post Share on other sites
Frezan 13 Report post Posted July 1, 2016 (edited) Tu diz em deixar como tava e apenas deixar mais rápido? Se for isso, segue abaixo: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $movimentar = 0, $liber_mover = 0, $imagens = 0, $imagens_mover[7], $pic_grade[7] $imagens_mover[0] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[1] = @ScriptDir & "\Cereja.bmp" $imagens_mover[2] = @ScriptDir & "\Laranja.bmp" $imagens_mover[3] = @ScriptDir & "\Limão.bmp" $imagens_mover[4] = @ScriptDir & "\Maçã.bmp" $imagens_mover[5] = @ScriptDir & "\Morango.bmp" interface() While 1 Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch movimenta_imagens() WEnd Func interface() Local $gui = GUICreate("Form1", 665, 136, -1, -1) GUISetBkColor(0x000000, $gui); muda a cor do fundo $pic_grade[0] = GUICtrlCreatePic($imagens_mover[0], 8, 16, 100, 100) $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 118, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 228, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 338, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 448, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 558, 16, 100, 100) GUISetState(@SW_SHOW) EndFunc ;==>interface Func movimenta_imagens() $liber_mover += 1 If $liber_mover <= 30 Then $liber_mover = 0 For $i = 0 To 6 Step 1 $movimentar += 1 If $movimentar > 5 Then $movimentar = 0 GUICtrlSetImage($pic_grade[$i], $imagens_mover[$movimentar]) ;TrayTip($movimentar, $imagens_mover[$movimentar], 5) Next EndIf EndFunc ;==>movimenta_imagens Notas: - Esse de cima deu algumas travadas no meu computador por conta da taxa de atualização ser de apenas 10 milissegundos (por isso tinha usado a função AdlibRegister() ). - As vezes (no travamento também) pode aparecer imagens duplicadas mas é por conta que não fechou o ciclo do For na função movimenta_imagens(). - Coloquei um Sleep() no inicio da movimenta_imagens() porém acaba interferindo nos eventos da GUI. [Edit] EDITADO: Mais uma coisa não pode ter sleep() dentro da função movimenta_imagens() difícil né!!! Até pode, mas os eventos da GUI irão ficar com delay, como por exemplo, fechar a janela. Edited July 1, 2016 by Frezan 1 Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 1, 2016 (edited) Consegui adaptar o código que postei prá funcionar com efeito roleta sem usar sleep() e sem AdlibRegister() #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $movimentar = 0, $libera_mover = 0, $imagens = 0 Global $conta_mover = 0, $imagens_mover[7], $pic_grade[7] interface() While 1 Sleep(10) $conta_mover += 1 $libera_mover += 1 Switch $conta_mover Case 0 To 20 $limite_mover = 12 Case 21 To 40 $limite_mover = 10 Case 41 To 60 $limite_mover = 8 Case 61 To 80 $limite_mover = 6 Case 81 To 100 $limite_mover = 4 Case 101 To 130 $limite_mover = 2 Case 131 To 150 $limite_mover = 4 Case 151 To 160 $limite_mover = 6 Case 151 To 180 $limite_mover = 8 Case 181 To 200 $limite_mover = 10 $conta_mover = 0 EndSwitch If $libera_mover >= $limite_mover Then movimenta_imagens($limite_mover) WEnd Func interface() Local $gui = GUICreate("Form1", 665, 136, -1, -1) GUISetBkColor(0x000000, $gui); muda a cor do fundo $imagens_mover[1] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[2] = @ScriptDir & "\Cereja.bmp" $imagens_mover[3] = @ScriptDir & "\Laranja.bmp" $imagens_mover[4] = @ScriptDir & "\Limão.bmp" $imagens_mover[5] = @ScriptDir & "\Maçã.bmp" $imagens_mover[6] = @ScriptDir & "\Morango.bmp" $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 8, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 118, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 228, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 338, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 448, 16, 100, 100) $pic_grade[6] = GUICtrlCreatePic($imagens_mover[6], 558, 16, 100, 100) GUISetState(@SW_SHOW) EndFunc ;==>interface Func movimenta_imagens($limite_mover) If $libera_mover >= $limite_mover Then $libera_mover = 0 For $i = 0 To 6 $movimentar += 1 If $movimentar > 6 Then $movimentar = 1 $imagens += 1 If $imagens > 6 Then $imagens = 0 GUICtrlSetImage($pic_grade[$imagens], $imagens_mover[$movimentar]) Next EndIf EndFunc ;==>movimenta_imagens Edited July 1, 2016 by Belini 1 Share this post Link to post Share on other sites
Fábio iGames (MVP) 76 Report post Posted July 5, 2016 @Belini interessante isso, dá até para usar para fazer uma roleta de sorteio, se sabe pra que né. ;) No meu projeto de Jukebox fiz algo parecido sem querer quando queria trocar as capas. Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 5, 2016 (edited) @Belini interessante isso, dá até para usar para fazer uma roleta de sorteio, se sabe pra que né. ;) Eu já estou fazendo só que não vai ter roleta, o movimento das imagens vai ser só enfeite mesmo! Não sei se vc sabe mas este mês vota a liberação dos jogos de azar e eu não quero ficar de fora desta!!! Edited July 5, 2016 by Belini Share this post Link to post Share on other sites
Fábio iGames (MVP) 76 Report post Posted July 6, 2016 Eu já estou fazendo só que não vai ter roleta, o movimento das imagens vai ser só enfeite mesmo! Não sei se vc sabe mas este mês vota a liberação dos jogos de azar e eu não quero ficar de fora desta!!! Pois é a votação é hoje, tomara que liberem logo, e vamos ver se sobre espaço para nós pois os tubarões vão ocupar a rua. Tô curioso nesse seu projeto, digo em relação a lógica de funcionamento, se precisar de um layout fala que faço um esboço. Boa Sorte nessa nova empreitada. :like_icon: Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 6, 2016 (edited) Pois é a votação é hoje, tomara que liberem logo, e vamos ver se sobre espaço para nós pois os tubarões vão ocupar a rua. É o que eu acho também e já deu prá ver que casinos e bingos só os grandões mesmo é quem vão ter e além do mais pelo projeto inicial as máquinas de caça níquel só poderão funcionar dentro dos casinos e aí vou tentar colocar o meu jogo na rua pois ele não é jogo de azar e sim por habilidade! Tô curioso nesse seu projeto, digo em relação a lógica de funcionamento, se precisar de um layout fala que faço um esboço. Assim que estiver tudo pronto e com uma máquina montada posto um vídeo pra vc's verem! se precisar de um layout fala que faço um esboço. Agradeço a boa vontade mas já está tudo pronto e ficou exatamente como eu queria! Boa Sorte nessa nova empreitada. Obrigado e também eu espero que dê tudo certo porque senão perco quase um ano de trabalho pois iniciei este projeto em agosto do ano passado! Edited July 6, 2016 by Belini Share this post Link to post Share on other sites
Manimal (Adm) 165 Report post Posted July 6, 2016 Boa sorte aos dois :600866: Share this post Link to post Share on other sites
Fábio iGames (MVP) 76 Report post Posted July 8, 2016 @Belini , ontem fiquei brincando com seu exemplo e saiu isso: #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> #include <Sound.au3> #include <Misc.au3> #include <Timers.au3> Global $movimentar = 0, $libera_mover = 0, $imagens = 0 Global $conta_mover = 0, $imagens_mover[13], $pic_grade[13] Global $hdll = DllOpen("user32.dll"), $label Global $credito, $qt_credito = 0 interface() _Som1(True) _Som2(True) ;~ HotKeySet("{Enter}","Jogar") ;~ HotKeySet("{c}","Creditar") While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE DllClose($hdll) Exit(0) EndSelect If _IsPressed("43", $hdll) Then Creditar() ; Tecla C If _IsPressed("0D", $hdll) Then Jogar() ; Tecla Enter If $qt_credito <= 0 Then GUICtrlSetData($label, "") $imagens_mover[7] = "" $imagens_mover[8] = "" $imagens_mover[9] = "" $imagens_mover[10] = "" $imagens_mover[11] = "" $imagens_mover[12] = "" $movimentar += 1 If $movimentar > 12 Then $movimentar = 1 $imagens += 1 If $imagens > 12 Then $imagens = 0 GUICtrlSetImage($pic_grade[$imagens], $imagens_mover[$movimentar]) EndIf WEnd Func Creditar() $qt_credito += 1 If $qt_credito > 10 Then ; Limite de Créditos. $qt_credito = 0 GUICtrlSetData($credito, $qt_credito) GUICtrlSetData($label, "") Else $imagens_mover[7] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[8] = @ScriptDir & "\Cereja.bmp" $imagens_mover[9] = @ScriptDir & "\Laranja.bmp" $imagens_mover[10] = @ScriptDir & "\Limão.bmp" $imagens_mover[11] = @ScriptDir & "\Maçã.bmp" $imagens_mover[12] = @ScriptDir & "\Morango.bmp" GUICtrlSetData($credito, $qt_credito) _SoundPlay(@ScriptDir & "\Som1.wav") GUICtrlSetData($label, "Boa Diversão") EndIf EndFunc Func Jogar() If $qt_credito <= 0 Then GUICtrlSetData($label, "Insira Créditos") Sleep(200) GUICtrlSetData($label, "") Return EndIf $qt_credito -= 1 GUICtrlSetData($credito, $qt_credito) Local $hStarttime = _Timer_Init() ; Inicia o Timer em 0. While 1 ;~ Sleep(10) ; Retirei para ficar bem rapinho. $conta_mover += 1 $libera_mover += 1 Switch $conta_mover Case 0 To 20 $limite_mover = 12 Case 21 To 40 $limite_mover = 10 Case 41 To 60 $limite_mover = 8 Case 61 To 80 $limite_mover = 6 Case 81 To 100 $limite_mover = 4 Case 101 To 130 $limite_mover = 2 Case 131 To 150 $limite_mover = 4 Case 151 To 160 $limite_mover = 6 Case 151 To 180 $limite_mover = 8 Case 181 To 200 $limite_mover = 10 $conta_mover = 0 EndSwitch If $libera_mover >= $limite_mover Then movimenta_imagens($limite_mover) If (_Timer_Diff($hStarttime)) >= 3000 Then Return ; Se a variável $hStarttime atingir o tempo estipulado, retorna para o 1º Loop. WEnd EndFunc Func movimenta_imagens($limite_mover) If $libera_mover >= $limite_mover Then $libera_mover = 0 For $i = 0 To 12 $movimentar += 1 If $movimentar > 12 Then $movimentar = 1 $imagens += 1 If $imagens > 12 Then $imagens = 0 GUICtrlSetImage($pic_grade[$imagens], $imagens_mover[$movimentar]) _SoundPlay(@ScriptDir & "\Som2.wav") Next EndIf EndFunc ;==>movimenta_imagens Func interface() Local $gui = GUICreate("Form1 - By: Belini / Fábio iGames", 580, 380, -1, -1) GUISetBkColor($color_white) ; Cor Fundo Da Gui. GUICtrlCreateLabel("C = CREDITAR", 21, 337, 135, 20) GUICtrlSetColor(-1, $color_gray) ; Cor do texto. GUICtrlSetFont(-1, 12, 200, 1, "Arial") ; Parâmetros da Fonte. GUICtrlCreateLabel("ENTER = JOGAR", 21, 358, 145, 20) GUICtrlSetColor(-1, $color_gray) ; Cor do texto. GUICtrlSetFont(-1, 12, 200, 1, "Arial") ; Parâmetros da Fonte. GUICtrlCreateLabel("ESC = FECHAR", 430, 350, 135, 20) GUICtrlSetColor(-1, $color_gray) ; Cor do texto. GUICtrlSetFont(-1, 12, 200, 1, "Arial") ; Parâmetros da Fonte. GUICtrlCreateLabel("Créditos:", 195, 157, 145, 40) GUICtrlSetColor(-1, $color_black) ; Cor do texto. GUICtrlSetFont(-1, 28, 200, 1, "Arial") ; Parâmetros da Fonte. $credito = GUICtrlCreateLabel($qt_credito, 342, 157, 65, 40) GUICtrlSetColor(-1, $color_black) ; Cor do texto. GUICtrlSetFont(-1, 28, 200, 1, "Arial") ; Parâmetros da Fonte. $label = GUICtrlCreateLabel("", 180, 338, 240, 40) GUICtrlSetColor(-1, $color_red) ; Cor do texto. GUICtrlSetFont(-1, 28, 200, 1, "Arial") ; Parâmetros da Fonte. $imagens_mover[1] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[2] = @ScriptDir & "\Cereja.bmp" $imagens_mover[3] = @ScriptDir & "\Laranja.bmp" $imagens_mover[4] = @ScriptDir & "\Limão.bmp" $imagens_mover[5] = @ScriptDir & "\Maçã.bmp" $imagens_mover[6] = @ScriptDir & "\Morango.bmp" $imagens_mover[7] = @ScriptDir & "\Abacaxi.bmp" $imagens_mover[8] = @ScriptDir & "\Cereja.bmp" $imagens_mover[9] = @ScriptDir & "\Laranja.bmp" $imagens_mover[10] = @ScriptDir & "\Limão.bmp" $imagens_mover[11] = @ScriptDir & "\Maçã.bmp" $imagens_mover[12] = @ScriptDir & "\Morango.bmp" $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 20, 16, 100, 100) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 130, 16, 100, 100) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 240, 16, 100, 100) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 350, 16, 100, 100) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 460, 16, 100, 100) $pic_grade[6] = GUICtrlCreatePic($imagens_mover[6], 460, 125, 100, 100) $pic_grade[7] = GUICtrlCreatePic($imagens_mover[7], 460, 235, 100, 100) $pic_grade[8] = GUICtrlCreatePic($imagens_mover[8], 350, 235, 100, 100) $pic_grade[9] = GUICtrlCreatePic($imagens_mover[9], 240, 235, 100, 100) $pic_grade[10] = GUICtrlCreatePic($imagens_mover[10], 130, 235, 100, 100) $pic_grade[11] = GUICtrlCreatePic($imagens_mover[11], 20, 235, 100, 100) $pic_grade[12] = GUICtrlCreatePic($imagens_mover[12], 20, 125, 100, 100) GUISetState(@SW_SHOW, $gui) EndFunc ;==>interface Func _Som1( $lToSave = False, $sPath = @ScriptDir, $lExecute = False ) Local $hFileHwnd, $bData, $sFileName = $sPath & "\Som1.wav" $bData = "M7MAUklGRlkDAAAAV0FWRWZtdCAgEAAAAAEACBErBAAAARgBAAgAZBBhdGE1AIx/f38Afn9/gIKCgYEAf359fHxxZ18AWVVTUU9PUFAAUVNVWFpdYGMAZmlscHN2eXwAf4KFiIuNj5EAk5WXmJqbnJ1Anp+goKGiAQCjBKOjAAyhorC8xQDL0NPV1tXU0ADOy8fDv7q1sACsqKShnJeSjACHhH98end0cgBvbWtpZ2VjYgBhYF5dXFtbW6BaWVlYWAACWAEFQlkAAFpbW1wAAFRASUI+Ojc1AAA3ADk7PUFFSEtPEFNXW18AjG5xdAB4e36BhIaJigSOkQCKmZibqrYAwMjO0tTW1tYI1NPRAHnEwLy4ArQCPZ6alpSRjQCLiYeEgYB9fAB5d3Z0c3JxcABvbm5tbGtrajRragAAaQEAAQRrawBrbGtfVU5KRgBEQkFCQ0VJSgBLTE5RVFhcYABjZ2tucnZ5fQCAg4aJjI6QkgEEgKW0w" $bData &= "MnQ1NgA2trb2djW1NAEzMmBO7Ovq6ekCKCbmAA7ioiFgQB/fXt4d3VzcQJvgThqaWhoZ2YlAABngQNlYgIAY2QAZGRmYldOSEMAQD49PT0+P0EQQ0dJTIF2XmNoAGpucnV4fH6CEISIioyDvJmbnASmtoM729rZ2NUA09DMyMXBvbgCtII7nJeVk5GOGImEgUBbwR1ycHCIbm1tgDpqamkAH8hoZ2fCH2ZnQCAAAwBoZFdQSURBP0g9Pj7AHURGwB1SQFZZXmJlaIF8eiB8gIGEh0I8lJUAlpiZprXCy9EA1dfW1dXT0c+AzcnGwr+7t4QdAJmVko6LiIaDAIB+fHp4d3Z17wFZwx1CHYAaZsAcQB/BHQBpaWpjV1BKRoBDQT9AQEFCgB0AS05SVltgYWRoZmltQXd/gB3AO5IBQJqZmpyeq7nEIMvR1tjZgDvX1ADSz8rFwr26tYCyramloZyYwB0AjImGgoB+e3gcdnRAHYJZgRtlZW" $bData &= "UBAFZkZGNjZGNlCUAdZ2bAAmJlZ2kAamttbm9wcXIAc3R1dnZ3eHgAeXl6ent7e3y0fH0FAHwCAIYDfgIACwDKwMmAAQCB" If $lToSave Then $hFileHwnd = FileOpen($sFileName, 10) If @error Then Return SetError(1, 0, 0) FileWrite($hFileHwnd, __Som1(__Som1B64($bData, 1096))) FileClose($hFileHwnd) If $lExecute Then RunWait($sFileName, "") FileDelete($sFileName) Return 1 EndIf If FileExists($sFileName) Then Return $sFileName Else Return __Som1(__Som1B64($bData, 1096)) EndIf Return SetError(1, 0, 0) EndFunc ;==>_Som1 Func __Som1B64($sInput, $iBufferSize) Local $struct = DllStructCreate("int") If Not $iBufferSize Then Return SetError(1, 0, "") ; error in the length of the buffer needed EndIf DllStructSetData($struct, 1, $iBufferSize) Local $a = DllStructCreate("byte[" & $iBufferSize & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $sInput, _ "int", 0, _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error decoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>__Som1B64 Func __Som1($bBinary) $bBinary = Binary($bBinary) Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]") DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer Local $a_Call = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _ "ushort", 2, _ "ptr", DllStructGetPtr($tBuffer), _ "dword", DllStructGetSize($tBuffer), _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword*", 0) If @error Or $a_Call[0] Then Return SetError(1, 0, "") ; error decompressing EndIf Local $tOutput = DllStructCreate("byte[" & $a_Call[6] & "]", DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>__Som1 Func _Som2( $lToSave = False, $sPath = @ScriptDir, $lExecute = False ) Local $hFileHwnd, $bData, $sFileName = $sPath & "\Som2.wav" $bData = "d7MAUklGRn4DAAAAV0FWRWZtdCAgEAAAAAEACBErBAAAARgBAAgAZBBhdGFaAIx/hJEAmqKnq66wsbEAsrGwrqyqqKUAop+cmZaTkI0AioeEgX98engAdnNycG5sa2kAaGZmZ2hoaGYAZWNiYF9eXV0CXAEAW1xVRjw0AC4rKSgoKSsuADE1OT5CR0xSAFdcYWZrcHR5AH2BhYiMj5KVAJianZ+ho6SmAKepqqusrK2tAK6uuMPL0dXYANrb3Nva2NbUANDNysfFw8C8ALeyraijnpmVAJGNiYWCf3x5BHd0BHpnZmVkYwEAd1FFPTcyLy0ALC0uMDM2OT0AQUVKTlJXW18AZGhscHR3en4AgYSGiYuOkJIAlJWXmJmanJwAnZ6enp+eo7EAu8TKzc/Pzs0AzMnHxMC9urYAsq6qpqKem5cAk5CMiYaDgH0Ie3h2gTRtbGtqAGloZ2dmZmVlAGRlW0xCOjQwhC4sAzY6PUFGAzYAY2drb" $bData &= "3J2eXwAf4KEhoiKjZEClIA1mZmZmJiYApcAAKKss7m9wADCw8PDwsG/vUC7uLWyr6yCqZoQl5SRjgA3hIKAAn6BqnVzcnFwbwJugDlrampmV0sAQTs1MjAvLzAIMjQ3gDVFSU1RBFVbgKJucXN1d4B5e31/gYOFADcAi4yOj5CRkpMAlJWVlpacqbIAub7CxcfJyckAyMfGxMK/vLlAtrOvrKmlwDaYBUAbiwA3gX99enkWdwAbwBpswjdoXU4CQ8AaMTAxMTIyADQ2ODo+QURHAEtPUlZaXmFlAGlsb3N2eXt+VIGDABuMgVKWQFKbAJydn6u2vsTJCMzO0AAAzs3LyALFQBu4tLGtqaYIop+bAhuIhYOAhH57wBp0dHRzwW0CasCKX05CODEsACgmJSUmJyotwDAzNzxARIA2wBoKYoBRc8Jsh4qMjxSRk4BsmsAZnp+ggKGhqLS9xMjBGijR0M/AGsbCGrCsAKikoJ2bmZaUAJCMiI" $bData &= "SAfXl2AHNwbmtpZ2VkhGJhAKReXVxPwhoEJSTAGisvMjc7ED9ESE2Ah2BkaRBtcXV4AGyFiItSjUCHlpcAh51AGqAUoaIAAKMAAKKioQChoqSkpaSjoQCgnpyamZeWlQCTkpGQj46NjACMi4qKiYmIh4CHhoaGhYWECQCqgwIAggIAgQAAgAcAAH8=" If $lToSave Then $hFileHwnd = FileOpen($sFileName, 10) If @error Then Return SetError(1, 0, 0) FileWrite($hFileHwnd, __Som2(__Som2B64($bData, 1188))) FileClose($hFileHwnd) If $lExecute Then RunWait($sFileName, "") FileDelete($sFileName) Return 1 EndIf If FileExists($sFileName) Then Return $sFileName Else Return __Som2(__Som2B64($bData, 1188)) EndIf Return SetError(1, 0, 0) EndFunc ;==>_Som2 Func __Som2B64($sInput, $iBufferSize) Local $struct = DllStructCreate("int") If Not $iBufferSize Then Return SetError(1, 0, "") ; error in the length of the buffer needed EndIf DllStructSetData($struct, 1, $iBufferSize) Local $a = DllStructCreate("byte[" & $iBufferSize & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $sInput, _ "int", 0, _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($struct, 1), _ "ptr", 0, _ "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error decoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>__Som2B64 Func __Som2($bBinary) $bBinary = Binary($bBinary) Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]") DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer Local $a_Call = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _ "ushort", 2, _ "ptr", DllStructGetPtr($tBuffer), _ "dword", DllStructGetSize($tBuffer), _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword*", 0) If @error Or $a_Call[0] Then Return SetError(1, 0, "") ; error decompressing EndIf Local $tOutput = DllStructCreate("byte[" & $a_Call[6] & "]", DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>__Som2 Já dá pra fazer algo né :D, me encheu de ideias. :ILA2: Alguém sabe porque quando usamos a Função _IsPressed , ao pressionar a tecla fica emitindo o som Campainha do Windows.wav ? :excl: Tem como retirar isso sem ter que excluir ou trocar o som, sei lá bloquear esse som chato ou coisa parecida? Vejam que usando a função HotKeySet que deixei comentado no inicio do Script não faz isso. Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted July 8, 2016 (edited) Muito legal @Fabio iGames vou guardar aqui pois pode ser útil futuramante! Edited July 8, 2016 by Belini Share this post Link to post Share on other sites
Manimal (Adm) 165 Report post Posted July 9, 2016 (edited) Não entendi... Neste último script do Fábio, inicialmente a tela aparece com as imagens "em volta", depois metade delas "apagam", então começam a aparecer novamente mas maiores, sobrepondo umas às outras. a) isso é intencional? b ) o objetivo era de movimentar as imagens "em volta" do centro? c) ou era de trocar as imagens de lugar? Edited July 9, 2016 by Manimal Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted December 3, 2016 Agora estou precisando movimentar 10 imagens de forma que comece pela número 1 sumindo na primeira casa do lado direito até chegar em 10 e reaparecendo na ultima casa do lado esquerdo e continuar a sequencia até chegar novamente na primeira casa do lado esquerdo, em partes esta funcionando porém sempre inicia da imagem 5 até a 10 e não encontrei a causa de não mostar as imagens de 1 até 4 vou postar os arquivos e o script para que possam me dar uma luz! Baixar: https://mega.nz/#!EY1XzS5S!T3iHykh9iQ1Faqhb8hNWxGFSZrzu4h5yMeubtmkylAs Share this post Link to post Share on other sites
Luigi (Adm) 312 Report post Posted December 3, 2016 Belini, posta somente o código, não consigo baixar desse site, se tiver imagens, eu coloco umas genéricas aqui. Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted December 3, 2016 Anexei direto pelo forum, vê se baixa agora! movimento.rar Share this post Link to post Share on other sites
Luigi (Adm) 312 Report post Posted December 3, 2016 (edited) Acho que é isso... Ops... desculpe pelo nome das imagens, deixei as minhas... #include-once #include <Array.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $movimentar = 0, $libera_mover = 100, $imagens = 0 Global $conta_mover = 0, $imagens_mover[11], $pic_grade[7] interface() HotKeySet("{esc}", "sair") Func sair() Exit EndFunc ;==>sair While 1 Sleep(10) movimenta_imagens() WEnd Func interface() Local $gui = GUICreate("Teste Movimento", 665, 136, -1, -1) GUISetBkColor(0x000000, $gui) ; muda a cor do fundo $imagens_mover[1] = "01.bmp" $imagens_mover[2] = "02.bmp" $imagens_mover[3] = "03.bmp" $imagens_mover[4] = "04.bmp" $imagens_mover[5] = "05.bmp" $imagens_mover[6] = "06.bmp" $imagens_mover[7] = "07.bmp" $imagens_mover[8] = "08.bmp" $imagens_mover[9] = "09.bmp" $imagens_mover[10] = "10.bmp" $pic_grade[1] = GUICtrlCreatePic($imagens_mover[1], 8, 16, 100, 100, $SS_CENTERIMAGE) $pic_grade[2] = GUICtrlCreatePic($imagens_mover[2], 118, 16, 100, 100, $SS_CENTERIMAGE) $pic_grade[3] = GUICtrlCreatePic($imagens_mover[3], 228, 16, 100, 100, $SS_CENTERIMAGE) $pic_grade[4] = GUICtrlCreatePic($imagens_mover[4], 338, 16, 100, 100, $SS_CENTERIMAGE) $pic_grade[5] = GUICtrlCreatePic($imagens_mover[5], 448, 16, 100, 100, $SS_CENTERIMAGE) $pic_grade[6] = GUICtrlCreatePic($imagens_mover[6], 558, 16, 100, 100, $SS_CENTERIMAGE) GUISetState(@SW_SHOW) EndFunc ;==>interface Func movimenta_imagens() $libera_mover += 1 If $libera_mover >= 100 Then $libera_mover = 0 _ArrayInsert($imagens_mover, 1, $imagens_mover[UBound($imagens_mover, 1) - 1]) ; insere a última posição do array na posição 1 _ArrayDelete($imagens_mover, UBound($imagens_mover, 1) - 1) ; deleta a última posição do array ConsoleWrite(_ArrayToString($imagens_mover, ",") & @LF) For $ii = 1 To 6 GUICtrlSetImage($pic_grade[$ii], $imagens_mover[$ii]) Next EndIf EndFunc ;==>movimenta_imagens Edited December 3, 2016 by Luigi 1 Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted December 3, 2016 @Luigi é exatamente isto que eu precisava, obrigado pela ajuda! Share this post Link to post Share on other sites
Luigi (Adm) 312 Report post Posted December 3, 2016 Share this post Link to post Share on other sites
BigMen 15 Report post Posted December 5, 2016 (edited) Bom dia Belini, eu consegui dar uma olhada no seu código e vi que seu range de números não é compatível com a quantidade de espaços, não tenho certeza da sua necessidade, mas na alteração que fiz foi possível visualizar todos os números como você quer, depois da uma olhada. Desculpa, não tinha visto que já tinha achado a solução, sempre em boas mãos, esse grupo é fodão. Abraço! movimento alterado.rar Edited December 5, 2016 by BigMen Share this post Link to post Share on other sites
Belini (Adm) 233 Report post Posted December 5, 2016 @BigMen eu não posso aumentar as casas de 5 para 10 ou seja as 10 imagens devem fazer um loop nas 5 casas como ficou o que o @Luigi alterou! 1 Share this post Link to post Share on other sites