Page 6 of 17 FirstFirst ... 4567816 ... LastLast
Results 126 to 150 of 422

Thread: Smart-Overhaul

  1. #126
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Awesome job One suggestion though, adding an option to show an overview of all tabs.
    So far I just have one update method that gets called, but you can notify and update the overview dynamically if you make a method in Canvas or Client (assuming this is similar to your tutorial)


    java Code:
    package org.obduro.loader.ui;

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.awt.image.BufferedImage;
    import java.util.HashMap;
    import java.util.Set;

    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    import javax.swing.JPanel;

    import org.obduro.loader.Client;
    import org.obduro.loader.utils.ClientPool;
    import org.obduro.loader.utils.Utilities;

    public class OverviewPanel extends JPanel {

        private static final long serialVersionUID = 5060519844144818836L;
       
        private HashMap<Integer, Client> clients;
        private int width = 1, height = 1;
       
        public OverviewPanel(){
            setPreferredSize(new Dimension(750, 570));
            setBackground(Color.RED);
            update();
        }
       
        public void update(){
            removeAll();
            clients = ClientPool.getClients();
            int size = clients.size();
            while(width * height < size){
                if(width < height){
                    width++;
                }else{
                    height++;
                }
            }
            System.out.println("Hashmap size: " + size);
            System.out.println("Width: " + width + ", height: " + height);
            System.out.println("JPanel width: " + getWidth() + ", height: " + getHeight());
            setLayout(new GridLayout(width, height));
           
            Set<Integer> keys = clients.keySet();
            int tabNumber = 0;
            for(int key : keys){
                Client client = clients.get(key);

                BufferedImage image = client.getPaintBuffer();
                Graphics2D g2d = image.createGraphics();
                g2d.setColor(Color.WHITE);
                g2d.setFont(new Font("Verdana", Font.BOLD, 40));
                g2d.drawString("Tab #" + tabNumber++, 0, 50);
               
                Image resizedImage = Utilities.scaleImage(getWidth()/width, getHeight()/height, image);
                ImageIcon icon = new ImageIcon(resizedImage);
               
                JLabel label = new JLabel(icon);
                add(label);
                System.out.println("Added label!");
            }
        }
       
    }

    Script source code available here: Github

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

    Default

    Quote Originally Posted by J J View Post
    Awesome job One suggestion though, adding an option to show an overview of all tabs.
    So far I just have one update method that gets called, but you can notify and update the overview dynamically if you make a method in Canvas or Client (assuming this is similar to your tutorial)

    Ahh cool Idea. I think someone suggested that a while back but I didn't have too much free time.


    If you're going to do that, don't forget that ClientPool access (if you're using one) should be synchronized if using multiple threads or Copy-Constructed in place such that changes to the original won't affect the copy (vice-versa).

    Meh.. just came home from the engineering shop.. I'll think about it and I'll prob push an update for the current bugs later or tomorrow.. kinda tired lol.
    I am Ggzz..
    Hackintosher

  3. #128
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Ahh cool Idea. I think someone suggested that a while back but I didn't have too much free time.


    If you're going to do that, don't forget that ClientPool access (if you're using one) should be synchronized if using multiple threads or Copy-Constructed in place such that changes to the original won't affect the copy (vice-versa).

    Meh.. just came home from the engineering shop.. I'll think about it and I'll prob push an update for the current bugs later or tomorrow.. kinda tired lol.
    My Client returns a copy of the buffer so it won't modify the actual buffer when resizing. I have it updating real time now, works smoothly. I still have to look in multiple threads, I hope you can answer my question in the tutorial thread :P

    Has some unexpected behaviour though, game_crash seems to occur some times.. Not sure why.
    java Code:
    package org.obduro.loader.ui;

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Graphics2D;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.awt.image.BufferedImage;
    import java.util.HashMap;
    import java.util.Set;

    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    import javax.swing.JPanel;

    import org.obduro.loader.Client;
    import org.obduro.loader.utils.ClientPool;
    import org.obduro.loader.utils.Utilities;

    public class OverviewPanel extends JPanel {

        private static final long serialVersionUID = 5060519844144818836L;
       
        private HashMap<Integer, Client> clients;
        private HashMap<Integer, JLabel> labels;
        private int width = 1, height = 1;
       
       
        public OverviewPanel(){
            setPreferredSize(new Dimension(750, 570));
            setBackground(Color.RED);
            setDoubleBuffered(true);
            updateAll();
        }

        private ImageIcon resize(BufferedImage image, int number){
            Graphics2D g2d = image.createGraphics();
            g2d.setColor(Color.WHITE);
            g2d.setFont(new Font("Verdana", Font.BOLD, 40));
            g2d.drawString("Tab #" + number, 0, 50);
           
            Image resizedImage = Utilities.scaleImage(getWidth()/width, getHeight()/height, image);
            return new ImageIcon(resizedImage);
        }
       
        public void updateAll(){
            removeAll();

            clients = ClientPool.getClients();
            labels = new HashMap<Integer, JLabel>();
           
            int size = clients.size();
            while(width * height < size){
                if(width < height){
                    width++;
                }else{
                    height++;
                }
            }
           
            setLayout(new GridLayout(width, height));
           
            Set<Integer> keys = clients.keySet();
            int tabNumber = 1;
            for(int key : keys){
                Client client = clients.get(key);
                ImageIcon icon = resize(client.getGameBuffer(), tabNumber++);
                JLabel label = new JLabel(icon);
                labels.put(key, label);
                add(label);
            }
           
            revalidate();
        }
       
        public void update(int hashCode){
            Set<Integer> keys = clients.keySet();
            int tabNumber = 1;
           
            for(int key : keys){
                if(key == hashCode){
                    JLabel label = labels.get(hashCode);
                    Client client = clients.get(hashCode);
                    ImageIcon icon = resize(client.getGameBuffer(), tabNumber++);
                    label.setIcon(icon);
                    label.revalidate();
                }
                tabNumber++;
            }
        }
       
    }

    And in the Client class
    java Code:
    /**
         * Custom implementation of drawing the graphics
         * @param g graphics to draw with
         * @return graphics we have drawn
         */

        public Graphics drawGraphics(Graphics2D g){
            Graphics paintGraphics = paintBuffer.getGraphics();
            paintGraphics.drawImage(gameBuffer, 0, 0, null);
           
            paintGraphics.setColor(Color.WHITE);
            paintGraphics.drawString("Custom drawing hashcode #" +  getCanvas().getClass().getClassLoader().hashCode(), 100, 100);
            paintGraphics.dispose();
           
            if(g != null){
                g.drawImage(paintBuffer, 0, 0, null);
            }
           
            overviewPanel.update(getCanvas().getClass().getClassLoader().hashCode());
            return gameBuffer.getGraphics();
        }

    I just give an instance of OverviewPanel and let it call the update method. Not the most efficient but it seems to get the job done..

    Script source code available here: Github

  4. #129
    Join Date
    Jan 2012
    Posts
    915
    Mentioned
    13 Post(s)
    Quoted
    87 Post(s)

    Default

    Woooaahhh.. I go for a few days and I come back, and Brandon's taken up the SMART mantle? I like what you've done with it, man. Supa sexy.

    And then JJ's bein' all cool and coming up with this multi-panel idea. I like it! I might (try) and join in on the development.


    Though, I did get a small bug. I'm not sure how to fix it.

    <Big picture>http://puu.sh/31B1i.png</bigpicture>

  5. #130
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    I have also noticed that the mouse cursor from the SMART stays in the smart screen even after you terminate the script and take over with your mouse.. I'm not sure if that means Jagex could know you have two mouses?

  6. #131
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    You should add different mouse options maybe, like the crosshair one, default one, and the one were a stream follows wherever the mouse went

  7. #132
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    You should add different mouse options maybe, like the crosshair one, default one, and the one were a stream follows wherever the mouse went
    That's a good idea.

  8. #133
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Sawyer View Post
    That's a good idea.
    Yea I know that's why I suggested it

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

    Default

    Ohh I made it so that the mouse stayed there when I was debugging.. I can remove it and make it only be there when MouseInput is enabled. Its a one liner to remove.

    No jagex can't detect it. The original Smart has a boolean that prevents the mouse from drawing when input is enabled. I'll just add:

    [Highlight=Java]
    if (!MouseInputEnabled) {
    //Draw Mouse..
    }
    [/Java]


    And as for the multiple Mouse drawings, that'll require me to add either a combobox or radio-group buttons.. Iunno :l
    I'm actually working on the next release right now but meh..
    I am Ggzz..
    Hackintosher

  10. #135
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Ohh I made it so that the mouse stayed there when I was debugging.. I can remove it and make it only be there when MouseInput is enabled. Its a one liner to remove.

    No jagex can't detect it. The original Smart has a boolean that prevents the mouse from drawing when input is enabled. I'll just add:

    [Highlight=Java]
    if (!MouseInputEnabled) {
    //Draw Mouse..
    }
    [/Java]


    And as for the multiple Mouse drawings, that'll require me to add either a combobox or radio-group buttons.. Iunno :l
    I'm actually working on the next release right now but meh..
    I wish we could add it in our scripts like I could on powerbot but I think it requires muiltithreading (on powerbot I forgot what it was but under paint I would always copy and paste the snippet)

    Would just be something cool to add at the end you or if you finish

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

    Default

    Quote Originally Posted by Officer Barbrady View Post
    I wish we could add it in our scripts like I could on powerbot but I think it requires muiltithreading (on powerbot I forgot what it was but under paint I would always copy and paste the snippet)

    Would just be something cool to add at the end you or if you finish
    EDIT:
    Now only draws mouse when script is running.. Stop the script, mouse disappears.
    I think I fixed all the bugs / suggestions and updated OP.


    Ohh I see what you mean.

    Something like
    Code:
    Procedure SmartSetMouseImage(Img: Bitmap);
    Hmmm.. I can add it but the thing is, Images in Simba aren't just raw pointers. They're a class wrapper around RBG arrays. Even so, if it was a raw pointer, I'd have to copy the data to the SHM file and let Smart read from that..

    The only thing I can think of is to allow Smart to load an Image file and draw that as the cursor.. Thus:

    Code:
    Procedure SmartSetMouseImage(FilePath: String);

    There's not really a way that I can think of to pass images directly from Simba to Smart nicely without bloating/increasing the SharedMemory file size OR using a socket to send/receive the Image.

    As for the mouse streaming, that's because PB reads java directly via .class files and classloader. Smart communicates with Simba through JNI.. Yeah you can make Smart read .class files and load a mouse and all the custom stuff or write a parser but that's a lot of stuff to do :l
    Last edited by Brandon; 05-26-2013 at 08:58 PM.
    I am Ggzz..
    Hackintosher

  12. #137
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Rather just have a default "set" of mouse cursors, small circle, large cross... lines across the screen you get it

  13. #138
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    @Brandon

    You sure you don't want Any sort of donation? I know this is an open source community, but you have put a ton of time into this project, and a Smart-overhaul has been something we have greatly needed for a long time.

    If you need any Rsgp or any type of donation /Help Let us know , Me and im sure others would be more then willing to help :P

  14. #139
    Join Date
    Jan 2012
    Posts
    915
    Mentioned
    13 Post(s)
    Quoted
    87 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    @Brandon

    You sure you don't want Any sort of donation? I know this is an open source community, but you have put a ton of time into this project, and a Smart-overhaul has been something we have greatly needed for a long time.

    If you need any Rsgp or any type of donation /Help Let us know , Me and im sure others would be more then willing to help :P
    Vouch. I'd donate some.

  15. #140
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    :l Im confused...Where to I put all the new smart Files? There are a bunch ive never seen before lol. Just put all the folders in the plugin folder? or put the class files themselves in the plugin folder?

    I already switched the New simba globals and parma's files out, I got the part, just no idea what to do with the rest lol

    Edit: Bin File seems to be empty for me?..

  16. #141
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Yeah there's no pre-compiled plugins in that newest version. By the way, Brandon, the Makefile has different commands now; what's the command for compiling? Make windows is no longer an option? Nevermind, I don't know why it didn't work for me before, perhaps I had changed my path to the wrong place. But you should know only the SMART jar itself compiles, the others have errors while compiling. :/
    Last edited by Flight; 05-27-2013 at 12:25 PM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  17. #142
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Yeah there's no pre-compiled plugins in that newest version. By the way, Brandon, the Makefile has different commands now; what's the command for compiling? Make windows is no longer an option? Nevermind, I don't know why it didn't work for me before, perhaps I had changed my path to the wrong place. But you should know only the SMART jar itself compiles, the others have errors while compiling. :/
    Ahh ok, thanks for all your help flight ^^ i shall just wait for the plugins to be added :c time to downgrade back to old smart lol

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

    Default

    Quote Originally Posted by Flight View Post
    Yeah there's no pre-compiled plugins in that newest version. By the way, Brandon, the Makefile has different commands now; what's the command for compiling? Make windows is no longer an option? Nevermind, I don't know why it didn't work for me before, perhaps I had changed my path to the wrong place. But you should know only the SMART jar itself compiles, the others have errors while compiling. :/
    Uhh its the same commands :S I didn't touch the make.. Well I did. The only thing I changed in the makefile was my path to the JDK because I develop on different laptops all the time and this laptop is x64 JDK installed.

    Other than that, it should all compile. I just tested it. I ran: Make Clean Windows. and Make Clean Windows -BitFLG=-m64.

    Both compile. Uhh sorry about not including the binaries. What compiling errors did you get @Flight;? Shouldn't have any :l

    @Itankbots; I updated OP to have the binaries as well as source.



    Note (I realized why some of you can't get OpenGL to show up even though it's loaded): If compiling OpenGL and GLHook for Smart with Pascalscript, the makefile needs to know this. You'll notice that the OpenGL makefile has:

    -DGLHOOK_SMART which tells it to compile for Smart. Removing it will make it compile for the browser.

    GLHook's Makefile has:

    -DGLHOOK_SMART -DPASCALSCRIPT which tells it to compile for Smart and PascalScript. Removing these will make it compile for browser and Lape.


    Anyway, I re-upped everything to include source and binary and set Smart/Pascalscript as default compilation defines.
    Last edited by Brandon; 05-27-2013 at 04:27 PM.
    I am Ggzz..
    Hackintosher

  19. #144
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Uhh its the same commands :S I didn't touch the make.. Well I did. The only thing I changed in the makefile was my path to the JDK because I develop on different laptops all the time and this laptop is x64 JDK installed.

    Other than that, it should all compile. I just tested it. I ran: Make Clean Windows. and Make Clean Windows -BitFLG=-m64.

    Both compile. Uhh sorry about not including the binaries. What compiling errors did you get @Flight;? Shouldn't have any :l

    @Itankbots; I updated OP to have the binaries as well as source.



    Note (I realized why some of you can't get OpenGL to show up even though it's loaded): If compiling OpenGL and GLHook for Smart with Pascalscript, the makefile needs to know this. You'll notice that the OpenGL makefile has:

    -DGLHOOK_SMART which tells it to compile for Smart. Removing it will make it compile for the browser.

    GLHook's Makefile has:

    -DGLHOOK_SMART -DPASCALSCRIPT which tells it to compile for Smart and PascalScript. Removing these will make it compile for browser and Lape.


    Anyway, I re-upped everything to include source and binary and set Smart/Pascalscript as default compilation defines.
    Awesome man! Thanks, ill test it out and let you know if i find any bugs or anything

    Edit: Seems to be stuck on loading smart up for me...Does this happen on the first time for the new client?

    http://gyazo.com/2921c76b7f30e290847169a114a643de

    ^ kept loading till the 3min market then terminated.

    Yeah doesn't seem to want to load the client at all..Just keeps saying loading please wait till it terminates :/

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

    Default

    Quote Originally Posted by Itankbots View Post
    Awesome man! Thanks, ill test it out and let you know if i find any bugs or anything

    Edit: Seems to be stuck on loading smart up for me...Does this happen on the first time for the new client?

    http://gyazo.com/2921c76b7f30e290847169a114a643de

    ^ kept loading till the 3min market then terminated.

    Yeah doesn't seem to want to load the client at all..Just keeps saying loading please wait till it terminates :/

    I can't replicate that problem :S Try deleting the Smart.PID and SmartCP.PID files if you have them and then load this version. Perhaps the old ones interfere.

    I hope you replaced the Simba files as well with the ones issued.
    Last edited by Brandon; 05-27-2013 at 07:54 PM.
    I am Ggzz..
    Hackintosher

  21. #146
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    I can't replicate that problem :S Try deleting the Smart.PID and SmartCP.PID files if you have them and then load this version. Perhaps the old ones interfere.

    I hope you replaced the Simba files as well with the ones issued.
    Yeah i did. Idunno, ill Look at it tomorrow, been up since yesterday, tired, probably failing something stupid lol

  22. #147
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    @Brandon
    I still notice that when SMART First loads up, simba does not interact with it. Have any ideas what could cause that? After it's loaded and I restart the script, it works fine. It hasn't reloaded after 6 hours for me yet though :|

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

    Default

    Quote Originally Posted by Sawyer View Post
    @Brandon
    I still notice that when SMART First loads up, simba does not interact with it. Have any ideas what could cause that? After it's loaded and I restart the script, it works fine. It hasn't reloaded after 6 hours for me yet though :|

    In Simba's debug box, does it print "Paired with: [PIDHere]". Or something similar? If so, I just fixed that and now it will only pair with clients with a current port. Basically this is how it will work now:


    OnClosing: Sets Process Port to Zero. Sets All Client Ports to Zero. That way, it will never pair with a zombie ever!
    OnPairing: Checks Controller and Port. If controller is zero and 0 < Port <= 65535, it will pair. This gets rid of Zombies and Smart Spawn Clients error.


    However, I'm not sure what you mean by interact with it on first load.

    Simba Code:
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}

    begin
        SetupSRL;
        while(true) do
        begin
            MMouse(random(100), random(100), random(100), random(100));
        end;
    end.

    That's the script I used to see if it would move the mouse as soon as RS is finished loading (aka at the login screen because that's how the SRL include is programmed to work).
    I am Ggzz..
    Hackintosher

  24. #149
    Join Date
    Dec 2011
    Location
    U.S.A.
    Posts
    635
    Mentioned
    5 Post(s)
    Quoted
    249 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    In Simba's debug box, does it print "Paired with: [PIDHere]". Or something similar? If so, I just fixed that and now it will only pair with clients with a current port. Basically this is how it will work now:


    OnClosing: Sets Process Port to Zero. Sets All Client Ports to Zero. That way, it will never pair with a zombie ever!
    OnPairing: Checks Controller and Port. If controller is zero and 0 < Port <= 65535, it will pair. This gets rid of Zombies and Smart Spawn Clients error.


    However, I'm not sure what you mean by interact with it on first load.

    Simba Code:
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}

    begin
        SetupSRL;
        while(true) do
        begin
            MMouse(random(100), random(100), random(100), random(100));
        end;
    end.

    That's the script I used to see if it would move the mouse as soon as RS is finished loading (aka at the login screen because that's how the SRL include is programmed to work).
    It loads smart, then said it is paired, then says welcome to runescape, then said my username as If it is logging in, but nothing happens. However, if I then restart the script the second time, it works.

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

    Default

    Quote Originally Posted by Sawyer View Post
    It loads smart, then said it is paired, then says welcome to runescape, then said my username as If it is logging in, but nothing happens. However, if I then restart the script the second time, it works.

    Very nice bug report. I was able to replicate this and narrow it down to Smart_FixSpeed := True. Try removing this from the script and let me know how it goes. If it works then I know exactly what the problem is: SmartFixSpeed tries to toggle a refresh bar that isn't there in this version of smart.

    Let me know if my suggestion works. If it did, I will be removing the throw UnSupportedException from the next update and removing the Smart(Set/Get)Refresh function.
    I am Ggzz..
    Hackintosher

Page 6 of 17 FirstFirst ... 4567816 ... LastLast

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
  •