Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Using multiple dice-mod rolls in one template causes errors #277

Open
3 of 7 tasks
bhemmelgarn opened this issue Nov 28, 2023 · 6 comments · Fixed by #279 or #286
Open
3 of 7 tasks

🐞 Using multiple dice-mod rolls in one template causes errors #277

bhemmelgarn opened this issue Nov 28, 2023 · 6 comments · Fixed by #279 or #286

Comments

@bhemmelgarn
Copy link

Check for existing bug reports before submitting.

  • I searched for existing Bug Reports and found no similar reports.

Expected Behavior

Rolls should correctly reference and output

Current behaviour

All kinds of wires get crossed, formatting goes crazy, and some rolls entirely don't render. No matter the combination of steps used, the results are (within wide variation) the same.
Dice Roller ex1
Dice Roller ex2
Dice Roller ex3
Dice Roller Sandbox ex1
Dice Roller Sandbox ex2

Reproduction

  1. Launch a sandbox vault
  2. install Dice Roller and Templater (or templates)
  3. Set up your reference folder
  4. Set up tables/notes to roll from
  5. Set up the template that you are using. It must contain at least 3 rolls using dice-mod. The more rolls, the more significant the errors become.
  6. Use Templater (or templates) to insert the template into a note

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version Check

1.5

Plugin Version

10.4.0

Confirmation

  • I have disabled all other plugins and the issue still persists.

Possible solution

So if I create a template for each roll and insert them one at a time, it works. It seems like the issue is when multiple dice are rolled simultaneously. The solution may be on the template end, or coding in an await function into the plugin itself.

@xgdgsc
Copy link
Contributor

xgdgsc commented Nov 30, 2023

I used to workaround it by inserting multiple dice commands inbetween dice-mod commands. But recent update has some performance improvements that breaks it for me. It' s an old problem https://forum.obsidian.md/t/data-race-safe-way-of-modifying-files/30847 . Reverting to 10.3.0 works for me. I don' t know if you or other plugin can add a configurable delay (say 1s) to before dice-mod or after dice-mod to make it work.

@xgdgsc
Copy link
Contributor

xgdgsc commented Jan 3, 2024

Thanks for the update, I tried 10.4.1 but it still doesn' t work for me.

@valentine195
Copy link
Member

Can you give me a reproducible markdown file?

@valentine195 valentine195 reopened this Jan 4, 2024
@xgdgsc
Copy link
Contributor

xgdgsc commented Jan 4, 2024

 
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]

---
### 📅 Daily Focus

##### 🚀  Things I plan to accomplish today is...
- [ ] <% tp.file.cursor() %>
- [ ] 
- [ ] 

#####  🌜  Things I plan to entertain today is...
- [ ]  drink: `dice-mod: [[ent/drink#^drink-id]]|name`
- sport: `dice: [[ent/sport#^sport-id]]|name`
<%* const dayOfWeek = moment().weekday(); console.log( "m", dayOfWeek) -%>
<%* if (( dayOfWeek != 5 ) && ( dayOfWeek != 6 ))  { -%>
- [ ]  inv: `dice: [[inv#^inv-id]]|name`
- next-morning: `dice: [[ent/food#^break-id]]|name`
<%* } else { -%>
- lunch: `dice: [[ent/food#^lunch-id]]|name`
<%* } -%>
- g: `dice-mod: [[ent/g#^g-id]]|name`

# 📝 Notes
- 

---

This is the daily template. Those lists of ent/drink ent/sport are just lists like:

| gen   | name      |
|:----- |:--------- |
| caffaine2   |   coffee   |
| caffaine1   | tea        |
| nocaff  |   water     |
| nocaff  | water       |

^drink-id

@xgdgsc
Copy link
Contributor

xgdgsc commented Jan 10, 2024

Might better keep it open?

@valentine195 valentine195 reopened this Jan 10, 2024
@mabgriff
Copy link

I'm having this issue as well on version 10.4.6. Using multiple dice-mod commands in a template (Obsidian templates, Templater is not installed) results in some of the commands not populating in notes using that template. I can force them to populate by making any change to the text block they're in (add a space after a period, whatever) and then going back to view mode, so it seems like Obsidian maybe skipped them and had to be reminded to go back and evaluate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants