Jump to content



Photo
- - - - -

dmd bsic script?


  • Please log in to reply
12 replies to this topic

#1 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 02 November 2010 - 11:19 PM

hi guys,

i work on a new table, and i hope someone have a kind of basic dmd script for me,
that shows the score.

thx in advance
lox smile.gif
if you not a part of the solution ure a part of the problem;)

#2 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 03 November 2010 - 05:21 PM

HudDmd is your DMD object, then:

Object oriented solution:

CODE
' initialization code (put it as global code)
Dim TDmd     ' class object handler
Set TDmd = new Dmd    ' create object instance


TDmd.AddScore(10000)    ' call from anywhere
TDmd.AddScore(555)


Class Dmd
    Dim score    ' score amount
    
    Sub Class_Initialize()    ' called when object is created
        ResetScore()    ' reset score to 0 at the beginning
    End Sub

    Sub ResetScore()    ' reset score for new game, f.e. inside ResetForNewGame() routine
        score = 0
        ShowScore()
    End Sub

    Sub AddScore(amount)    ' add amount of score
        score = score + amount
        ShowScore()
    End Sub

    Sub ShowScore()    ' display current amount of score (AddScore calls it as well)
        HudDmd.Text = "[f1][xc][yc]" & CStr(score)
    End Sub
End Class



Classic solution:

CODE
ResetScore() ' reset score for new game, f.e. inside ResetForNewGame() routine
AddScore(10000)    ' call from anywhere
AddScore(555)


Dim score    ' score amount
Sub ResetScore()    ' reset score for new game, f.e. inside ResetForNewGame() routine
    score = 0
    ShowScore()
End Sub

Sub AddScore(amount)    ' add amount of score
    score = score + amount
    ShowScore()
End Sub

Sub ShowScore()    ' display current amount of score (AddScore calls it as well)
    HudDmd.Text = "[f1][xc][yc]" & CStr(score)
End Sub

Edited by Sebek74, 04 November 2010 - 08:45 AM.

Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#3 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 03 November 2010 - 10:07 PM

thx for help sebek,
that works:)
first table so i had my problems smile.gif
in some tables is see some graphics in the dmd, how can i get these in the dmd?
i try to create a image list with a picture, and activate this with

hud.AddImageList 1, "imagelist1" but nothing happens...

need the pictures a special size or what do i wrong;)
can you help me again?
thx in advance

cheers lox
if you not a part of the solution ure a part of the problem;)

#4 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 04 November 2010 - 08:44 AM

QUOTE (loxagon1 @ Nov 4 2010, 01:07 AM) <{POST_SNAPBACK}>
thx for help sebek,
that works:)
first table so i had my problems smile.gif
in some tables is see some graphics in the dmd, how can i get these in the dmd?
i try to create a image list with a picture, and activate this with

hud.AddImageList 1, "imagelist1" but nothing happens...

need the pictures a special size or what do i wrong;)
can you help me again?
thx in advance

cheers lox


I suggest you reading DMD section in manual. AddImageList just assigns images to DMD, the same way you add fonts by AddFont. If you add font, nothing is still displayed, right? smile.gif
So... if you know now how to display anything by Dmd.Text routine it's time to get knowledge about displayed text syntax.
Sample: to display one image frame added as image list number 1 you need to execute:

CODE
HudDmd.Text = "[il1][sf1]"

Now if you want to display that image together with score, you need to join both information about image & score:
CODE
HudDmd.Text = "[il1][sf1][f1][xc][yc]" & CStr(score)

Clear so far? Ok.... if you have several frames of animation (let assume there is 10 of frames), and you want to change the frame every 100ms, the code is:
CODE
HudDmd.Text = "[il1][as100][sf1][ef10][f1][xc][yc]" & CStr(score)

I'm sure it works.. but animation is displayed only once! Do you wish to play it all the time? Here is the code:
CODE
HudDmd.Text = "[il1][as100][sf1][ef10][rf1][f1][xc][yc]" & CStr(score)

