SimMission.Calculator WorldScript no longer updates after initial load

Version: 1.0.72.0
Still an issue in v1.1.9.0

Frequency: Consistently

Severity: Blocker

Marketplace package name: Emerald Object Library & 8AK5 Fort Crosby
(Library contains the controller script, which affects SimObjects and Wwise sounds called in the airport scenery.)

Bug description:
I use a basic WorldScript in my object library that acts as a controller for a lot of dynamic features in my sceneries. This includes stuff like, making Wwise audio only play when certain simvars are met that are not supported by the Wwise XML or making SimObjects appear or disappear based on variables that I cannot read in a SimObject XML.

It’s a workaround in 2020 to get around a lot of limitations of those two systems.

The WorldScript uses a SimMission.Calculator to write a custom Lvar if certain conditions are met. For whatever reason this Lvar no longer changes. I am not exactly sure if this is a fault in the script or if this goes deeper into the actual simvars themselves. At the moment, it seems that the script just doesn’t update the Lvar to 1 and it remains 0 if I debug it using the Behaviors tool in the sim.

Here is an example of some conditions I use for an Owl SFX in the scenery. The Owl should only be audible at night near the Hangar at Fort Crosby, but because the Lvar is not being updated, it plays all the time:

<SimMission.Calculator InstanceId="{C826657A-5392-464D-B510-6834BE4862FF}" id="NightNoWX">
	<CalculatorActions>
		<CalculatorAction>
			<CalculatorFormula>(E:TIME OF DAY, Enum) 3 == (A:AMBIENT PRECIP STATE, mask) 2 == and (L:ESD_NightNoWX, bool) !=</CalculatorFormula>
			<OnActionCompleteFormula>(E:TIME OF DAY, Enum) 3 == (A:AMBIENT PRECIP STATE, mask) 2 == and (&gt;L:ESD_NightNoWX, bool)</OnActionCompleteFormula>
		</CalculatorAction>
	</CalculatorActions>
</SimMission.Calculator>

Repro steps: Spawn in the hangar at Fort Crosby and you will hear an Owl call from the trees just to the right, every so often.

1 Like

For me this is working, so I think it got fixed. However without the working flight object debug, it’s hard to know what is going on inside the calculators. Hopefully the public release will fix it.

Hmm. I’m still seeing no difference here.

I’m not sure if it’s a case of the script not being able to read the simvars, or if it just can’t set the custom Lvar to 1. As mentioned in my original post, I can use the Behaviors debug tool and view that the Lvar is at least showing up with a value of 0 for the simobject in question.

Maybe something else is causing it not to work? If you simplify it, setting an lvar from a worldscript calculator should still work.

I’ve spent the last hour researching it and have determined that it is reading the simvars and setting the Lvar, the problem seems to be that it’s no longer updating if the conditions change.

Whatever conditions are met on the first load are what Lvars will trigger. For example, roof snow and snow banks controlled by snow depth are not visible if I load in during summer and then change the conditions to winter, but they will show if I load in as winter first. Then it’s the same deal if I change that back to summer conditions. All the snow objects will still be visible.

maybe the onactioncomplete part is broken? You could rewrite as:

<SimMission.Calculator InstanceId="{C826657A-5392-464D-B510-6834BE4862FF}" id="NightNoWX">
	<CalculatorActions>
		<CalculatorAction>
			<CalculatorFormula>
                (E:TIME OF DAY, Enum) 3 == 
                (A:AMBIENT PRECIP STATE, mask) 2 == 
                and d (L:ESD_NightNoWX, bool) !=
                if{ (&gt;L:ESD_NightNoWX, bool) }
           </CalculatorFormula>
		</CalculatorAction>
	</CalculatorActions>
</SimMission.Calculator>

the d duplicates the value so it can be used twice. For the comparision and for setting the Lvar

Still no luck on my end with this format. I did verify it in 2020 just to make sure the code actually works, and it does. So, it’s still just something specific with 2024 it seems.

Chris is one of the most innovative developers I know of! It would be great if this issue could be investigated further. @EPellissier @FlyingRaccoon @Boris

1 Like

This is still an issue as of the last sim update, but I did notice another bit of info today. It seems that if I open one of my airport projects and do a package build (not even opening the scenery editor) when it reloads after building the package, the WorldScript will work correctly.

I can change conditions and objects and sounds will trigger as intended. However, it will not update like usual on the next sim restart.

Maybe some info that could be useful in narrowing down the issue…

Hello @Rotornut44

My apologies, we overlooked this report. I’m checking this asap.
Possibly related to other bug reports about time simvars being incorrect.
Are your non working scripts all using time simvars?

Regards,
Sylvain

Hello @Rotornut44

Mounted both your packages from the Community folder and I seem to have the expected behavior. The Lvar is set and I can ear the owl. Am I missing something?

Regards,
Sylvain

Hi Sylvain,
Thanks for taking a look into this!

On my very first load in today I loaded it clear skies preset with default time and season. Using the time slider in the dev menu, it actually worked like in your video. However, when I tried to change it with the sim’s toolbar weather menu, it broke and would not change.

I have tried to replicate what I did the first time on two sim restarts now and even the dev toolbar time change doesn’t affect the sounds anymore.

Slightly unrelated, yet maybe related, I also have water puddles that will appear on the runway when there is precipitation. This is not controlled by the worldscript, just a simobject targeting the precip variable, but I have noticed that sometimes when I drag the precip slider (in the weather window) up and back to 0, they do not disappear. But if I slide it back and forth a few times, eventually they will. Just mentioning as it could be related…

I’m sending the full script to the private content channel so that you can view it in it’s entirety.

Current features affected in the scenery:

  • Some bird sounds (Woodpecker, etc)
  • Owl (It’s own Lvar)
  • Snow berms along runway and Snow/Icicles on hangar roof
  • Hangar lights and their accompanying electric hum sound

Ok, I have a repro.
It seems quite easy to replicate by dragging the slider from one extremity to the other very quickly. At some point, the L var will stop being updated.

Regards,
Sylvain

2 Likes