Author Topic: Teamspeak query script  (Read 5677 times)

r2t3

  • Newbie
  • *
  • Posts: 5
Teamspeak query script
« on: April 12, 2006, 06:19:16 PM »
I'd like to create a teamspeak query script, but am not heavily familiar with vb/ice chat-scripting, and the over all structure needed for such a script. What recommended resources should I look into so that I could take on a project like this?


Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Teamspeak query script
« Reply #1 on: April 12, 2006, 06:24:30 PM »
Well, I have no idea how teamspeak even works with IRC, so I am at a complete loss there.

Perhaps a bit of information on what your trying to accomplish, and I could send you in the right direction.
The IceChat God

r2t3

  • Newbie
  • *
  • Posts: 5
Re: Teamspeak query script
« Reply #2 on: April 12, 2006, 08:02:42 PM »
Well teamspeak is a voip program that gamers often use.  The program should query the particular server <ip:port> (and also ts query port I think).  Then there is a way to obtain the membernames of users currently connected to the server.  Those usernames would then be printed to an IRC text message.  There is a script for mIRC that does this, but I like icechat and not mIRC.  Here is the code, maybe that will help?

Code: [Select]
; mIRC Teamspeak query bot by Andromeda
; Version 0.92
; Email: andromeda.gdi@gmail.com
; IRC: irc.protium.org #nbw

on *:LOAD:{
  if ($version < 6.03) {
    .unload -rs tsquery.mrc
    echo -ts Teamspeak Query Bot Requires mIRC v6.03 or newer to be installed successfully.
  }
  else { /echo -a mIRC Teamspeak Query Bot LOADED successfully }
}

on $*:TEXT:/^[!@.]addalias/i:*:{
  var %alias $2
  var %ip $3
  if ((%alias != $null) && (%ip != $null)) {
    .writeini query.ini tsquery %alias %ip
    /msg $chan $nick  $+ %alias %ip $+  has been added to tsquery $+ $chr(46)
  }
}

;-----------------------------------------------------------------------------
; Begin TS Server Query
;-----------------------------------------------------------------------------

on $*:text:/^[!@.]ts/i:#:{
  $tsquery($chan,$2)
}

on $*:text:/^[!@.]ts/i:?:{
  $tsquery($nick,$2)
}

on *:input:#:{
  if ($1 == !ts) {
    $tsquery($chan,$2)
  }
  else if ($1 == !addalias) {
    var %alias $2
    var %ip $3
    if ((%alias != $null) && (%ip != $null)) {
      .writeini query.ini tsquery %alias %ip
      /msg $chan $nick  $+ %alias %ip $+  has been added to tsquery $+ $chr(46)
    }
  }
}

on *:input:?:{
  if ($1 == !ts) {
    $tsquery($nick,$2)
  }
  else if ($1 == !addalias) {
    var %alias $2
    var %ip $3
    if ((%alias != $null) && (%ip != $null)) {
      .writeini query.ini tsquery %alias %ip
      /msg $nick  $+ %alias %ip $+  has been added to tsquery $+ $chr(46)
    }
  }
}

alias -l tsquery {
  if (($2 != $null) && ($chr(46) !isin $2)) {
    if ($readini(query.ini,tsquery,$2) != $null) {
      var %server $readini(query.ini,tsquery,$2)
      ; %server --> 67.18.198.30:9000
      var %sockserver $1 $+ $chr(174) $+ %server
      ; %sockserver --> nickŪ67.18.198.30:9000
      sockclose ts. [ $+ [ %sockserver ] ]
      unset %ts. [ $+ [ %sockserver ] ]
      unset %pl. [ $+ [ %sockserver ] ]
      sockopen -tk ts. [ $+ [ %sockserver ] ] $gettok(%server,1,58) 51234
    }
    else if (server* iswm $2) {
      $gettsservers($1)
    }
    else {
      /msg $1  Please put in a valid IP or alias. Type: "!ts servers" for list of servers.
    }
  }
  else if (($2 != $null) && ($gettok($2,2,58) != $null)) {
    var %sockserver $1 $+ $chr(174) $+ $2 $gettok($2,1,58) 51234
    ; %sockserver --> nickŪ67.18.198.30:9000
    sockclose ts. [ $+ [ %sockserver ] ]
    unset %ts. [ $+ [ %sockserver ] ]
    unset %pl. [ $+ [ %sockserver ] ]
    sockopen -tk ts. [ $+ [ %sockserver ] ]
  }
  else if ($2 != $null) {
    /msg $1  TS ERROR: Please put a port number.
    /msg $1  Example: !ts ts1.dsservers.com:8767
  }
  else { /msg $1  Please put in a valid IP or alias. Type: "!ts servers" for list of servers.  }
}

