I've never used scripting in C3 but I'm very very familiar with the event sheet. I've been doing javascript coding at work lately and thought I should try scripting in C3.
So does scripting do the picking for you like the event sheets do?
Hello, yes it does in some ways. Read the documentation about scripting, and also instance picking under Object Interface.
https://www.construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/object-interfaces/iinstance
Develop games in your browser. Powerful, performant & highly capable.
Picking is a concept unique to Construct event sheets, and is not a concept that exists in other programming languages like JavaScript. However you can write code that achieves the same result, and script blocks in event sheets can access the instances picked by the event's conditions. There's some more advice at the very end of the 'Learn JavaScript in Construct' tutorial series.
One way I find myself doing "picking" in js only is using array.filter
const instances = runtime.objects.Sprite.getAllInstances(); // get an array of instances const picked = instances.filter(obj => obj.instVars.foobar); // filter based on instance Variable
which in events would be basically just this
Here's some more info on it
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
Might be interesting to create a little class that does this. Keeps track of picked list and filters down with subsequent picking conditions. Also has a reset picking mechanism. Just as a helper for folks coming from events to JS.