Scripting error
Scripting error
Hi - I'm trying to create the Volume Knob given as an example in MD.
I've followed the written tutorial & double checked it several times but it isn't compiling.
I'm new to scripting in Java so, after moving/deleting & generally becoming more bewildered I have to admit I don't know what adjustments to make to the script to make it work.
Pathetic, I know, but any help would be much appreciated.
Many thanks.
I've followed the written tutorial & double checked it several times but it isn't compiling.
I'm new to scripting in Java so, after moving/deleting & generally becoming more bewildered I have to admit I don't know what adjustments to make to the script to make it work.
Pathetic, I know, but any help would be much appreciated.
Many thanks.
- Attachments
-
- SCRIPTINGerror.Screenshot 2019-05-21 at 11.26.15.png (24.03 KiB) Viewed 13210 times
-
- Scripting.Screenshot 2019-05-21 at 11.25.43.png (157.48 KiB) Viewed 13210 times
iMac 27/Catalina/3.5 GBh Intel Core i7/16 GB Ram/3 TB HD
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
Re: Scripting error
Hi JackOats...
My guess, and I'm not a Java guru, is the variable declaration isn't allowed there 'cause it will only exist in the context of the if statement. Consider this:
What the compiler sees is this:
So it's objecting to the creation of a variable that's going to get thrown away as soon as it's set.
This, on the otherhand, compiles:
I hope that helps!
Cheers,
--
Terry McG
We all have to start somewhere... don't worry, it'll get clearer as you go along!
My guess, and I'm not a Java guru, is the variable declaration isn't allowed there 'cause it will only exist in the context of the if statement. Consider this:
Code: Select all
boolean foo = true;
if (foo)
double bar = 1.0;
Log ("bar = " + bar);
Code: Select all
boolean foo = true;
if (foo) {
double bar = 1.0;
}
Log ("bar = " + bar);
This, on the otherhand, compiles:
Code: Select all
boolean foo = true;
if (foo) {
double bar = 1.0;
Log ("bar = " + bar);
}
Cheers,
--
Terry McG
Re: Scripting error
What terrymcg said It’s always a good idea to use the curly brackets with IF statements, otherwise it might not be super obvious what exactly is contained inside the IF block.
In addition, I spotted a couple of typos in the code: in the ProcessSample() function, there’s ”Getvalue()” and ”Setvalue()” with a lowercase ”value”. It should be ”GetValue()” and ”SetValue()” (case matters in Java).
Also, ”inputJack. GetValue()”, while it seems to compile (that was news for me! ), looks much better without the space.
In addition, I spotted a couple of typos in the code: in the ProcessSample() function, there’s ”Getvalue()” and ”Setvalue()” with a lowercase ”value”. It should be ”GetValue()” and ”SetValue()” (case matters in Java).
Also, ”inputJack. GetValue()”, while it seems to compile (that was news for me! ), looks much better without the space.
Re: Scripting error
@terrymcg
@Captain
Hi Guys - Thanks very much for the messages & suggestions.
Well, I've corrected all the typos I can find & pored over the scripting example for most of yesterday & today but I'm still getting the same error message. More studying required I think. Thanks anyway Guys.
@Captain
Hi Guys - Thanks very much for the messages & suggestions.
Well, I've corrected all the typos I can find & pored over the scripting example for most of yesterday & today but I'm still getting the same error message. More studying required I think. Thanks anyway Guys.
iMac 27/Catalina/3.5 GBh Intel Core i7/16 GB Ram/3 TB HD
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
Re: Scripting error
Now that I look more closely...
While the code that's causing you grief needs more braces, there's also a bigger issue...
Just to get the braces thing out of the way, something like this will compile:
Code: Select all
if(outputJack.IsConnected()) {
double signal = inputJack.GetValue();
signal *= mvolume;
}
Hang in there!
Cheers,
--
Terry McG
Re: Scripting error
Hi Terry,
Thanks for the message:
One reads: "double cannot be dereferenced" and the other 5 read: "cannot find symbol".
Thanks for the message:
I deleted lines 325 - 329, as you suggested above, but instead of failing with 1 error it now has failed with 6 errors.If you just delete lines 325 thru 329, your compile error should go away and, since you've got the code in ProcessSample (where it should be), it may even do what you want
One reads: "double cannot be dereferenced" and the other 5 read: "cannot find symbol".
iMac 27/Catalina/3.5 GBh Intel Core i7/16 GB Ram/3 TB HD
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
Re: Scripting error
I'm happy to help with debugging, but I'd really need a screenshot (or ideally copy&paste) of the code...
Re: Scripting error
@Captain
Would you need the whole script or just the problematic part?
That would be most kind - and very helpful, thank you."I'm happy to help with debugging"
Would you need the whole script or just the problematic part?
iMac 27/Catalina/3.5 GBh Intel Core i7/16 GB Ram/3 TB HD
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
Re: Scripting error
If it's OK for you (meaning there are no trade secrets or anything ), the full code is of course the easiest. Then I could just copy&paste it into my MD, see what the problems are, try to fix them, and make sure it compiles OK. Maybe sending it through Google Drive or similar would be easiest, so that the forum post doesn't get overly long, but anything works for me! EDIT: Seems like you can attach files to forum posts, that's also a viable option.
Re: Scripting error
O.K. Thanks. Will try that. Away from home at the moment - but as soon as I get back tomorrow.☺
iMac 27/Catalina/3.5 GBh Intel Core i7/16 GB Ram/3 TB HD
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.
The masculine includes the feminine (Guys)
Google: 'JackOats' to see my Soundcloud page, 'Brian Watterson - Vimeo' for my Videos.