Tabletop Simulator

Tabletop Simulator

Utility Memory Bag
58 Comments
Corvalis 7 Mar @ 8:03am 
Really Love it but it Really Needs the ability to Select Clusters of objects at once rather than 1 click at a time then "ADD" button..:) 500 Trees for World Building UMBag = 500 clicks lol
WUFFA 17 Aug, 2024 @ 9:04am 
I was having problems with the selection button disappearing in into the object for some single cards on top of a board. To fix this I added + 0.1 to the y position in createButtonsOnAllObjects():

objPos.y = objPos.y * globalScaleFactor + 0.1
Slushy 7 May, 2024 @ 4:52pm 
Would love for this to be combined with the Relative Memory Bag, so it places stuff in relative location to the bag.
Quickle 23 Feb, 2024 @ 5:20pm 
@Kyndral22 No problem!

Here's how you can make any object into a memory bag:

Step 1:
Make an object into a regular bag. You can do this one of two ways:
- (A) Use this mod: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2302198936
- (B) Right click on a Custom Model (custom models only, doesn't work on tiles/tokens/etc.) > Custom > (select "Bag" at the bottom)

Step 2:
Make your bag into a 🌟Memory Bag🌟:
- Spawn a Memory Bag into the game.
- Right Click (on your *custom* bag, not the memory bag) > Scripting > Scripting Editor
- Wait a moment for the scripting window to pop up.
- Your custom bag's script will be selected. It should be empty.
- Click on the Memory Bag to switch to its script.
- Copy the whole script.
- Click on your custom bag to switch to its (currently empty) script.
- Paste the whole script.
- Click "Save & Play" (WARNING: You must be inside of a "saved game" for this to work. Otherwise it will complain that it can't save.)
Kyndral of The Scara 23 Feb, 2024 @ 4:20pm 
@Quickle aw heellllll yeaahh, thatll do just fine! now i just need to learn how to turn any object into a memory bag and ill be set, THANK YOU
Quickle 15 Feb, 2024 @ 1:36am 
Hi @Kyndral22, that's a great feature request! I would love to use that feature too.

As far as I can tell, the Utility Memory Bag isn't able to do it.

Until this feature is added, I found two other bags in the workshop that look like they can do what you're asking:
- https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1347434285
- https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1966767669
Kyndral of The Scara 14 Feb, 2024 @ 2:40pm 
can i do this but have it place the items just next to the bag? Example, if I have 11 orks I want to spawn, and they are in a bag, is there a way to just get all 11 out of the bag at once instead 1 at a time? My only issue with memory bags is that they remember where to put them, but Im going to be playing in different places, so i dont want to have them spawn in the middle of something else, rather just next to or around the bag itself
BradMang 16 Jun, 2023 @ 12:15am 
Awesome, thanks for your help. I'll give it a shot!
Quickle 15 Jun, 2023 @ 10:23pm 
Hi @BradMang, the only way I know how to do it is to "comment out" a few lines of the bag's script. Specifically, comment out these lines:

(1) https://github.com/sunflowermans/TTS-UtilityMemoryBag/blob/master/UtilityMemoryBag.lua#L309-L313

(2) https://github.com/sunflowermans/TTS-UtilityMemoryBag/blob/master/UtilityMemoryBag.lua#L683-L692

In case you or anyone reading is unfamiliar with scripting, "commenting out" in TTS means to put "--" at the start of each line that you want to "turn off".

You can open up a bag's script by right clicking the bag and clicking "Scripting" > "Scripting Editor". That opens a pop-up window showing the bag's script. I recommend copy-pasting the code into a text editor like Notepad or Notepad++ so you can search for the specific lines that you want to comment out. Then paste it bag into the TTS window and click "Save & Play".

I hope this helps! It sounds like a lot, but it's fast once you've done it the first time.
BradMang 13 Jun, 2023 @ 2:32pm 
Amazing mod this, saves so much time! Is there a way to remove the setup/move buttons once a bag has been configured?
Quickle 31 May, 2023 @ 1:46am 
You sure can!

TLDR: Convert an object into a bag, then copy & paste a Utility Memory Bag's script onto the object.

Steps:
1. Load an existing save. (Or create a new game, save it, then load it).
2. Spawn a Utility Memory Bag.
3. Right click on the custom object (i.e. custom 3d model) that you want to transform into a Utility Memory Bag. Click "Custom" (at the top) > Select "Bag" (at the bottom) > Click "Import".
4. Right click on the same object > Click "Scripting" > Click "Scripting Editor" > Wait a moment for the scripting window to pop up. Note: your custom object's empty script will be selected in the script editor.
5. Copy & Paste all the text from the Utility Memory Bag's script into your custom object's empty script.
6. Click "Save & Play" (top left of the pop up window).
7. Profit!

Note: Check out the "Make Anything a Bag" mod if you want to use a token/tile as the bag instead of a 3d model.
Julio The Colombian 29 May, 2023 @ 11:04am 
is there a way to reskin a memory bag to be something else? like a box? just for looks.
Quickle 18 Dec, 2022 @ 1:29pm 
@Sileflas - The memory bag's onLoad function starts on line 276. I think it would work if you add the "players= " and "self.setInvisibleTo(players)" inside the bag's existing onLoad function.

https://github.com/sunflowermans/TTS-UtilityMemoryBag/blob/ed492b9c68dd25c6a607782fe2f3648614f79739/UtilityMemoryBag.lua#L276
Sileflas 18 Dec, 2022 @ 9:07am 
I've got a short bit of script to make items invisible to players, but I can't seem to add it to the bags without breaking the rest of the script. Any help for the scripting noob would be appreciated!

Here's the script:
players = {"White", "Pink", "Orange", "Green", "Blue", "Teal", "Yellow", "Red", "Brown", "Purple"}
none = {}

function onload()

self.setInvisibleTo(players)

end
kinariys1 2 Dec, 2022 @ 10:41pm 
Apparently, there is a memory leak somewhere in the script, which is why after each operation of folding and laying out items, the TTS begins to eat more and more memory.
Quickle 26 Sep, 2022 @ 11:57am 
Hi Receptive™, the easiest way is to just have two bags sitting next to each other, and give them both the same "Group Name". You can change each bag's group name by clicking the bag's "Setup" button, then clicking "Group Name" and typing in the name. Putting them in the same group makes it so that clicking "Place" on one bag will automatically recall items from the other bag, so only one of the bags can have it's items out at a time.

If you really want to have one bag with two buttons then you could modify the bag's script to accomplish it.
Receptive 25 Sep, 2022 @ 3:09pm 
hi don't know if anyone posts on this anymore, im having trouble, i would like the bag two have two diffrent buttons on it that when one is clicked it places cards in one position and when the other is clicked it places them in anoth position/ how would i go about that? any help is appriciated
gfeather 9 Jan, 2022 @ 11:41am 
Also, if possible, a version that has a button to select all and pack everything in the scene. (So it's possible to delete things from the bag rather than try to find hidden items in the scene.) Finding lights or things that have fallen inside locked objects can be a real pain sometimes.
gfeather 17 Dec, 2021 @ 8:09pm 
Any chance someone here knows how to get it to store alpha information as well?
Old School Oni 13 Dec, 2021 @ 3:58pm 
Thanks @MoonkeyMod. I got most of what I needed using https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2134382679 . It's not working perfectly, but very close ot what I had hoped for.
MoonkeyMod 11 Dec, 2021 @ 4:19am 
@Old School Oni
The short answer is yes, the meaningful answer is you need to poke around in the code changing values.

I did a similar thing in this mod top the "boxes" and the "folders" that are placed from them
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2461320101
Old School Oni 10 Dec, 2021 @ 1:21pm 
Asking here since this fork seems to have collected so many of the neat offshoots and clearly represents people who know a lot more about this stuff than I do!

Is there a way to get Memory Bag functionality out of another (non-bag-looking) object? I tried cutting and pasting the script onto my object, and while it technically worked, the presentation was awful. Things like the "Setup" button being too far away, scaling badly with the object's scaling, etc.

I was unable to find a way to point the default bag image towards a different mesh.

Any other suggestions?

Thanks!
Sileflas 17 Aug, 2021 @ 10:50am 
Not sure why, but lately when I hit the submit button, the bag flies way up in the air along with all of the selection squares and just hovers there. The only workaround I've found is to lock the bag in place before clicking setup. Minor issue, but very perplexing!
Quickle 9 May, 2021 @ 5:08pm 
Thanks for sharing your table Marlow.

I did an extensive deep dive but wasn't able to find the root cause and fix it.

I found a workaround for now -- simply "lock" the memory bag before you click "Setup", and unlock it after you've clicked "Submit"/"Cancel"/etc.

I opened an issue on GitHub to track this: https://github.com/sunflowermans/TTS-UtilityMemoryBag/issues/7
Quickle 9 May, 2021 @ 11:11am 
Could you share your table? I'll see if I can figure out the issue.
Marlow 9 May, 2021 @ 5:38am 
Seems to be an issue on my specific table and coming from the new group update
Marlow 9 May, 2021 @ 5:32am 
Hey for some reason, when I hit "setup" the bag deletes itself. I'm at a loss as to why!
directsun  [author] 9 Apr, 2021 @ 10:20pm 
Thanks Quickle. Merged and updated.
Quickle 7 Apr, 2021 @ 2:13am 
Done! I've submitted a pull request to combine this with the Group Memory Bags: https://github.com/sunflowermans/TTS-UtilityMemoryBag/pull/4

Hopefully the feature can go live this week.
Sileflas 30 Mar, 2021 @ 8:41pm 
Would anyone be interested in combining this with the Group Memory Bags? I love the extra functions on these, but I don't have the scripting skills to do it myself . . .
GenericName24 6 Feb, 2021 @ 3:16pm 
To fix this with the latest update, replace all "local bagObjList = self.getObjects()" with "local bagObjList = self.getData().ContainedObjects"
Then replace all "bagObj.guid" with "bagObj.GUID"
GrayGeist 6 Feb, 2021 @ 12:57pm 
Hey ever since the last update the bag no long places or recalls objects or even sets up correctly. it states: "Error in Script (Utility Memory Bag - fc34bd) function ,buttonClick_place.: Object reference not set to an stance of an object <4>".

Apparently this issue is "network" wide for anything using memory bags. Arkham LCG, Dice Throne, etc.
MoonkeyMod 10 Jan, 2021 @ 6:24am 
I don't believe so, though I'm not 100% on what your looking for.
Boozebeard 9 Jan, 2021 @ 4:23pm 
I need something that will place tiles back in the same pattern but randomly, can this do that?
MoonkeyMod 9 Dec, 2020 @ 4:21am 
@WalBanger - UK, If you want to contact me on discord we can try and figure it out MoonkeyMod#9394

sounds like you have a number of things to look at potentially and I don't want to spam the mod page here.
WalBanger -UK- 8 Dec, 2020 @ 4:58pm 
@MoonkeyMod... sorry im a real n0-0b... i tried to copy script from the bag to box and failed :(
WalBanger -UK- 8 Dec, 2020 @ 4:23pm 
@MoonkeyMod
Thanks thats awesome...

I'm now having an issue at moment though (with this original bag)...
I currently have 6 bags set up with "dungeon layouts" and when i put then in the bag and then out the bag etc... It works ok for me but the other players have items missing...

If they host the game it works but then I'm missing the parts from the dungeon...

any clues as to why this happens?
MoonkeyMod 27 Oct, 2020 @ 7:24am 
@WalBanger -UK- Have you tried copying the bag script to your desired object? I did a similar thing using the Memory Bag 2.0 script and had it running on a chest, it also worked when attached to the game boxes from this mod https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=878540818&searchtext=box

You can then upload your own image to the game box.
WalBanger -UK- 13 Oct, 2020 @ 2:43pm 
Hi
Love this... Really well done, and thank you very much :)

but is there anyway we could change the Bag to an Icon or Object....
Id love to make a card (for example) with a picture of Mission 1 on it and you click that to open mission 1.... then another card with Mission 2 etc.... so you can just look at the picture and you will instantly know which one is which....

because at the moment it looks like il have to put down 20 Bags lol
GrayGeist 4 Aug, 2020 @ 6:15pm 
Yeeeehaw!
directsun  [author] 4 Aug, 2020 @ 1:11pm 
Thank you, @cowgoesmoo33 ! Changes incorporated.
GrayGeist 25 Jul, 2020 @ 1:47pm 
Also, do you know how to make imported custom PDF objects selectable to be placed into the memory bag?
GrayGeist 12 Jul, 2020 @ 11:49am 
Hi Directsun! Question for you. Is it possible to script in the ability to select the green boxes via a mouse drag? Clicking every square, as I'm sure you know, is quite time-consuming. Having the ability to drag over them and select would be powerful!
directsun  [author] 7 Jun, 2020 @ 11:48am 
@graygeist this bag does have all the current features of the Memory Bag 2.0 by MrStump. So you could use it as a replacement if you'd like.
GrayGeist 6 Jun, 2020 @ 6:27pm 
Nice work! Does this mean I don't need the Memory Bag 2.0? I watched your video and it seems this replaces it and adds more features?
directsun  [author] 28 May, 2020 @ 4:37pm 
I dig it. I'll open a repo on GitHub to make these things easier with issues and pull requests. I think it's time.
Quickle 26 May, 2020 @ 11:31am 
If I may make a suggestion, I recommend adding a few configuration variables at the top of the file to let users quickly configure some common behaviors without needing to know how to script.

Personally I've added these two to my bags:

```lua
Config = {}

-- If true, will broadcast a message to all players when the objects are placed or recalled.
-- This is the default behavior of Utility Memory Bag.
Config.BROADCAST_WHEN_OBJECTS_PLACED_OR_RECALLED = false

-- If true, the Setup and Move buttons will be visible.
-- This is the default behavior of Utility Memory Bag.
-- You should turn this off before publishing your mod, to keep things simple for your users.
Config.ENABLE_SETUP_BUTTONS = false
```
directsun  [author] 26 May, 2020 @ 9:29am 
Thanks for the kind words, yall. Thanks for that @quickle! I'll make the change soon.