Grouping Snippet

by Spuzzum
This is a snippet on how to create objects that can be grouped in a user's inventory. [More]
To download this demo for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Spuzzum.GroupingSnippet##version=0

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Spuzzum.GroupingSnippet##version=0

2058 downloads
Latest Version
Date added: May 28 2001
Last updated: Jul 29 2009
0 fans
If you create objs of the type /obj/groupable, then you whenever you pick up those items, they will be grouped into groups of 'max_group' items.

If you don't specify a 'max_group' variable, then there will be an unlimited amount of items that can be grouped together.

Note that when you want to delete a groupable item, subtract 1 from its 'num' var and then call PoolItems(). The format is described to you in the snippet.


This snippet assumes you have a /obj/get() and a /obj/drop() verb, but it doesn't use them. If you don't have those verbs, just add "verb/" (without quotes) in front of each of the verbs inside the code.


Remember, a snippet is focused more on giving a functional method of implementing something. If you don't understand how it works, then you shouldn't be using it yet. =)