Help with SOL

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I haven't played around with the SOL that much and some things are confusing me a bit since they're not heavily documented.

    I'm trying to implement an action which has an object param. What i want to do is be able to loop through all the instances picked by the conditions in the event, this is as basic as it gets i'd imagine. What i'm not sure about is that i can't just take

    type.getCurrentSol().instances and loop through the array, because sometimes the list of instances is empty. I'm not really sure what "sol.select_all" does, other than it's true under the basic condition that there are no conditions filtering the type in question, and false if there are conditions filtering the type. I don't know if there's more to "sol.select_all" and the few sentences in the SDK aren't helping me out with more than understanding how it works in basic cases. Also i don't know if theres anything special i have to do to make containers and or/else and inverted conditions work properly. The documentation in the sdk is rather scarce/vague on this topic and i can't find very many examples of actions using the sol within the standard plugins.

    I just wanna be on the safe side since my plugin is quite large and small bugs in small features get left behind or missed easily if i don't try my best to implement things robustly from the start.

    my current code is:

    	Acts.prototype.ObjAddChild = function (childtype)
    	{
    	
    		var sol = childtype.getCurrentSol();
    		var i, leni , inst;
    		
    		if(sol.select_all) inst = sol.type.instances;
    		else inst = sol.instances;
    		
    		for (i = 0, leni = inst.length; i < leni; i++)
    		{
    		
    			this.obj.add(inst[i].obj);
    
    		};
    
    	};[/code:29k00w53]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • var insts = childtype.getCurrentSol().getObjects();

  • thanks I missed that!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)