Connexion rapide:  

Forum: Wishes and new features

Sujet Don Moir's VDJScript editor / nested conditionals

Ce topic est ancien et peut contenir des informations obselètes ou incorrectes.

doug9474ControlleristMember since 2019
Here, https://www.virtualdj.com/forums/223743/General_Discussion/Script_School.html?page=2

Don Moir created a page that appears to make the language much clearer to read. One thing that I have found very difficult to interpret without rewriting the code to make it more understandable is nested conditional statements. Even professional programmers such as myself find it difficult to read, so I know novices find it difficult... Don Moir's page broke down the parts of the conditionals into multiple lines and did color coding for the keywords.

A code editor such as this one should be a standard part of editing VDJScript. It takes too much time to read and rewrite nested conditionals when necessary. Unlike other languages, there aren't parenthesis, squigly braces or multiple lines.

Thanks,
Doug


 

Posté Mon 26 Aug 19 @ 5:01 am
NicotuxHome userMember since 2014
+1
but ...
Don Moir's tool page gives error 404 for weeks

You can now add lineefeeds in your scripts, free to you to format them

The other hand, complex scripts may use embedded scripts in strings or backquotes which are not easily formattable

Parenthesis is one of the most requested features for a looong time

 

Posté Tue 27 Aug 19 @ 12:19 am
doug9474ControlleristMember since 2019
Ok. Then, I request something like a function in 3G programming languages, where I could give a script a name and call it as necessary.

Also, could you point me to the documentation for embedded scripts? I'm not sure if they would do what I need, but I would like to know how to implement them.
 

Posté Mon 02 Sep 19 @ 8:30 pm
NicotuxHome userMember since 2014
What i "abusively" called "embedded scripts" are scripts called as parameters to verb.
These are simply strings with executable scripts in them such as the following example, not easy to format

holding ? set my_var 0 : set my_var "`var clock 12 ? get_clock 12 : var clock 24 ? get_clock 24 : play ? get_time 'remain' : loaded ? get_time 'total' : get_constant -1` "

If you want to implement some named "function" the actual "hack" is to create some unused custom buttons - i.e. custom_button 99 - or use dedicated custom pad page / pad ... and use them as needed as a subroutine
see custom_button, custom_button_name, get_custom_text, pad, padshift, padshift, pad_pressure, pad_color...
 

Posté Mon 02 Sep 19 @ 11:25 pm
doug9474ControlleristMember since 2019
ouch... kinda ugly and unwieldy...

but, I guess they can get the job done when necessary. something more like an IDE would be helpful, especially given how complex the language can be.

This is my interpretation of what's in the backticks for your script.


var clock 12 ?
get_clock 12
: var clock 24 ?
get_clock 24
: play ?
get_time 'remain'
: loaded ?
get_time 'total'
: get_constant -1
 

Posté Tue 03 Sep 19 @ 3:58 am
locodogPRO InfinityModeratorMember since 2013
How you're taking, it sounds like you're familiar with coding, vdj has an API, you'll still be talking to vdj with script but using C++ to write/ stringstream << the script is much easier.
 

Posté Tue 03 Sep 19 @ 7:31 pm
doug9474ControlleristMember since 2019
I am familiar with coding. I'll look into the C++ thing, but that sounds like even more trouble when I want to do something simple lol.

Hopefully someone will work on making vdjscript easier to use.

I have been thinking about a plugin idea though.... Maybe I'll work on that.


 

Posté Wed 11 Sep 19 @ 11:29 am
I took the script formatter down because I got tired of the BS. More than that though, it is just not worth it. I can only say one good thing about VDJ script, and that is it is at least available.

1) bad and error prone syntax
2) no syntax checking - typing, misplaced syntax errors, and misspelling of key words are very common errors in any language.
3) no way to know what is wrong when the script does not work...
4) can appear ambiguous
5) no macros... a lot of scripts are one offs, or lots of duplicated code

I was going to add macros to the formatter but not worth it. If it was me I would throw away the current vdjscript and do something much more useful.. and convert old script over to new syntax. But if they have not done any basic tools in years well... The thing is they have to do syntax checks and they know where there is something wrong... They have the code for it basically... but the user is left guessing... god only knows why. They probably started out very simple and kept adding baggage to it. Throw it away... start over... add feed back to user.. you already have some of it.... simple does not work well beyond very simple and the simple becomes way more complex and error prone then needed.

example of a macro. Given this segment of code where about the same thing is duplicated.

....loop 2
....? loop_position & param_bigger 90%
......? set "top" 1
......: var "top" 1
........? loop 1 & set "top" 0
........: nothing
....: loop 1
......? loop_position & param_bigger 90%
........? set "top" 1
........: var "top" 1
..........? loop 0.5 & set "top" 0
..........: nothing

change it to a macro

macro myLoop (L1, L2)
{
.... loop L1
....? loop_position & param_bigger 90%
......? set "top" 1
......: var "top" 1
........? loop L2 & set "top" 0
........: nothing
}

myLoop (2,1)
myLoop (1,0.5)

calling myLoop will do text replacement with the given parameters.. Just an example and not exactly right. It reduces code, reduces errors, and makes it much more useful. All above are expected things and not like special request.

I started to do a debugger and did enough on it for a feasibility check.. It would work and you could have break points and check variables but again just not worth it. When I was doing this a I had var_list come up.... Stick that in a loop with a count of 1000 or so... You will have 1000 var_list windows up... useless
 

Posté Wed 18 Sep 19 @ 5:22 pm
doug9474ControlleristMember since 2019
Agreed. I have found it useful for a few simple things, but it could be amazing if they had someone who is good at designing computer languages build it from the ground up.
 

Posté Wed 18 Sep 19 @ 9:48 pm


(Les anciens sujets et forums sont automatiquement fermés)