Register    Login    Forum    FAQ    PinSimDB.org

Board index » Welcome to GoPinball » General Discussion




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Sun May 05, 2019 2:31 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2753
Location: Ontario, Canada
GeorgeH wrote:
You might send the code to Smoke. I don't think he likes entering duplicate code but he might go for this.

George


If I were to code a table from the beginning like the true table dev's , I would definitely use this code. It seems very simple.

There are 2 ways that we commonly add text to DMD's :

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1. We can add text to DMD's as single text line statement (not in a queue)
This is the so called "Simple Method"
From Fp manual:
<String> .Text = { "String to Display" } ** SIMPLE METHOD **

Here is an example from FP manual
Code:
MyDmd.Text = "SCORE " & FormatNumber(nvScore1, 0, -1, 0, -1)


The code example above only applies to one DMD named "MyDMD"

The monster bash code uses this to capture all DMD's:

Code:
Sub DMDSetText(pText)
   DispDmd1.Text = pText
        DispDmd2.Text = pText
   DispDmd3.Text = pText
End Sub


Using example above, Then in script you can simply do this:
Code:
DMDSetText  "SCORE " & FormatNumber(nvScore1, 0, -1, 0, -1)


This code above applies to all three DMD's


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
2. In a queue of successive lines of text. This allows coding a series of DMD frames, with
scrolling effects and timing settings...

From FP manual
.QueueText ( <String> Text, <Enumeration> Effect, <Integer> TimeOn, <Boolean> FlushQueue, <String> SoundEffect )


Example from FP manual:
Code:
MyDmd.QueueText "[edge2]SCROLL LEFT", deScrollLeft, 750, True
MyDmd.QueueText "[edge4]SCROLL LEFT OVER", deScrollLeftOver, 750, True


The code above only applies to one DMD named "MyDMD"

The monster bash code uses this to capture all DMD's:
Code:
Sub DMDQueueText(pText, pEffect, pTimeOn, pFlush)
   DispDmd1.QueueText pText, pEffect, pTimeOn, pFlush
   DispDmd2.QueueText pText, pEffect, pTimeOn, pFlush
   DispDmd3.QueueText pText, pEffect, pTimeOn, pFlush
End Sub


Using example above, Then in script you can simply do this:
Code:
 DMDQueueText "[edge2]SCROLL LEFT", deScrollLeft, 750, True
 DMDQueueText "[edge4]SCROLL LEFT OVER", deScrollLeftOver, 750, True


This code above applies to all three DMD's

Monster bash also had this variant of the Queue method, adding a sound clip to the queue
Code:
Sub DMDQueueTextWSound(pText, pEffect, pTimeOn, pFlush, pSound)
   DispDmd1.QueueText pText, pEffect, pTimeOn, pFlush, pSound
   DispDmd2.QueueText pText, pEffect, pTimeOn, pFlush
   DispDmd3.QueueText pText, pEffect, pTimeOn, pFlush
End Sub


Example
Code:
DMDQueueTextWSound "[edge2]SCROLL LEFT", deScrollLeft, 750, True, "bellsound"
 DMDQueueTextWSound "[edge4]SCROLL LEFT OVER", deScrollLeftOver, 750, True, "JackHammerSound"


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
3. Adding Fonts to DMDs

From FP Manual the synax is:
.AddFont ( <Integer> Slot, <Boolean> FontName )

Example from FP Manual:
Code:
MyDmd.AddFont 1, "dmd05x05p"
MyDmd.AddFont 2, "dmd06x07p"


Once again, this only applies to DMD Named "MyDMD"

The monster bash code uses this to capture all DMD's:
Code:
Sub DMDAddFont(pSlot, pName)
   DispDmd1.AddFont pSlot, pName
   DispDmd2.AddFont pSlot, pName
   DispDmd3.AddFont pSlot, pName
End Sub


Using example above, Then in script you can simply do this:

Code:
DMDAddFont 1, "dmd05x05p"
DMDAddFont 2, "dmd06x07p"


This code above applies to all three DMD's


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Now, if for some reason later we want to add a new DMD , and we name it
DispDmd4

We can simply add it to each of the above config routines and it will be implemented automatically during game play:
Code:
[code]Sub DMDSetText(pText)
   DispDmd1.Text = pText
        DispDmd2.Text = pText
   DispDmd3.Text = pText
       DispDmd4.Text = pText
End Sub[/code]


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Sun May 05, 2019 3:16 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
Interesting. It looks like you would still have to make lots of changes to the script of an existing table, but this looks like it might be easier if you were coding a table from scratch.

