PDA

View Full Version : Can Player Disable Campaign Extension



dllewell
May 11th, 2020, 16:26
Is it possible for a player to disable an extension that is enabled in a game they join?

Specifics
I, as the GM, have an extension that puts my dice in a very specific location. It works great for the size and resolution of my monitor.

However, when players join my game this extension automatically loads for them. Because they have monitors with different sizes and resolutions it puts the dice in a 'weird' place for them.

Can the players disable or not load this specific extension when they are joined to my game.

Daniel

LordEntrails
May 11th, 2020, 16:29
Welcome to FG. No, players can not disable extensions.

mattekure
May 11th, 2020, 16:40
Players cannot unload or disable extensions, but perhaps the extension author can put in code that the code only gets executed for the GM.

dllewell
May 11th, 2020, 22:57
Thank you for the replies. Unfortunate, but not unexpected. I'll look at different options.

pr6i6e6st
May 12th, 2020, 23:45
Thank you for the replies. Unfortunate, but not unexpected. I'll look at different options.

if you don't mind looking at a bit of code, you could open the extension, and it's likely editing the desktop_pannel.xml or desktop_classes.xml files. in there for the extension, you can likely set it so that it's only for host that the change is applied.

damned
May 13th, 2020, 00:12
if User.isHost() then

dllewell
May 13th, 2020, 15:36
Thank you for the responses. I did look at the code and started down the same path as indicated above. Specifically the User.isHost() command. I could not, however, find any way to use the User.isHost() command to then call xml commands. The extension I'm modifying is actually the Move Dice extension that you wrote Damned.

Specifically, the gameelements.xml is modified. For each of the dice a <position> tag is added, see below -

<die name="d4">
<icon>d4icon</icon>
<position>-3050,-68</position>
</die>

I can add a <script> tag to the <die> tag but I can't then call the <position> tag from inside the function in the <script> tag

<die name="d4">
<icon>d4icon</icon>
<script>
function changePos()
if User.isHost() then
<position>-3050,-68</position>
end
end
</script>
</die>

I get this error when loading the extension - "Script Error: [string "d4"]:1: 'end' expected near '<eof>'". I did try the code with and without a semicolon at the end of the <position> tag line of code.

So. Is there a different way to call the xml tag from within the <script> tag? Or is there a way to set the position using lua code in the function? Or is there a different way to do this?

Sorry for the wall of text but I wanted to be clear on the code I was using.

pr6i6e6st
May 13th, 2020, 15:50
Thank you for the responses. I did look at the code and started down the same path as indicated above. Specifically the User.isHost() command. I could not, however, find any way to use the User.isHost() command to then call xml commands. The extension I'm modifying is actually the Move Dice extension that you wrote Damned.

Specifically, the gameelements.xml is modified. For each of the dice a <position> tag is added, see below -

<die name="d4">
<icon>d4icon</icon>
<position>-3050,-68</position>
</die>

I can add a <script> tag to the <die> tag but I can't then call the <position> tag from inside the function in the <script> tag

<die name="d4">
<icon>d4icon</icon>
<script>
function changePos()
if User.isHost() then
<position>-3050,-68</position>
end
end
</script>
</die>

I get this error when loading the extension - "Script Error: [string "d4"]:1: 'end' expected near '<eof>'". I did try the code with and without a semicolon at the end of the <position> tag line of code.

So. Is there a different way to call the xml tag from within the <script> tag? Or is there a way to set the position using lua code in the function? Or is there a different way to do this?

Sorry for the wall of text but I wanted to be clear on the code I was using.

try replacing it with this and see if that works (you will need to set your coordinates yourself, my d4 is set at <position>470,-68</position>)




<!--GM's Dice -->
<die name="d4">
<icon>d4icon</icon>
<position>distancefromleftinpixels,distancefromtopinpixels</position>
<script>
function onInit()
if User.isHost() then
setVisible(true);
else
setVisible(false);
end
</script>
</die>


<!--Player's Dice -->
<die name="d4">
<icon>d4icon</icon>
<position>distancefromleftinpixels,distancefromtopinpixels</position>
<script>
function onInit()
if not User.isHost() then
setVisible(false);
else
setVisible(true);
end
</script>
</die>

dllewell
May 13th, 2020, 22:30
pr6i6e6st - Good idea. Unfortunately, that does not appear to work.

Whatever <position> values are put in the second <die> tag are what are used.

I added some Debug.chat calls and best I can tell the <script> is never called.

