Array and for loop
Posted: Thu Jul 19, 2012 10:48 am
I think I mentioned before that I had a setup to rip sounds directly by recording gameplay. I essentially set up and LUA and side to be completely silent except for whatever sounds I had set up for my weapons. Long story short a short in the trace of the motherboard on my last machine put too much static in the files, and not being streams they were dependent on the 3D world. With VO it plays in 2D, so it'll be much easier to capture. I've set up a function below to run through an array of VO files to play them.
What I need is to have someone take a look at my "I'm-at-work-and-can't-test-it" code and see if my Lua-fu is good enough to get this to work.
What I need is to have someone take a look at my "I'm-at-work-and-can't-test-it" code and see if my Lua-fu is good enough to get this to work.
Code: Select all
function ScriptPostLoad()
--Here is our array of VO file strings to call
currentVO = { "vo1", "vo2", "vo3", "vo4", vo5", "vo6" }
function PlayTheVO()
local a
for a = 1, table.getn(currentVO) do
--Broadcast the current voice over file
BroadcastVoiceOver([currentVO]a, REP)
--Show what VO file we're playing on-screen
ShowMessageText([currentVO]a, REP)
--Dump the same info to BFront2.log
Print([currentVO]a)
end
VOstartTimer= CreateTimer("VOstartTimer")
SetTimerValue(VOstartTimer, 4) --wait four seconds to start
StartTimer(VOstartTimer)
OnTimerElapse(
function(PlayTheVO())
DestroyTimer(VOstartTimer)
end,
VOstartTimer
)