crnormand / gurps

Implementing a GURPS 4e game aid for Foundry VTT
MIT License
105 stars 49 forks source link

Script Macros run for GM but not Players #991

Closed Farmeroz closed 3 years ago

Farmeroz commented 3 years ago

This issue became apparent in 0.11.7 and still appears in 0.11.8 and 0.11.9.

As a Player or Trusted Player, some Script Macros will not run (but Chat macros do).

Global settings for user levels are all set to allow Scripts and individual macro permissions are also set correctly.

Example of Script Macros that won't run for players but work for GM:

GURPS.executeOTF(/if [S:"Acrobatics"] [Dodge +2] /else [Dodge -2])

(I know this can be run as a chat macro, and it works in that case, but the above works for a GM level user but not a Player - and changing access level changes the ability to run it)

function fireballDamage(energy) { GURPS.executeOTF(/r [${energy}d burn] *Cost ${energy}FP) }

new Dialog({ title: Fireball Damage, content:

, buttons: { confirm: { label: "Confirm", callback: async (html) => fireballDamage(html.find('#energy').val()) } } }).render(true);

This works for GM but not player or trusted player. Note, it also does not adjust FP (or any other stat - please see other bug post).

Example of a Script Maco that does work:

if (game.paused) game.togglePause()

So a player who can't press space to unpause the game can run the above to do so.

crnormand commented 3 years ago

I am unable to recreate your problem.

I created a brand new world (in 0.11.9), 1 player and 2 actors. The gamemaster was logged into my local Foundry VTT, and the "player" logged into the world using Chrome (on my Windows 10 machine). I assigned ownership of the actors to the player, and when I clicked on the Execute Macro button (in Chrome), it showed: image

I tried the second macro (I didn't have the HTML, so I just put in a fixed number), executing the macro displayed: image

And when I pressed Confirm, it showed the damage in the chat log: image

There do not seem to be any permission issues. I know that the GURPS.executeOTF() function by itself does not do anything that requires permission.

Can you ZIP up your world and attach it? If you are running Foundry locally, it will be located in the Users Directory under Data/worlds.

Farmeroz commented 3 years ago

Thanks for checking into this.

After playing around with Fireball macro (as per other issue) it stopped working on both the playe rand GM side. So I went back to a chat I had with one of my players where I copy/pasted the script, and copied it back in. Now it works, as a script, on both player and GM. The "unpause" script also works both sides. However, now the Acrobatic Dodge script doesn't work as a Script (but does as a Chat - and yes I change the syntax appropriately for each) for either player or GM. Since it can be run as a Chat, it's no longer an issue except it's weird that there are issues at all. Fireball script as per other reported issue didn't like the suggested change in syntax, so it's running but not reducing FP.

World attached for reference.

ForgeVTT-export-chalandra-2021-10-09_19_17_11.zip

Thanks for your ongoing assistance :-)

Farmeroz commented 3 years ago

This is not faulting at all now. I don't know what the issue was, as I did try with no modules loaded and it didn't help, but now it's all good, so issue closed.