BAM Two Methods of Swapping Textures Using BAM Code

GeorgeH

Flippered Out
Site Supporters
Joined
May 3, 2016
Messages
3,025
Solutions
7
Reaction score
2,418
Points
145
Favorite Pinball Machine
Attack From Mars
The purpose of this tutorial is to capture comments about 2 ways of swapping texture on table objects so it is not lost.

1) The method at the following link works well but requires that table objects have a name that can be used in the script. It can't be used on ramps or other unnamed objects.


2) This method can be used on objects that don't have a name. It does exhibit some odd behavior on FP models that use an invisible texture.

This method replaces all textures used on the table that have the same texture name as the code in the red text below. The texture is replaced with the name of the texture in blue below. It requires adding the code in green. If you don't want to have all the objects on the table use the texture with the name in red below, you can make another copy of the texture with a different name and upload to the table and use it on the objects you want to change.

It works perfectly except when attempting to replace a texture on a model with a FPM file extension and use an invisible texture. For some reason, you must have the "Reflects off playfield" option checked for it to work. Oddly, the "Reflects off playfield" option does not need to be checked on other table objects except FP models. If you can't live with the "Reflects off playfield" option checked, then you can change the FP model unnamed model to a named object like a toy and use the code from the first option above.

===========================================
Dim PuP_Plug_Tex
Set PuP_Plug_Tex = xBAM.Get("PuPPlugin")

If PuP_Plug_Tex Is Nothing Then AddDebugText "PuP Plugin is missing"

' swap ramp texture with new texture

PuP_Plug_Tex.ReplaceTexture PuP_Plug_Tex.GetTextureId("ramp_texture"), PuP_Plug_Tex.GetTextureId("ramp_texture_2")

' swap ramp texture back to original texture

PuP_Plug_Tex.ReplaceTexture PuP_Plug_Tex.GetTextureId("ramp_texture"), PuP_Plug_Tex.GetTextureId("ramp_texture")
===========================================

This method is described in depth on this link:

 
You have to create an image list with ramp texture and ramp texture.
 
You have to create an image list with ramp texture and ramp texture.

Aye! That is true about both methods. You may not need to add the first texture to an image list if it is used on the ramp.

For sure though, it is easy to forget to add textures to an image list that are not used on the table. For those of you that don't know, FP does not load textures that are not used on the table so you add the textures to an image list to force FP to load the texture so the name of the texture can be used in the BAM coding. On Gimli's tutorial, he says to add the textures to invisible surfaces but adding them to an image list is easier.

FP does load all DMD fonts and audio listed on the font and audio (sound and music) managers. I have encountered many tables where the authors have just abandoned audio which does get loaded. I have found some tables with as much as 30MB of unused audio which will affect table loading time, even on today's PCs.
 
It's normal. FP allows you to delete unused textures and models and not musics or sounds.
PlaySound Text. So you can write PlaySound "Sound" &nvBallsPerGame &CurrentPlayer, so FP can't know what is really used.
 
It's normal. FP allows you to delete unused textures and models and not musics or sounds.
PlaySound Text. So you can write PlaySound "Sound" &nvBallsPerGame &CurrentPlayer, so FP can't know what is really used.

That is true. It is odd how many table developers abandon so much audio. It makes me wonder if they realize that FP loads all of what they add.
 
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:
    Cattlesnake has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    AchillesK has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    emanoel299 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Bwolf122 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    thE fluiD musics lab. has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    denisman has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    odanny has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Rayman1103 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Vergin with Gerbil has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    pavement has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    AnyNameYouWish has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    NIPOGI has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    blackrose989 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    GeorgeH has joined the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Cheech93 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    MedievilMadness has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Pinbalbilly has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    flipjuice has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    apollo2000 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gmelo1 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    jose49 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    darcel has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    cocopops has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Nightvoice has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    drew1 has left the room.
      Chat Bot Mibs Chat Bot Mibs: drew1 has left the room.
      Back
      Top