Cyberwizzard.nl

Welcome to my world

Team Speak plugin for LCD Smartie

ImageI found a plugin for LCD Smartie for people who want to show TS data on their display. Unfortunately the original plugin couldn't show one speaker for each line - which looked the coolest in my opinion. So I started coding in the plugin and after 30 minutes I got a modified version ready to go :)

Download the the binary version of the dll using the download menu or grab it on the next page.

Continue to the main text for instructions, source code and downloads.

 I'll put the highlights from the orignal forum thread here. For those of you wanting to read the original - scroll down.

Vesa wrote:

Some days ago I received my Crystalfontz-display and I started using LCD Smartie with it. Great program, but I couldn't find plugin for Team Speak. So I made one myself, here it is for everyone to use and to develop it.

It's written with C# and I used Microsoft .Net Framework v2.0.40607. Download it from here.

Other thing I used is the great .NET Wrapper for using Team Speak SDK functions from .Net. The wrapper is made by James Mimeault and I used revision 02/22/2005. Get the wrapper from here. The file is named TSRemote.zip, unzip it to somewhere.

To compile the plugin, put the source code (you'll find it from below) of TSPlugin to file named as TSPlug.cs and copy TSRemote.cs to the same directory. Next open TSRemote.cs to text editor and change line
namespace YourNameSpaceHere
to
namespace TSPlug
and save file.

The C#-compiler comes with .NET Framework and should be in folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607. Add this to path to use the compiler (csc.exe) from anywhere. But of course it's possible to use it by entering the whole path with the compiler file name while compiling.

Now, go to command prompt and to the folder containing files TSPlug.cs and TSRemote.cs. To Compile type the following command and press enter:
csc /target:library *.cs
Or if you didn't add framework directory to the system path, use the following string instead:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\csc.exe /target:library *.cs
And after a little bit of waiting you'll find file TSPlug.dll from the same directory. Copy DLL-file to plugins\ -directory under your LCD Smartie directory. Also copy file TSRemote.dll from directory client_sdk under your team speak directory to the plugins directory.

In LCD Smartie I have following config on TS screen:
line 1:
$dll(TSPlug,1,param1,param2)
Continue on next line is on for lines 1 and 2.
Line 4:
$dll(TSPlug,2,param1,param2)
Center the text if wanted.

Now my own instructions for the additional mode:

Cyberwizzard wrote:

Brilliant plugin Wink

I compiled it using .NET v1.1.4322 and that works like a charm as well Smile

The only thing I missed was to allow to show speakers per line so I modified the code to use a function 3 for that.

Usage:
$dll(TSPlug,3,#,param2)
where # is a positive number (starting at 0) indicating the index of the speaker (they are in a list). If you have 4 lines you could use for example:
$dll(TSPlug,3,0,param2)
$dll(TSPlug,3,1,param2)
$dll(TSPlug,3,2,param2)
$dll(TSPlug,3,3,param2)
thus showing the first 4 speakers.
However, at my TS server we usually talk with loadsa people so just 4 names won't cut it, thats why the new mode has a remainder function: show the remainder of the speakers on one scrolling line - a lot like the mode 2 of the current plugin although this one can skin the first x names as you probably have them on a line above.

Example:
$dll(TSPlug,3,-1,3)
The first 3 once again indicates the new mode, -1 tells the plugin to show a list of names instead of 1 and the last 3 tells it to skip the first 3 names as we have them on another line.

Adapting the example from above this would become:
$dll(TSPlug,3,0,param2)
$dll(TSPlug,3,1,param2)
$dll(TSPlug,3,2,param2)
$dll(TSPlug,3,-1,3)

For a 4 line display Smile


The new source code looks like this:

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
 
namespace TSPlug {
     public class LCDSmartie {
         private bool bOpen = false;
         public LCDSmartie()
         {
 
             if (TSRemote.Open() == 0)
             {
                 bOpen = true;
             }
 
         }
 
    public string function1(string param1, string param2)
    {
             try
             {
                 string strPlayers = "Not connected to TS";
                 if (bOpen)
                 {
                     TSRemote.TtsrPlayerInfo[] tpia = TSRemote.Players;
                     strPlayers = tpia.Length.ToString();
                     strPlayers += " ";
                     for (int index = 0; index < tpia.Length; index++)
                     {
                         strPlayers += tpia[index].NickName;
                         strPlayers += "|";
                     }
                 }
                 return strPlayers;
             }
             catch (Exception e)
             {
                 return e.Message;
             }
         }
 
    public string function2(string param1, string param2)
    {
             try
             {
                 string strSpeakers = "Not connected to TS";
                 if (bOpen)
                 {
                     int[] iSpeakers = TSRemote.SpeakerIds;
                     strSpeakers = iSpeakers.Length.ToString() + " ";
                     for (int index = 0; index < iSpeakers.Length; index++)
                     {
                         TSRemote.TtsrPlayerInfo tpi = TSRemote.GetPlayerInfo(iSpeakers[index]);
                         strSpeakers += tpi.NickName + "|";
                     }
 
                 }
                 return strSpeakers;
             }
             catch (Exception e)
             {
                 return e.Message;
             }
     }
    
    
     public string function3(string param1, string param2) {
                 int line = 1;
             try {
                        line = int.Parse(param1);
                 } catch(Exception) {
                        // give user a beating
                        return "Param1 should be an int";
                 }
                    
         try {
             string strSpeakers = "Not connected to TS";
             if (bOpen) {
                     int[] iSpeakers = TSRemote.SpeakerIds;
                    
                 if (line >= 0) {
                         if (line > iSpeakers.Length - 1) {
                                 return "-";
                         } else {
                                 TSRemote.TtsrPlayerInfo tpi = TSRemote.GetPlayerInfo(iSpeakers[line]);
                                 return tpi.NickName;
                         }
                     } else {
                              // This will show the remainder
                              if (iSpeakers.Length == 0) return " -=Nobody speaking=-";
                             
                              int offset = 0;
                              try {
                                                offset = int.Parse(param2);
                                         } catch(Exception) {
                                                // give user a beating
                                                return "Param2 should be an int when using negative Param1";
                                         }
                                                
                                         strSpeakers = "";
                         for (int index = offset; index < iSpeakers.Length; index++) {
                             TSRemote.TtsrPlayerInfo tpi = TSRemote.GetPlayerInfo(iSpeakers[index]);
                             strSpeakers += tpi.NickName + "|";
                         }
                         if (strSpeakers == "") strSpeakers = "-";
                        
                         }
                }
                return strSpeakers;
         } catch (Exception e) {
                 return e.Message;
         }
     }
 }
 }

The original thread can be found here.

Files:
TSPlugMod.rar Version:0.1
LCD Smartie plugin to display TeamSpeak information on an LCD.
License GNU/GPL Date 2009-01-05 Language  English System  Windows Filesize 5.77 KB Download 1333