Author Topic: Need help with Mousemove profile  (Read 1193 times)

VoiceAble556

  • Newbie
  • *
  • Posts: 9
Need help with Mousemove profile
« on: December 29, 2020, 12:28:20 AM »
I'm not really sure where i messed up, i've looked at every line multiple times. if someone has time can you point out the mistake?

Attached profile and video i watched below hopefully that helps a little


the video i followed for reference:

https://www.youtube.com/watch?v=ohaCsPD1wn8







Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Need help with Mousemove profile
« Reply #1 on: December 29, 2020, 12:11:46 PM »
Your profile isn't working because the "Loop Start" actions are checking the value of a text variable named "movement", where they should be checking an integer variable by the same name instead.

Given that there is likely no text variable named "movement" with a value of "0", the loop never starts, so the cursor never moves.


The original profile should work once you change those checks, but here is a rewritten version that uses a few different techniques to achieve the same end-result:

[go;] [up;down] [left;right;] [crawl;slow;fast;sprint;];[go;] [left;right] [up;down;] [crawl;slow;fast;sprint;]
Code: [Select]
Set Boolean [stopMoving] to True

Set integer [incrementDelayms] value to 50
Set integer [incrementAmount] value to 3
Begin Text Compare : [{CMDSEGMENT:3}] Equals 'crawl'
    Set integer [incrementDelayms] value to 125
    Set integer [incrementAmount] value to 1
Else If Text Compare : [{CMDSEGMENT:3}] Equals 'slow'
    Set integer [incrementAmount] value to 1
Else If Text Compare : [{CMDSEGMENT:3}] Equals 'fast'
    Set integer [incrementAmount] value to 9
Else If Text Compare : [{CMDSEGMENT:3}] Equals 'sprint'
    Set integer [incrementAmount] value to 21
End Condition
Set decimal [incrementDelay] value to the converted value of {INT:incrementDelayms}
Set decimal [incrementDelay] to [incrementDelay] divided by 1000,00000

//If moving diagonally, apply a different scaler, if desired
Begin Text Compare : [{CMDSEGMENT:2}] Does Not Equal ''
    Set integer [incrementAmount] to [incrementAmount] times 1
Else
    Set integer [incrementAmount] to [incrementAmount] times 1
End Condition

Set integer [incrementX] value to 0
Set integer [incrementY] value to 0
Begin Text Compare : [{CMDSEGMENT:1}] Equals 'up'
    Set integer [incrementY] value to 0
    Set integer [incrementY] to [incrementY] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'down'
    Set integer [incrementY] value to the value of [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'left'
    Set integer [incrementX] value to 0
    Set integer [incrementX] to [incrementX] minus [incrementAmount]
Else
    Set integer [incrementX] value to the value of [incrementAmount]
End Condition

Begin Text Compare : [{CMDSEGMENT:2}] Equals 'up'
    Set integer [incrementY] value to 0
    Set integer [incrementY] to [incrementY] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'down'
    Set integer [incrementY] value to the value of [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'left'
    Set integer [incrementX] value to 0
    Set integer [incrementX] to [incrementX] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'right'
    Set integer [incrementX] value to the value of [incrementAmount]
Else
End Condition

Kill command, 'mouse movement loop'
Set Boolean [stopMoving] to False
Execute command, 'mouse movement loop' (and wait until it completes)

mouse movement loop
Code: [Select]
Start Loop While : [stopMoving] Equals False
    Move mouse right [{INT:incrementX}] pixel(s), down [{INT:incrementY}] pixel(s) (from cursor position)
    Pause a variable number of seconds [incrementDelay]
End Loop

stop
Code: [Select]
Kill command, 'mouse movement loop'




If you want different speeds for diagonal movement, you can move the speed setting section into the scaler condition (top branch is for diagonal movement speed, bottom for straight), E.G.
Code: [Select]
Set Boolean [stopMoving] to True

//If moving diagonally, apply a different scaler, if desired
Begin Text Compare : [{CMDSEGMENT:2}] Does Not Equal ''
    Set integer [incrementDelayms] value to 50
    Set integer [incrementAmount] value to 3
    Begin Text Compare : [{CMDSEGMENT:3}] Equals 'crawl'
        Set integer [incrementDelayms] value to 125
        Set integer [incrementAmount] value to 1
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'slow'
        Set integer [incrementAmount] value to 1
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'fast'
        Set integer [incrementAmount] value to 9
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'sprint'
        Set integer [incrementAmount] value to 21
    End Condition
    Set integer [incrementAmount] to [incrementAmount] times 1
Else
    Set integer [incrementDelayms] value to 50
    Set integer [incrementAmount] value to 3
    Begin Text Compare : [{CMDSEGMENT:3}] Equals 'crawl'
        Set integer [incrementDelayms] value to 125
        Set integer [incrementAmount] value to 1
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'slow'
        Set integer [incrementAmount] value to 1
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'fast'
        Set integer [incrementAmount] value to 9
    Else If Text Compare : [{CMDSEGMENT:3}] Equals 'sprint'
        Set integer [incrementAmount] value to 21
    End Condition
    Set integer [incrementAmount] to [incrementAmount] times 1
End Condition
Set decimal [incrementDelay] value to the converted value of {INT:incrementDelayms}
Set decimal [incrementDelay] to [incrementDelay] divided by 1000,00000

Set integer [incrementX] value to 0
Set integer [incrementY] value to 0
Begin Text Compare : [{CMDSEGMENT:1}] Equals 'up'
    Set integer [incrementY] value to 0
    Set integer [incrementY] to [incrementY] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'down'
    Set integer [incrementY] value to the value of [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:1}] Equals 'left'
    Set integer [incrementX] value to 0
    Set integer [incrementX] to [incrementX] minus [incrementAmount]
Else
    Set integer [incrementX] value to the value of [incrementAmount]
End Condition

Begin Text Compare : [{CMDSEGMENT:2}] Equals 'up'
    Set integer [incrementY] value to 0
    Set integer [incrementY] to [incrementY] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'down'
    Set integer [incrementY] value to the value of [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'left'
    Set integer [incrementX] value to 0
    Set integer [incrementX] to [incrementX] minus [incrementAmount]
Else If Text Compare : [{CMDSEGMENT:2}] Equals 'right'
    Set integer [incrementX] value to the value of [incrementAmount]
Else
End Condition

Kill command, 'mouse movement loop'
Set Boolean [stopMoving] to False
Execute command, 'mouse movement loop' (and wait until it completes)


I have attached the profile so you can import it directly.


EDIT: Corrected the inversion of X and Y, which was incorrect in the source profile this is based on (X is left to right, Y is top to bottom, not the other way around)
« Last Edit: January 19, 2021, 09:18:39 AM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Need help with Mousemove profile
« Reply #2 on: December 29, 2020, 12:24:36 PM »
Holy wow - great work, Pfeil!

VoiceAble556

  • Newbie
  • *
  • Posts: 9
Re: Need help with Mousemove profile
« Reply #3 on: December 29, 2020, 11:42:36 PM »
Thanks again i really appreciate the amount of effort you've put into my problems and solving them. thank you so much

VoiceAble556

  • Newbie
  • *
  • Posts: 9
Re: Need help with Mousemove profile
« Reply #4 on: December 30, 2020, 12:51:21 AM »
Okay I actually fixed the other profile thanks to your advice. I had everything as text instead of integer and the guy didn't show how he did it or at least I didn't understand it LOL, anyway thank you very much once again.