Ok... it looks nice, but every score change animation starts from first frame. To avoid this you need to start animation only once, and don't alter it when score changes. Here is the altered code from previous post:
CODE
Dim score    ' score amount
Sub ResetScore()    ' reset score for new game, f.e. inside ResetForNewGame() routine
    score = 0
     HudDmd.Text = "[il1][as100][sf1][ef10][rf1][f1][xc][yc]" & CStr(score)
End Sub

Sub AddScore(amount)    ' add amount of score
    score = score + amount
    ShowScore()
End Sub

Sub ShowScore()    ' display current amount of score (AddScore calls it as well)
    HudDmd.Text = "[f1][xc][yc]" & CStr(score)
End Sub

Edited by Sebek74, 04 November 2010 - 08:46 AM.

Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#5 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 05 November 2010 - 01:02 PM

hehe your right, nothing happens smile.gif)

ok i read the dmd section again and with your coding advice, i hope it will works:))

thank you again, it was very helpfully for me smile.gif

cheers lox

ps. if the dmd work, i will post again here:), the start queue work already:)

if you not a part of the solution ure a part of the problem;)

#6 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 05 November 2010 - 05:54 PM

QUOTE (loxagon1 @ Nov 5 2010, 04:02 PM) <{POST_SNAPBACK}>
hehe your right, nothing happens smile.gif)

ok i read the dmd section again and with your coding advice, i hope it will works:))

thank you again, it was very helpfully for me smile.gif

cheers lox

ps. if the dmd work, i will post again here:), the start queue work already:)


You are welcomed. During last 1.5 years I played with tons of DMD solutions/issues. Some coders avoid using DMD, dealing with multiple overlays or Seg & overlay combination. I believe DMD (even with it's limitation) is great solution - especially for recreation of original pc & real tables.
I will try to help as much as I can if you want to continue your "DMD journey".
Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#7 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 24 November 2010 - 04:30 PM

hi again,

i try out a lot of things with the dmd,
and i use now a normal dispdmd on backclass, i have a cabinet and its looks good. i think:P
my problem now, i try out some things to create a animation on a huddmd and this is definitly too big for me at this time.
sebek sorry but im not fit enough to handle this..with the regular dmd, i can create some queues and text passages for events..but i hope you can help me again
is it possible to insert a picture in the dmd?
by playing the table and a event is finished, we work now to play a sound and show a picture, like a comet or so, on the dmd to give the table more life,
and have a better feeling when someone playing the pinball.
it is our first table, my friend script the main parts and i designed the playfield, backglass, sample some sounds and script the dmd. the knowledge is limited, but we will spend a lot of time in little details and things, to make everything "rounder". i play in my youth a lot of pinballs, and a good sound and dmd is important "for me".

ok enough history talking, hope i hear something helpfully from you or someone else:)

best regards

lox

if you not a part of the solution ure a part of the problem;)

#8 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 24 November 2010 - 10:37 PM

For good quality animations I follow font animation idea. Nice samples with easy code are presented by highrise. Check the thread "Real DMD animations". I can respond any detailed question you ask.
Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#9 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 25 November 2010 - 01:31 PM

QUOTE (Sebek74 @ Nov 24 2010, 11:37 PM) <{POST_SNAPBACK}>
For good quality animations I follow font animation idea. Nice samples with easy code are presented by highrise. Check the thread "Real DMD animations". I can respond any detailed question you ask.



ok, i found the thread, and youre right, there awesome.that would be nice at our table wink.gif.
so i read the fp manual again, the section about the dmd font editor. it try out a animation series. 20 pics
if i insert the font in the script on dispdmd1, the dmd shows my animation too fast and not on full dmd, just in the middle. ok i know why its just show in the middle, i pick the size in the dmd font editor, 32x32, but is the largest that is avaible........
can u explain me a little more detailled what this script exactly do, please? wink.gif. i mean i see the result, but if i create my own, i must understand the code;) sorry again for my simple questions...but i will really understand this stuff.

this is the test script from highrise.

Sub FuturePinball_BeginPlay()
LookAtBackbox()

DispDmd1.AddFont 1, "judgedeathanim"
DispDmd2.AddFont 1, "judgedeathanim"

DispDmd1.AddFont 2, "sstiff"
DispDmd2.AddFont 2, "sstiff"

DispDmd1.AddFont 3, "tales"
DispDmd2.AddFont 3, "tales"

