Code/Example Help BAM Timers and variables

Coding and examples for future Pinball and BAM
Sence you guys were wondering.
REMEMBER IM A SOAKING WET NEWBIE WITH SCRIPTING


Dim TimerInterval ' The interval at which the timer will fire, in seconds
Dim IncreaseAmount ' The amount by which to increase or decrease the trail length each time the timer fires
Dim DefaultTrailLength '

' Set the default trail length
DefaultTrailLength = 0.48

<SNIP>
...

' Get the ID of the DefaultBall
ballID = xBAM.BallManager.GetBallID("DefaultBall")
...
<SNIP>

custom balls and trails all in one with transformations
i have not tweaked it as Im not sure how or if it can be

Hey HZR - in your code above, where did the function GetBallID come from?

Get the ID of the DefaultBall
ballID = xBAM.BallManager.GetBallID("DefaultBall")


I'm not seeing this anywhere in the BAM function list.
 
Thank you... was gone for a while havent had much time
 
Hey HZR - in your code above, where did the function GetBallID come from?

Get the ID of the DefaultBall
ballID = xBAM.BallManager.GetBallID("DefaultBall")


I'm not seeing this anywhere in the BAM function list.
I think I may have used AI... try it and see if you get a error
 
I think I may have used AI... try it and see if you get a error
Thank GIMLI for this


  • ----------------------------------------------------------------------------------------------- Old script comment style tricks --------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    '[BAM] !texture = textureName
    '[BAM] !normalMap = textureName
    '[BAM] !specularMap = textureName
    '[BAM] !shininess = value
    '[BAM] !specularLevel = value
    '[BAM] !heightMap_bias = value
    '[BAM] !heightMap_scale = value
    '[BAM] !specularBalance = value
    '[BAM] !specularColorRed = value
    '[BAM] !specularColorGreen = value
    '[BAM] !specularColorBlue = value
    '[BAM] !normalMapScale = value
    '[BAM] !latlong = 1
    '[BAM] !latlongRotation = value
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    -------------------------------------------------------------------------------------------- procedures in script called by BAM --------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    Sub BAM_Init
    Sub NewtonPhysicsTick
    Sub FLIPPERNAME_prehit // note, FLIPPERNAME is FP Object Flipper Name... and xBAM.Flipper "FP Object Flipper Name" must be called in BAM_Init
    Sub EnumBallsCallback ball // ball is BallInfo object
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------------- functions, objects, constats accesible with xBAM --------------------
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    xBAM
    .Ball (ret: BallInfo ***)
    .BallID (get int)
    .BallRadius (set only)
    .BallMass (set only)
    .BallOpacity (set only)
    .BallCloseTo x, y, z (ret: BallInfo ***)
    .BallSpeedLimit (set only)

    .EnumBalls max, order, callback_FunctionNameInScript

    .MiniPlayfield minX, maxX, minY, maxY, minZ, maxZ, toX, toY, toZ, scale
    .CreateMiniPlayfield maxX, minY, maxY, minZ, maxZ, cenX, cenY, cenZ (ret: MiniPlayfield ***)

    .CreateMagneticField x, y, z, range, strength (ret: MagneticField ***)

    .CreateModel ModelTemplateName, x, y, z, height, rotX, rotY, rotZ, relfectionsFlag, z2yFlag (ret: Model ***)
    .LoadModels
    .ModelAnimationSplit ModelTemplateName, startFrame, endFrame, dstAnim, srcAnim

    .SetTexture FPObjectName, textureName, textureId (default textureId = 0)
    .SetTopTexture FPObjectName, textureName (same as .SetTexture FPObjectName, textureName, 0)
    .SetSideTexture FPObjectName, textureName (same as .SetTexture FPObjectName, textureName, 1)
    .SetEnamelTexture FPObjectName, textureName (same as .SetTexture FPObjectName, textureName, 2)
    .SetPlayfieldTexture textureName
    .SetTransliteTexture textureName
    .SetCabinetTexture textureName
    .SetPosterTexture textureName
    .GameRome (property, boolean, can be read and write, TRUE = show game room, FALSE = hide game room)

    .Flipper FPFlipperObjectName (ret: FlipperExt ***)

    .FixScore
    .EnterPinballHighScore CurrentPlayer
    .GetKeyCode keyId

    .FrameCounter
    .NewtonCounter

    .FindObject x, y, type (get ObjectInfo)

    .ShadowMap LightSourceFPObjectName, Amount, Passes, Radius, Brighness, SpotlightRange, WhiteLight, Reflection
    .RemoveFlippersFromShadowmaps (bool value: true/false, can be SET and READ) // obsolete, now it is alway = true
    .SetBallShadows dark_level, radius_soft, radius_hard, maxLevelAbovePlayfield

    .PhysicsXML "xml"

    .Camera (ret: Camera ***)
    .Physics
    .SetMaterial PObjectName, elasticCoef, softnessCoef, staticFriction, kineticFriction
    .ExpandWorldSize left, right, up, down, above, below
    .BallCollidable - sets it to FALSE and there will be no ball-ball collisions. WRITEONLY

    .BallManager
    .DefineCustomBall red, green, blue, dirtTextrureName, reflectionTextureName, reflectionInPlayfieldTextureName (ret: BAM_BALL_TYPE_NAME)
    .CreatCustomBall BAM_BALL_TYPE_NAME (ret: BallCreationInfo)
    .CreateTransformation (ret: Transformation)
    .UpdateBall BallID, BAM_BALL_TYPE_NAME
    .GetBallName BallID (ret: BAM_BALL_TYPE_NAME)
    .SetBallOpacity BallID, opacity
    .SetBallOpacityWithEasing BallId, opcity, time, easingFunction

    .DispDMD DispDMDName (ret: DispDMDExt)
    .HudDMD DispDMDName (ret: HudDMDExt)
    .CreateAllExt
    .SetDefaultMatrixBaseColor red, green, blue
    .Lights (ret: Lights ***)


    // ****************** new things:
    .Get pluginName (ret: plugin object) see: PuPPlugin
    .DisableFlipperShadows()
    .EnableFlipperShadows()
    .HideHud()
    .ShowHud()
    .HideAllDispOnBackbox()
    .ShowAllDispOnBackbox()
    .GetTexture "textureName" // return of texture object...
    .isValid
    .normalMap // same as '[BAM] !normalMap = textureName
    .specularMap // same as '[BAM] !specularMap = textureName
    .shininess
    .specularLevel
    .heightMap_bias
    .heightMap_scale
    .specularBalance
    .specularColorRed
    .specularColorGreen
    .specularColorBlue
    .SetSpecularColor red, green, blue
    .normalMapScale
    .latlong
    .latlongRotation
    .SetColor red, green, blue
    .brightness

    .Trails // way to set in script same ball trails params as in BAM menu
    .Level // set "level" of ball trails.
    .Color radm green, blue // set color of ball trails
    .Enabled // = true or false to enable/disable trails

    .Table // this variable is same as name of table, so for "NewTable" xBAM.Table is same thing as NewTabele... this way in script you don't have to check name of table to get width, height,....

    .LoadGif gifTexture - returns IGif object to control gif animations
    .VisibleCabParts bitField - every bit of 16 bit word enables/disable cabinet parts (legs, wood parts, etc)
    .DrawCustomModelsLast - controls when BAM Custom models are drawed (boolean)
    .DrawCustomModelsWithSurface "surfaceNameInFpEditor" - controls when BAM custom models are drawed
    .SuppressLoadMessages - set to True to hide BAM yellow loading messages (boolean)
    .EnableShadows - fake ball/flippers shadows (boolean)
    .TimeScale - change physics simulation time speed, default = 1.0 (float)
    .SetShadowColor red, green, blue - sets color of fake shadows
    .MouseX - horizontal mouse move between frames (READONLY) (int)
    .MouseY - vertical mouse move between frames (READONLY) (int)
    .RayCastShadows
    .Enable - use it to enable/disable ray-cast-shadows from script
    .Sharpness - float
    .DarkLevel
    .Set sharpness, darkLevel - enables shadows and sets params for sharpness and dark level
    .DumpAllObjectInfo()

    constansts:
    xBAM.easeLinear
    xBAM.easeInSine
    xBAM.easeOutSine
    xBAM.easeInOutSine
    xBAM.easeInQuad
    xBAM.easeOutQuad
    xBAM.easeInOutQuad
    xBAM.easeInCubic
    xBAM.easeOutCubic
    xBAM.easeInOutCubic
    xBAM.easeInQuart
    xBAM.easeOutQuart
    xBAM.easeInOutQuart
    xBAM.easeInQuint
    xBAM.easeOutQuint
    xBAM.easeInOutQuint
    xBAM.easeInExpo
    xBAM.easeOutExpo
    xBAM.easeInOutExpo
    xBAM.easeInCirc
    xBAM.easeOutCirc
    xBAM.easeInOutCirc
    xBAM.easeInBack
    xBAM.easeOutBack
    xBAM.easeInOutBack
    xBAM.easeInElastic
    xBAM.easeOutElastic
    xBAM.easeInOutElastic
    xBAM.easeInBounce
    xBAM.easeOutBounce
    xBAM.easeInOutBounce

    xBAM.orderXYZ
    xBAM.orderXZY
    xBAM.orderYXZ
    xBAM.orderYZX
    xBAM.orderZXY
    xBAM.orderZYX

    xBAM.RESET
    xBAM.ASAP
    xBAM.APPEND

    --------------------------------------------
    BallInfo (from xBAM.Ball or xBAM.BallCloseTo)
    .Position
    .x
    .y
    .z
    .PositionGlobal
    .x
    .y
    .z
    .Velocity
    .x
    .y
    .z
    .Speed
    .HitSpeed
    .Exist
    .ExtInt1 (can be SET or READ)
    .ExtInt2 (can be SET or READ)
    .ExtInt3 (can be SET or READ)
    .ExtFloat1 (can be SET or READ)
    .ExtFloat2 (can be SET or READ)
    .ExtFloat3 (can be SET or READ)
    .Id (READ only)
    .Name (can be SET or READ)
    .UpdateBall Red, Green, Blue, DirtTexture, ReflectionTexturem, ReflectionInPlayfield
    .Opacity (only SET)
    .SetBallOpacityWithEasing opacity, time, easingFunction
    .ExtTimer1 (READ only)
    .ExtTimer2 (READ only)
    .ExtTimer3 (READ only)
    .ResetExtTimer idx (idx = 1, 2, 3)
    .StopExtTimer idx (idx = 1, 2, 3)

    ---------------------------------------------
    BallCreationInfo (from xBAM.BallManager.CreateCustomBall)
    .Red (read only)
    .Green (read only)
    .Blue (read only)
    .BallNumer (read only)
    .Opacity (can be SET and READ)
    ---------------------------------------------
    Transformation (from xBAM.BallManager.CreateTransformation)
    .AddRule sourceBall, DestinationBall
    .Update ballID
    ---------------------------------------------
    MiniPlayfield (from xBAM.CreateMiniPlayfield)
    .Position
    .x
    .y
    .z
    .Rotation
    .x
    .y
    .z
    .Scale
    .Time
    .MoveTo x, y, z, rotX, rotY, rotZ, scale, time
    .Easing (set only)
    .EasingPosition (set only)
    .EasingRotation (set only)
    .EasingScale (set only)
    .TargetPosition
    .x
    .y
    .z
    .TargetRotation
    .x
    .y
    .z
    .TargetScale
    .CurrentPosition
    .x
    .y
    .z
    .CurrentRotation
    .x
    .y
    .z
    .CurrentScale
    .RotationOrder
    .TrackedBall (can be SET and READ, BallInfo)
    .TrackedBallExist
    .TrackedBallStop
    .Inertia
    .TraceBallRotation
    .GravityAngle
    .GravityRotation
    .GravityScale
    .SetGravity angle, rotation, scale
    .Collidable
    .PhysicsMove
    .Update maxX, minY, maxY, minZ, maxZ, cenX, cenY, cenZ
    -------------------------------------------
    MagneticField (from xBAM.CreateMagneticField)
    .X
    .Y
    .Z
    .Strength
    .Range
    .SingleBall
    .Horizontal
    .MaxForce
    .MinZ
    --------------------------------------------
    ObjectInfo (from xBAM.FindObject) (everything read only)
    .Position
    .x
    .y
    .z
    .Rotation
    .x
    .y
    .z
    .Velocity
    .x
    .y
    .z
    .RotationSpeed
    .x
    .y
    .z
    .Exist
    .Material
    .lineardamping
    .angulardamping
    .Center
    .x
    .y
    .z
    --------------------------------------------
    Model (from xBAM.CreateModel)
    .Position
    .x
    .y
    .z
    .Rotation
    .x
    .y
    .z
    .Scale
    .x
    .y
    .z
    .Z2Y
    .Reflections
    .Mode
    .Anim StringAsAnimationDescription
    .Loop StringAsAnimationDescription
    .Frame start, end, loop
    .CurrentFrame
    .Speed
    .Kd
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Ks
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Ke
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Spe
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Rim
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Part partIndex (ret: ModelPart)
    .Visible
    .Height
    --------------------------------------------
    ModelPart (from Model.Part partIndex)
    .Kd
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Ks
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Ke
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Spe
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    .Rim
    .r (is same thing as .x)
    .g (.y)
    .b (.z)
    .a (.w)
    --------------------------------------------
    FlipperExt (from xBAM.Flipper)
    .Mass
    .Omega
    .ReleaseOmega
    .SetMaterial elasticCoef, softnessCoef, staticFriction, kineticFriction
    .Angle
    .ContactPoint
    .BallHSpeed
    .BallVSpeed
    .Hit
    .AngleDiff
    .IsSolenoidOn (READONLY)
    --------------------------------------------
    DispDMDExt (from xBAM.DispDMD)
    .SetMatrixColor red, green, blue
    .SetBackgroundMatrixColor red, green, blue
    .SetMatrixBaseColor red, green, blue
    .FullColorBackground (bool value: true/false, can be SET and READ)
    .Visible
    --------------------------------------------
    HudDMDExt (from xBAM.HudDMD)
    .SetMatrixColor red, green, blue
    .FullColorBackground (bool value: true/false, can be SET and READ)
    .SetBackgroundMatrixColor red, green, blue // probably don't work
    --------------------------------------------
    DispReelExt & IDispSegExt (created with xBAM.CreateAllExt from DispReel and DispSeg with added "Ext" at end of object name)
    .Visible (you can hide disp reel and disp seg with this)
    --------------------------------------------
    LightExt (created with xBAM.CreateAllExt from Bulbs, Flashers, image lights .... with added "Ext" at end of object name)
    .SetLitColor red, green, blue
    .SetUnliteColor red, green, blue
    .SetPosition x,y,z, glowStaysWithModel
    .GlowRadius
    .DetachLight
    .Brightness
    .GlowBrightness
    .SetGlowColor red, green, blue
    .isOnBackbox
    .X
    .Y
    .Z
    .SpotLight radius, angleZ, angleX, softEdge
    .SetAttenuation constant, linear, quadratic
    .EnableRayCastShadows
    --------------------------------------------
    Camera (from xBAM.Camera)
    .Mode
    .AspectRatio
    .ScriptControl
    .RequestForControl
    .DesktopSet eyeX, eyeY, eyeZ, atX, atY, atZ, fov, delay
    .DesktopRelease delay
    .DesktopSetLookAt eyeX, eyeY, eyeZ, atX, atY, atZ, fov, delay
    .DesktopSequenceBegin seqId
    .DesktopSequenceEnd
    .DesktopSequenceAddEntry eyeX, eyeY, eyeZ, atX, atY, atZ, fov, delay
    .DesktopSequencePlay seqId, loopFlag
    .CabinetSet tX, tY, tZ, sX, sY, sZ, rX, rY, rZ, delay
    .CabinetRelease delay
    .CabinetSequenceBegin seqId
    .CabinetSequenceEnd
    .CabinetSequenceAddEntry tX, tY, tZ, sX, sY, sZ, rX, rY, rZ, delay
    .CabinetSequencePlay seqId, loopFlag
    --------------------------------------------
    Lights (from xBAM.Lights)
    .EnableNewRenderer (bool value: true/false, can be SET and READ)
    .MainLightLock (bool value: true/false, can be SET and READ)
    .EnablePostprocessing (bool value: true/false, can be SET and READ)
    .SetMainLightPosition x, y, z
    .SetMainLightProperties size, diffuse, specular, ambient
    .SetMainLightAttenuation constant, linear, quadratic
    .SetOtherLightsAttenuation constant, linear, quadratic
    .SetPostprocessing contrast, brightness, gamma, saturation
    .SetPostprocessingForNewRenderer contrast, brightness, gamma, saturation, srcGamma, srcSpecular, outDiffuse, outSpecular, outSepecularColor
    .Backup
    .Restore
    .Brightness
    .GlowBrightness
    .LockGlowBrightness
    .LockFlasherBrightness
    .BallReflection
    .BallShininess
    .BallSpecular
    .BallBrightness
    --------------------------------------------
    Gif (from xBAM.LoadGif)
    .ReplaceTexture textureName
    .NumFrames - READONLY returns number of frames in gif
    .CurrentFrame
    .StepForward
    .UpdateInterval
    .Frame startFrame, endFRame, repeatFrame
    .Stop
    .RestoreTexture
    .SetTransparentColor red, green, blue
    .Solid
 
I think I may have used AI... try it and see if you get a error
Ah yes, I see. Yup probably just an error on the part of AI. xBam.BallID is available.
 
look above...
use an integer ballid(i)
Id is only a property get that returns an int:
HRESULT Id([out, retval] int* retval);
 
Id is only a property get that returns an int:
HRESULT Id([out, retval] int* retval);
hmmm i remember reading about ball id, i think it was in a create custom ball tutorial
where the ball id changes or something
 
hmmm i remember reading about ball id, i think it was in a create custom ball tutorial
where the ball id changes or something
as a get info.... where it stores it as a variable or is it a string... lol
 
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:
    SaixXemnas has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gege has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Fatmeatball has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    titomajo has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    daveseawater has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    rockin ray has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Citron68 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    hammerpower has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    max37170 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    OZZOLO has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    GG974 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    MSev has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    sghure has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    huik has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    ellitehaxor has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    KenF has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Mario1963 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    etherealmusic has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Snowstorm125 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    LBlackburn has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Ducati66 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    pinballgirlBR has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    arthab has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    bor74 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    ROCJR73 has left the room.
      Chat Bot Mibs Chat Bot Mibs: ROCJR73 has left the room.
      Back
      Top