ChazFire's REVENGE Posted July 25, 2005 Share Posted July 25, 2005 Letz cut to the chase... I cannot get the mouse controls to work(you'll understand from my code) what i am trying to acomplish is simply this, when the mouse reaches the limits set it will jupm to any location that i would like it to (sooner or l8r ima make it just move back a few pixls...) I have gotten these commands to work bfore but simply cant do it the way im tring ro add them to my script... yambling on... expandcollapse popup; 1024 x 768 - desktop size tested/scripted with ; Simple tool designed to help Diablo users who use windows, not to click off the game screen... ;Author = me >.< ChazFire of course ; ; ; Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(270628,"ChazFire D2:LOD Windows helper 'Simple Edition'","Would you like to load Windows Helper now?" & @CRLF & "") Select Case $iMsgBoxAnswer = 6;Yes Case $iMsgBoxAnswer = 7;No exit EndSelect $mousepos = MouseGetPos() Global $Paused HotKeySet("{PAUSE}", "TogglePause") $var = IniRead("C:d2w.ini", "name", "winname", "Diablo II") ToolTip('Press "pause/break" to pause or continue script', 20, 20) $1 = 1 Do If WinActive($var) Then Sleep(100) Else WinActivate($var) WinMove("Diablo II", "", 0, 0) MouseMove(400, 400, 0) #region ""mouse boundries"" ; left If ($mousepos[0]) <= 10 Then MouseMove(50, 50) EndIf ; right If ($mousepos[0]) >= 795 Then MouseMove(50, 50) EndIf ;top If ($mousepos[1]) <= 33 Then MouseMove(50, 50) EndIf ;bottom If ($mousepos[1]) >= 602 Then MouseMove(50, 50) EndIf #region ""mouse boundries"" EndIf $1 = $1 + 1 Until $1 = 0 Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is Paused, You may resume to freely roam your computer now, or choose to continue script..."', 20, 20) Wend ToolTip('Press "pause"/break" to pause or continue script', 20, 20) EndFunc ;==>TogglePause You can change the ini dir or w/e to test this [font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font] Link to comment Share on other sites More sharing options...
ChazFire's REVENGE Posted July 25, 2005 Author Share Posted July 25, 2005 (edited) HMMM still cant get it to work independantly (not great at spelling) the code works well and the mouse does in fact get "trapped" inside the area set but i cant seem to get it to work in this script after thinking about it i tried this select ; left case ($mousepos[0]) <= 10 MouseMove(50, 50) ; right case ($mousepos[0]) >= 795 MouseMove(50, 50) ;top case ($mousepos[1]) <= 33 MouseMove(50, 50) ;bottom case ($mousepos[1]) >= 602 MouseMove(50, 50) endselect wich doesnt "trap" the mouse either but on both codes i get no errors... the rest of it works fine.... Round 2 (or is it 3) i have now tried to make it a function func _funcTrapMouse() select ; left case ($mousepos[0]) <= 10 MouseMove(50, 50) ; right case ($mousepos[0]) >= 795 MouseMove(50, 50) ;top case ($mousepos[1]) <= 33 MouseMove(50, 50) ;bottom case ($mousepos[1]) >= 602 MouseMove(50, 50) endselect endfunc <<<<<<<<<<<<<skip some code >>>>>>>>>>>>>>>>> Do If WinActive($var) Then Sleep(100) Else WinActivate($var) WinMove("Diablo II", "", 0, 0) MouseMove(400, 400, 0) call ("_funcTrapMouse") ; <<<<<<<----------called in here EndIf $1 = $1 + 1 Until $1 = 0 sigh, ill never get it done at this rate ***yes i know another individual has done almost same thing for WC3 but it didnt quiet work with DiabloII:LOD even after changing target ect Edited July 25, 2005 by ChazFire's REVENGE [font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font] Link to comment Share on other sites More sharing options...
LxP Posted July 25, 2005 Share Posted July 25, 2005 The MouseGetPos() command needs to be within the Do..Until loop. Link to comment Share on other sites More sharing options...
ChazFire's REVENGE Posted July 25, 2005 Author Share Posted July 25, 2005 The MouseGetPos() command needs to be within the Do..Until loop.<{POST_SNAPBACK}>Tanks for the tip, but I just tried doing that now it acts a little wierd. I.E. it doesnt trap mouse but when ever i click off screen it traps the mouse untill D2 comes bac up... is thier a way i can trap it while the window is running...trust me im looking through old threads and the help file as i work... [font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font] Link to comment Share on other sites More sharing options...
ChazFire's REVENGE Posted July 25, 2005 Author Share Posted July 25, 2005 (edited) OMG I feel like the biggest dumb @** in the world right now, i put it in the wrong part of the loop.... Do $mousepos = MouseGetPos() If WinActive($var) Then #region ""mouse boundries"" select ; left case ($mousepos[0]) <= 10 MouseMove(50, 50) ; right case ($mousepos[0]) >= 795 MouseMove(50, 50) ;top case ($mousepos[1]) <= 33 MouseMove(50, 50) ;bottom case ($mousepos[1]) >= 602 MouseMove(50, 50) endselect #region ""mouse boundries"" Sleep(100) Else WinActivate($var) WinMove("Diablo II", "", 0, 0) MouseMove(400, 400, 0) EndIf works.... Thats like dur i need it to work while win is active..... **pats self on back, then walks out the room in shame** allthough func would be lil less messy... Edited July 25, 2005 by ChazFire's REVENGE [font="Arial"]--------When you go to jail a friend will bve thier to bail you out, but a best friend will be sitting right next to you saying, "D*** we F**ked up!"--------A friend helps you move, but a best friend helps you move dead bodies?Which brings me to my question, what kind of friend are you?[/font] Link to comment Share on other sites More sharing options...
LxP Posted July 25, 2005 Share Posted July 25, 2005 (edited) allthough func would be lil less messy...That's okay -- we can tidy your code up in other ways (untested but should work):expandcollapse popup; Confirmation prompt if (msgBox(0x42124, "...", "Load Windows Helper?") = 7) then exit ; Pause functionality global $paused = 0 hotkeySet("{PAUSE}", "togglePause") toolTip("Press Pause to pause or continue the script", 20, 20) Func togglePause() $paused = not($paused) if ($paused) then toolTip("Script is paused -- press Pause to continue", 20, 20) while ($paused) sleep(100) wEnd else toolTip("Press Pause to pause or continue the script", 20, 20) endIf endFunc ; Get window title from INI local $title = iniRead("C:d2w.ini", "name", "winName", "Diablo II") while (1) sleep(100) if (winActive($title) then winMove("Diablo II", "", 0, 0) local $mousePos = mouseGetPos() #region "Mouse boundaries" ; left if ($mousePos[0] <= 10) then mouseMove(50, 50) ; right if ($mousePos[0] >= 795) then mouseMove(50, 50) ; top if ($mousePos[1] <= 33) then mouseMove(50, 50) ; bottom if ($mousePos[1] >= 602) then mouseMove(50, 50) #region "Mouse boundaries" endIf wEnd Edited July 25, 2005 by LxP Link to comment Share on other sites More sharing options...
therks Posted July 25, 2005 Share Posted July 25, 2005 (edited) call ("_funcTrapMouse") ; <<<<<<<----------called in here<{POST_SNAPBACK}>Oh. My. God. You know, I never believed Valik before. But I guess some people really do use Call() when they don't need to. Damn. Edited July 25, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Valik Posted July 25, 2005 Share Posted July 25, 2005 Oh. My. God. You know, I never believed Valik before. But I guess some people really do use Call() when they don't need to. Damn.<{POST_SNAPBACK}>I don't have to make things up, Saunders, which is the sad part given some of the seemingly outrageous things I've likely said. 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