Skip to content

Dev: FAQ

Silent edited this page Jul 6, 2023 · 3 revisions

Q: My custom FiniteStateDevice is crashing when TXEngine Starts. Why?

  • A: Are you trying to fetch from the cache within __init__? Many elements in the cache are not available at load-time. Instead, fetch from the cache during runtime (IE, within a state's logic function).

Q: How do I get a reference to the main Player object?

  • A: from_cache('player')

Q: Do I need to check for input validity within the states of my FiniteStateDevice?

  • It depends. If you're simply enforcing an input range (IE an int between -1 and 5) then you can simply set those as your input type and input bounds. If your state's input validity is more complex, then yes, you will likely need to implement logic to check. Keep in mind that, except in rare cases, you should not be creating states with complex input validity.