Thread: Hover Box / Info Box

Results 1 to 3 of 3
  1. #1 Hover Box / Info Box 
    Registered Member

    Join Date
    Jun 2012
    Posts
    204
    Thanks given
    61
    Thanks received
    77
    Rep Power
    104
    Doesn't use sprites, but it looks decent enough...
    It's the one that iHerp released, but that was laggy as shit
    and got removed (Would drop you from 50fps to 4-7fps).

    Features:
    • Customizable, and resizable
    • Uses "\\n" to generate a new line
    • Can display information nicely, has an example for items
    • Has a set boundry, so it doesn't cut off past the frame
    • Can easily input Strings you want to ignore
    • In fixed state, it draws over the gameframe


    Code:
    	public String[] ignore_startswith = {
    		"View", "World",  "Logout",  "Open Advanced", "Toggle", "Report", "Read Quest", "Select", "Message", "Ok",  "On", "Cast", "Activate", "Show", "Add",  
    		"Delete", "Swap", "Special Attack",  "Join",  "Adjust",  "Leave", "Combat",  "Stats",  "Quest",  "Inventory", "Worn", "Prayer",  "Magic",  "Follower",
    		"Friend",  "Ignore",  "Clan",  "Options", "Emotes",  "Music", "Ignore"
    	};
    	
    	public String[] ignore_contains = {
    		"Quickchat", "Walk here", "Special Attack"
    	};
    	
    	public String[] ignore_equals = {
    		"Search", "Close"
    	};
    	
    	private int hover_x;
    	private int hover_Y;
    	private String hover_tooltip;
    	public int debug_type;
    	
    	public void drawTooltipHover(int draw_x, int draw_y) 
    	{
    		if(!menuOpen)
    			if(Config.mouseovertext) 
    			{
    				int mouse_x = hover_x - draw_x;
    				int mouse_y = hover_Y - draw_y;
    				drawHover(mouse_x, mouse_y);
    			}
    		
    	}
    	
    	private void drawHover(int draw_x, int draw_y) 
    	{
    		hover_tooltip = menuActionName[menuActionRow - 1];
    		for(int starts = 0; starts < ignore_startswith.length; starts++) 
    		{
    			if(hover_tooltip.startsWith(ignore_startswith[starts]))
    				return;
    		}
    		for(int contains = 0; contains < ignore_contains.length; contains++) 
    		{
    			if(hover_tooltip.contains(ignore_contains[contains]))
    				return;
    		}
    		for(int equals = 0; equals < ignore_equals.length; equals++) 
    		{
    			if(hover_tooltip.equals(ignore_equals[equals]))
    				return;
    		}
    		if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
    			return;
    		if(itemSelected == 1 && menuActionRow < 2)
    			return;
    		else if(spellSelected == 1 && menuActionRow < 2)
    			return;
    		else 
    			buildDebug(hover_tooltip, debug_type);
    		inputTaken = true;
    		needDrawTabArea = true;
    		buildMenu(hover_tooltip, draw_x, draw_y);
    	}
    	
    	public void buildDebug(String desc, int type) 
    	{
    		if(type == 0) 
    		{
    			ItemDefinition item = ItemDefinition.forID(menuActionCmd1[menuActionRow - 1]);
    			hover_tooltip = desc + 
    			"\\nID: <col=ff0000>" + item.id + "</col>" +
    			"\\nGround: <col=ff0000>"+item.groundModel + "</col>" +
    			"\\nMale: <col=ff0000>" + item.maleModel + "</col>" +
    			"\\nFemale: <col=ff0000>"+item.femaleModel + "</col>" +
    			"\\nArm: [<col=ff0000>"+item.maleArm +"</col><col=ffffff>]  [<col=ff0000>"+item.femaleArm +"</col><col=ffffff>]" +
    			"\\nValue: <col=ff0000>" + intToKOrMilLongName(item.value) + "</col>";
    		} else if(type == 1) 
    		{
    			ObjectDefinition object = ObjectDefinition.forID(menuActionCmd4[menuActionRow - 1]);
    			hover_tooltip = desc + " \\nID: <col=ff0000>" + object.type;
    		} else
    			hover_tooltip = desc;
    	}
    	
    	private void buildMenu(String desc, int draw_x, int draw_y) 
    	{
    		TextDrawingArea font = newSmallFont;
    		int menu_width = 0;
    		int menu_hegiht = 0;
    		int x_bounds = super.mouseX + 15;
    		int y_bounds = super.mouseY + 20;
    		for (String line = hover_tooltip; line.length() > 0;) 
    		{
    			int length = line.indexOf("\\n");
    			String new_line;
    			if (length != -1) 
    			{
    				new_line = line.substring(0, length);
    				line = line.substring(length + 2);
    			} 
    			else 
    			{
    				new_line = line;
    				line = "";
    			}
    			int new_width = font.getTextWidth(new_line);
    			if (new_width > menu_width) 
    			{
    				menu_width = new_width;
    			}
    			menu_hegiht += font.baseCharacterHeight + 2;
    		}
    		menu_width += 8;
    		menu_hegiht += 9;
    		if(x_bounds < client_width &&
    			y_bounds < client_height) 
    		{
    			if(x_bounds + menu_width + 3 > client_width) 
    			{
    				x_bounds = client_width - menu_width - 3;
    			}
    			if(y_bounds + menu_hegiht + 3 > client_height) 
    			{
    				y_bounds = client_height - menu_hegiht - 3;
    			}
    			hover_x = x_bounds;
    			hover_Y = y_bounds;
    		}
    		DrawingArea.method338(draw_y + 1, menu_hegiht - 2, 170, 0, menu_width + 3, draw_x + 1);
    		DrawingArea.method338(draw_y, menu_hegiht, 170, 0, menu_width + 1, draw_x + 2);
    		DrawingArea.method338(draw_y + 1, menu_hegiht - 2, 256, 0xffffff, menu_width - 1, draw_x + 3);
    		DrawingArea.method338(draw_y + 2, menu_hegiht - 4, 256, 0xffffff, menu_width + 1, draw_x + 2);
    		DrawingArea.method335(0x222222, draw_y + 2, menu_width - 1, menu_hegiht - 4, 220, draw_x + 3);
    		for (int new_y = draw_y + font.baseCharacterHeight + 4; hover_tooltip.length() > 0; new_y += font.baseCharacterHeight + 2) 
    		{
    			int length = hover_tooltip.indexOf("\\n");
    			if (length != -1) 
    			{
    				desc = hover_tooltip.substring(0, length);
    				hover_tooltip = hover_tooltip.substring(length + 2);
    			} 
    			else 
    			{
    				desc = hover_tooltip;
    				hover_tooltip = "";
    			}
    			font.drawBasicString("<col=ffffff>" + desc, draw_x + 5, new_y, 0x999999, -1);
    		}
    	}
    Add a toggle if ya want, and to display it,

    In drawTooltip() at the bottom add
    Code:
    drawTooltipHover(client_state > 0 ? 0 : 4, client_state > 0 ? 0  : 4);
    And then where drawMenu() is, add drawTooltipHover(x, y);


    Spoiler for 3 Piece Gameframe (x, y):
    Map x = 516/519
    Map y = 0

    Chat x = 0
    Chat y = 338

    Tab x = 516/519
    Tab y = 168


    Spoiler for To set the debug type:

    Add:
    Code:
    debug_type = #;
    were the menu commands, actions and ids are built
    for example:
    Code:
    if(rsi.inventory[k2] > 0) {
    	ItemDefinition itemDef = ItemDefinition.forID(rsi.inventory[k2] - 1);
    	debug_type= 0;


    Final Product
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    3lv3n snip3r's Avatar
    Join Date
    Jan 2011
    Posts
    916
    Thanks given
    48
    Thanks received
    114
    Rep Power
    84
    Nice job. I might use the item value feature for the version that I have.
    Spoiler for RuneScape:

    [Only registered and activated users can see links. ][Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #3  
    Donator


    Join Date
    Aug 2012
    Posts
    2,479
    Thanks given
    312
    Thanks received
    459
    Rep Power
    457
    So if i have a quest tab and i have a list of texts, how can i use this to to create hover boxes for that?
    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. Replies: 2
    Last Post: 02-09-2011, 11:20 PM
  2. Replies: 2
    Last Post: 02-09-2011, 08:40 PM
  3. [new] option box + hover
    By felten in forum Graphics
    Replies: 14
    Last Post: 10-28-2010, 05:42 AM
  4. [Both] 8 Lined Chat Box Hover & Click Areas - FIXED
    By Jeremy Yak in forum Tutorials
    Replies: 28
    Last Post: 12-02-2009, 06:10 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
  •