Your ad here, right now:

Console In Plugin

Posted on: March 15th, 2010 by cmptrwz

I got tired of having to find odd places on my keyboard to assign G-Keys to on my Logitech keyboard in TF2.

I wanted to be able to bind my G-Keys to build and destroy buildings and to specific disguises.

So I wrote a simple plugin (see link below) to enable that. Extracted to the tf folder, normally found in
<steam install dir>\steamapps\<username>\team fortress 2
it will create a “Named Pipe” whenever the game is running. Dumping commands into this pipe will run them as though you typed them into the console directly.

This will ONLY work when you are actually in a game. It will not work in menus, or after being disconnected. It is also one way, console output and command output from the commands you run are not fed back the other way. There is also, due to the way it is coded, a built-in rate limit of sorts.

The named pipe is \\.\pipe\SourceConsole and, for me, I use a program that allows me to run cmd.exe invisibly. I then pass it parameters like so:

cmd.exe /C echo "build 1" > \\.\pipe\SourceConsole

The entire command line (entered into the G-series Key Profiler via “Assign Shortcut”) actually ends up including the program I use, but this is enough for now. What this will do, when bound to a key, is tell TF2 to build a teleporter entrance, as though you typed “build 1″ into the game console or had it bound to a key normally.

This plugin is written in a very simplistic manner, and a number of things can prevent it from working properly. A major thing being something grabbing onto the named pipe and not wanting to release control. It works for me, and as people were asking me about it, I am posting it here.

And for the record, it will NOT allow you to do things that you can’t do by typing into the console already. I will not make it do anything like that either.

To get the plugin, click here:

Tags: , , , , ,

3 Responses to “Console In Plugin”

  1. Tara Says:

    Can you explain this for dumb people like me? :D

  2. cmptrwz Says:

    Extract plugin to TF2 directory so that it ends up in tf/addons folder (it will make said folder if needed).

    Bind G-Keys via Logitech’s software so that they run a command like

    cmd.exe /C echo “build 1″ > \\.\pipe\SourceConsole

    Press G-Keys while playing TF2, and they should magically trigger the commands in the quotes, after popping a REALLY annoying console window unless you have something to prevent that. <_<

    I have not, for my own reasons, provided the other program I use to hide the console window at this time. Maybe I will make a stupid little program that dumps the command line to \\.\pipe\SourceConsole or something in the future, if there is demand for it.

  3. Nathan Says:

    I would love you if you made it so it would also echo console output to the named pipe.

    Also, this is VAC safe, correct?

Leave a Reply