IntegratedDynamics icon indicating copy to clipboard operation
IntegratedDynamics copied to clipboard

Operator to read a Card's value from its item form

Open TheTrigg opened this issue 5 years ago • 4 comments

Issue type:

  • :heavy_plus_sign: Feature request

Short description:

This may be kind of a confusing request at first, but the chat I had over at the discord server may clarify why this could be useful.

Use example; from what I originally intended to do before I found out I couldn't:

Use an inventory reader on a variable store Return a list of all cards Map them to this new operator and return a list of all their values You may now have a dynamically assembled list from tons of readers You can then map them all to whatever you may need. Removing or adding a card to the store automatically updates the list and the resulting maps.

TheTrigg avatar Apr 08 '20 15:04 TheTrigg

Thumbs up to this feature request; it would allow pretty powerful meta-programming. Part and card IDs are powerful but inaccessible to the users unfortunately.

A possible way of implementing this feature would be by creating a rather simple operator: Get Card Value :: Integer -> Any Parameter is card id, result is whatever is stored in the card. The operator can then be used in a few ways - for example, create a lazy list of integers, store a bunch of cards from readers into a store, then map the list via this operator, then do whatever is necessary. (Discord link: https://discordapp.com/channels/386052815128100865/386054223688630272/705551702761275463 )

Yet another nice thing might be taking this one step further and allow the same kind of operations but with the readers themselves: Get aspect :: Integer -> String -> Any Parameters are: part ID, aspect name, result is whatever is produced by that reader. This would even eliminate the necessity for cards if you have a large self-repeating structure with consecutive part IDs!

Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

Yogghy avatar May 01 '20 11:05 Yogghy

I immediately imagined something to the effect of map(getCardValue, $VARIABLESTORE->contents()) or $VARIABLESTORE->slot(SlotNr)->callCardFunction($VARIABLESTORE_B->slot(slotNr_b)).

Put a named variable store next to your machine, put in all the item cards you want it to process, put the resulting list into an item exporter.

Maybe less useful?: $NETWORK.getCardWithID($VARIABLESTORE.slot(42).getCardID + 23).getCardValue() - 63

7eggert avatar Mar 16 '21 10:03 7eggert

Related to #525

rubensworks avatar Jul 18 '21 13:07 rubensworks