Here is another tutorial for “Oldskool Demomaker” users out there. This time not a tutorial for an entire demo, but some general tips for creating your own multi-part demos with OSDM.
This tutorial was originally published in 2010 at the OSDM Support Wiki. I decided to re-post it at my blog, because the Wiki wasn’t always up and running, as much as my own site unfortunately. Anyway, consider this another backup, just in case hehe.
If your productions grow bigger and your script code longer, it makes sense to start structuring your code to keep things clean and organized and avoid headaches later on.
Here is how I usually structure the code for my own multi-part demos that are entirely controlled via OSDM Script.
The general idea behind this structure is to “split” your demo into multiple “mini demos” and keep them pretty much independent from each other. That makes it easy to add additional parts or to rearrange the order of your existing parts. There are typically some exceptions, like the music, which does not necessarily change with every part of the demo (although it could of course).
Each part starts with the display stopped, which allows the loading and initializing of the effects that you are going to use for the part without showing any artifacts on the screen visible for the viewer of your demo. Once everything is in place you enable the display to fade in your initial setup of the part. Then you do all the things that you want to do, like moving things around fade in or out sprites or activate effects that were not needed during part loading. Once done, you stop the display followed by a NOP = 1 to let it fade-out nicely. Then you clean up house and disable all the effects that you were using for the part. You do that for all the parts and it should not happen that effects from other demo parts interfere with the currently active one and it also keeps your script code organized and structured.
FPS = 60 ;Set the Frame Rate for the Demo PSH ;Update Effect Values ;(always good, I had some issues once where adding ;this command to the script solved it. ;Can't remember the exact details anymore though) CAL = MUSIC ;Start the Music ;LEA = MUSIC ;Enable, if you created an OMA archive with multiple tunes ;IDN = 0 ;Select the first tune in OMA archive STP = DISPLAY ;Stop the Display for a moment to avoid artifacts being ;displayed during initialization NOP = 1 ;Refresh the screen, You might use NOP = 0, but I had OSDM ;crash sometimes when I did it ;Initialize JSR = 1 ;Calls the routine that initializes all settings ;especially hidden sprites entirely, which can't be done ;via the OSDM interface ;I typically set the alpha to "1", but "1" is not making ;them entirely invisible ;Part 1 JSR = 2 ;Start a demo part ... ;add sub routines for each part of the demo ;Part X ;JSR = X ;Quit Demo via Scroll Text Ctrl Code ^Q1 JSR = 99 ;Quit the demo END ;End the Script Control ;------------------------------ ;Initialize LAB = 1 CAL = SPRITE ;Turn Sprite Effect On (make sure that it is also enabled ;in the "Main" settings screen in OSDM) LEA = SPRITE ;Activate Script Control for Sprite Effect IDN = 0 ;Select Sprite 1 MVA = 0 ;Set Alpha of Sprite to 0 (Invisible) IDN = 1 MVA = 0 IDN = 2 MVA = 0 IDN = 3 MVA = 0 IDN = 4 MVA = 0 IDN = 5 MVA = 0 IDN = 6 MVA = 0 IDN = 7 ;Select Sprite 8 MVA = 0 ;Set Alpha to 0 STP = SPRITE ;Stop Sprite Effect ;Stop Scroll Text 8 With Quit Ctrl Code CAL = SCROLL LEA = SCROLL IDN = 7 ;Select Scroll Text ID: 8 MVS = 0 ;Set Speed to 0 (Stop the Scroll Text) STP = SCROLL RTS ;------------------------------ ;Part 1 ;Example Demo Part LAB = 2 ;Initialize Effect CAL = SPRITE LEA = SPRITE IDN = 0 MVA = 254 ;Set desired Alpha Value of Sprite, 254 makes it Opaque CAL = MASK ;Enable other effects, such as the MASK Effect ;Fade in the Display CAL = DISPLAY NOP = 1 ;NOP = 1 makes sure that the screen is faded in nicely ;Make sure that you enabled "Allow to fade display in and out" ;in the "Display" Tab in OSDM ... ;Do whatever you want to do ;Fade Out STP = DISPLAY ;Let the Screen Fade out again NOP = 1 ;Clean Up LEA = SPRITE ;Hide the Sprite and Stop all Effects that were enabled ;for this Demo part IDN = 0 MVA = 0 STP = SPRITE STP = MASK RTS ;-------------------------- ;Quit Demo (" ^P3^Q1" Code in Scroll Text) LAB = 99 CAL = DISPLAY ;Enable Display to prevent crash during Quit NOP = 1 CAL = SCROLL ;Enable Scroll Effect LEA = SCROLL ;Enable Script Control for Scroll Text IDN = 7 ;Select Scroll Text ID: 8 MVS = -5 ;Set Speed to scroll forward (remember, it was stopped via ;the 'Initialize' Routine earlier) NOP = 3 ;Wait .. Demo will quit shortly and disable everything RTS
This Tutorial was originally posted at the OSDM Wiki at forums.deltaforceteam.de.
For more OSDM resources, tutorials, demos, intros and downloads, check out the OSDM Section at my web site.
Carsten aka Roy/SAC