Kuram Posted November 6, 2010 Share Posted November 6, 2010 I've searched around a bit and could not find any information so here I am asking: I was wondering if it possible to have 2 separate scripts sync up over the internet or a network (although preferably internet). For example, me and my friend run the same script, however due to latency the synchronization of both drifts apart over time, which isn't good for the script when it is suppose to run for 8 hours+ (assume all actions must be performed at the same time). Is there a way to have it, every so often, do a sleep command conditional on both scripts arriving at the same point (kind of like the lead script stops and waits for the other to catch up)? Thanks for help. Link to comment Share on other sites More sharing options...
Bert Posted November 7, 2010 Share Posted November 7, 2010 Is this for a game? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Kuram Posted November 7, 2010 Author Share Posted November 7, 2010 Is this for a game?Yeah. Does that change if it's possible or not? I dont exactly see how... Link to comment Share on other sites More sharing options...
Jayson Posted November 7, 2010 Share Posted November 7, 2010 Go read that post then : http://www.autoitscript.com/forum/forum-2/announcement-12-game-bots-and-automation/ Link to comment Share on other sites More sharing options...
supadodger Posted November 7, 2010 Share Posted November 7, 2010 (edited) yes you can. just post your question again as not related to a game and i will help you out. secondarily... does anyone know why no game automation is allowed... Edited November 7, 2010 by supadodger Link to comment Share on other sites More sharing options...
Kuram Posted November 7, 2010 Author Share Posted November 7, 2010 (edited) yes you can.just post your question again as not related to a game and i will help you out.secondarily... does anyone know why no game automation is allowed...Well it's not only for games but that was one scenario. It just seems a bit arbitrary to have to make a new thread with the exact same question. Let's just say if I wanted to start a timer, and start it at different times on both computers, it would reach a point at which 1 computer pauses until the other catches up, ie i'm using it to test the latency between our computers as a method of checking connection speed, using a timer while its paused to determine the time differentiation (without simply pinging in the cmd window) so that I can save each output in a txt file to determine both the connection speed, and how much slower/faster it is a different times of the day as a mean value. I know how to do the calculations, i just dont know if both computers can actually connect to each other and bounce info off one another.going through the faq, would it perhaps have something to do with the udpsend or udpopen commands? Edited November 7, 2010 by Kuram Link to comment Share on other sites More sharing options...
supadodger Posted November 7, 2010 Share Posted November 7, 2010 Well it's not only for games but that was one scenario. It just seems a bit arbitrary to have to make a new thread with the exact same question. Let's just say if I wanted to start a timer, and start it at different times on both computers, it would reach a point at which 1 computer pauses until the other catches up, ie i'm using it to test the latency between our computers as a method of checking connection speed, using a timer while its paused to determine the time differentiation (without simply pinging in the cmd window) so that I can save each output in a txt file to determine both the connection speed, and how much slower/faster it is a different times of the day as a mean value. I know how to do the calculations, i just dont know if both computers can actually connect to each other and bounce info off one another.going through the faq, would it perhaps have something to do with the udpsend or udpopen commands?if it was me i would just make both scripts stop every 15 minutes on the minute and sleep for 1 minute.that would probably be the simplest.at the beginning of the script have you both add a start time so they are syncing at the exact same time... Link to comment Share on other sites More sharing options...
Kuram Posted November 7, 2010 Author Share Posted November 7, 2010 if it was me i would just make both scripts stop every 15 minutes on the minute and sleep for 1 minute.that would probably be the simplest.at the beginning of the script have you both add a start time so they are syncing at the exact same time...Hmmm how do you add a specific start time then? Link to comment Share on other sites More sharing options...
supadodger Posted November 7, 2010 Share Posted November 7, 2010 (edited) Hmmm how do you add a specific start time then? $Hour = InputBox("","Start Time In Format 12:00") if @Hour > 12 Then $RealHour = @Hour -12 Else $RealHour = @HOUR EndIf $minute = @Min While $RealHour & ":" & $minute <> $Hour Sleep(100) TrayTip ("",$hour & @CRLF & $REalHour & ":" & @Min,30000) Wend Then at the end of the mainloop put $Minute = $Minute + 5 if $minute > 60 Then $Minute = 5 EndIF While @Min <> $Minute Sleep(100) Wend that way every loop they both sleep until the next batch. you can change the 5s to anything you want... Edited November 7, 2010 by supadodger Link to comment Share on other sites More sharing options...
Kuram Posted November 7, 2010 Author Share Posted November 7, 2010 (edited) $Hour = InputBox("","Start Time In Format 12:00") if @Hour > 12 Then $RealHour = @Hour -12 Else $RealHour = @HOUR EndIf $minute = @Min While $RealHour & ":" & $minute <> $Hour Sleep(100) TrayTip ("",$hour & @CRLF & $REalHour & ":" & @Min,30000) Wend Then at the end of the mainloop put $Minute = $Minute + 5 if $minute > 60 Then $Minute = 5 EndIF While @Min <> $Minute Sleep(100) Wend that way every loop they both sleep until the next batch. you can change the 5s to anything you want... This is kinda dependent on both computers having exactly the same system time. There is no way via direct connection? I was thinking of using UDPopen, UDPsend and UDPrecv at the end of each cycle, but I cant think of a way to determine if the other computer received it. Like, you can send a string through a socket, and the other computer can receive it, but i dont know how to tell that first computer that the second one received it, so they can both move on, unless a UDPsend will return an error until the other computer does the UDPrecv command, in which case it'll work perfectly.... time for some testing edit: so i was looking, looks like the TCP commands will work for what i've got in mind (with some creative tinkering ) thanks for help though. Here is what I'm gonna do. Have a script setup so that 1 computer, once it reaches the sycn spot, activates tcp and tcplisten, while having previously set a variable to -1 (which is the error code), and have the second computer do the same thing except with tcpconnect instead of tcplisten, with the same error code, and have it wait about 15-30 seconds after stopping, and to continue looping and attempting connection. Once the connection is established, both computer's will return a socket identifier instead of the error code, which will trigger the end of the loop and loop the entire script again. Edited November 7, 2010 by Kuram Link to comment Share on other sites More sharing options...
supadodger Posted November 7, 2010 Share Posted November 7, 2010 if both computers have time synced with windows time it should be accurate within 200ms... udpopen is out of my depth of knowledge.... good luck maybe an expert can post here and help you... 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