Author Topic: CURSE YOU SOUND  (Read 6552 times)

0 Members and 2 Guests are viewing this topic.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
CURSE YOU SOUND
« on: October 29, 2006, 11:30:45 PM »
For monkeys sake, I've been fooling around with this for ages. No matter how I try to get a sound to play using lua, it doesnt work.
It works with 'play' in console.
It works in an old swep I made

but in this script, no matter what I try, it won't (@*# play.

Code: [Select]
function PickRandSong()
GTMSongList = _file.Find( "sound/"..GTM.SongFolder.."*.mp3" );
  GTMSongNum = table.getn(GTMSongList)
if GTMSongNum <= 3 then
local more = 4 - GTMSongNum
_PrintMessageAll(HUD_PRINTTALK, "You cant play with less than 4 songs! Add at least "..more.." more songs and try again.\n")
_PrintMessageAll(HUD_PRINTCONSOLE, "You cant play with less than 4 songs! Add at least "..more.." more songs and try again.\n")

return;
end

GTMSongPlayingNum = math.random(1,GTMSongNum)
_Msg("Picked: "..GTMSongPlayingNum.."\n")

_PlaySound( ""..GTM.SongFolder..GTMSongList[GTMSongPlayingNum].."\n")
_Msg( ""..GTM.SongFolder..GTMSongList[GTMSongPlayingNum].."\n")

end



Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: CURSE YOU SOUND
« Reply #1 on: October 30, 2006, 09:30:21 PM »
Perhaps this is an engine bug, it only works in SWEPS. Not even ulx playsound works.


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: CURSE YOU SOUND
« Reply #2 on: October 30, 2006, 10:17:45 PM »
Are you trying to play mp3s?
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: CURSE YOU SOUND
« Reply #3 on: October 31, 2006, 04:30:39 PM »
Quote from: Megiddo
Are you trying to play mp3s?

Answering for GD...
Code: [Select]
GTMSongList = _file.Find( "sound/"..GTM.SongFolder.."*.mp3" );
:D Yes
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: CURSE YOU SOUND
« Reply #4 on: November 01, 2006, 03:35:28 PM »
Are you trying to play mp3s?
Yes, but wavs do not work either.


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: CURSE YOU SOUND
« Reply #5 on: November 01, 2006, 04:00:52 PM »
I've heard from many sources that MP3's don't work, but wavs work fine.

EDIT: What's the output from the _Msg() function?
« Last Edit: November 01, 2006, 04:02:42 PM by Megiddo »
Experiencing God's grace one day at a time.

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: CURSE YOU SOUND
« Reply #6 on: November 01, 2006, 07:40:05 PM »
I've tried using the exact code that worked in a swep via console/this script, it doesn't play, but it works fine in the script.
And me entering:
_PlaySound("elvis.mp3") inside the swep works.

I put that exact same thing in a simple
function lol()
_PlaySound("elvis.mp3")
end

and it still doesnt work.

Code: [Select]
] lua_openscript GuessThatMusic/init.lua
] startmusicgame
Picked: 3
GTMSongs/s1.mp3
A game of 'Guess That Music' by Golden-Death has been started!