StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
PowderToastMan  
#1 Posted : Saturday, October 9, 2021 2:49:09 PM(UTC)
PowderToastMan

Rank: Newbie

Reputation:

Groups: Approved
Joined: 10/9/2021(UTC)
Posts: 1
United States

Hi everyone i just made a script and i am trying to figure out how i can create a loop with just keys please see it below. Also if possible is there a way to setup it up to run so many times or stop it at one point?


sp.MouseMove(new Point(1043, 651));
sp.Sleep(422);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(511);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(29);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(30);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(29);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(46);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(30);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(30);
sp.SendVKeyDown(vk.VK_W);
sp.Sleep(10);
sp.SendVKeyDown(vk.TAB);
sp.Sleep(151);
sp.SendVKeyUp(vk.TAB);
sp.Sleep(1352);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(503);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(31);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(47);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(30);
sp.SendVKeyDown(vk.VK_D);
sp.Sleep(25);
sp.SendVKeyUp(vk.VK_D);
sp.Sleep(337);
sp.MouseMove(new Point(1022, 649));
sp.Sleep(9);
sp.MouseMove(new Point(1001, 643));
sp.Sleep(11);
sp.MouseMove(new Point(983, 633));
sp.Sleep(25);
sp.MouseMove(new Point(987, 613));
sp.Sleep(18);
sp.MouseMove(new Point(999, 596));
sp.Sleep(322);
sp.MouseMove(new Point(1008, 578));
sp.Sleep(22);
sp.MouseMove(new Point(1027, 570));
sp.Sleep(64);
sp.MouseMove(new Point(1047, 564));
sp.Sleep(59);
sp.MouseMove(new Point(1067, 561));
sp.Sleep(31);
sp.MouseMove(new Point(1088, 561));
sp.Sleep(28);
sp.MouseMove(new Point(1108, 559));
sp.Sleep(35);
sp.MouseMove(new Point(1128, 557));
sp.Sleep(57);
sp.MouseMove(new Point(1149, 557));
sp.Sleep(107);
sp.MouseMove(new Point(1169, 556));
sp.Sleep(111);
sp.MouseMove(new Point(1188, 564));
sp.Sleep(59);
sp.MouseMove(new Point(1208, 569));
sp.Sleep(40);
sp.MouseMove(new Point(1228, 570));
sp.Sleep(35);
sp.MouseMove(new Point(1248, 571));
sp.Sleep(432);
sp.MouseMove(new Point(1266, 580));
sp.Sleep(54);
sp.MouseMove(new Point(1287, 580));
sp.Sleep(22);
sp.MouseMove(new Point(1307, 581));
sp.Sleep(14);
sp.MouseMove(new Point(1327, 584));
sp.Sleep(11);
sp.MouseMove(new Point(1347, 588));
sp.Sleep(12);
sp.MouseMove(new Point(1368, 590));
sp.Sleep(10);
sp.MouseMove(new Point(1389, 593));
sp.Sleep(10);
sp.MouseMove(new Point(1409, 596));
sp.Sleep(8);
sp.MouseMove(new Point(1429, 601));
sp.Sleep(10);
sp.MouseMove(new Point(1450, 606));
sp.Sleep(10);
sp.MouseMove(new Point(1471, 612));
sp.Sleep(211);
sp.MouseMove(new Point(1491, 615));
sp.Sleep(36);
sp.MouseMove(new Point(1512, 614));
sp.Sleep(13);
sp.MouseMove(new Point(1532, 615));
sp.Sleep(11);
sp.MouseMove(new Point(1554, 618));
sp.Sleep(10);
sp.MouseMove(new Point(1576, 620));
sp.Sleep(11);
sp.MouseMove(new Point(1596, 623));
sp.Sleep(12);
sp.MouseMove(new Point(1616, 624));
sp.Sleep(15);
sp.MouseMove(new Point(1636, 625));
sp.Sleep(13);
sp.MouseMove(new Point(1658, 625));
sp.Sleep(11);
sp.MouseMove(new Point(1680, 625));
sp.Sleep(8);
sp.MouseMove(new Point(1702, 625));
sp.Sleep(8);
sp.MouseMove(new Point(1722, 623));
sp.Sleep(7);
sp.MouseMove(new Point(1743, 622));
sp.Sleep(7);
sp.MouseMove(new Point(1763, 620));
sp.Sleep(9);
sp.MouseMove(new Point(1785, 618));
sp.Sleep(8);
sp.MouseMove(new Point(1806, 618));
sp.Sleep(9);
sp.MouseMove(new Point(1827, 618));
sp.Sleep(8);
sp.MouseMove(new Point(1850, 618));
sp.Sleep(8);
sp.MouseMove(new Point(1871, 620));
sp.Sleep(9);
sp.MouseMove(new Point(1891, 623));
sp.Sleep(10);
sp.MouseMove(new Point(1911, 627));
sp.Sleep(483);
sp.MouseMove(new Point(1920, 645));
sp.Sleep(131);
sp.MouseMove(new Point(1921, 665));
sp.Sleep(1143);
sp.MouseMove(new Point(1920, 685));
sp.Sleep(667);
sp.MouseMove(new Point(1922, 665));
sp.Sleep(505);
sp.MouseMove(new Point(1920, 685));
sp.Sleep(400);
sp.MouseMove(new Point(1919, 665));
sp.Sleep(81);
sp.MouseMove(new Point(1920, 645));
sp.Sleep(52);
sp.MouseMove(new Point(1919, 625));
sp.Sleep(223);
sp.MouseMove(new Point(1920, 605));
sp.Sleep(1788);
sp.MouseMove(new Point(1919, 625));
sp.Sleep(230);
sp.MouseMove(new Point(1920, 645));
sp.Sleep(712);
sp.MouseMove(new Point(1921, 625));
sp.Sleep(1600);
sp.SendVKeyUp(vk.VK_W);
sp.ConsumePhysicalInput(false);
sp.ReloadScriptEnginePool()




randomConstant  
#2 Posted : Saturday, October 9, 2021 11:25:30 PM(UTC)
randomConstant

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/17/2021(UTC)
Posts: 6

Hi there, following are some ways to do specific things repeatedly (in loop)

Loop for specified number of times
Code:
//make a counter variable to control the loop
var loopCounter = 10; //you can put your desired positive integer number (repeat times) in here

//make a while loop
while(loopCounter > 0){ //this condition checks if loopCounter is still bigger than 0, if Yes then it continues, if No then it returns false and stops
    //decrease loop counter by 1 or any number, loop will stop when condition inside while() becomes false
    loopCounter = loopCounter - 1;

    //do something in loop
    //...any code written here will be repeated...
}


Loop for infinite number of times
Code:
//make a while loop and put 1 in the condition part which will always return true and loop will continue forever, no need for a counter variable
while(1){
    //...any code written here will be repeated...
    //...
}


Stop infinite loop (or any script running) by reloading StrokePlus
I actually dont have a solution to stop a running script, but I reload StrokePlus if I need to stop some script from running (or keep running in loop) using this.
Code:
sp.Reload();



You can put your code for those keys inside the loop and it should execute in a loop. Goodluck
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.