Reviewing the Developer Ruleset API Reference for the <die> tag it does not look like the <script> tag is an option here. (https://www.fantasygrounds.com/refdoc/die.xcp)

-----

die
This definition is used to define the properties of a built-in die resource.

If a standard die type (d4,d6,d8,d10,d12,d20,dF) is defined, the 3D model of the die will be available on the desktop.

Definition
<die name="..." >
<icon > ... </icon> The name of an icon resource used to represent the die results in the chat log
<position > ... </position> The default placement of the die on the desktop in the form "x,y"
</die>

pr6i6e6st
May 13th, 2020, 22:33
what about changing the first line <die name="d4" mode="host"> and a duplicate d4 control which has the mode "client"? scratch the script stuff.

Trenloe
May 13th, 2020, 22:40
Whatever <position> values are put in the second <die> tag are what are used..
This is because <die name="d4"> is unique within the FG environment and so overwrites/merges with any previous uses of that - and this true for all root level XML tag/name combinations.


I added some Debug.chat calls and best I can tell the <script> is never called.
customdie has a script, not die (because that isn't custom and so doesn't need a script to change the value): https://www.fantasygrounds.com/refdoc/customdie.xcp

I don't think you'll be able to use modes="host" as this is reserved for desktop panels: https://www.fantasygrounds.com/refdoc/panel.xcp But, hey, give it a quick go.

dllewell
May 13th, 2020, 23:24
what about changing the first line <die name="d4" mode="host"> and a duplicate d4 control which has the mode "client"? scratch the script stuff.

I tried it. No luck. It appears to completely ignore the mode statement.


customdie has a script, not die (because that isn't custom and so doesn't need a script to change the value): https://www.fantasygrounds.com/refdoc/customdie.xcp

I looked at that but I don't believe it will work. From reading the description this doesn't create a new dice that could be put on the screen. It adds an option to an existing dice.

For example. There is code in the gamelements.xml file of the CoreRPG ruleset that uses <customdie> to create a "d3" and "d2"


<customdie name="d3">
<model>d6</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.ceil(result/2);
end
</script>
</customdie>
<customdie name="d2">
<model>d6</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.ceil(result/3);
end
</script>
</customdie>

You can see that by right-clicking the 6 Sided die to bring up the radial menu. It has a 'custom die' option which you can click on. That will bring up the "d2" and "d3" custom dice.

35351

I did confirm this by adding a custom "d5" die and confirming that it showed up under the custom die radial of the "d10"



<customdie name="d5">
<model>d10</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.ceil(result/2);
end
</script>
</customdie>


I really do appreciate the suggestions. I'm beginning to feel like the '***' in the room. You keep coming up with ideas and I keep saying 'nope, nope, nope'.

damned
May 13th, 2020, 23:50
Testing and finding out stuff doesnt work is still both useful and a learning experience.
It would be nicer if it did work but sometimes there isnt an answer.

The other thing that might be possible - if you can find where the Arrange Dice info is stored on your computer.
But damned if I can locate it!
Maybe it is only stored in Memory....

Trenloe
May 14th, 2020, 08:33
Re customdie. So sorry, I wasn't suggesting to use that. I was just referencing where a script could be associated with a die, I wasn't saying that it would allow you to do what you want. Sorry for wasting your time.

I really don't think you have an option here.

Trenloe
May 14th, 2020, 08:35
Maybe it is only stored in Memory....
Yep, it is. It resets when you reload your campaign.

dllewell
May 14th, 2020, 13:32
Re customdie. So sorry, I wasn't suggesting to use that. I was just referencing where a script could be associated with a die, I wasn't saying that it would allow you to do what you want. Sorry for wasting your time.

I really don't think you have an option here.

Oh, OK. No worries. It gave me the opportunity to learn a little more by trying out that code. So, in my mind, no time was wasted.

Tuleen Donai
June 18th, 2020, 00:14
You mentioned that players cannot unload extensions.

Do players need to download/purchase extensions that the GM has in his installation? Or, do they get downloaded to their instance much like book content, and unloaded upon exit?

Reason I ask, is that I have purchased a few 5e extensions that help with effects like Luck, or other Bardish-like effects, and will my Bardish player, who didn't purchase them, still have "access" to them?

JohnD
June 18th, 2020, 00:27
The GM loads the extensions so their players only get whatever the GM decides.

LordEntrails
June 18th, 2020, 00:55
You players will be fine. Extensions change the ruleset code, so when your players connect to your game, they will download your extension modified code. It all goes in their campaign cache on the player computer.

You purchase the extensions, all your players have access to the new functions.

Tuleen Donai
June 18th, 2020, 01:08
you players will be fine. Extensions change the ruleset code, so when your players connect to your game, they will download your extension modified code. It all goes in their campaign cache on the player computer.

You purchase the extensions, all your players have access to the new functions.

Awesome! ( I was kind of counting on this! )