Sign in to follow this  
Followers 0
unform25

More on the Desync issue

2 posts in this topic

ok, last night I posted asking about how to run independant clients w/o having them sync'd like syncronised swimmers. Obviously the first thing that was shot back was multi-threading and that AutoIt doesn't support it. This I kinda figured but I knew there was an easier way to implement it. I think I found out how, but actualy implementing it in my script is something I'm having trouble with. A buddy of mine had done this same thing once before, that's how I knew it could be done, but he deleted the source. pwnd. Anyway he said that he did it using each client w/ its own array and using a select/case to tell it what to do. My problem is this, I don't realy know how to use Select/Case that well. This is still technicly my first script so I'm kinda edging on the extent of my reasoning skills. This is basicly what I have so far:

Select
  Case $CurrentClient[$ClientStep] = 1
     Func1()
  Case $CurrentClient[$ClientStep] = 2
     Func2()
EndSelect

Func Func1()
  yadayada
  $CurrentClient[$ClientStep] = $CurrentClient[$ClientStep] + 1
EndFunc

Func Func2()
  yadayada
  $CurrentClient[$ClientStep] = 1
EndFunc

now, the hard part is actualy making it work. Like I said, I'm a newbie. I don't know if select works like Do/Until wich can loop indefinately simply by putting Until True = False at tthe end. So, yeah, thank you for any pointers you can send my way

Share this post


Link to post
Share on other sites



ok, I think I got it. I'm controling the Select/Case with a For/Next embeded in a infinate loop Do/Until. Here's what I got:

Do
  For $Z = 1 To $NumberOfClients
Select
  Case $CurrentClient[$ClientStep] = 1
     Func1()
  Case $CurrentClient[$ClientStep] = 2
     Func2()
EndSelect
ChangeClient()
Next
Until True = False

Func ChangeClient()
  $CurrentClient = $CurrentClient + 1
  If $CurrentClient > $NumberOfClients Then $CurrentClient = 1
EndFunc

Func Func1()
  yadayada
  $CurrentClient[$ClientStep] = $CurrentClient[$ClientStep] + 1
EndFunc

Func Func2()
  yadayada
  $CurrentClient[$ClientStep] = 1
EndFunc

Any thoughts on how to make this better?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0