Saibot393 / LocknKey

A Foundry VTT module to handle locking and unlocking of doors and other objects
MIT License
10 stars 7 forks source link

Not working with Sandbox system? #16

Closed McAwesum00 closed 1 year ago

McAwesum00 commented 1 year ago

Hi there. Been trying to use the Lock and Key module with the Sandbox system and I can't seem to get any of the functions to work. I applied the "sword;" key to the "Sword Key" compendium item and also on one of the locked doors, but nothing happens and no pop-ups also occur. I am adding my world from foundry/forge-vtt to test. ForgeVTT-export-test-2023-08-14_21_24_13.zip

Saibot393 commented 1 year ago

I took a look at the world but it seems quite broken to me (at least in Foundry v10). Since Sandbox is ony officially supported for Foundry v9, i assume thats the version you use? In this case there could be a core compatibility issue since Lock & Key is only supported for v10 updwards. I will still take a look at it and see if i can do something about but i can not guarantee for anything.

McAwesum00 commented 1 year ago

Oh, you might need the updated version~ This is the version of Sandbox I am using. I am on Foundry v10 Stable - Patch 7 (Build 303). sandbox_0.14.0.dev_RC7_20230205024717.zip

Saibot393 commented 1 year ago

I just released an update (v1.8.2) which should fix the compatibility issues. Theres were some problems going on with the way inventories are handled in sandbox. Thanks for including the save and the system files in the issue, helped a lot with fixing the problem.

McAwesum00 commented 1 year ago

Nice! I'll check it out ASAP! Thank you!

McAwesum00 commented 1 year ago

Hi, again. I still can't seem to get the module to work. I still don't even see the popup messages for the locks. Do you think it's another module interfering perhaps? or is it because I am not putting the correct format in the "Type of key items" box? do I just put citem? or "citem" or 'citem'? is it case sensetive? like cItem or cITEM? sorry for all the questions and trouble. image

Saibot393 commented 1 year ago

"cItem" should be the correct one. Just to make sure, when shift+right clicking a door no item generated in the item tab, right? In this case, doe any error messages pop up in the console (F12), when doing that? It could in theory be a problem with other modules interfering, could you send me list of the modules installed?

McAwesum00 commented 1 year ago

Here are all the modules I am using in this game. I'll try and get you some console messages. image image image

McAwesum00 commented 1 year ago

Here is the console commands. It seems like it is creating keys. But I am still not seeing pop-ups. Not sure if the keys are functioning as they are supposed to. but Shift+right click is making keys and new matching IDs. image

McAwesum00 commented 1 year ago

Oh okay. It seems like creating keys with shift+key does create functioning keys for the doors. But I tried copying the key ID data onto an item I had made previously and using that, and the item wouldn't work. Still not seeing the custom popups when the player tries to open the doors though.

Saibot393 commented 1 year ago

I think i found the problem, i will probably release an update, that hopefully fixes the compatibility issues, tomorrow

McAwesum00 commented 1 year ago

Great! Looking forward to it! Truly appreciate you responding and working on that so quickly! You are awesome!

McAwesum00 commented 1 year ago

Shoot! Didn't mean to close the issue! Wrong button. haha

Saibot393 commented 1 year ago

I just released v1.9.0 which should (hopefully) fix the compatibility issues, let me know if it worked

McAwesum00 commented 1 year ago

Okay~ After having one of my players help me test. Popup messages worked for lockpicking (shift+rightclick), and door breaking(alt+rightclicking), but not for locked doors (right+clicking). Also, I couldn't get the system to recognize lockpick cItems. When my player tries to open the door it says he's missing the item, even thought I set it in the module settings.

Also, as a request, can there be popup messages if the player attempts to but fails on lockpicking/breaking?

Saibot393 commented 1 year ago

I looked into it and solved the issue with the lockpick items (hopefully, again). Regarding the Popups messages for the locked doors, is there no message when a player successfully lockl/unlocks a door or if a player tries to unlock a door they do not have a matching key for?

Regarding the popup messages, there should already be Popup messages (Failed to break/pick lock), i would guess that that has something to do with the key popup issue

McAwesum00 commented 1 year ago

(in 1.9.0) Messages were popping up when the door was unlocked and locked with the appropriate keys. But the custom popup was not appearing when the door was attempted to be unlocked without the key.

I guess it makes sense that there would be popups for breaking/picking, but I didn't see them. I'll test the new version later tonight with my friend and see. Thanks again for your vigilance, patience, and hard work!

Saibot393 commented 1 year ago

I just released v1.9.1 which should fix the problem with the lockpick items. There is not yet a custom popup for not having a matching key, there was not even a standard popup (until now). I will add an option for custom popups in the next update.

McAwesum00 commented 1 year ago

Okay after having my player test stuff with me today.

(first two screenshots are mine. third is from my player) image image image

  1. I see this in the console when I have the Right click popup menu option turned on: image
Saibot393 commented 1 year ago

Regarding your points:

  1. Good to hear
  2. I will add a custom messages for that in the next update (or rather theres is a bug that prevents this message from showing, will be fixed in the next update)
  3. I can not quite figure out how to correctly reference skill values in this system, or rather they do not seem to update correctly from my testing so far. How would you for example roll a Handgun check in the chat?
  4. I can not reproduce the double rolling behaviour on my end, but i will keep looking, the empty text box with the GMs name was due to some text not being displayed correctly, will be fixed with the next update