DispDmd1.AddFont 4, "cv1"
DispDmd2.AddFont 4, "cv1"

DispDmd1.AddFont 5, "cv2"
DispDmd2.AddFont 5, "cv2"

DispDmd1.AddFont 6, "dmdtest"
End Sub

dim ii,dmdstring,thisfont

ii=0:thisfont=1

Timer1.set true,100

Sub Timer1_expired()


dmdstring="[na][f"+cstr(thisfont)+"]"+chr(32+ii)+chr(33+ii)+chr(34+ii)+chr(35+ii)+"[f"+cstr(thisfont)+"]"
DispDmd2.Text=dmdstring
DispDmd1.Text=dmdstring

ii=ii+4
if ii=92 then
ii=0
thisfont=thisfont+1

if thisfont=6 then thisfont=1

end if

Timer1.set true,100

End sub

if you not a part of the solution ure a part of the problem;)

#10 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 25 November 2010 - 09:06 PM

The script is quite simple. It displays text (in fact one character) in specified interval of time.
QUOTE (loxagon1 @ Nov 25 2010, 04:31 PM) <{POST_SNAPBACK}>
the dmd shows my animation too fast
The clue is here: Timer1.set true,100
The timer elapse function is called every 100ms. You can make it slower by raising value from 100 to higher one. You can even change the value to change the intervals every frame (f.e to slow animation very frame).
QUOTE (loxagon1 @ Nov 25 2010, 04:31 PM) <{POST_SNAPBACK}>
dmd, just in the middle
That's because your dmd alignment is set do center. Two solutions:
1. set alignment to left or right
2. specify text position by adding [x0] to the displayed string:
CODE
dmdstring="[na][f"+cstr(thisfont)+"][x0]"+chr(32+ii)+chr(33+ii)+chr(34+ii)+chr(35+ii)+"[f"+cstr(thisfont)+"]"

QUOTE (loxagon1 @ Nov 25 2010, 04:31 PM) <{POST_SNAPBACK}>
i pick the size in the dmd font editor, 32x32, but is the largest that is avaible

The 32x32 size is maximum allowed size for editor, but not for FP itself. HR discovered the "hack" that FP accepts larged fonts (created with another tool).
QUOTE (loxagon1 @ Nov 25 2010, 04:31 PM) <{POST_SNAPBACK}>
can u explain me a little more detailled what this script exactly do, please? wink.gif. i mean i see the result, but if i create my own, i must understand the code;) sorry again for my simple questions...but i will really understand this stuff.

Ok... watch the comments:
CODE
Sub FuturePinball_BeginPlay()    ' executed at the beginning
    LookAtBackbox()     ' set the view (not important for now)

    ' HR loaded 6 custom created fonts into FP table
    DispDmd1.AddFont 1, "judgedeathanim"    ' assign font nr 1 for first dmd (translite)
    DispDmd2.AddFont 1, "judgedeathanim" ' assign font nr 1 for second dmd (hud) - for each dmd fonts need to be assigned separately

    DispDmd1.AddFont 2, "sstiff" ' assigning second font
    DispDmd2.AddFont 2, "sstiff"

    DispDmd1.AddFont 3, "tales"
    DispDmd2.AddFont 3, "tales"

    DispDmd1.AddFont 4, "cv1"
    DispDmd2.AddFont 4, "cv1"

    DispDmd1.AddFont 5, "cv2"
    DispDmd2.AddFont 5, "cv2"

        DispDmd1.AddFont 6, "dmdtest"        ' it's not used becasue only 5 fonts are used
End Sub

dim ii,dmdstring,thisfont

ii=0:thisfont=1    ' to see another animation font set thisfont to 2, 3... 5

Timer1.set true,100    ' setting first call time

Sub Timer1_expired()    ' timer expiration routine


dmdstring="[na][f"+cstr(thisfont)+"]"+chr(32+ii)+chr(33+ii)+chr(34+ii)+chr(35+ii)+"[f"+cstr(thisfont)+"]"

