Playmaker Forum

PlayMaker Feedback => Feature Requests => Topic started by: djaydino on January 29, 2018, 02:44:57 PM

Title: Reset bool option on standard get next actions
Post by: djaydino on January 29, 2018, 02:44:57 PM
Hi.
It would be nice if there is a reset bool option on all the standard 'get next' action as i noticed that this is useful in many cases.
Title: Re: Reset bool option on standard get next actions
Post by: jeanfabre on January 31, 2018, 03:49:47 AM
Hi,

 yes, I agree, I'll check with Alex if he's ok for this to be added. The problem is it's complex to explain, but indeed I think necessary for completness in possibilities.

 Bye,

 Jean
Title: Re: Reset bool option on standard get next actions
Post by: tcmeric on February 08, 2018, 08:37:33 PM
Not sure what this is. Can you give an example?
Title: Re: Reset bool option on standard get next actions
Post by: djaydino on February 08, 2018, 09:21:17 PM
Hi.
@tcmeric

for example a get next action will loop from 0-9 but then you only want to loop it until a certain object is found (object was for example on index 4)

Later you want to loop again from the start, if there is no reset option the action will continue from it last position which means (in the example) it will not start from 0 but it will start from index 5 (continue from its last know index)

With a reset option the action will check if reset is true before continuing.
If false it will continue like looping.
If true it will Start back from the 'start index' and set the reset bool to false.

You can see the difference on 'ArrayGetNext2' on the ecosystem.

There are many cases that you do not want to loop thru the whole array list (or other lists like 'Get Next Child')
Title: Re: Reset bool option on standard get next actions
Post by: Marc Saubion on February 22, 2018, 12:35:17 PM
Good point. Also an auto array lenght on array get next. It would avoid aving to get the array lenght an create a variable just for that.
Title: Re: Reset bool option on standard get next actions
Post by: djaydino on February 23, 2018, 02:30:45 AM
Hi.
@Marc Saubion
If you leave the end index to 0 it will loop thru the whole list, then you do not need the Length :)
Title: Re: Reset bool option on standard get next actions
Post by: Deek on April 14, 2018, 05:46:31 PM
I actually added a reset button to those default "get next" actions a short while ago while working on the DialogManager for my game, without even knowing that there seems to be a demand for that functionality.

As it turns out, there couldn't be anything more trivial: since those actions rely on caching the current index in a private variable which don't get reset when re-entering the action, so you have to do it yourself at the start of OnEnter(), like so:
Code: [Select]
if(reset.Value) nextItemIndex = 0; reset.Value = false;(as you can see I even added that the reset bool automatically gets set back to false after resetting the index, since there's no plausible reason to keep resetting the action, and if there is, one could just keep the bool set to true in the action after that "get next" action).

You can find the two customized actions for 'Array Get Next' and 'Get Next Child' in the attachments and I would also urge HutongGames to add that option to the standard actions, so that no one has to rely on these or their own custom actions just for that function (even though you rarely need it, it's very nice-to-have if one does).
Title: Re: Reset bool option on standard get next actions
Post by: Marc Saubion on April 15, 2018, 08:25:32 AM
Hi.
@Marc Saubion
If you leave the end index to 0 it will loop thru the whole list, then you do not need the Length :)
Thanks for the tip. I should read the tooltip more carefully. XD
Title: Re: Reset bool option on standard get next actions
Post by: djaydino on April 15, 2018, 10:46:45 AM
hi.
Reset options will be added to the official actions soon (maybe in the next update)