+1
Fixed

Remove variables/ Use itarator

Akeos 5 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 11 1 duplicate

To be honest, variables are not the easiest part for me, so i need some help.

I use a list variables with actions that are executed in random order.

The problem is that i need to remove this action from the list after it is completed. I assume that i need to use an iterator, but I don’t fully understand how it works.

Unity version:
2019.3.0f6
Game Creator version:
1.1.7
GOOD, I'M SATISFIED
Satisfaction mark by Akeos 4 months ago

Duplicates 1

Answered

After using any "get" operation on a List Variables, the iterator will point to that index. So, all you need to do is to use the Remove From List Variables Action and set the Select field to "Current" (which is the iterator, pointing to the last used element on the list).

Variables are probably the hardest thing to wrap the head around :-) 

I tried to use "Remove From List Variables Action" already. But all times "Current" was 1st element of list.
I correctly understand that i dont need function "List variables Iterator" ? 

Added:

For example i set "execute action with index 1", but still "current" is first of the list...
What im doing wrong?

Correct, but that's because the first action is accessing the second element of the list (where you input Index 1). When you access a List Variables element, the iterator is updated to point at the last accessed element.

You wanted to randomly execute an action and destroy/remove it from the list right? Then, in the first action, simply change the value of the "Select" field from Index to Random.

The second action will remove the randomly selected action after it has been executed.

Marti, i trying to say you, what iterator always on the first of list element (with index 0) iterator dont update.

Planned

Understood. I'm revising the code and indeed, the iterator isn't updating according to the read access. I'm not sure how this was missed during the testing phase. Anyway, I've marked this as a bug to be addressed in the next update and I'll update this thread as I work on this. Thanks!

Glad to hear that =) 

+1

The new Action Pack 1 (hopefully approved by Unity very soon), allows you to have a list of Actions, like go to marker, and randomly execute these actions, but only once and then delete that one from the list. 

After all Actions have played, a final Action can be executed if desired. I know this is not exactly what you are saying, but it might help achieve the same result.

Planned

Selecting a "Random" value from a list however, should move the iterator position. This is something we're aware of and we'll provide a fix in the next update :-) I'm merging this ticket with the other one.

Just curious if there is a time table for this fix? This is actually exactly what I need as well and I'm having the same problem (remove current always removes the first in list). I'm making a workaround, but using a list would make it much cleaner. I'm not sure if I should wait or just go ahead with my workaround. Thanks in advance.

I don't like setting milestones because, to be honest, I haven't been able to meet 60% of them. I'm currently working full steam on the Traversal module, while keeping all the bugs in check. Before launching the Traversal module I'll most likely be updating most modules with the latest bug fixes, but I can't set a defined date. Could be in a range of a week (most likely not) and 2 months.

+1
Fixed

I've fixed this issue for the next iteration, so I'm marking this topic as complete. If after updating you experience any issues, feel free to continue the discussion below. Cheers!