Register    Login    Forum    FAQ    PinSimDB.org

Board index » Resources » Tutorials, how-to's, bug report and docs




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to Code More Than One DMD to a Table Easily
 Post Posted: Thu Apr 16, 2020 12:55 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2772
Location: Arkansas, USA
Some of the old tables only have one DMD in the script. The table developer would sometimes add a blank DMD and provide directions on how to swap between the two DMDs. You could either have a HUD DMD or a translite DMD but not both. The reason this was done is that DMDs used to be coded so that the same lines of code were duplicated for each DMD. Adding duplicate code for each DMD can be a long tedious process. This tutorial describes a different method. If updating a table, I describe how to use replace commands below to add more than one DMD to a table. If you are creating a new table, this method makes it so you only need to code the DMDs once and not have to repeat code for each DMD. Multiple DMDs can be added by just adding the name of the DMD to a few subroutines. I am a novice at coding so these directions should be able to be performed by anyone. I am assuming you are starting this process on a table that has one DMD named "DispDmd1". If your table has the DMD named something else, use that name instead of "DispDmd1".

If you want to add another DMD to a table that already has two DMDs, you will need to remark out one of the DMDs and then follow the guide below. The easiest way to remark out one DMD is to use the replace option in the script and replace the name of the DMD with the name of the DMD that has a single quote in front of it.

Search the script for:
DispDmd2

Replace with:
' DispDmd2

I would not use the "replace all" function because there may be special cases that you need to address. Script can be coded by using a colon that functions like a hard return or the start of a new line. For those lines where the name of a DMD comes after a colon, you can replace the colon with a hard return before you use the replace function.

The following steps are the replace operations you need to perform. The subroutine that I direct you to add only has two DMDs listed but you can add as many as you want. Just copy one of the existing lines and paste it to a new line and change the name of the DMD. If your search yields no results, then go on to the next step:

1a) Search the script for:
DispDmd1.text = or
DispDmd1.Text=

Replace with:
DMDSetText

1b) Add this subroutine:
Sub DMDSetText(pText)
DispDmd1.Text = pText
HudDmd1.Text = pText
End Sub


NOTE: Be sure there is a space after "DMDSetText" and the rest of the line of code.

2a) Search the script for:
DispDmd1.AddFont

Replace with:
DMDAddFont

2b) Add this subroutine:
Sub DMDAddFont(pSlot, pName)
DispDmd1.AddFont pSlot, pName
HudDmd1.AddFont pSlot, pName
End Sub


3a) The queue text code may have a sound that plays at the end of the line of code although it is not always used. The code that plays sound must be handled differently than code that does not. A sound can be identified as a name with double quotes before and after the name and appears red in color. The line of code that does not use sound ends with true or false.

Example of code with a sound at the end of the line of code:
DispDmd1.QueueText "[f11][y3][xc]TOTAL SCORE[F11][y18][XC]" & FormatNumber(nvScore(CurrentPlayer), 0, -1, 0, -1), deScrollIn, 2000, FALSE, "bonus"

Example of code with no sound:
DispDmd1.QueueText "[f4][xc][y12]WELCOME PLAYER " & PlayersPlayingGame, deNone, 1000, true

Search the script for:
DispDmd1.QueueText

Replace with:
DMDQueueText or
DMDQueueTextWSound

NOTE: If the line ends with true or false, then add "DMDQueueText" to the line. If the lines ends with a sound, then use "DMDQueueTextWSound".

3b) Add this subroutine:
Sub DMDQueueText(pText, pEffect, pTimeOn, pFlush)
DispDmd1.QueueText pText, pEffect, pTimeOn, pFlush
HudDmd1.QueueText pText, pEffect, pTimeOn, pFlush
End Sub


If "DMDQueueTextWSound" is used, then add this:

Sub DMDQueueTextWSound(pText, pEffect, pTimeOn, pFlush, pSound)
DispDmd1.QueueText pText, pEffect, pTimeOn, pFlush, pSound
HudDmd1.QueueText pText, pEffect, pTimeOn, pFlush, pSound
End Sub


