Picking / SOL?

0 favourites
  • 4 posts
  • Is there a good place or plugin to look at to learn how to implement object picking?

    I've been looking around a bit, and it's hard to tell what is and is not special-case picking code.

    (Kind of the same way the function object has the "fast trigger" system that's not intended for general SDK use.)

    Does anyone know of an SDK picking tutorial, or a plugin that has generally applicable picking code?

    Part of the reason I'm interested is that I'm building a document full of template code snippets for various common ACE related tasks, such as looping, executing triggered conditions, and now picking and SOL manipulation, if I can figure it out.

    Any thoughts or advice much appreciated, thanks.

  • A sample code to fill SOL with some uids.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Picking is pretty simple in principle: either select_all is true, in which case it uses all instances, or if it's false then it uses the instances in the SOL list. However the implementation details of this tend to be tricky.

    Note you can only pick instances of the same object type or those which are referenced in object parameters - the event system does really important optimisations based on this assumption, but it means it won't work if you pick anything else. I'd also strongly recommend you don't pick anything outside of conditions, since it contradicts what the rest of C2 does. Ideally plugins can just stick to normal triggers and normal conditions.

  • Thanks Rex and Ashley for the info

    I looked through the example code you posted, Rex,

    and in the context of some of the things you said, Ashley,

    I think I kind of see what's going on.

    Is there a place in any of the runtime files I could look to see the implementation of the SOL system?

    In particular I'd be interested to see a list of the available methods and fields you can use to interact with the SOL.

    Kind of the SOL "interface".

    Is a SOL attached to each C2 object type, and implemented as a SOL JavaScript object, assigned to a JavaScript field of the c2 object type?

    Or is it something global to the entire runtime?

    I might be misremembering, but it seems like I've been seeing things that looked to me like they could indicate that it's handled on a per C2 object type basis.

    I haven't yet been able to track the references to the SOL far enough back upstream to see where they are originating from.

    I also gather that there is a SOL stack that is used to store (for later restoration) SOL state as you recurs into deeper levels of events. Though again, I'm having trouble finding the actual code that would make it clear if that stack is a field of a C2 object type. I suspect that it might be in the commonace.js file, but I haven't been able to spend much time poking around in it yet.

    Sorry for the noobly questions.

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