001 Game Creator Guide

A short introduction to Collections for 001 Game Creator

A short introduction to Collections

Overview

A short guide on how to use Collections in your game.

What are Collections?

Collections hold data in a list format that can be searched, edited, added to or removed from at runtime. You can for example use them to store things the player has done, enemies destroyed, items unlocked and much much more. This guide assumes some experience with Use Values in 001 Game Creator.

Events related to Collections

Collection Events

Add to Collection

Adds a new element to the collection.

Clear Collection

Removes everything inside a Collection.

Collection Contains Branch

Takes the left path if the chosen Collection contains the parameter. If not if takes the right path.

Collection Count Branch

Checks if the Collection has the specified amount of items in it. This will take the left path ONLY if the Collection contains exactly that amount of items. In some cases it can therefore be better to use a Comparison Branch to count the Collection, as this lets you use Greater Than, Less Than and so on.

Collection Loop

Goes through every element inside the collection and can do scripts based on the current item. Requires a variable to hold the current loop information.

Copy Collection

Copies data from one Collection into the Destination collection.

Edit Element in Collection

Changes an item on a specified Index inside a collection to a new value. This can be tricky to use, since you need to know the exact Index of the item you want to edit. Since this isn’t always the case, we can instead search through the Collection to find the correct Index using the Find in Collection use value.

This will return the index number of the value searched for. If we don’t find anything, it returns 0.

Insert in Collection

Inserts a new value at a specified Index.

Remove from Collection

Removes the value from a Collection if it’s found.

Remove from Collection at Index

Similar to Edit Element in Collection, except that this event removes the entry from the Collection.

Sort Collection

Sort a a collection either by alphabetical or numerical, ascending or descending. This can come in handy if you need to sort items in the players inventory for example.

Collection Use Values

Like all global variables, Collections has their own set of Use Values that you can make use of in your game. The use value code is written inside [ ].

Collection Count [Collection.Count(Collection)]

Returns how many entries are inside a collection.

Find in Collection [Collection.Find(Collection, “Search”, Start)]

Searches the Collection for the parameter and returns the index the parameter was found at.

Make Collection [Collection.Make(Values)]

Makes a new Collection from a set of values. Use it with Variable Operations like the example below to make that variable into a collection you can use in your scripts.

Merge Collections [Collection.Merge(Collection 1, Collection 2)]

Merges two collections together and returns them as a string. Use this with variable operations like in the example.

Join Into Text [Collection.Join(Collection, Delimiter)]

Returns each element inside a collection into a string with an optional delimiter. For example if you have a collection that contains “Item 1” “Item 2” “The Third Item” it would return as “item 1, item 2, the third item” with , being the delimiter. You can use whatever character you want as the delimiter, but I recommend using comma.

Left Portion [Collection.Left(Collection, Entries)]

Returns x entries inside a collection starting from the TOP of the list.

Right Portion [Collection.Right(Collection, Entries)]

Returns the x entries inside a collection starting from the BOTTOM of the list.

Middle Portion [Collection.Middle(Collection,Starting,Entries)]

Returns the x entries inside a collection starting from a custom Index in the list then continuing down.

Cut Out Left Portion [Collection.LeftCut(Collection,Entries)]

Returns a Collection with x entries on the TOP removed.

Cut Out Right Portion [Collection.RightCut(Collection,Entries)]

Returns a Collection with x entries on the BOTTOM removed.

Cut Out Sides [Collection.Cut(Collection,Start,End)]

Returns a Collection with a set amount of entries cut from the Top and Bottom.

SteamSolo.com