Closed MOARdV closed 7 years ago
Could we have the ability to make a sound have to finish playing instead of being cut off the second its variable goes out of range? Kind of like RPMs MustBePlayedOnce.
Also can we have variable pitch of the sound? We could make engine or wind noises.
Also can we have variable pitch of the sound? We could make engine or wind noises.
I think the engine sound effects are set in the engines config
power_dry
{
AUDIO
{
channel = Ship
clip = sound_jet_deep
volume = 0.0 0.0
volume = 0.05 0.4
volume = 1.0 0.9
pitch = 0.0 0.8
pitch = 1.0 1.4
loop = true
}
}
I know, but i mean a different engine noise that plays in the IVA. I find that the engines are very quite when flying. Im mostly going to use it for wind noise that changes with speed.
Okay:
volume
now can be a number or a variable. Valid range is [0, 1], and it will clamp to those values.pitch
can be a number or variable. Defaults to 1.0. No range bounds - I did not see documentation for that.mustPlayOnce
: boolean (true/false), defaults to false. Does not work with LOOP audio. Will prevent the audio playback from stopping before the loop finishes playing.I did not make 'sound' a variable yet - that looks like it is easy to change, but I need to figure out the right way to handle errors if an invalid sound clip is provided.
EDIT: And it is available on DropBox.
I have a problem with all my alarms now:
[ERR 18:41:49.003] [AvionicsSystems] INITIALIZATION ERROR: GetVariable with empty variableName
[ERR 18:41:49.004] [AvionicsSystems] INITIALIZATION ERROR: Failed to configure prop #15 (AC_K320_GPWS)
[ERR 18:41:49.005] [MASComponent] Failed to configure prop #15 (AC_K320_GPWS)
[ERR 18:41:49.005] [MASComponent] System.ArgumentException: [MASFlightComputer] Trying to GetVariable with empty variableName
at AvionicsSystems.MASFlightComputer.GetVariable (System.String variableName, .InternalProp prop) [0x00000] in
Is pitch a require field now?
No. I had a copy-paste error that I just now noticed and fixed. Re-download, please
LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER! LONG LIVE COPY PASTER!
EDIT: whoops, i meant long live copy paste... :D
I dont know what the problem is but now all my stock parts are missing and all of my ships are broken... my log is full of this:
[LOG 20:52:57.036] PartLoader: Compiling Part 'Squad/Parts/Aero/cones/avionicsNoseCone/PART' [ERR 20:52:57.037] PartCompiler: Part config requires value 'name' is defined
[ERR 20:52:57.038] PartCompiler: Cannot compile part
[LOG 20:52:57.038] PartLoader: Compiling Part 'Squad/Parts/Aero/cones/ConeA/PART' [ERR 20:52:57.039] PartCompiler: Part config requires value 'name' is defined
[ERR 20:52:57.039] PartCompiler: Cannot compile part
[LOG 20:52:57.040] PartLoader: Compiling Part 'Squad/Parts/Aero/cones/ConeB/PART' [ERR 20:52:57.041] PartCompiler: Part config requires value 'name' is defined
[ERR 20:52:57.041] PartCompiler: Cannot compile part
[LOG 20:52:57.042] PartLoader: Compiling Part 'Squad/Parts/Aero/cones/noseConeAdapter/PART' [ERR 20:52:57.042] PartCompiler: Part config requires value 'name' is defined
Do you know what I should do?
Did you delete something you shouldn't have by accident? Nothing in my code would do that, and I haven't had a problem here.
I dont think so. I tried validating game cache and it replaced 2 files. But the game was still broken. I restarted my computer and it still didn't work. so im reinstalling the game. If it still doesn't work then i dont know whats wrong.
If you have time, theres been something thats been nagging at me. I'm still new to programming in lua and have been using notepad+ as it has handy tools and features to help. Theres something i've noticed however.
Notepad+ has a line on the left of the page to show you the beginning and end of a function, but if the function has more than one 'IF' statements, the line goes pass the function as if its missing an 'end' statement. (notice the red line showing the wind noise function continuing down the page.)
Does every IF statement needs its own 'end'?
The script still works (when KSP is working) so i don't have much to complain about, im just wondering if the way i've set up the functions is ok.
Whatever was broken with KSP is fixed now.
Does every IF statement needs its own 'end'?
As far as I understand, yes. Every "if" must to be "closed" by "end" On your screen two "if" and function, so you need three "end"
Does every IF statement needs its own 'end'?
Yes:
if somecondition then
someaction
end
or, for compound cases,
if somecondition then
someaction
elseif someOtherConditon then
someOtherAction
end
Note that it is elseif
as one word, not two.
On your screen two "if" and function, so you need three "end"
Ok. The scripts still work like this. Should i use 'elseif'?
Should i use 'elseif'?
If you're doing compound checks, it is probably more efficient to use elseif.
I discovered that GitHub supports Lua syntax highlighting for code blocks:
if somecondition then
someaction
elseif someOtherConditon then
someOtherAction
end
if you add 'Lua' after the triple-backtick (eg ```Lua to start the code block, and triple-backtick by itself to end it)
Ok thank you.
Using a variable for sound =
is going to be tricky - I have some optimizations to convert some variables from Lua to C#, and that optimization needs to be smarter to recognize unquoted string literals.
sound
remains a static (unchanging) sound clip for the common use case. Omit sound
and use dynamicSound
instead, and the sound clip can be changed in-flight.
So volume can be adjusted, and maybe more than one sound option.