Thread: Interface Help

Results 1 to 4 of 4
  1. #1 Interface Help 
    Registered Member
    Join Date
    May 2018
    Posts
    19
    Thanks given
    1
    Thanks received
    5
    Rep Power
    20
    I've been running into a problem where I want to try and use a interface to open up shops. Except I want to use the interface to display multiple shops.. If that makes sense. I'll give you an example of what I'm trying to do if it doesn't.
    - Player clicks on an object to open the interface with 10 shops listed
    - Player clicks on a different object to open the same interface with 10 different shops listed

    I think the issue is that I need a way to differ the interface I want at that time in ButtonHandler. To click a button in the interface it points to ButtonHandler.

    How would I make it click the buttons within just the local interface.java file, without pointing to ButtonHandler first?


    Here is the code for the shop java file:

    Code:
    package com.rs.game.player.content.interfaces.stores;
    
    import com.rs.game.player.Player;
    import com.rs.utils.ShopsHandler;
    
    public class MeleeWeapons {
    
    	public static int InterfaceID = 72;
    	public static void sendInterface(Player player) {
    		player.getInterfaceManager().sendInterface(InterfaceID);
    		player.getPackets().sendIComponentText(InterfaceID, 55, "Pick a shop");
    		player.getPackets().sendIComponentText(InterfaceID, 31, "Daggers");
    		player.getPackets().sendIComponentText(InterfaceID, 32, "Swords");
    		player.getPackets().sendIComponentText(InterfaceID, 33, "Longswords");
    		player.getPackets().sendIComponentText(InterfaceID, 34, "Spears");
    		player.getPackets().sendIComponentText(InterfaceID, 35, "Hasta");
    		player.getPackets().sendIComponentText(InterfaceID, 36, "Two-Handed");
    		player.getPackets().sendIComponentText(InterfaceID, 37, "Claws");
    		player.getPackets().sendIComponentText(InterfaceID, 38, "Battleaxes");
    		player.getPackets().sendIComponentText(InterfaceID, 39, "Maces");
    		player.getPackets().sendIComponentText(InterfaceID, 40, "Warhammer");
    	}
    
    	public static void handleButtons(Player player, int componentId) {
    		int DaggerShop = 1;
    		int SwordShop = 81;
    		int LongswordShop = 82;
    		int SpearShop = 83;
    		int HastaShop = 84;
    		int TwoHShop = 108;
    		int ClawShop = 114;
    		int BattleaxeShop = 115;
    		int MaceShop = 116;
    		int WarhammerShop = 117;
    			if (componentId == 68) {
    				ShopsHandler.openShop(player, DaggerShop);
    				return;
    				}
    			if (componentId == 67) {
    				ShopsHandler.openShop(player, SwordShop);
    				return;
    				}
    			if (componentId == 66) {
    				ShopsHandler.openShop(player, LongswordShop);
    				return;
    				}
    			if (componentId == 65) {
    				ShopsHandler.openShop(player, SpearShop);
    				return;
    				}
    			if (componentId == 64) {
    				ShopsHandler.openShop(player, HastaShop);
    				return;
    				}
    			if (componentId == 73) {
    				ShopsHandler.openShop(player, TwoHShop);
    				return;
    				}
    			if (componentId == 72) {
    				ShopsHandler.openShop(player, ClawShop);
    				return;
    				}
    			if (componentId == 71) {
    				ShopsHandler.openShop(player, BattleaxeShop);
    				return;
    				}
    			if (componentId == 70) {
    				ShopsHandler.openShop(player, MaceShop);
    				return;
    				}
    			if (componentId == 69) {
    				ShopsHandler.openShop(player, WarhammerShop);
    				}
        	}
    
    }
    Here is what I have to put in ButtonHandler for it to even recognize that I have a button to be clicked:


    Code:
    		if (interfaceId == 72) {
    			MeleeWeapons.handleButtons(player, componentId);
    		}
    Thank you for reading in advance ^.^
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2018
    Posts
    19
    Thanks given
    1
    Thanks received
    5
    Rep Power
    20
    Bump, still need this.
    Reply With Quote  
     

  3. #3  
    Registered Member
    rebecca's Avatar
    Join Date
    Aug 2017
    Posts
    1,071
    Thanks given
    862
    Thanks received
    915
    Rep Power
    5000
    unless you directly reference the shop interface class when identifying the incoming button click packet, youll have to add a short handling method in the buttonclicked class like this:
    Code:
    if(ShopInterface.handler(player, button)) {
    			return;
    		}
    Last edited by rebecca; 07-24-2018 at 03:58 AM.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2018
    Posts
    19
    Thanks given
    1
    Thanks received
    5
    Rep Power
    20
    Ahh I see. I'll give that a try. Thank you.
    Reply With Quote  
     


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. Quest Open Interface help...
    By 0v3rc0m3 in forum Help
    Replies: 11
    Last Post: 02-01-2009, 11:54 PM
  2. teleport interface help
    By Bmxican in forum Help
    Replies: 2
    Last Post: 01-09-2009, 02:03 AM
  3. New interface help
    By Magers in forum Help
    Replies: 0
    Last Post: 12-01-2008, 12:46 AM
  4. item in interface help plz
    By garaa447 in forum Help
    Replies: 0
    Last Post: 11-25-2008, 02:51 AM
  5. [508] item on interfaces help
    By tinosk in forum Requests
    Replies: 7
    Last Post: 10-31-2008, 06:17 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
  •