Jump to content



Photo
- - - - -

Detecting Uninitialized UserValue

vbs script visual pinball

  • Please log in to reply
No replies to this topic

#1 Two

Two

    Hobbyist

  • Members
  • PipPip
  • 11 posts

  • Flag: ---------

  • Favorite Pinball: Star Trek

Posted 08 May 2025 - 10:34 PM

Hi!

 

I was investigating some ball methods of keeping state information about the ball, and there was a recommendation about assigning an object to the UserValue.  This seems like a great idea, and it's easy to set the UserValue to an object when you create a ball (e.g. in a kicker).

 

However, when debugging you can "throw balls in player" using the mouse.  These are not in my control when created, and when I try to reference the uninitialized UserValue I get an error "Variable uses an Automation type not supported in VBScript".

 

IsEmpty, IsObject. VarType, and VarName all throw this error when trying to reference it.  Does anyone know a way to check if UserValue is uninitialized?  The best I've come up with is catching the error with "on error resume next", and then initializing the ball by assigning it an object.  This seems clunky.

 

Any suggestions?

 

Thanks!







Also tagged with one or more of these keywords: vbs, script, visual pinball