on *:SOCKOPEN:ts.*:{
  sockwrite -n $sockname si $gettok($sockname,2,58)
}

on *:SOCKOPEN:pl.*:{
  sockwrite -n $sockname pl $gettok($sockname,2,58)
}

on *:SOCKREAD:ts.*: {
  if ($sockerr > 0) { return }
  var %tmp | var %maxusers | var %tmpserv $gettok($sockname,2-,46) | var %tmpchan $gettok($gettok($sockname,2-,46),1,174)
  sockread %tmp
  while ($sockbr) {
    if (%tmp == [TS]) { sockread %tmp }
    else if (%tmp == OK) { sockclose $sockname }
    else if (server_name=* iswm %tmp) {
      set %ts. [ $+ [ %tmpserv ] ] $gettok(%tmp,2,61)
    }
    else if (server_maxusers=* iswm %tmp) {
      set %maxusers $chr(47) $+ $gettok(%tmp,2,61) $+ $chr(41)
    }
    else if (server_currentusers=* iswm %tmp) {
      set %ts. [ $+ [ %tmpserv ] ] %ts. [ $+ [ %tmpserv ] ] $+ $chr(32) $+ $chr(40) $+ $gettok(%tmp,2,61) $+ %maxusers
      /msg %tmpchan TS Server: $gettok(%tmpserv,2,174) %ts. [ $+ [ %tmpserv ] ]
      sockclose pl. [ $+ [ %tmpserv ] ]
      sockopen -tk pl. [ $+ [ %tmpserv ] ] $gettok($gettok(%tmpserv,1,58),2,174) 51234
      sockclose $sockname
      break
    }
    sockread %tmp
  }
}

on *:SOCKREAD:pl.*: {
  if ($sockerr > 0) { return }
  var %tmp | var %tmpchan $gettok($gettok($sockname,2-,46),1,174)
  sockread %tmp
  while ($sockbr) {
    if (%tmp == [TS]) { sockread %tmp }
    else if (%tmp == OK) { tspost $gettok($sockname,2-,46) | break }
    else {
      if ($len( % [ $+ [ $sockname ] ] ) < 400 ) {
        set % [ $+ [ $sockname ] ] % [ $+ [ $sockname ] ] $replace($gettok(%tmp,15,9) $+ $chr(32) , nick, $null)
      }
      else {
        /msg %tmpchan Users connected: % [ $+ [ $sockname ] ]
        set % [ $+ [ $sockname ] ] $replace($gettok(%tmp,15,9) $+ $chr(32) , nick, $null)
      }
    }
    sockread %tmp
  }
}

alias tspost {
  sockclose *. [ $+ [ $1- ] ]
  if (%pl. [ $+ [ $1 ] ] == $chr(32)) {
    unset %ts. [ $+ [ $1 ] ]
    unset %pl. [ $+ [ $1 ] ]
    return
  }
  /msg $gettok($1,1,174)  Users connected: %pl. [ $+ [ $1 ] ]
  unset %ts. [ $+ [ $1 ] ]
  unset %pl. [ $+ [ $1 ] ]
}

alias -l gettsservers {
  var %i 0
  var %list
  while (%i <= $ini(query.ini,tsquery,0)) {
    var %ini $ini(query.ini,tsquery,[ %i ])
    if ($gettok($readini(query.ini,tsquery,[ %ini ]),1,58)) {
      set %list %list %ini   
    }
    inc %i
  }
  /msg $1 TS Servers: %list
}

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Teamspeak query script
« Reply #3 on: April 12, 2006, 09:39:26 PM »
Well, because it uses mirc SOCK events(SOCKOPEM,SOCKREAD,etc), there will be no way to convert it, because IceChat 5 has no support for anything of the sort.

As for IceChat 7, which does support most mirc scripts, has no socket support added into it, and I am not even sure if it ever will.
The IceChat God