' "[na]  - cancels image animation (not needed becasue we dont use it here any
' [f"+cstr(thisfont)+"]" - select font 1, 2.. or 5
' chr(32+ii) - display first character in font table (which is redefined space with ascii code 32
' chr(33+ii)+chr(34+ii)+chr(35+ii) ' display next 3 characters
'"[f"+cstr(thisfont)+"]"    ' assign font again - not needed

    DispDmd2.Text=dmdstring    ' display string on first dmd
    DispDmd1.Text=dmdstring ' display string on second dmd

ii=ii+4            ' text uses 4 characters so raise index by 4
if ii=92 then     ' 92/4 frames only, so start again
ii=0
thisfont=thisfont+1    ' select next font if animation completed

if thisfont=6 then thisfont=1    ' only 5 fonts, so set to first one again

end if

Timer1.set true,100    ' set timer interval again

End sub


Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#11 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 26 November 2010 - 10:06 AM

thx a lot man, very helpful:)
i checked out that the first timer is for start the sequence and the last for the frames, that works:)
but i must do something wrong. with the font editor i create 20 pics to let a rocket start from down to up.
every pic the rocket a little bit higher. if i display that in the dmd, he get my 32x32 size and put 4 pics side to side.
i think the problem is, that the animation goes from left to right side of the dmd , right?
is it possible to change them from down to up?
or is it better i create animation with another tool, u wrote it gives another that support the full size of the dmd.

hm ok when i think a little, is it possible to create the animation from down to up. i must take 4 pics at once, and create animation every 4 pics....
i will test it:)

if you not a part of the solution ure a part of the problem;)

#12 Sebek74

Sebek74

    Enthusiast

  • Members
  • PipPipPip
  • 114 posts
  • Location:Lodz, Poland

  • Flag: Poland

  • Favorite Pinball: Pinball Dreams: Ignition

Posted 26 November 2010 - 11:49 AM

QUOTE (loxagon1 @ Nov 26 2010, 01:06 PM) <{POST_SNAPBACK}>
thx a lot man, very helpful:)
i checked out that the first timer is for start the sequence and the last for the frames, that works:)
but i must do something wrong. with the font editor i create 20 pics to let a rocket start from down to up.
every pic the rocket a little bit higher. if i display that in the dmd, he get my 32x32 size and put 4 pics side to side.
i think the problem is, that the animation goes from left to right side of the dmd , right?
is it possible to change them from down to up?
or is it better i create animation with another tool, u wrote it gives another that support the full size of the dmd.

hm ok when i think a little, is it possible to create the animation from down to up. i must take 4 pics at once, and create animation every 4 pics....
i will test it:)


Can you send me a table? I will look at this. You will find e-mail at my homepage.

Edited by Sebek74, 26 November 2010 - 11:49 AM.

Sebek74
Visit http://futurepinball.mm.com.pl/ for my tables download: Ignition, Beat-Box, Nightmare, Billion Dollar Gameshow, Wild West
http://futurepinball...om.pl/Gfx2DmdF/ for Gfx2DmdF font conversion
http://picasaweb.google.com/sebek74 - personal photo gallery

#13 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 26 November 2010 - 04:35 PM

QUOTE (Sebek74 @ Nov 26 2010, 12:49 PM) <{POST_SNAPBACK}>
QUOTE (loxagon1 @ Nov 26 2010, 01:06 PM) <{POST_SNAPBACK}>
thx a lot man, very helpful:)
i checked out that the first timer is for start the sequence and the last for the frames, that works:)
but i must do something wrong. with the font editor i create 20 pics to let a rocket start from down to up.
every pic the rocket a little bit higher. if i display that in the dmd, he get my 32x32 size and put 4 pics side to side.
i think the problem is, that the animation goes from left to right side of the dmd , right?
is it possible to change them from down to up?
or is it better i create animation with another tool, u wrote it gives another that support the full size of the dmd.

hm ok when i think a little, is it possible to create the animation from down to up. i must take 4 pics at once, and create animation every 4 pics....
i will test it:)


Can you send me a table? I will look at this. You will find e-mail at my homepage.



when i click on your name and information, there is only the option to send you a mail over vp.
my mail is ..., send me a test mail and i will send you the table:)

Edited by loxagon1, 29 November 2010 - 04:08 PM.

if you not a part of the solution ure a part of the problem;)