Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

A handy variation on the "enum",

The imageEnum Contraption:

Load this contraption with a selection of images, and then pick between them. Exposes attributes "value" (an Image interface, read-only!), "imageIndex" (an integer, read/write), respects the standard "show" and "locked" attributes, and provides a "change[]" event, just like enums and the slider.

%%WGT0{"w":[{"name":"imageEnum1","type":"contraption","size":[63,34],"pos":[229,154],"def":"imageEnum","widgets":{"s":{"size":[63,34]},"c":{"size":[33,30],"image":"%%IMG2ACEAHgD/AP8A/wDh"},"o":{"size":[44,31],"pos":[92,-20]}}}],"d":{"imageEnum":{"name":"imageEnum","size":[100,100],"resizable":1,"margin":[17,3,18,5],"description":"select from among enumerated image values.","script":"on images do\n extract arg where arg..type=\"image\" from o.value\nend\n\non get_options do o.value end\non set_options x do o.value:x view[] x end\non get_value do images[][s.value] end\non get_valueIndex do s.value end\non set_valueIndex x do s.value:x view[] x end\n\non view do\n im:images[]\n i:im[s.value]\n s.interval:0,0|(count im)-1\n s.locked:card.locked\n s.show  :card.show\n c.show  :card.show\n c.clear[]\n c.paste[i .5*c.size-i.size 1]\nend\n\non change do\n card.event[\"change\" get_value[] s.value]\n view[]\nend","template":"on change img index do\n \nend","attributes":{"name":["options"],"label":["Options"],"type":["rich"]},"widgets":{"s":{"type":"slider","size":[100,100],"pos":[0,0],"interval":[0,0],"format":"","style":"compact"},"c":{"type":"canvas","size":[70,96],"pos":[15,2],"locked":1,"border":0,"image":"%%IMG2AEYAYAD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AWg==","scale":1},"o":{"type":"field","size":[44,53],"pos":[129,-20],"locked":1,"show":"none"}}}}}