McAwesum00 commented 1 year ago

Sandbox is a little weird, it's a system designed to help the GM build their own system and character sheets; so there isn't a universal way to reference skill values. I do know that the main thing that the system does reference a KEY on a Property. image Most of Sandox works by making new "items" in the Items tab. There several types of items that Sandbox recognizes: properties, panels, multipanels, sheettabs, groups, and citems. image Properties are the main thing to look at when dealing with Sandbox; a property is the basic form of data that the system looks at on a character sheet. If you want to reference a property on a character sheet you usually use @{key field data}; so for instance if I made a handun skill and named the Key "handgun" and I wanted to make a roll formula including it, it would probably be 1d20 +@{handgun} image Each property must have a chosen data type that it contains and that usually determines how Sandbox deals with it. image Tables are the other way to reference items on a character sheet. Tables deal with "groups" which usually references other properties or cItems. When referencing items in a table the formula changes a little bit. Table properties are referenced by a # instead of an @ symbol. So if I made a handgun cItem and put it in a table I would reference it as #{handgun} instead of @{handgun}

As an example. This is the character sheet I made for the game world I sent you that I am currently trying to set up. It is a ttrpg conversion of the Resident Evil Remake video game, but using a rule system that I created, and am using Sandbox to create my character sheets. image As you can see there are several properties that can affect my player's rolls.

  1. How many d20s to roll.
  2. Whether it's a normal, advantage, or disadvantage roll.
  3. If there are any injury penalties applied.
  4. My system is modular so I made an editable table that has skills and their skill mods and other bonuses to the roll.

So here is the SkillTableRoll property which contains the formula for die rolls. You can see the references to property keys on the character sheet and skill table. image

I hope this makes sense and helps. Apologies if it was too longwinded. if you want to learn more about Sandbox; these tutorials were made by the creator and explain how to use it and how it works https://youtube.com/playlist?list=PLMAQsyqo9jDFpHYy4WZv0eF_SgqotcUKs&si=ll2hIdu_f-J3Rq77

McAwesum00 commented 1 year ago

Oh, also as a note a property Key can be made by whomever is making the character sheets or can be autogenerated by Sandbox. There is no universal key for skills or bonuses. It's made by whatever you fill the Key box with. Not sure if I explained that part clearly, but wanted to make sure.

Saibot393 commented 1 year ago

I think i figured out how to theoretically access the values, here written in console code (ignore the yellow warnings): image As expected the system rolls a d20 and adds the value of Skill1ModL, which can be seen here: image This should correspond to the "Handgun" attribut of the character "Seth Ward" (see Skill1NameL above). Now, the problem is, that according to these values "Handgun" should be at a value of 5, which is (strangely) not the case: image Same happens with the api, so it seems to be the right place: image As far as i can see there is also no api function for accessing attributes via their name. If the above formula were to work lock break roles could for example be done like this: image I am currently a bit stuck but i will investigate further.

Saibot393 commented 1 year ago

Ok, figured it out, the roll formula to reference the first skill would look like this: @actor.system.attributes.TBL_SKILLSTABLE.tableitems.0.attributes.skillmod.value Replace the 0 with the position in the Skill table (starting at 0) to reference the different attributes of a character. I don't think i can build a system to reference values easier (or by name) due to the modularity of Sanbox, so this way of referencing will probably have to suffice

McAwesum00 commented 1 year ago

yeah, I understand that the modularity makes it a lot trickier to deal with, so I wasn't expecting a super perfect solution. Just was hoping to see if we could get some base functionality of it recognizing properties or something~ Excited to try out the next build!

Saibot393 commented 1 year ago

I just released v1.9.2, which should fix two bugs:

  1. The previuosly empty chat box with the GMs name should now have the correct content
  2. The custom popup for lefclicking a locked door should now be displayed correctly

Since i cannot reproduce the double rolling bug, i will probably need your world file to figure out what exactly is happening

McAwesum00 commented 1 year ago
  1. Whatever changes you made seemed to have fixed the double roll issue. So that's gone.
  2. the formula for accessing the character sheet is working the way you wrote it.
  3. however, I would love to be able to access the Roll Formulas in the properties as the formulas for the lockpick/breaking formulas. Not sure if you could get that to function or not~ image
  4. I not seeing the popup messages when leftclicking a door.

Here is my world if you need it still: ForgeVTT-export-test-2023-08-23_9_47_10.zip

Saibot393 commented 1 year ago

Regarding 3.: The problem is the modular nature of the module. I would have to write additional code to even reach these formulas (that could break for different worlds/character sheets) and then write an interpreter for the rolls themself (as far as i can see Synbox provides no api for that). Both of these (and especially the last) are bit out of scope for this mdoule. So i will probably not be able to include a feature for that, sorry. Regarding 4.: Should be fixed with v1.9.5

McAwesum00 commented 1 year ago
  1. Totally understand! I kind of figured as much, but thought I would bring it up just in case! I am honestly amazed you even put in as much effort and work as you already have in order to get Sandbox working with the module as is! You rock!
  2. I'll check it as soon as i can!
McAwesum00 commented 1 year ago

Okay! Just checked with my players and it seems like the popup messages are working correctly now! Thank you for everything!

Saibot393 commented 1 year ago

Good to hear that everything works now, should any more problems arise, feel free to add to this issee or open a new one. I will close this issue for now.