-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ca we create a new action? #24
Comments
Hi @Derooms, after creating a new class for the Action ( @@ -53,6 +53,8 @@ namespace TTMouseclickSimulator.Project
actionTypes.Add("Speedchat", typeof(SpeedchatAction));
+ actionTypes.Add("PickFlower", typeof(PickFlowerAction));
+
actionTypes.Add("Pause", typeof(PauseAction));
} After this, you will be able to use the new action in a XML project file: <PickFlower /> Please note about mouse coordinates: When calling In order to get the correct x/y values to click a button in TT Rewritten, you can set a 4:3 resolution in the TT Rewritten options, like 640x480, 800x600 or 1024x768; then get the x/y coordinates in that window, and calculating them like this (for 800x600):
For example, in the following screenshot that was taken with 640x480, it shows the "Pick Flower" button and the "Yes" button: The "Pick Flower" button here has the coordinates (31, 110) and the "Yes" button has coordinates (293, 321) (marked with a black cross). For the Mouse Click Simulator, these coordinates can now be calculated as follows: The next step is to identify if the alignment of the buttons is left, centered or right (in your sample code, this is already done correctly), because TT Rewritten does a scaling of the window so that its content has the correct aspect ratio, even if the window size doesn't have a 4:3 ratio. We can see this if we reduce the window height (but don't modify the window width): As the "Pick Flower" stays on the left hand side, we need to specify So, you can use the following code for the action: public override sealed async Task RunAsync(IInteractionProvider provider)
{
// Click on the "Pick Flower" button.
await MouseHelpers.DoSimpleMouseClickAsync(provider, new Coordinates(78, 264),
HorizontalScaleAlignment.Left);
await provider.WaitAsync(200);
// Click on the "Yes" button.
await MouseHelpers.DoSimpleMouseClickAsync(provider, new Coordinates(733, 770));
} Edit: Please note that the new @@ -69,6 +69,7 @@
<Compile Include="Core\Actions\AbstractAction.cs" />
<Compile Include="Core\Actions\AbstractActionContainer.cs" />
<Compile Include="Core\Actions\IActionContainer.cs" />
+ <Compile Include="Core\ToontownRewritten\Actions\Gardening\PickFlowerAction.cs" />
<Compile Include="Core\ToontownRewritten\Actions\Gardening\PlantFlowerAction.cs" />
<Compile Include="Project\SimulatorProject.cs" />
<Compile Include="Utils\TaskDialog.cs" /> Hope this helps! |
Helps a lot, unfortunately I don't have time during the week to work on it, but I'll try to get it done over the next weekend and post it here when it is |
I'm trying to write a script for fully automated gardening (moving and all). I tried to create a "pick flower" action but when i try to load it into the simulator (ofc I'm loading a .xml file with the action in it) the simulator says "Pick Flower could not be recognized as an action type".
The file is Saved as .cs
The file is in the Gardening folder inside the core
The path to it is correct (I believe)
The .xml file isn't the problem, I loaded quitfishing and it worked fine
Here's the code:
using System;
using System.Text;
using System.Threading.Tasks;
using TTMouseclickSimulator.Core.Actions;
using TTMouseclickSimulator.Core.Environment;
namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions.Gardening
{
public class PickFlowerAction : AbstractAction
{
public override sealed async Task RunAsync(IInteractionProvider provider)
{
// Click on the "Pick Flower" button.
await MouseHelpers.DoSimpleMouseClickAsync(provider, new Coordinates(46, 210),
VerticalScaleAlignment.Left);
await provider.WaitAsync(200);
}
The text was updated successfully, but these errors were encountered: