Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 3 of 3
  1. #1
    Join Date
    February 2012
    Posts
    2

    Problem with LUA-Plugin

    Hello,

    i hope to get some help here, as i can't figure out, what is wrong.
    I just try to play a Wave file with: ts3.playWaveFile

    my code is like this:
    require("ts3defs")
    require("ts3errors")

    function wave(serverConnectionHandlerID)
    ts3.printMessageToCurrentTab("Hello World")
    ts3.playWaveFile(serverConnectionHandlerID, "test.wav")
    end
    test.wav is in the same directory as the script.
    but when i try. /lua run wave, i just get the "Hello World". The wave isn't played and on console i get this error: Lua: Error playing wave file: 2051

    Hope someone has a hint.

    Greetz
    Wallo

  2. #2
    Join Date
    June 2008
    Location
    Krün, Germany
    Posts
    510
    This works for me:

    Code:
    local function playWave(serverConnectionHandlerID)
    	local error = ts3.playWaveFile(serverConnectionHandlerID, "plugins/lua_plugin/test.wav")
    	if error == ts3errors.ERROR_ok then
    		ts3.printMessageToCurrentTab("Played wave file")
    	else
    		ts3.printMessageToCurrentTab("Error playing wave file: " .. error)
    	end
    end
    You need to give the full path to the wave file, relative to the TeamSpeak installation dir. Reason for this was so you can easier access the existing sound files (sound/default/*.wav). Ok, if plugins/lua_plugin were automatically appened, you could still access the defaults with "../../sound/default/*.wav. Overall I think it makes little difference. Changing this now might break existing Lua scripts, so I assume it's best to leave it as it is.

  3. #3
    Join Date
    February 2012
    Posts
    2
    Thank you!
    Now it works.
    Well i´m having some trouble doing timed events. I want my sound to be played after x
    seconds.

    I found this trick.
    Code:
    function sleep(n)
      if n > 0 then os.execute("ping -n " .. tonumber(n+1) .. " localhost > NUL") end
    end
    It seems to work but hangs TS3 during the delay. I could try to code a scheduler that runs Tasks from a list.
    So when i call a function it writes the time + x seconds in this list. The scheduler then can compare the time in the list with the actual time and if even run my sound-function.

    Or do u know a better way?

    MfG
    Wallo

    and thank you again!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Plugin Loading Problem
    By Dione in forum Client Plugins / Lua Scripts
    Replies: 5
    Last Post: July 18th, 2014, 01:28 PM
  2. plugin problem
    By Darter in forum Client Plugins / Lua Scripts
    Replies: 7
    Last Post: July 7th, 2011, 04:58 PM
  3. Problem with plugin
    By T.S. Excreta in forum Client Plugins / Lua Scripts
    Replies: 2
    Last Post: June 16th, 2011, 06:23 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •