Hi All,
I'm running into an issue and I don't seem to be able to fix it. My Pinn game is very procedural and because of this I do most of the coding in Python itself.
In this particular case I'm trying to get the show player to play a light show. but pending on a selection in the game it is using a different light or color. I want to do it in python because otherwise I need to add hundreds of events, which I wonder what that will do to the performance.
Most of the objects I have been able to trace back and I'm able to launch my lightshows via python. However I'm not able to stop them. and I do get this warning
2023-08-26 18:25:16,465 : WARNING : show_player : Config player show_player is missing context effect_controlled_friend
In the attachment I added a video, the purple blinking light should be turned off when moving to the next light. but that doesn't happen.
The problem is that I can't trace back the issue, I gave it a key, and gave it context, but for some reason it still doesn't have context when I try.
Code looks like this:
def light_play_show(self, light: str, color_id: str, action="play", **kwargs):
led = NativeTypeTemplate(value=light, machine=self.machine)
color = NativeTypeTemplate(value=color_id, machine=self.machine)
self.settings = self.get_show_settings(led, color, action)
self.machine.show_player.play(settings=self.settings, context="effect_controlled_friend", calling_context=None)
def get_show_settings(self, led, color, action="play", **kwargs):
settings = {
self.condition: {
"action": action,
"key": "effect_controlled_friend",
"priority": 5000,
"block_queue": False,
"start_step": self.start_step,
"speed": "1.0",
"loops": "-1",
"start_running": self.start_step,
"sync_ms": None,
"manual_advance": False,
"events_when_played": [],
"events_when_stopped": [],
"events_when_looped": [],
"events_when_paused": [],
"events_when_resumed": [],
"events_when_advanced": [],
"events_when_stepped_back": [],
"events_when_updated": [],
"events_when_completed": [],
"show_tokens": {
"led": led,
"color1": color
}
}}
return settings
I made a version (not procedural) in YAML to check if there is a difference between the context and key. compared to calling it manually via python. but everything that I print looks exactly the same.
show_player:
ball_started:
ls_controlled_friend:
action: play
key: effect_controlled_friend
priority: 5000
show_tokens:
color1: purple
led: l_objective_hide_target_h
s_left_flipper_active:
ls_controlled_friend:
action: stop
key: effect_controlled_friend
If any of the developers has any idea where I'm going wrong I would gladly hear it.
I have done similar things with widgets and that works perfectly, especially since that works with the given key. Which doesn't seem to be the case with shows...
Best regards,
Jordy de Lat