How would I implement a For each... -style condition in my object? SVN does not have examples on this, such as Array::For each element.
Is it just a matter of (pseudoish code):
long ExtObject::cForEachThing(LPVAL params) { if(things.size() == 0) return false; //no things, no for each currentThing++; //reset counter if at end if(currentThing == things.end()); currentThing = things.begin(); return true; } [/code:vo7952n6] and then an expression to retrieve data from currentThing. Doesn't this just get called once per frame, when I want to go through each object on every frame?
Develop games in your browser. Powerful, performant & highly capable.
You would have to loop through everything in that thing.
so you would have a loop
extObj::cMyfunction(lpval PARAMS) { for(int i =0; i < keys.length; i++) { currentKey = keys[i] } } in your expression ace extObj::eReturnCurrentKey(Lpval params) { return currentKey; } somthing like that I think would be how its done [/code:f04cr8ii]
gotta go to bed, so I don't have time to distill the answer down, but here's a good start (especially ashley's part)
Lucid did you forget to post something along with that?
oh yeah, oops:
http://www.scirra.com/forum/viewtopic.php?f=7&t=4064&p=32406&hilit=loop
Interesting, I wouldn't have ever figured that out on my own.
Yeah, Lucid's link has the right way to do it. You have to hijack the event system to repeat the event actions multiple times - if you don't do that the actions will only ever be run once!