Page 1 of 2 12 LastLast
Results 1 to 25 of 36

Thread: How do I run "two" processes at once?

  1. #1
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How do I run "two" processes at once?

    Hi, I'm trying to create J.E.S.S.I, my secret project. So far, it's going really smoothly.

    I have one question though. I have a function that is really random and creates nice mouse movements. It also clicks and moves away and almost constantly moves the mouse. But when the mouse is being moved, my procedure is always being used. I also need to do other things like find colours and such while my mouse is moving at the same time. How do I do this? If this is possible, it will be a really big step in my project.

  2. #2
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Using current procedures, you can't. But you could make your own procedure that could do the job.


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  3. #3
    Join Date
    Sep 2006
    Location
    Scripter's Heaven
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think it is something like "settimeoutexception(seconds:integer, nameofcommand:string);

    search for "set timeout"

    And check out my pascal interpreter!
    <R0b0t1> No, really, I went to a bar and picked up a transvestite.

  4. #4
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    All that does is make something terminate if it's gone on too long.


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  5. #5
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Moving one pixel then getcolor, then repeat would be the next best thing.

  6. #6
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by I Pick Axes View Post
    Using current procedures, you can't. But you could make your own procedure that could do the job.
    Hmmm.... I would want to make my own procedures. But how?

  7. #7
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What are you making anyways? Usually you move your mouse to click or hover and that changes the screen anyways, invalidating your FindColor.


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

  8. #8
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    My idea is to always keep the mouse moving to seem like a human. (Well, almost always). But when you're always moving the mouse, you cant be doing anything else (like, searching colours, dtms or bitmaps). I want to be able to do both of those things at once.

  9. #9
    Join Date
    Sep 2006
    Location
    Scripter's Heaven
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah, i remeber seeing a post about how someone had figured out how to do it, maybee if you wait they will post here

    And check out my pascal interpreter!
    <R0b0t1> No, really, I went to a bar and picked up a transvestite.

  10. #10
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    i think one way could be to ThreadSafeCall the procedure, it doesnt have to be called that way but its the only way you can let the scripter specify the procedure, something like this

    Code:
    procedure MouseProcedure(x,y,rx,ry:integer; proname:string; args:TVariantArray;)
    begin
    //...
    //...
    repeat
    movemouse(.....
    threadsafecall(procname,args)
    until( MouseIsAtDestination );
    end;
    it would be used like this

    Code:
    var p: TVariantArray;
    begin
    setarraylength(p,6);
    p[0] := bmpRock; //the bitmap of a rock
    p[1] := x; //the variable x
    p[2] := y; 
    p[3] := 5;//the parimieters x1,y1,x2,y2
    p[4] := 6;
    p[7] := 454;
    p[8] := 553;
    MouseProcedure(x,y,5,5,'FindBitmapIn',p);
    that wouldnt acctualy work, what would the procedure do if it finds the bitmap, but it shows how it might work
    Join the Official SRL IRC channel. Learn how to Here.

  11. #11
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by lardmaster View Post
    yeah, i remeber seeing a post about how someone had figured out how to do it, maybee if you wait they will post here
    Thanks, I'll wait.

  12. #12
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by solarwind View Post
    Hmmm.... I would want to make my own procedures. But how?
    I said in my other post.

    Kinda like a deck of cards being rifle shuffled just before the bridge, interweaved. You would need to write you own mouse procedure or disect another one so that it's like many movemouse's that go 1 pixel at a time each. Inbetween this mouse movements you have your color/bitmaps/dtms. You would have to figure out how much you can shove between them while still keeping the fluidity of movement (for example take a flipbook, if you go too slow it looks like strobe lighting if you know what I mean). To do that, set mousespeed to sometthing you like then, then

    mmouse(10,20,0,0);
    a:=getsystemtime;
    mmouse(10,30,0,0);
    b:=getsystemtime;
    writeln(inttostr((b-a)/10)+' milsecs per pixel');

    Then do

    a:=getsystemtime;
    for i:= 1 to 1000;
    getcolor(random(100),random(100));
    b:=getsystemtime;
    writeln(inttostr((b-a)/1000)+' milsecs per getcolor')

    (Eventually you'll have to make this auto calibrate for any machine)

    Now you know how many getcolors you can put between the movemouse. Then you have to make the mouse procedure change the coords of the movemouses so that it moves in the righ path and make the getcolors use different points.

    This is a lot of work. You would be better off doing what lardmaster and Yakman said.

    You would also have to put in something so that it doesn't search where the mouse is for either method.

  13. #13
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a lot for taking the time to explain to me. SCAR is slow enough already. That would make it way too slow to be of any use.

  14. #14
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Yakman View Post
    i think one way could be to ThreadSafeCall the procedure, it doesnt have to be called that way but its the only way you can let the scripter specify the procedure, something like this

    Code:
    procedure MouseProcedure(x,y,rx,ry:integer; proname:string; args:TVariantArray;)
    begin
    //...
    //...
    repeat
    movemouse(.....
    threadsafecall(procname,args)
    until( MouseIsAtDestination );
    end;
    it would be used like this

    Code:
    var p: TVariantArray;
    begin
    setarraylength(p,6);
    p[0] := bmpRock; //the bitmap of a rock
    p[1] := x; //the variable x
    p[2] := y; 
    p[3] := 5;//the parimieters x1,y1,x2,y2
    p[4] := 6;
    p[7] := 454;
    p[8] := 553;
    MouseProcedure(x,y,5,5,'FindBitmapIn',p);
    that wouldnt acctualy work, what would the procedure do if it finds the bitmap, but it shows how it might work
    Thanks a lot. However, when I click on your signature, it gives me an error.

  15. #15
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by solarwind View Post
    Thanks a lot for taking the time to explain to me. SCAR is slow enough already. That would make it way too slow to be of any use.
    How would it make it slow?

    I just did some rough calculations and estimate that you could do about 60,000 getcolors during the time the mouse moves around the screen for 3 seconds. Thats about a third of all the pixels on the main screen.

  16. #16
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    You could use 2 scars at the same time, and let 1 SCAR do all the color searching and let him send co ordinates using SendInterScarMessage.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  17. #17
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    You could use 2 scars at the same time, and let 1 SCAR do all the color searching and let him send co ordinates using SendInterScarMessage.
    him? How sexist!

  18. #18
    Join Date
    Jun 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol i dont think it would be possible to do it anyother way then 2 scar applets, since your making it for iBot aswell, to to ruler or geno, and see if they could add somethingk like that to iBot

  19. #19
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    My bad!!! SCAR sees under the mouse pointer. Just watch out for clicking, hovering (that's only on the gametab so searching on MS should be fine) and the uptext changes.

  20. #20
    Join Date
    Sep 2006
    Location
    Scripter's Heaven
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well, i guess this will be one of the things in JESSI that might only be in the IBOT version

    And check out my pascal interpreter!
    <R0b0t1> No, really, I went to a bar and picked up a transvestite.

  21. #21
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Yea, it's tricky with SCAR, but IMO worth pursuing. I'm going to work on an example of a 'helper' script for stuff like this.

    Edit: Protoype done, only has 1 procedure atm (its for bank booth finding)

    bbankf.scar goes in includes
    helper.scar is the slave, run that first
    yellow.scar is the bankfiner run that after, follow instructions inside

    Worked on it all day, pretty proud of it even though it only works at port phasmatys and draynor atm.

  22. #22
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great, this is excellent. My prototype looks similar. I think this should be the future of SCAR, multi threading. Imagine how nicely this would run on a dual core or a quad core. I'll defiantly include this in JESSI. Just like that *snap*, almost all lag gone and I can move the mouse while checking and other stuff. Thanks for the prototype.

    This has a great potential to not get detected.

    Edit: Only got a little lag while the map is turning. I'll try to fix the script.

    Edit: Fixed, no lag.

  23. #23
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    there was an include for SCAR which had one SCAR checking for randoms and the other acctually autoing, i think it was called WAAMP or something, you get it if you press File -> Download Includes in SCAR.

    also, thanks for telling me about my sig, it should work now
    Join the Official SRL IRC channel. Learn how to Here.

  24. #24
    Join Date
    Oct 2006
    Posts
    888
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, my multi threading prototype is coming along nicely.
    Currently, this is what it can do...

    Script A:
    - Moves mouse and clicks.
    - Randomly moves mouse 90% - 95% of the time.
    - Makes random clicks on the main screen 5% of the time.
    - Makes random clicks in inventory 10% of the time.

    Script B:
    - Finds colours of goblin on main screen and reports back to Script A
    - Continues to find colours and ques them up in a rapid and dynamic queing array.

    - MAKES SURE SCRIPT A DOES NOT CLICK ON GOBLINS ALREADY BEING FOUGHT BY OTHER PLAYERS (this is the sickest part), I'll try to complete it quickly for an alpha.

    It does this by using findcolorspiraltolerence and stores the blue "0" colours and the red hits in the array (their co ordinates) Dynamically updates as you move.

    Thanks all for your help.



    Also, I'm having trouble with my SCAR. When I launch my DTM editor, It looks like this: (see next post) for screenshot.

  25. #25
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    @ Yakman-Thanks, it was before my time (started after everything but SRL was outdated) so I never looked it at. Just did, it gave me some ideas to make it more functional. Like having an id for status, another for commands, etc.

    @solarwind-Try setting the crosshairs right before dtm editor

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 05-17-2008, 12:48 PM
  2. action="www.site.com" method="post"
    By Jason2gs in forum General
    Replies: 4
    Last Post: 05-17-2007, 11:50 PM
  3. Replies: 3
    Last Post: 04-19-2007, 03:44 AM
  4. Replies: 5
    Last Post: 10-26-2006, 11:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •