Results 1 to 13 of 13

Thread: Probably possible: Smart threading.

  1. #1
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default Probably possible: Smart threading.

    K I somehow this weird idea came into my head about being able to use multi-threading with smart..

    I mean smart is written in c++ and java so shouldn't smart be able to initialize a thread like Backgroundworker^ and then have simba send commands to smart who then gives the Backgroundworker.doWork() something to do?


    So Simba Command -> Smart -> Smart's backgroundworker.dowork();

    Code:
    private: System::ComponentModel::BackgroundWorker^  Worker;
    
    void InitializeComponent(void)  //this would go in smart's source code itself.
    {
        this->Worker->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &Form1::Worker_DoWork);
    }
    
    //This would go in smart's source code itself..
    private: System::Void Worker_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
       // Work/comands to do here from SMART/Simba
    }
    
    Worker->RunWorkerAsync();  // Tells Smart's backgroundworker to do what it has been assigned.. could possibly implement this in simba?
    Of course it's not going to be managed code though.. it would have to be Win32 API.. Don't think its cross platform either but most users use windows anyway so what do u guys think? Possible or no? Idea of making smart initialize the thread and have simba tell smart what to do with the thread..
    Last edited by Brandon; 07-25-2011 at 10:30 PM.
    I am Ggzz..
    Hackintosher

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    I think so, but what kind of commands/uses do you have in mind for this thread?

    E: I don't believe it's possible to tell the thread to do things like search for colors and such, since that is written in pascal.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    I think so, but what kind of commands/uses do you have in mind for this thread?

    E: I don't believe it's possible to tell the thread to do things like search for colors and such, since that is written in pascal.
    could have the thread do stuff like his SMARTchat plugin which types stuff.. so the bot can keep going and clicking as it's typing
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    I think so, but what kind of commands/uses do you have in mind for this thread?

    E: I don't believe it's possible to tell the thread to do things like search for colors and such, since that is written in pascal.

    Source itself is in Smart.. and it definitely is C++ not pascal.. I believe wrappers or an interpreter was used to make simba tell smart to find colours..

    Smart's Colour.Cpp file..
    Code:
    //Finds a color and returns the position --- historical
    bool findColor(int& x, int& y, int color, int sx, int sy, int ex, int ey) {
        sy *= width;
        ey *= width;
        for (int offset = sy; offset <= ey; offset += width) {
            int end = ex + offset;
            for (int i = sx + offset; i <= end; i++) {
                if (target[i].color == color) {
                    x = i % width;
                    y = i / width;
                    return true;
                }
            }
        }
        x = -1;
        y = -1;
        return false;
    }
    
    //Finds a color given a tolerance and returns the position --- historical
    bool findColorTol(int& x, int& y, int color, int sx, int sy, int ex, int ey, int tol) {
        RGB find;
        find.color = color;
        sy *= width;
        ey *= width;
        for (int offset = sy; offset <= ey; offset += width) {
            int end = ex + offset;
            for (int i = sx + offset; i <= end; i++) {
                if (cmpColors(target[i], find, tol)) {
                    x = i % width;
                    y = i / width;
                    return true;
                }
            }
        }
        x = -1;
        y = -1;
        return false;
    }
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    //Finds a color and returns the position --- historical
    historical, like in never been used.

    edit:
    Benland made these color functions which where faster as the scar ones. I think they are also faster as the simba one. But they have never been used by simba. If you want to see the functions we use at the moment I suggest you look in to MML. We basically copy the client canvas as a bitmap, and search for colors on that bitmap.

    Quote Originally Posted by grats View Post
    could have the thread do stuff like his SMARTchat plugin which types stuff.. so the bot can keep going and clicking as it's typing
    But the typing we use for runescape client has certain random waits between each key it presses. Do you also want to implant such functions in SMART?
    Last edited by masterBB; 07-25-2011 at 11:25 PM.
    Working on: Tithe Farmer

  6. #6
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    historical, like in never been used.

    edit:
    Benland made these color functions which where faster as the scar ones. I think they are also faster as the simba one. But they have never been used by simba. If you want to see the functions we use at the moment I suggest you look in to MML. We basically copy the client canvas as a bitmap, and search for colors on that bitmap.



    But the typing we use for runescape client has certain random waits between each key it presses. Do you also want to implant such functions in SMART?
    his thing goes through simba, no? I figured it would be the same thing with the same waits since it all uses simba procedure stuff.. just on a different thread

    idk how it works then
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

  7. #7
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by grats View Post
    his thing goes through simba, no? I figured it would be the same thing with the same waits since it all uses simba procedure stuff.. just on a different thread

    idk how it works then
    My wrong, SmartSendKeys(S); It has it own key sending proc.
    Working on: Tithe Farmer

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

    Default

    Quote Originally Posted by masterBB View Post
    historical, like in never been used.

    edit:
    Benland made these color functions which where faster as the scar ones. I think they are also faster as the simba one. But they have never been used by simba. If you want to see the functions we use at the moment I suggest you look in to MML. We basically copy the client canvas as a bitmap, and search for colors on that bitmap.
    When we use SMART, we don't copy data at all, we just directly read SMART's bitmap.



    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)

  9. #9
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    When we use SMART, we don't copy data at all, we just directly read SMART's bitmap.
    But we search for colors on that bitmap with functions from simba/mml right? So not the functions from SMART?

    e:
    used in the finding of the color:
    PtrData := TClient(Client).IOManager.ReturnData(xs, ys, dX + 1, dY + 1);

    Wouldn't this return a copy of the bitmap? Or does it just points towards the given points in SMART's bitmap?

    Sorry for the questions and derailing the thread. But now I started reading the source...
    Last edited by masterBB; 07-25-2011 at 11:49 PM.
    Working on: Tithe Farmer

  10. #10
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    I think perhaps this could be used with an onscreen paint? Is that what you wanted ggzz?

  11. #11
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    I think perhaps this could be used with an onscreen paint? Is that what you wanted ggzz?
    Yup.. Exactly. U send the data to the thread which paints in real time on smart.. I was only trying to see way of improving smart..

    Such ways were: Forms on smart (with a handle.. was told its not possible atm) or using threading to have real time progress reports and multi-tasking.. This can actually do a lot more than just proggies

    It seems possible to me but I don't know how simba works. I only know how smart and C++ works so if simba CAN actually send the commands to smart and smart give the work to the thread then it would actually be quite amazing. I think all my ideas are either just crazy or impossible to do :c
    Last edited by Brandon; 07-26-2011 at 02:24 AM.
    I am Ggzz..
    Hackintosher

  12. #12
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    Yup.. Exactly. U send the data to the thread which paints in real time on smart.. I was only trying to see way of improving smart..

    Such ways were: Forms on smart (with a handle.. was told its not possible atm) or using threading to have real time progress reports and multi-tasking.. This can actually do a lot more than just proggies

    It seems possible to me but I don't know how simba works. I only know how smart and C++ works so if simba CAN actually send the commands to smart and smart give the work to the thread then it would actually be quite amazing.
    I think it should be possible, just use Java Graphics class. Send the text, other info to smart. would make the painting a little faster, but you would still have to call the function that sends the info to smart very often. With titan, paxCompiler is threadsafe which could help

  13. #13
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Kind of off topic, but ggzz, you seem to know SMART's source pretty well. What I think needs to be done before something like multithreading is fixing the exception SMART throws if RS hasn't been loaded in a browser after an update. If that problem is fixed, SRL can easily be edited to run straight through updates (assuming the script is color).

Thread Information

Users Browsing this Thread

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

Posting Permissions

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