playMaker

Author Topic: Reset bool option on standard get next actions  (Read 967 times)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3522
    • View Profile
    • jinxtergames
Reset bool option on standard get next actions
« on: January 29, 2018, 12: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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13432
  • Official Playmaker Support
    • View Profile
Re: Reset bool option on standard get next actions
« Reply #1 on: January 31, 2018, 01: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

tcmeric

  • Hero Member
  • *****
  • Posts: 655
    • View Profile
Re: Reset bool option on standard get next actions
« Reply #2 on: February 08, 2018, 06:37:33 PM »
Not sure what this is. Can you give an example?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3522
    • View Profile
    • jinxtergames
Re: Reset bool option on standard get next actions
« Reply #3 on: February 08, 2018, 07: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')

Marc Saubion

  • Junior Playmaker
  • **
  • Posts: 57
    • View Profile
Re: Reset bool option on standard get next actions
« Reply #4 on: February 22, 2018, 10:35:17 AM »
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3522
    • View Profile
    • jinxtergames
Re: Reset bool option on standard get next actions
« Reply #5 on: February 23, 2018, 12: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 :)

Deek

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Reset bool option on standard get next actions
« Reply #6 on: April 14, 2018, 02: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).
« Last Edit: April 14, 2018, 02:49:55 PM by Deek »

Marc Saubion

  • Junior Playmaker
  • **
  • Posts: 57
    • View Profile
Re: Reset bool option on standard get next actions
« Reply #7 on: April 15, 2018, 05: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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3522
    • View Profile
    • jinxtergames
Re: Reset bool option on standard get next actions
« Reply #8 on: April 15, 2018, 07:46:45 AM »
hi.
Reset options will be added to the official actions soon (maybe in the next update)