Helper class to invoke xBam.Call Asynchronously to avoid nested call errors

Support File BAM Helper class to invoke xBam.Call Asynchronously to avoid nested call errors 1.0

No permission to download
I've updated this to 1.0 version.
For those that are interested, I've created a script helper which will invoke xBam.Call asynchronously. Calling xBam.Call async like this enables one function to "use" xBam.Call for a time delay invoke and not have to worry about if the call to xBam.Call is "contained" within another xBam.Call.

Save the vbs file in same dir as table, then in the script for the table at the very top, put:
C#:
ExecuteGlobal LoadExternalScript ("BamAsyncInvoke.vbs")
Note you can also just copy the class definition into your table script.

Then I put one timer object on my table. Note the name of the timer. In the example below I named my timer AsyncBamCallTimer but you can use whatever as long as you update the below. Add this code in BeginPlay:
C#:
Dim xBamAsync

Sub FuturePinball_BeginPlay()

    set xBamAsync = (new BamInvoke)(AsyncBamCallTimer) 'AsyncBamCallTimer is a FP timer object

    ...

Now in my calls where I used xBam.Call, I now use either of Inoke or InvokeWithArgs:
C#:
    xBamAsync.InvokeWithArgs "RotateTrunkTo", 300, cTrunkLight
    ' or
    xBamAsync.Invoke "TrunkFrontHole_DestroyBall", 300

Updated code to support having multiple calls in same sub/function
C#:
    xBamAsync.Invoke "TrunkFrontHole_DestroyBall", 300
    xBamAsync.InvokeWithArgs "MakeSound", 600, "ding"

At the Initialize of the object I use Execute to auto generate the Timer's Expired method, but apart from that it doesn't use Execute/Eval
Author
madmrmax
Downloads
10
Views
557
First release
Last update
Rating
0.00 star(s) 0 ratings
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
  • Chat Bot Mibs Chat Bot Mibs:
    aeponce has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    JEAN LUC has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    lorenzom has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    maxangelo19 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Dragonslapper has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    royaljet has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tyfox has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Goldtopboy has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    slick267 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    dabreeze has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Spike has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tofa has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Atropine has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    bongo2k5 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Bouly has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Felipefx3 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    djrbx has left the room.
  • F @ freebird1963:
    were do music and sound files go
    Quote
  • Chat Bot Mibs Chat Bot Mibs:
    jhbradley has left the room.
      Chat Bot Mibs Chat Bot Mibs: jhbradley has left the room.
      Back
      Top