Page 1 of 1

play a sound clip on game start from map resources

Posted: 28 Nov 2009, 09:51
by KaiserJ
i would imagine it's LUA.

i dont even know what that stands for.

Lemur Undercarriage Access
Lesbian Underage Anal
Lithuanian Ukranian Alliance
Leopard Underpants Acquistions.
Lets Undermine America!

if somebody has sort of an idea of how it might be done, post plox! i need you to help me make my christmas present to spring.

santa com is coming to town

Re: play a sound clip on game start from map resources

Posted: 28 Nov 2009, 10:50
by Pressure Line
its 'Lua' not 'LUA', and it doesnt 'stand' for anything (because its not an acronym) it means 'moon' (or 'Moon' if you want to be really pedantic) in Portugese.

Re: play a sound clip on game start from map resources

Posted: 28 Nov 2009, 17:30
by lurker
More or less, you need this:

LuaGaia/main.lua

Code: Select all

VFS.Include("LuaGadgets/gadgets.lua",nil, VFS.BASE)
LuaGaia/Gadgets/play_a_sound.lua

Code: Select all

function gadget:GetInfo()
	return {
		name = "play_a_sound",
		desc = "Plays a sound at game start",
		author = "author",
		date = "2009-11-28",
		license = "Public domain",
		layer = 10,
		enabled = true
	}
end

if not (gadgetHandler:IsSyncedCode()) then

gadget:GameStart()
	Spring.PlaySoundFile("sounds/gamestart.wav")
end

end

Re: play a sound clip on game start from map resources

Posted: 28 Nov 2009, 18:00
by KaiserJ
<3 :mrgreen:

Re: play a sound clip on game start from map resources

Posted: 28 Nov 2009, 20:09
by Beherith
Lol kaiser, just check out my asteroid maps, they all have a music track playing at game start.

If you want to start track when game clock starts, then use the if spring.getgameseconds()>0 expression

Re: play a sound clip on game start from map resources

Posted: 29 Nov 2009, 10:11
by lurker
Note that I'm not sure if gamestart is called in unsynced, I kind of flipped a coin about putting that 'not' in, remove it if so.

Re: play a sound clip on game start from map resources

Posted: 30 Nov 2009, 13:48
by Wombat
Pressure Line wrote:its 'Lua' not 'LUA'
LUOL

Re: play a sound clip on game start from map resources

Posted: 02 Dec 2009, 15:23
by Achilla
Beherith wrote:Lol kaiser, just check out my asteroid maps, they all have a music track playing at game start.

If you want to start track when game clock starts, then use the if spring.getgameseconds()>0 expression
Just wondering, is it possible in the current Spring build for the sound to play in loop (repeat itself) and not just end after end of the track?

Re: play a sound clip on game start from map resources

Posted: 02 Dec 2009, 16:08
by Auswaschbar
Achilla wrote:
Beherith wrote:Lol kaiser, just check out my asteroid maps, they all have a music track playing at game start.

If you want to start track when game clock starts, then use the if spring.getgameseconds()>0 expression
Just wondering, is it possible in the current Spring build for the sound to play in loop (repeat itself) and not just end after end of the track?
Yes. Search the sound forum.