4a) Search the script for:
DispDmd1.FlushQueue() or
DispDmd1.FlushQueue

Replace with:
DMDFlushQueue

4b) Add this subroutine:
Sub DMDFlushQueue()
Dispdmd1.FlushQueue
HudDmd1.FlushQueue
End Sub


5a) Search the script for:
DispDmd1.FlushAnimation() or
DispDmd1.FlushAnimation

Replace with:
DMDFlushAnimation

5b) Add this subroutine:
Sub DMDFlushAnimation()
Dispdmd1.FlushAnimation
HudDmd1.FlushAnimation
End Sub


6a) Search the script for:
DispDmd1.UpdateInterval = or
DispDmd1.UpdateInterval=

Replace with:
DMDUpdateInterval

NOTE: Be sure there is a space after "DMDUpdateInterval" and the rest of the line of code.

6b) Add this subroutine:
Sub DMDUpdateInterval(pInterval)
Dispdmd1.UpdateInterval = pInterval
HudDmd1.UpdateInterval = pInterval
End Sub


After performing the above replacements, perform another search for the name of the DMD. You should only find hits in the subroutines that you added. The exception is coding for the HUD. Don't change DMDs set to FadeIn and FadeOut commands that are used for the HUD because each DMD needs to be coded differently.

You may rarely but occasionally encounter a few additional subroutines that you need to add. The ones identified above are the main ones. Jurassic Park uses a function called DMD FastBlinkSpeed but I didn't add it to the guide because it is almost never used. You can use the method similar to steps 1 and 6 above for FastBlinkSpeed. Gimli wrote a guide that uses a conceptual approach to doing this that might help and is available here:

viewtopic.php?f=15&t=10214&start=10

There is a subroutine that runs on DMDs that is used very rarely also. Just repeat the subroutine for each DMD. This can be used to run sequences during the attract mode (as it does on "Tales of the Arabian Nights"). This is an example:

Sub DispDmd1_Empty()
DMDrun()
End Sub


If you add more than one HUD DMD, you can switch between them while playing the table by setting up the HUD toggle key. My mods of "Tales of the Arabian Nights" and "Jurassic Park" tables use this code. You can open the script on these tables and search for "HUD Toggle Mod Start" to find examples. There are 3 occurrences of "HUD Toggle Mod Start" so be sure to find all 3. I included comments in the script on how to set up this code. If you have never seen the nvR1, nvR2, nvR3... to nvR16 code before, it saves the setting to the fpRam file so that when you play the table it loads the setting that you used last. You will need to search the script of your table to see if the code is being used elsewhere in the script. Use a number that is not currently being used.

The Jurassic Park table uses over 900 lines of code to drive one DMD. It would be a monumental task to add duplicate code for a second DMD using the old method. It only took about 45 minutes to do it using the method in this guide. If you have questions, feel free to ask.

Tales of the Arabian Nights:
http://www.pinsimdb.org/pinball/table-2 ... ian_nights

Jurassic Park:
http://www.pinsimdb.org/pinball/table-2 ... mt1lt_mods

George


Top 
 Profile  
 
 Post subject: Re: How to Code More Than One DMD to a Table Easily
 Post Posted: Thu Apr 16, 2020 4:30 pm 
Offline
User avatar

Joined: Thu Jul 01, 2010 3:02 pm
Posts: 340
Thanks for the tips George!

-mark


Top 
 Profile  
 
 Post subject: Re: How to Code More Than One DMD to a Table Easily
 Post Posted: Thu Apr 16, 2020 9:13 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2772
Location: Arkansas, USA
Mark,

You are welcome! When I was working on TOTAN, I discovered I didn't remember how to do this so I wrote a guide for myself. Then, I decided I would share it with everyone. It really saves a lot of time after you figure it out.

George


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 3 posts ] 

Board index » Resources » Tutorials, how-to's, bug report and docs


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: