[directmusic] Re: Script Weirdness II

  • From: "Scott Morgan" <scott@xxxxxxxxxxxxxxxxx>
  • To: <directmusic@xxxxxxxxxxxxx>
  • Date: Mon, 27 Jan 2003 05:01:53 -0800

I typically use AudioVB just cause its smaller.

There are a ton of fancy things you can do with VB that the Audio VB can't
do, but mostly you can get by without.

The things I miss most from VB is the laxer syntax, for next, switch
statements, and exit sub statements.

In VB you can get away with:

sub VBExample
    if x=4 then segment1.play: segment2.play issecondary   'commands are on
the same line as the if seperated by a colon
       end if
    if x=5 then exit sub                              'exit sub leaves the
sub...can't do that in AudioVB
    Segment10.play
end sub

For next is kind of rare to use in music routines, but there are times when
I've wished I've had it.  I've always been able to get by with a crazy set
of 'ifs' though.
Oh that reminds, I don't think Audio VB supports arrays.  Arrays can hold
lots of good info if you need complex data.
Switch statements are cleaner sometimes than 'if' but aren't necessary.

Ice_Planet (VB) uses the 'abs' function for some calculations.  I can't
remember why I did that though.

Ice_Planet and GlobalConflict were both VB since the old Audioscripts sample
required VB for the passing of the text to the app's main window (variant
data or something).

There are lots of other things, but they get more and more less useful for
music scripts.

-Scott Morgan
http://Morganstudios.com


----- Original Message -----
From: "Ciaran Walsh" <ciaran@xxxxxxxxxxxxxx>
To: <directmusic@xxxxxxxxxxxxx>
Sent: Monday, January 27, 2003 4:31 AM
Subject: [directmusic] Re: Script Weirdness II


>
> I'm glad I could be of some help, even if it was in the most oblique
fashion
> ;)
>
> your point about VB vs. AudioVB raises something I've often wondered but
> never found the time to investigate properly...
>
> What is it that you can do with VB script that you can't do with AudioVB?
(I
> have never done any VB programming so forgive my ignorance) As I
understand
> it, AudioVB is a stripped down version of VB so presumably there is some
> trade off in terms of functionality.
>
> What is the difference in performance between the two?
> Any points of view on the pros and cons of each would be most welcome,
> Cheers,
> Ciaran
>
> -----Original Message-----
> From: directmusic-bounce@xxxxxxxxxxxxx
> [mailto:directmusic-bounce@xxxxxxxxxxxxx]On Behalf Of Kenneth Young
> Sent: 27 January 2003 12:31
> To: directmusic@xxxxxxxxxxxxx
> Subject: [directmusic] Re: Script Weirdness II
>
>
> Thanks Ciaran,
>
> I created a simple demo with which to prove you wrong (or so I thought),
but
> everything worked as expected!
>
> Then I realised what I had done wrong; I had a VB Script passing a
variable
> to an AudioVB script (doh!). The two of them don't seem to communicate
> properly.
>
> Changing all my scripts to VBScript solves the problem.
>
> Cheers,
>
> Kenny
>
> ----- Original Message -----
> From: "Ciaran Walsh" <ciaran@xxxxxxxxxxxxxx>
> To: <directmusic@xxxxxxxxxxxxx>
> Sent: Monday, January 27, 2003 11:30 AM
> Subject: [directmusic] Re: Script Weirdness II
>
>
> >
> > I had to break up my scripts into about 5 components in my last project,
> one
> > master script and various sub scripts dedicated to specific areas of
> > functionality. I was able to set a variable in one script from a routine
> in
> > another, prefixing the target script name to the variable name, as you
> would
> > to call a routine, thus:
> >
> >
> > sub Init
> > Def = 0
> > PLevel = 0
> > SLevel = 0
> > Stopped = 1
> > Internal.X = 0
> > Internal.FT = 0
> > Internal.PTrans = 0
> > DScript.DStatus = 0
> > DScript.DFuse = 0
> > DScript.Seen = 0
> > SScript.SStatus = 0
> > Internal.CMode = 0
> > Grooves.GL = 0
> > SetMasterGrooveLevel Grooves.GL
> > SetMasterVolume 0
> > end sub
> >
> > was an initialisation routine in my main script that set the initial
> values
> > of variables in 4 other scripts.
> >
> > I hope that's helpful,
> > Ciaran
> >
> > -----Original Message-----
> > From: directmusic-bounce@xxxxxxxxxxxxx
> > [mailto:directmusic-bounce@xxxxxxxxxxxxx]On Behalf Of Kenneth Young
> > Sent: 25 January 2003 23:37
> > To: directmusic@xxxxxxxxxxxxx
> > Subject: [directmusic] Script Weirdness II
> >
> >
> > Hey folks,
> >
> > Things have been quiet around here recently; I hope everyone is doing
> ok?!!
> >
> > My script has been getting rather obese recently, and I found that I had
> > reached a limit on its size.
> > So, I've begun converting my project into multiple scripts (oh joy
> unbound).
> >
> > I've found that passing a variable to another script, where that
variable
> is
> > then being checked by an if statement, results in this error:
> >
> > <0001> Script error in script.spp, line 244
> > <0001> Microsoft AudioVBScript Runtime Error: Type Mismatch: the
condition
> > of an if statement did not evaluate to a numeric True/False value
> > <0001> Error Code: 0x88781224
> >
> > My solution to this is to call a subroutine in the destination script
> which
> > "manually" changes the variable.
> > Whilst this solves the problem, and I have everything working, I was
> > wondering if I was missing something fundamental?
> >
> > Cheers,
> >
> >
> > Kenny
> >
>
>
> -- Binary/unsupported file stripped by Ecartis --
> -- Type: application/x-zip-compressed
> -- File: Script Weirdness II.zip
>
>
>


Other related posts: