kirkwoodwest
Junior Member
Building Lemur Templates for Live and Studio
Posts: 47
|
Post by kirkwoodwest on Feb 28, 2019 16:02:25 GMT
Is it possible or is there some trick to calling functions on objects that you don’t have the direct name to?
i was hoping to be able to do the following
decl object = getobject(); decl parent_object = getparent(object); parentobject.my_function()
|
|
|
Post by xPsycHoWasPx on Feb 28, 2019 23:44:23 GMT
Nope decl only works to define new values in a script. Nor can values be used as Part of a command or have sub commands u would be able to in c++ / python/java etc. Or make functions within a script.
But you can call a script as a function by adding (val, val2,ect) to the end of the script name So if u named it ”my_script(val1,val2)”
Then u can call it from another script By doing:
my_script(input1,input2);
If script has following code:
decl output = val1 + val2; return(output);
And execute it :
new_val = my_script(1,2);
new_val is now 3.
..........
|
|
|
Post by xPsycHoWasPx on Feb 28, 2019 23:48:30 GMT
Dunno if that answered anything of what you wanted to know. Or if you are just thinking 2-3 steps ahead of what is possible besides what’s documented. ( sorry for wasting your time) In that case hopefully somebody else can find it useful 😎
But after reading your post again I get what now what you mean. And answer is no. Scripts can't be dynamic called like that in lemur. (o how I wish it was Like when I'm making ableton live midi remote scripts, just gotta love python coding)
In your case u have to make a main script and inside that u can make some if rules triggered by words, and each will execute other new scripts. At least that is how I do to get a somewhat similar action, like you are talking about.
|
|
kirkwoodwest
Junior Member
Building Lemur Templates for Live and Studio
Posts: 47
|
Post by kirkwoodwest on Mar 1, 2019 17:47:56 GMT
yeah. i'm doing exact tricks like this to pull off functionality. I love being able to do dynamic callbacks in Lua and Python. This is the difference between advanced scripting and just basic scripting. very easy to wrap up callbacks in an object and reuse it.
After I solve my specific problem here, i'll post my real world workaround... but it doesn't seem to really exist. I guess its all about making some sort of if/then event and passing the data dynamically through that...
Something like this...
if(ui==linn_id) process_linn(MIDI_ARGS); if(ui==juno106_id) process_juno(MIDI_ARGS);
then those functions probably look similar(i.e. lots of copy/paste) but have specific references to their objects.
|
|
|
Post by xPsycHoWasPx on Mar 3, 2019 20:38:03 GMT
|
|