<aside> 💾 This update will NOT break saves from previous versions of Mapbase.

</aside>

<aside> 📂 For programmers: This update will include VPC changes.

</aside>




📜 VScript VGUI

Mapbase v7.1 adds long-awaited support for VScript to create custom VGUI panels, which one of our contributors (Sam) has been developing for over a year. This feature will allow you to create custom HUD elements and implement custom fonts to use with them.


// This is a simple script which creates a label with a custom font.
// Feel free to adapt it for your own purposes.
if ( CLIENT_DLL )
{
	surface.CreateFont( "TestVScriptFont",
	{
		"name"			: "Verdana"
		"tall"			: 40
		"weight"		: 500
		"additive"		: false
		"antialias" 	: true
		"dropshadow" 	: false
		"proportional" 	: true
	} );
	
	local s_pPanel = vgui.CreatePanel( "Label", vgui.GetRootPanel(), "TestVScriptPanel" );
	
	s_pPanel.MakeReadyForUse();
	s_pPanel.SetVisible( true );
	s_pPanel.SetPos( XRES(32), YRES(96) );
	s_pPanel.SetSize( 512, 256 );
	s_pPanel.SetFont( surface.GetFont("TestVScriptFont", true) );
	s_pPanel.SetText( "This is a test label created by VScript." );
	s_pPanel.SizeToContents();
	s_pPanel.SetContentAlignment( Alignment.southeast );
	s_pPanel.SetFgColor( 128, 255, 255, 255 );
}

The implementation is not final, but it is stable.

The implementation is not final, but it is stable.


Sam has uploaded several videos demonstrating this feature being used in a variety of different ways:

A custom crossbow scope created with VScript.

A custom crossbow scope created with VScript.

A custom TF2-based HUD created with VScript.

A custom TF2-based HUD created with VScript.

Fake Steam notifications created with VScript.

Fake Steam notifications created with VScript.

A custom CS:GO-based HUD created with VScript.

A custom CS:GO-based HUD created with VScript.

See Sam’s VScripts repository for the relevant source files.


We might look at extending this to vgui_screen in the future, which would allow this functionality to be used for in-world monitors.