George


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Sun May 05, 2019 5:35 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2753
Location: Ontario, Canada
It's probably easier on all counts, as in existing tables you are simply pasting over top the existing DMD name not adding new lines of code


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Sun May 05, 2019 6:08 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
I think I am beginning to understand. To convert an existing table, you would add these 2 subroutines (for 3 DMDs):

Sub DMDQueueText(pText, pEffect, pTimeOn, pFlush)
DispDmd1.QueueText pText, pEffect, pTimeOn, pFlush
DispDmd2.QueueText pText, pEffect, pTimeOn, pFlush
DispDmd3.QueueText pText, pEffect, pTimeOn, pFlush
End Sub

Sub DMDSetText(pText)
DispDmd1.Text = pText
DispDmd2.Text = pText
DispDmd3.Text = pText
End Sub

Then you would have to replace all occurrences of the name of the DMD with DMDQueueText if the DMD is displaying text. If it displays fonts, then you would change the name the DMD to DMDSetText.

I am guessing that the DMD text has to have all 4 of the parameters defined (pText, pEffect, pTimeOn, pFlush) or there will be some sort of error.

Not too many tables use the pSound parameter. Funhouse used it though. I am sure it is only used for one DMD because you don't want the same sound to play more than once at the same time otherwise it would be too loud and distorted.

George


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Sun May 05, 2019 6:11 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2753
Location: Ontario, Canada
Yep and I would also use the addfont routine as this deals with not just text fonts but all the dmdfonts that give the animations


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Wed Jun 26, 2019 5:53 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
To my surprise, I managed to add this coding to a table with a single DMD that was named "DispDmd2". I made the initial mistake of replacing "DispDmd2.QueueText" with "DMDQueueText.QueueText". I should have replaced "DispDmd2.QueueText" with "DMDQueueText" and dropped the ".QueueText" at the end. As Gimli said, I needed to subroutine for the fonts.

I found I also needed this subroutine:

Sub FlushDMD()
Dispdmd1.FlushQueue
Dispdmd2.FlushQueue
End Sub

Then I performed a replace function in the script and replaced "DispDmd2.FlushQueue()" with "FlushDMD()"

I have to say that this is easier than the alternative which would be duplicating each line of code for the single DMD with the name of the second DMD.

If someone requests it, I may post a more prescriptive tutorial on how to do this.

George


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Thu Jul 04, 2019 6:49 pm 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
I tried saving this subroutine to a table:

Sub DMDSetText(pText)
DispDmd1.Text = pText
DispDmd2.Text = pText
DispDmd3.Text = pText
End Sub

I got a script error when I replaced "DispDmd1.text" with "DMDSetText" in the following script:

DispDmd1.text = "[f2][xc][y5]Light Setting " & nvR2 & "[f2][xc][y19]Night Mode"

I didn't get the error when I removed "nvR2". I guess having it display the value of something is not considered a "simple method" or maybe something like that.

George


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Fri Jul 05, 2019 3:14 am 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
OK my bad. The problem was not "nvR2" but was instead me leaving the equal sign.

The script error was produced when I changed this code:

DispDmd1.text = "[f2][xc][y5]Light Setting " & nvR2 & "[f2][xc][y19]Night Mode"

to look like this:

DMDSetText = "[f2][xc][y5]Light Setting " & nvR2 & "[f2][xc][y19]Night Mode"

when I should have changed the code to this:

DMDSetText "[f2][xc][y5]Light Setting " & nvR2 & "[f2][xc][y19]Night Mode"

No more script error!

George


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Fri Jul 05, 2019 7:55 am 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2753
Location: Ontario, Canada
Ya for some reason you don't need an equal sign...I noticed that as well in Monster Bash


Top 
 Profile  
 
 Post subject: Re: DMD ON BACKGLASS
 Post Posted: Fri Aug 02, 2019 11:52 am 
Offline

Joined: Thu Aug 16, 2012 11:12 pm
Posts: 2321
Location: Arkansas, USA
I have been modifying the Jurassic Park table. The original table has only one DMD and uses over 900 lines of code to drive the DMD. WOW! It would be a monumental task to add duplicate code for a second DMD using the old method. Slamt1lt added a second DMD on his version and it uses 200 lines of code. ...So it doesn't do everything the original does.

I ended up adding 3 additional DMDs using the new method so that the end user can switch between 3 different sizes of HUD DMDs with different overlays. To do this the old way, would require adding 2700 lines of code! Instead, I was able to do it using the replace function in the script and adding 10 short subroutines. I found it best to not just blindly use the replace all function but instead used the find command to look at each change before I replaced it. Even so, it only took about 45 minutes to do it all.

George


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2, 3  Next

Board index » Welcome to GoPinball » General Discussion


Who is online

Users browsing this forum: No registered users and 12 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: