kpreisser / MouseClickSimulator

Mouse Click Simulator for Toontown Rewritten and Corporate Clash
MIT License
24 stars 17 forks source link

How to set an X offset #2

Closed judge2020 closed 8 years ago

judge2020 commented 8 years ago

I'm trying to make this work with toontown infinite. I have it finding infinite.exe instead of ttrengine.exe but now that i'm playing around with speedchat phrases it clicks on the regular (speedchat plus) bubble instead of speedchat. Is there a way to get it to move the simulated click to the right or add an X offset?

judge2020 commented 8 years ago

This is also an issue with (i believe) where the fishing pole button is when using a fishing script. It clicks on the bucket (maybe where it is in TTR) instead of the fishing button

TTExtensions commented 8 years ago

Hi,

I run the simulator with TT Infinite (1.2.0 live-v1.1.5), but I cannot seem to reproduce the coordinate issue with the Speedchat button: When I use a <Speedchat menuItems="3, 0" /> action, the simulator clicks on the Speedchat button, then "Hello" and then "Hi!".

When using the fishing function, clicking on the button to cast the rod also works, until to the point when the simulator wants to stop fishing by clicking on the red "X" button at the bottom, as that button has other coordinates and alignment as in TT Rewritten. However, on TT Infinite the fishing function does not correctly detect fish bubbles because the ambient light seems to change depending on the game's daytime.

I used the following changes to the source code (diff file):

 .../Core/ToontownRewritten/Actions/Fishing/QuitFishingAction.cs       | 4 ++--
 .../Core/ToontownRewritten/Environment/TTRWindowsEnvironment.cs       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/QuitFishingAction.cs b/TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/QuitFishingAction.cs
index ea45a44..38dfcf2 100644
--- a/TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/QuitFishingAction.cs
+++ b/TTMouseclickSimulator/Core/ToontownRewritten/Actions/Fishing/QuitFishingAction.cs
@@ -13,8 +13,8 @@ namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Fishing

         public override sealed async Task RunAsync(IInteractionProvider provider)
         {
-            Coordinates c = new Coordinates(1503, 1086);
-            await MouseHelpers.DoSimpleMouseClickAsync(provider, c, 200);
+            Coordinates c = new Coordinates(1470, 1086);
+            await MouseHelpers.DoSimpleMouseClickAsync(provider, c, 200, VerticalScaleAlignment.Right);
         }

         public override string ToString()
diff --git a/TTMouseclickSimulator/Core/ToontownRewritten/Environment/TTRWindowsEnvironment.cs b/TTMouseclickSimulator/Core/ToontownRewritten/Environment/TTRWindowsEnvironment.cs
index e6ba68c..3d26c84 100644
--- a/TTMouseclickSimulator/Core/ToontownRewritten/Environment/TTRWindowsEnvironment.cs
+++ b/TTMouseclickSimulator/Core/ToontownRewritten/Environment/TTRWindowsEnvironment.cs
@@ -15,7 +15,7 @@ namespace TTMouseclickSimulator.Core.ToontownRewritten.Environment
     /// </summary>
     public class TTRWindowsEnvironment : AbstractWindowsEnvironment
     {
-        private const string ProcessName = "TTREngine";
+        private const string ProcessName = "infinite";

         public static TTRWindowsEnvironment Instance { get; } = new TTRWindowsEnvironment();

As you say that in your case the simulator seems to use wrong X coordinates, can you make a screenshot of your TT window to verify the position of the speedchat button etc.? What operating system are you using? (I used WIndows 10 and Windows 7). Are you able to test with TT Rewritten if the same coordinate issue occurs?

judge2020 commented 8 years ago

Made a video explaining, im on windows 10 https://youtu.be/qTxkqz1tGX0

this is using your changes for TTI but nothing changed for ttr

TTExtensions commented 8 years ago

Hi, I just fixed a bug where the Mouse Click Simulator sometimes would calculate the mouse coordinates wrong. This happened for example if the system had multiple monitors.

Can you check if the current version fixes your problem? Thanks

judge2020 commented 8 years ago

Oh yes, never thought it could be from multiple displays. I'll test it out.

judge2020 commented 8 years ago

That works!. If I suspected that I would have included that I had multiple monitors.