The Dink Network

Midi Question

December 26th 2005, 11:57 AM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
I used playmidi("1.mid"); in a script, but when DInk leaves the screen will the midi changed to what is attached to the screen, so is there a way to make it not do that and just play the midi 'till its done or whatever?
December 26th 2005, 12:20 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Not really. You'd have to get rid of midi attached to the screen.

You'd probably be best off attaching a script to the screen that checks to see if 1.mid is running. If it isn't, have it play the midi that used to be attached to the screen.
December 26th 2005, 02:19 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
And, as far as I know, there is no way to check if a certain midi is running. There might be in 1.08, but I haven't tried it.
December 26th 2005, 02:35 PM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
I thought so too Striker, but I had to ask if maybe there was an easy way, allthough what you said is pretty easy too though

Thanks anyways all
December 26th 2005, 04:48 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Don't listen to the other folks. They'll be... taken care of

turn_midi_off() will disable the playing of midis when you enter a new screen.

turn_midi_on() will enable the playing of midis when you enter a new screen.

December 26th 2005, 05:13 PM
fairy.gif
Glennglenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
Weee, thank you mister red.
December 27th 2005, 12:03 AM
dinkdead.gif
millimeter
Peasant He/Him Canada
Millimeter is Wee-Lamm, Recording Artist. :-) 
Are you saying that turn_midi_off() will cause the check_midi(void) to return without loading a new midi, thus causing the currently playing midi to continue?

If this is the case, should we call turn_midi_on() in the base script of the new screen @ void main(void)?

mm.
December 27th 2005, 12:33 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I didn't check in the code to see if the command was actually working before, but...

Looking at the code, the check_midi function is called upon loading the screen, while the base script is executed when drawing the screen. So, setting turn_midi_on() in the base script would have absolutely no effect on that screen.

Just use turn_midi_on() when you want the next screen to play the midis used by screens.
December 27th 2005, 07:37 PM
dinkdead.gif
millimeter
Peasant He/Him Canada
Millimeter is Wee-Lamm, Recording Artist. :-) 
I think your original answer was right, and I am trying to prove to myself that I can read it in the code. so my guess is...

If we want a fresh midi to play on a new screen, we make sure that turn_midi_on() happens before we enter the screen. Then the fresh midi is started in the base script's main function.

If this is true then we shouldn't need to use turn_midi_on() or turn_midi_off(). We could simply test (&story perhaps) to see if we should start the base midi, or just allow the current one to continue.

e.g.
if (&story = 2)
{ ignore }
else
{ playmidi("insper.mid"); }

Perhaps turm_midi_off() prior to exiting screen 2 would keep it from starting a fresh midi, then we would have to turn_midi_on() prior to exiting to screen 3, if it had a base midi.

Fortunately if 2 screens have the same base_midi, it should simply continue playing rather than restarting the same one as per
if (nothing_playing).

If I am out to lunch, please lambaste me as it will help me learn.

tyia,
mm.
December 28th 2005, 09:07 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
You're eating Pizza for lunch? Again? Jeez

turn_midi_on() and turn_midi_off() are required if you assign midis to screens in the editor under certain circumstances. You can't control the playing of these assigned midis via script.

Let's say Dink is walking through a spooky forest, and there's a midi named 201.mid that sounds kind of spooky. So in Dinkedit or WinDinkedit, we'll set '201' as the midi number for all of the forest screens.

If Dink reaches the center of the forest, a giant evil toaster will awaken and start to chase Dink across screens. The spooky music that worked before doesn't work so well now... we want to play a high-action chase music midi (chase.mid). So we play that using playmidi("chase.mid");

But, dang, when Dink moves to another screen 201.mid starts to play. We don't want that.

So when we play chase.mid, we also issue the command turn_midi_off(), so 201.mid will not play unless we specifically tell it to. Once the toaster toasts Dink into another dimension, we'll issue the turn_midi_on() command so midis assigned to screens will play normally.

I hope that example explains things...

You could also use base scripts and playmidi commands to handle the playing of all midis (which is sort of what you were saying), but turn_midi_on() and turn_midi_off() would have no effect at all.
December 29th 2005, 10:51 PM
dinkdead.gif
millimeter
Peasant He/Him Canada
Millimeter is Wee-Lamm, Recording Artist. :-) 
Actually I was eating peanut butter with my bananas.

I think we were saying the same thing except you know what you are talking about, and I am only learning.

I should have admitted that turn_midi_[on|off] affects subsequent screens and not the current one.

The only point I am not clear on is where during the screen load does the midi get assigned?

Can we assign the base midi in dinkedit or do we only name the base script, then assign the midi when we write the script?

mm.
December 29th 2005, 11:06 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
A base midi can only be assigned in the editor.