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

17.17-b4 Roll Confirmation breaks multiple damage rolls even if disabled #2112

Closed
devakm opened this issue Jan 11, 2025 · 6 comments · Fixed by #2114
Closed

17.17-b4 Roll Confirmation breaks multiple damage rolls even if disabled #2112

devakm opened this issue Jan 11, 2025 · 6 comments · Fixed by #2114
Assignees
Labels
bug Something isn't working

Comments

@devakm
Copy link

devakm commented Jan 11, 2025

This works if Roll Confirmation is disabled; if enabled it only rolls the last one: /r [2d (2) pi] \\/r [1d burn]

The issue happens even with separate executeOTF statements.

let attackDamageOtF = '[1d-4 cr]'; // [6d+14 imp] or [2d+4 cr] or [2d+4 (2) cr] 
let followUpDamage = '[1d-4 burn]'; // default follow-up damage

function wait(x) {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve(x);
      }, 10000);
    });
  }

await GURPS.executeOTF(`/r ${attackDamageOtF}`); 
await wait(1);
await GURPS.executeOTF(`/r ${followUpDamage}`); 

With Roll Confirmation enabled, the added delay lets both rolls work as long as you click the first Roll Confirmation fast enough. However, if you disable Roll Confirmation, the second executeOTF never runs.

Using regular chat rolls, this next OtF works only if Roll Confirmation is enabled; if not enabled it only rolls the last one:
["Explosion with Fragments" /4d-1 cr\\/2d cut]

@mjeffw
Copy link
Collaborator

mjeffw commented Jan 11, 2025

Furthermore, entering /r [2d burn] without an actor selected or a token targeted silently fails. Is this the same bug, or something new, @chrismaille?

@mjeffw mjeffw added the bug Something isn't working label Jan 11, 2025
@mjeffw
Copy link
Collaborator

mjeffw commented Jan 11, 2025

This bug is related to some code in gurps.js:

Lines 668-672:

        // Before open a new dialog, we need to make sure
        // all other dialogs are closed, because bucket must be reset
        // before we start a new roll
        await $(document).find('.dialog-button.cancel').click().promise()
        await dialog.render(true)

The first command is executed, it calls await dialog.render(true) and shows the dialog for the first damage roll. The thread is released at this point, allowing the next command to execute. It reaches this statement:

await $(document).find('.dialog-button.cancel').click().promise()

Which clicks on and closes the first dialog. Then it called render() and is shown.

There needs to be a way to pause/queue up other commands while the dialog is open.

@mjeffw
Copy link
Collaborator

mjeffw commented Jan 11, 2025

I have a fix for this, but I want @chrismaille to review it before closing this bug.

@devakm
Copy link
Author

devakm commented Jan 12, 2025

The fix is working for me. Have not seen any other side-effects, but I'm not an expert/

@chrismaille
Copy link
Contributor

Bug is related to GURPS.LastActor logic and the line $(document).find('.dialog-button.cancel').click().promise() is needed. Working on that.

@mjeffw
Copy link
Collaborator

mjeffw commented Jan 12, 2025

Bug is related to GURPS.LastActor logic and the line $(document).find('.dialog-button.cancel').click().promise() is needed. Working on that.

I put in a fix and created a PR for you to review. Check it out before spending any time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants