Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report does not accept a boolean from a manager script as report event #8870

Closed
BrianCollinss opened this issue Apr 27, 2024 · 1 comment
Closed
Labels

Comments

@BrianCollinss
Copy link
Member

What happened?

While reports work with something like Maize.IsAlive == true as the "report event", they don't work with a boolean from a manager script, like AutoIrrigate.Script.IrrigNeeded == true.

Failed to publish event SubscribeToEvents. Error from subscriber SubscribeToEvents.OnSubscribeToEvents --> Exception has been thrown by the target of an invocation. --> Invalid report frequency found: AutoIrrigate.Script.IrrigNeeded == true

What Operating System are you on?

Windows

@par456
Copy link
Collaborator

par456 commented Apr 29, 2024

The problem you are running into here with manager scripts is that the scripts are not defined until they are compiled at runtime, which is after linking happens. So the report doesn't know that the Script has a property called IrrigNeeded that it can call and fails.

There is a workaround for this however. If you type your event as:
(bool)AutoIrrigate.GetProperty("IrrigNeeded") == true

Then it will be able to pass the checks when linking, and access the property at runtime correctly. This really only applies to manager scripts, as any other object would be defined in its class ahead of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants