Garry's Mod Wiki

Tool Information Display

This page describes how to use TOOL.Information.

CLEAN ME UP

You can find source code for it here.

You cannot have more than two key combinations displayed.

Here's an example:

if CLIENT then TOOL.Information = { { name = "info", stage = 1 }, { name = "left" }, { name = "right" }, { name = "right_use", icon2 = "gui/e.png" }, { name = "reload" }, { name = "reload_use", icon2 = "gui/e.png" }, } language.Add( "tool.example.1", "See information in the context menu" ) language.Add( "tool.example.left", "Select an object" ) language.Add( "tool.example.right", "Select next mode" ) language.Add( "tool.example.right_use", "Select previous mode" ) language.Add( "tool.example.reload", "Select yourself" ) language.Add( "tool.example.reload_use", "Select your view model" ) end

For each table inside the TOOL.Information a new line of text is added on HUD. It will display "#tool.<toolclassname>.<namefromthename>" by default.

  • <toolclassname> is the filename of your tool.

  • icon key defines a path to the icon

  • icon2 key defines a a second icon path

  • certain names have a default fallback icon

  • stage key makes the text only appear for given stage ( Tool:SetStage )

  • op key makes the text only appear for given operation ( Tool:SetOperation )

  • Default name is "info", which will display tool.example.<toolstage>, as all tools that do not use TOOL.Information do.

  • If your name ends on "use" and you do not override the icon2, icon2 will be E key. ( gui/e.png )

  • If your name starts with "info" - default icon is "gui/info"

  • If your name starts with "left" - default icon is LMB icon ( gui/lmb.png )

  • If your name starts with "right" - default icon is RMB icon ( gui/rmb.png )

  • If your name starts with "reload" - default icon is R key icon ( gui/r.png )

To change what the Panel on the front of the ToolGun looks like use the function TOOL:DrawToolScreen

Page Links


Special Pages


Wikis

?

Render Time: 110ms

DB GetPage 24
Generate Html 2
SaveChanges (1) 75
Render Body 0
Render Sidebar 6