Thread: Interface Slider

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 Interface Slider 
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    Code was done by Sam or Poohman or whatever gender he is now.

    1. Create a new class; your default position value will vary depending on the width; feel free to add it into the constructor.

    Code:
    public class Slider {
        
        private int position = 86;
        
        private double value;
        
        private int x, y;
        
        private final double minValue, maxValue, length;
        
        private final Sprite[] images = new Sprite[2];
        
        public Slider(Sprite icon, Sprite background, double minimumValue, double maximumValue) {
            this.images[0] = icon;
            this.images[1] = background;
            this.minValue = this.value = minimumValue;
            this.maxValue = maximumValue;
            this.length = this.images[1].myWidth;
        }
        
        public void draw(int x, int y) {
            this.x = x;
            this.y = y;
            images[1].drawSprite(x, y);
            images[0].drawSprite(x + position - (int) (position / length * images[0].myWidth), y - images[0].myHeight / 2 + images[1].myHeight / 2);
        }
        
        public void handleClick(int mouseX, int mouseY, int offsetX, int offsetY, int contentType) {
            if (RSApplet.mouseX - offsetX >= x && RSApplet.mouseX - offsetX <= x + length 
                       && RSApplet.mouseY - offsetY >= y + images[1].myHeight / 2 - images[0].myHeight / 2 
                       && RSApplet.mouseY - offsetY <= y + images[1].myHeight / 2 + images[0].myHeight / 2)                 
            {
                position = mouseX - x - offsetX;
                if (position >= length) {
                    position = (int) length;
                }
                if (position <= 0) {
                    position = 0;
                }
                value = minValue + ((mouseX - x - offsetX) / length) * (maxValue - minValue);
                if (value < minValue) {
                    value = minValue;
                }
                if (value > maxValue) {
                    value = maxValue;
                }
                switch(contentType) {
                case 1:
                    Texture.method372(minValue + maxValue - value);
                    break;
                }
            }
        }
        
         public double getPercentage() {
            return ((position / length) * 100);
         }
    
    }
    2. Client.java, create a new interface type; pick any number.

    Code:
    else if (class9_1.type == 123) {
        Slider slider = class9_1.slider;
            if (slider != null) {
               slider.draw(k2, l2);
    }
    3. Add these in Interface.java

    Code:
    public Slider slider;
    
    public static void addSlider(int interfaceId, double min, double max, String iconSprite, String backgroundSprite, int contentType) {
            Interface widget = interfaceCache[interfaceId] = new RSInterface();
            Sprite icon = imageLoader(Integer.parseInt(iconSprite.split(" ")[1]), iconSprite.split(" ")[0]);
            Sprite background = imageLoader(Integer.parseInt(backgroundSprite.split(" ")[1]), backgroundSprite.split(" ")[0]);
            widget.slider = new Slider(icon, background, min, max);
            widget.type = 123; 
            widget.contentType = contentType;
     }
    MouseDragged, MousePressed

    Code:
    if (interfaceId != -1) {
                RSInterface widget = RSInterface.interfaceCache[interfaceId];
                for (int childId : widget.children) {
                    RSInterface child = RSInterface.interfaceCache[childId];
                    if (child == null || child.slider == null)
                        continue;
                    child.slider.handleClick(i, j, Client.isFullScreen ? 0 : 519, Client.isFullScreen ? 0 : 168, child.contentType);
                }
                Client.tabAreaAltered = true;
                Client.needDrawTabArea = true;
            }
            interfaceId = Client.openInterfaceID;
            if (interfaceId != -1) {
                RSInterface widget = RSInterface.interfaceCache[interfaceId];
                for (int childId : widget.children) {
                    RSInterface child = RSInterface.interfaceCache[childId];
                    if (child == null || child.slider == null)
                        continue;
                    child.slider.handleClick(i, j, 4, 4, child.contentType);
                }
            }
    Usage:

    Code:
    addSlider(child, 0.6, 1.5, "icon_sprite.png", "background_sprite.png", 1);
    4. Images, these are mine for brightness.






    5. This is what you're adding.



    Do Enjoy.ee
    Reply With Quote  
     


  2. #2  
    Forum Moderator


    Join Date
    Dec 2016
    Posts
    312
    Thanks given
    166
    Thanks received
    177
    Rep Power
    1089
    Nice job on this
    Attached image
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    Quote Originally Posted by UrEx View Post
    Nice job on this
    Credit goes to this https://www.rune-server.ee/members/thim+slug/
    Reply With Quote  
     

  4. #4  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    didn't even get my permission u twonk
    Reply With Quote  
     

  5. #5  
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    Quote Originally Posted by thim slug View Post
    didn't even get my permission u twonk
    people were selling it gimp
    Reply With Quote  
     

  6. #6  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    Quote Originally Posted by nucleon View Post
    people were selling it gimp
    I was only joking lol! who's been selling it lmfao? wait who even has it?
    Reply With Quote  
     

  7. #7  
    Donator


    Join Date
    Mar 2012
    Posts
    1,023
    Thanks given
    221
    Thanks received
    299
    Rep Power
    605
    Quote Originally Posted by thim slug View Post
    I was only joking lol! who's been selling it lmfao? wait who even has it?
    https://www.rune-server.ee/showthrea...=1#post5330307
    Reply With Quote  
     

  8. #8  
    Registered Member
    thim slug's Avatar
    Join Date
    Nov 2010
    Age
    28
    Posts
    4,132
    Thanks given
    1,077
    Thanks received
    1,137
    Rep Power
    5000
    Don't forget need to call handleClick somewhere lol!
    Reply With Quote  
     

  9. #9  
    Registered Member
    _Ali's Avatar
    Join Date
    Apr 2014
    Posts
    382
    Thanks given
    67
    Thanks received
    147
    Rep Power
    252
    Had this for 4 years now. A wild but thin slug made it for me back in the day. Should help some people out.

    Quote Originally Posted by thim slug View Post
    Don't forget need to call handleClick somewhere lol!
    mouseDragged, mousePressed. Let me know if you need further help.
    Reply With Quote  
     

  10. #10  
    Registered Member OP411's Avatar
    Join Date
    May 2014
    Posts
    293
    Thanks given
    28
    Thanks received
    31
    Rep Power
    0
    neat-o
    will save me a lot of time
    have a lot of ideas for this
    thanks
    Reply With Quote  
     

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)


User Tag List

Similar Threads

  1. Rune--Cheat Client Full interface *pictures + Video*
    By i ant geting in no plane in forum Downloads
    Replies: 27
    Last Post: 01-25-2008, 03:09 AM
  2. Recoloring the whole interface and stuff!!!!!!
    By Ninja Cat in forum Tutorials
    Replies: 19
    Last Post: 12-09-2007, 07:03 AM
  3. Replies: 15
    Last Post: 09-15-2007, 06:48 PM
  4. Packet 36 - Interface button Status
    By uber killer in forum Tutorials
    Replies: 9
    Last Post: 07-31-2007, 04:33 AM
  5. Adding Gfz in WhiteScape And Advanced Level Interface
    By Santa Noobie in forum Tutorials
    Replies: 1
    Last Post: 05-29-2007, 10:52 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
  •