Hey, remember Chatterbox?

Hey, remember Chatterbox?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Hey, remember Chatterbox?

Post by CarRepairer »

Hey, remember Chatterbox?

I miss that widget. Anyone have it? I'd be willing to fix it now that I widge-it all day long.
User avatar
quantum
Posts: 590
Joined: 19 Sep 2006, 22:48

Re: Hey, remember Chatterbox?

Post by quantum »

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--  file:    snd_chatterbox.lua
--  brief:   annoys sounds
--  author:  Dave Rodgers
--
--  Copyright (C) 2007.
--  Licensed under the terms of the GNU GPL, v2 or later.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

function widget:GetInfo()
  return {
    name      = "ChatterBox",
    desc      = "Annoying sounds",
    author    = "trepan",
    date      = "Jan 9, 2007",
    license   = "GNU GPL, v2 or later",
    layer     = -10,
    enabled   = false  --  loaded by default?
  }
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

local SOUND_DIRNAME = LUAUI_DIRNAME .. 'Sounds/'


local function playSound(filename, ...)
  Spring.PlaySoundFile(SOUND_DIRNAME .. filename, unpack(arg))
end


--------------------------------------------------------------------------------

function widget:KeyPress(key, mods, isRepeat)
  if (not isRepeat) then
    playSound('flag_grab.wav')
  else
    playSound('land.wav', 0.4)
  end
  return false
end

--[[
function widget:KeyRelease(key, mods)
  playSound('flag_grab.wav')
  return false
end
--]]


function widget:MousePress(x, y, button)
  if     (button == 1) then playSound('pop.wav')
  elseif (button == 2) then playSound('message_admin.wav')
  elseif (button == 3) then playSound('bounce.wav')
  end
  return false
end


function widget:UnitFinished(unitID, unitDefID, unitTeam)
  if (unitTeam == Spring.GetMyTeamID()) then
    playSound('teamgrab.wav')
  end
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Attachments
Sounds.7z
(96.42 KiB) Downloaded 24 times
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Hey, remember Chatterbox?

Post by CarRepairer »

Thanks! More sounds = better.
Post Reply

Return to “Lua Scripts”