Paulie Posted September 17, 2006 Share Posted September 17, 2006 (edited) I'm making a script that will create a word, and make it follow behind your mouse, like a mousetail I got it to make the windows with the text right, but the movement thing isn't working Currently, the thing doesn't move at all when ran, but if you take out the 'Do...Until' loops it moves, but it goes in right angles instead of directly to the mouse and i want each letter to move individually, So say i use the word "Paulie", i want the 'P' to go into position, then the 'a', then the 'u' etc. not like moving the whole thing as if it were just one window Also, how can I make the background of the letter window transparent, but the letter still visible? I think thats possible. Here is my current code expandcollapse popup#include <GuiConstants.au3> Dim $window[100], $letter[100], $label[100] $word = InputBox("Input", "Input the word you want for a mousetail.") Global $Count = StringLen($word) $Letter = StringSplit($word, "") For $integer1 = 1 to $count $pos = MouseGetPos() $window[$integer1] = GUICreate($Integer1, 20, 20, $pos[0]+(20*$integer1), $pos[1]+(20*$integer1),$Ws_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) $Label[$Integer1] = GUICtrlCreateLabel($Letter[$Integer1],0,0,20, 20, $SS_CENTER) GUICtrlSetFont($Label[$integer1], 12, 600) GUICtrlSetColor($Label[$integer1], 0xFF0000) GuiSetState(@SW_SHOW) Next While 1 For $Integer2 = 1 to $Count $Winpos = WinGetPos($Integer2) $pos = MouseGetPos() Select Case $Winpos[0] > $pos[0]+(20*$Integer2) Do WinMove($Integer2, "", $Winpos[0]-1, $Winpos[1]) Until $Winpos[0] = $pos[0]+(20*$Integer2) Case $Winpos[1] > $pos[1]+(20*$Integer2) Do WinMove($Integer2, "", $Winpos[0], $Winpos[1]-1) Until $Winpos[1] = $pos[1]+(20*$Integer2) Case $Winpos[0] < $pos[0]+(20*$Integer2) Do WinMove($Integer2, "", $Winpos[0]+1, $Winpos[1]) Until $Winpos[0] = $pos[0]+(20*$Integer2) Case $Winpos[1] < $pos[1]+(20*$Integer2) Do WinMove($Integer2, "", $Winpos[0], $Winpos[1]+1) Until $Winpos[1] = $pos[1]+(20*$Integer2) EndSelect Next WEnd Edited September 17, 2006 by Paulie Link to comment Share on other sites More sharing options...
Paulie Posted September 17, 2006 Author Share Posted September 17, 2006 seriously, no one can help me?? Bump z Link to comment Share on other sites More sharing options...
jvanegmond Posted September 17, 2006 Share Posted September 17, 2006 I have done almost exactly this a few times.. The first 4 times I tried this it was a disaster and the fifth time it worked so well, I decided I was never going to do it again. Whoever wrote that Snake game in AutoIt knows how to do it really well, you might look at his script as a example. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Paulie Posted September 17, 2006 Author Share Posted September 17, 2006 I have done almost exactly this a few times.. The first 4 times I tried this it was a disaster and the fifth time it worked so well, I decided I was never going to do it again. Whoever wrote that Snake game in AutoIt knows how to do it really well, you might look at his script as a example.Which snake game?Do you have a link? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 17, 2006 Moderators Share Posted September 17, 2006 Which snake game?Do you have a link? http://www.autoitscript.com/forum/index.ph...ghlite=%2BSnake Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
/dev/null Posted September 17, 2006 Share Posted September 17, 2006 and the fifth time it worked so wellso, why don't you post your code here?CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Paulie Posted September 17, 2006 Author Share Posted September 17, 2006 http://www.autoitscript.com/forum/index.ph...ghlite=%2BSnakei searched for snake, but i got 30 results, and 6 of them pertained to snake the game, and most used the arrow keys, and i couldn't find '360 snake' which I'm assuming is what he was talking about.I wasn't to lazy to search, just wanted him to be a little more specificand i have to agree with /dev/nullcan i see your code? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 17, 2006 Moderators Share Posted September 17, 2006 Paulie, the code is really confusing ... One thing I'll point out that doesn't really seem to fix the issue (as I'm not digging too deep) is that in your While/WEnd ... you are using $Integer alone, but you are trying to move a Int() not a window... you created your windows in an array.... yet you aren't trying to move WinMove($windows[$Integer]) you are trying to WinMove($Integer) << If the above is confussing sorry, but so was the example Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted September 18, 2006 Author Share Posted September 18, 2006 Paulie, the code is really confusing ... One thing I'll point out that doesn't really seem to fix the issue (as I'm not digging too deep) is that in your While/WEnd ... you are using $Integer alone, but you are trying to move a Int() not a window... you created your windows in an array.... yet you aren't trying to move WinMove($windows[$Integer]) you are trying to WinMove($Integer) << If the above is confussing sorry, but so was the example Well, notice when i created the windows, i used the integer to name them so when it asks for title to move with winmove, i just use a number I know the name isn't the problem, because if you remove the Do...Until loops, the windows all move, but if the mouse is moved in a diagonal path, the window moves entirely to the left, then entirely to the right making it not follow the mouse correctly Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 18, 2006 Moderators Share Posted September 18, 2006 Well, notice when i created the windows, i used the integer to name them so when it asks for title to move with winmove, i just use a number I know the name isn't the problem, because if you remove the Do...Until loops, the windows all move, but if the mouse is moved in a diagonal path, the window moves entirely to the left, then entirely to the right making it not follow the mouse correctlySo you're saying this is not the effect you're going for ... is that right?#include <GuiConstants.au3> Dim $window[100], $letter[100], $label[100] $word = InputBox("Input", "Input the word you want for a mousetail.") Global $Count = StringLen($word) $Letter = StringSplit($word, "") For $integer1 = 1 to $count $pos = MouseGetPos() $window[$integer1] = GUICreate($Integer1, 20, 20, $pos[0]+(20*$integer1), $pos[1]+(20*$integer1),$Ws_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) $Label[$Integer1] = GUICtrlCreateLabel($Letter[$Integer1],0,0,20, 20, $SS_CENTER) GUICtrlSetFont($Label[$integer1], 12, 600) GUICtrlSetColor($Label[$integer1], 0xFF0000) GuiSetState(@SW_SHOW) Next While 1 For $Integer2 = 1 to $Count $pos = MouseGetPos() $Winpos = WinGetPos(HWnd($window[$Integer2])) Select Case $Winpos[0] > $pos[0]+(20*$Integer2) WinMove(HWnd($window[$Integer2]), "", $Winpos[0]-1, $Winpos[1]) Case $Winpos[1] > $pos[1]+(20*$Integer2) WinMove(HWnd($window[$Integer2]), "", $Winpos[0], $Winpos[1]-1) Case $Winpos[0] < $pos[0]+(20*$Integer2) WinMove(HWnd($window[$Integer2]), "", $Winpos[0]+1, $Winpos[1]) Case $Winpos[1] < $pos[1]+(20*$Integer2) WinMove(HWnd($window[$Integer2]), "", $Winpos[0], $Winpos[1]+1) EndSelect Next WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted September 18, 2006 Author Share Posted September 18, 2006 (edited) That was cleaner Smoke_N, But, After tinkering, i have managed to improve the movement SLIGHTLYNow the only problems I am having areMaking each letter move individually(versus as a whole chunk)Making the background of the letter windows transparent but the letters themselves remain visibleMy code with improved movement:expandcollapse popup#include <GuiConstants.au3> Dim $window[100], $letter[100], $label[100],$loc, $loc1, $locA, $locB $word = InputBox("Input", "Input the word you want for a mousetail.") Global $Count = StringLen($word) $Letter = StringSplit($word, "") For $integer1 = 1 to $count $pos = MouseGetPos() $window[$integer1] = GUICreate($Integer1, 20, 20, $pos[0]+(20*$integer1), $pos[1]+(20*$integer1),$Ws_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) $Label[$Integer1] = GUICtrlCreateLabel($Letter[$Integer1],0,0,20, 20, $SS_CENTER) GUICtrlSetBkColor($Label[$integer1], $WS_EX_TRANSPARENT); my attempt at transparency GUICtrlSetFont($Label[$integer1], 12, 600) GUICtrlSetColor($Label[$integer1], 0xFF0000) GuiSetState(@SW_SHOW) Next While 1 For $Integer2 = 1 to $Count $pos = MouseGetPos() Select Case $loc <> $pos[0] Or $loc1 <> $pos[1] _SetPos($loc, $loc1, $pos) EndSelect Next WEnd Func _SetPos($loc, $loc1, $pos) For $Integer3 = 1 to $Count $GUIPos1 = WinGetPos($Integer3) $loc = "" If $pos[0]+(20*$integer3) > $GUIPos1[0] Then $loc = $GUIPos1[0] + 2 ElseIf $pos[0]+(20*$integer3) < $GUIPos1[0] Then $loc = $GUIPos1[0] - 2 Else $loc = $GUIPos1[0] EndIf $loc1 = "" If $pos[1]+(20*$integer3) > $GUIPos1[1] Then $loc1 = $GUIPos1[1] + 2 ElseIf $pos[1]+(20*$integer3) < $GUIPos1[1] Then $loc1 = $GUIPos1[1] - 2 Else $loc1 = $GUIPos1[1] EndIf WinMove($Integer3, "", $loc, $loc1) Next EndFunc ;==> _SetPosAnyone have any more suggestions? Edited September 18, 2006 by Paulie Link to comment Share on other sites More sharing options...
death pax Posted September 18, 2006 Share Posted September 18, 2006 Also, how can I make the background of the letter window transparent, but the letter still visible? I think thats possible http://www.autoitscript.com/forum/index.ph...amp;mode=linear Link to comment Share on other sites More sharing options...
Paulie Posted September 18, 2006 Author Share Posted September 18, 2006 (edited) http://www.autoitscript.com/forum/index.ph...amp;mode=linearThanks, used that to make the transparency thing work First For...Next loop: For $integer1 = 1 to $count $pos = MouseGetPos() $window[$integer1] = GUICreate($Integer1, 20, 20, $pos[0]+(20*$integer1), $pos[1]+(20*$integer1),$Ws_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) GUISetBkColor(0x00FF00) $Label[$Integer1] = CreateTextRgn($window[$integer1],$letter[$integer1],20,"Lucida Console",500) GuiSetState(@SW_SHOW) SetWindowRgn($Window[$integer1],$Label[$Integer1]) Next Still need the things to move individually though Any ideas? Edited September 18, 2006 by Paulie Link to comment Share on other sites More sharing options...
death pax Posted September 18, 2006 Share Posted September 18, 2006 ill see what i can do ^.^ Link to comment Share on other sites More sharing options...
evilelf Posted September 18, 2006 Share Posted September 18, 2006 (edited) Still need the things to move individually though Any ideas? Ok i am new to Auto as u can see Paulie and u hate me so.... how did u get them to move at the same time? if u can try to add like 2 Seconds Before the next line is ran that would be the Next Letter. Input the word u like for a mouse tail. Paulie "P" Would Move. Sleep"2000" Or Even "1000" "A" Would Move. Should not work. Would this work? Or u cant do this with that Set up. I understand its out of my lead but hey I did try Some how just add a little Sleep Before it moves. Edited September 18, 2006 by evilelf Link to comment Share on other sites More sharing options...
jvanegmond Posted September 18, 2006 Share Posted September 18, 2006 i searched for snake, but i got 30 results, and 6 of them pertained to snake the game, and most used the arrow keys, and i couldn't find '360 snake' which I'm assuming is what he was talking about.I wasn't to lazy to search, just wanted him to be a little more specificand i have to agree with /dev/nullcan i see your code?I can't find the code anymore. It was part of a strategy game I was working on. I was referring to 'Snake 360', sorry I wasn't more clear the first time. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Paulie Posted September 18, 2006 Author Share Posted September 18, 2006 Ok i am new to Auto as u can see Paulie and u hate me so....No, I don't hate you, I strongly dislike what you said.Anyone else could have said the tings you said, and I would've replied in the same wayNothing personal.I tried your idea, and though it did have a pretty weird effect, it didn't actually help the problem of having the 'P' move into position, before the 'A' movesThanks for the help though@mandar,It's cool, I should have searched harderUnfortunately, Blindwig's movement function was very complex, i don't quite understand itthe math is incredible however, and if he were here to explain it... anyway, thanks all for help, but for some reason my script gets stuck when I try to put any loops in the select statementAnd this is preventing me from getting the letters to move individuallyStill accepting any sugesstions. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 18, 2006 Share Posted September 18, 2006 (edited) Make the first window letter move to the mouse, and let the second window follow the first and the first follows the second etc. (You might have to store the last 'no. of letters' mouse positions or something.)It's worth a try, I'm going to try and do this as well.Edit: This has the desired effect, only the letters are in the wrong order quite often. But it's a improvement.#include <GuiConstants.au3> Global $window[20] Dim $word = "Paulie" Dim $letter = StringSplit($word, "") For $i = 1 to $letter[0] $window[$i] = GUICreate($letter[$i], 20, 20, 0,0,$WS_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) GUICtrlCreateLabel($letter[$i],0,0,20, 20, $SS_CENTER) GUICtrlSetFont(-1, 12, 600) GUICtrlSetColor(-1, 0xFF0000) GuiSetState(@SW_SHOW) Next Dim $x = 6 While 1 $pos = MouseGetPos() WinMove($window[$x],"", $pos[0],$pos[1]) Sleep(50) $x -= 1 If $x = 0 Then $x = 6 EndIf WEnd Edit: I know how to do it! Store positions in a array and push the values one and delete them when they get to position 6. Give me a day, because I am desperate for sleep. Edited September 18, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Paulie Posted September 18, 2006 Author Share Posted September 18, 2006 Make the first window letter move to the mouse, and let the second window follow the first and the first follows the second etc. (You might have to store the last 'no. of letters' mouse positions or something.) It's worth a try, I'm going to try and do this as well. Edit: This has the desired effect, only the letters are in the wrong order quite often. But it's a improvement. expandcollapse popup#include <GuiConstants.au3> Global $window[20] Dim $word = "Paulie" Dim $letter = StringSplit($word, "") For $i = 1 to $letter[0] $window[$i] = GUICreate($letter[$i], 20, 20, 0,0,$WS_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) GUICtrlCreateLabel($letter[$i],0,0,20, 20, $SS_CENTER) GUICtrlSetFont(-1, 12, 600) GUICtrlSetColor(-1, 0xFF0000) GuiSetState(@SW_SHOW) Next Dim $x = 6 While 1 $pos = MouseGetPos() WinMove($window[$x],"", $pos[0],$pos[1]) Sleep(50) $x -= 1 If $x = 0 Then $x = 6 EndIf WEndoÝ÷ Ù±ßÛ"IèÂ0¶hÝ÷JÚ+z,بȧiªëk&§v¬Ø^½©nzÊ'y©Ýué^µëazl!z{a{(¶Ú)¢Èú+Þæk&Þq«¬x¦uë)z¶yú+²W§ú®¢×~(.çhºÛ(ëax-«p¢¹,~æy»y¢ëazWµêìj·¨~קçí±ÆµêÞu§+¢Ë-ç^²Kh¤¶½éí¹©eÊX¤zêQmßÙ¦jH§¡®ú+'(uâ7öYm¯,¨º½ý²)Ú±çºØ^æ«zlz÷¥¢ÛzZqì!W¬µ«^éíÂ+a¶¬jëh×6While 1 For $Integer2 = 1 to $Count $pos = MouseGetPos() Select Case $loc <> $pos[0] Or $loc1 <> $pos[1] _SetPos($loc, $loc1, $pos) EndSelect Next WEnd EndFunc Func _SetPos($loc, $loc1, $pos) For $Integer3 = 2 to $Count Do $pos = MouseGetPos() $GUIPos2 = WinGetPos(1) $GUIPos1 = WinGetPos($Integer3) ;Moves first letter WinMove(1, "", $pos[0]+20, $pos[1]+20) ;Keeps other letters together $loc = "" If $Pos[0]+(20*$integer3) > $GUIPos1[0] Then $loc = $GUIPos1[0] + 2.5 ElseIf $pos[0]+(20*$integer3) < $GUIPos1[0] Then $loc = $GUIPos1[0] - 2.5 Else $loc = $GUIPos1[0] EndIf $loc1 = "" If $pos[1]+(20*$integer3) > $GUIPos1[1] Then $loc1 = $GUIPos1[1] + 2.5 ElseIf $pos[1]+(20*$integer3) < $GUIPos1[1] Then $loc1 = $GUIPos1[1] - 2.5 Else $loc1 = $GUIPos1[1] EndIf WinMove($Integer3, "", $loc, $loc1) Until $GUIPos1[0] = $pos[0]+(20*$integer3) and $GUIPos1[1] = $pos[1]+(20*$integer3) Next EndFunc ;==> _SetPos Link to comment Share on other sites More sharing options...
jvanegmond Posted September 18, 2006 Share Posted September 18, 2006 (edited) I got it Sorry for the little ego trip in there by the way. #include <GuiConstants.au3> Global $window[30], $pos[30][2] Dim $word = InputBox(@ScriptName,"What word do you want to display?", "Manadar owns") Dim $letter = StringSplit($word, "") For $i = 1 to $letter[0] $window[$i] = GUICreate($letter[$i], 20, 20, 0,0,$WS_POPUP,Bitor($WS_EX_TOOLWINDOW,$WS_EX_Topmost)) GUICtrlCreateLabel($letter[$i],0,0,20, 20, $SS_CENTER) GUICtrlSetFont(-1, 12, 600) GUICtrlSetColor(-1, 0xFF0000) GuiSetState(@SW_SHOW) Next While 1 For $x = $letter[0] to 1 Step -1 $pos[$x][0] = $pos[$x-1][0] $pos[$x][1] = $pos[$x-1][1] Next $pos[0][0] = MouseGetPos(0)+2 ; +2 makes sure no window appears under your mouse allowing you to click. $pos[0][1] = MouseGetPos(1)+2 For $x = 1 to $letter[0] WinMove($window[$x],"", $pos[$x][0],$pos[$x][1]) Next Sleep(50) WEnd Edit: Forgot tags. Edited September 18, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now