PDA

View Full Version : Always The Client??



UrsaTeddy
July 30th, 2022, 02:29
Greetings,

First off I am using the Mac OS version of FGU as my main Fantasy Grounds.

I have resumed working on an extension that does different things based on if the user is the GM (Host?) or a Player (Client?).

To this end I am using Session.IsHost to differentiate the two entities.

However when I start FGU in either the LAN or Cloud versions, the first instance that I start thinks that it is a Client (Session.IsHost is false), thus defeating the purpose of detecting which is a Host and which is a Client.

Am I doing this incorrectly? Or is there some other way of doing this?

I could have sworn this was working correctly a couple of versions ago.

D

Zacchaeus
July 30th, 2022, 09:09
I don't know but would the first instance be the client until another instance joins when it would become the host?

UrsaTeddy
July 30th, 2022, 11:10
Then it defeats the purpose of "Load Game" versus "Join Game" in the initial interface.

If I Load Game then I am intending to Host the game (or work on my development campaign) whereas if I Join Game I am intending to be a Client.

This is how it used to work (maybe 2 or 3 updates ago).

My extension checks to see if it is a Host or a Client to present settings (to Host only) and display the choices made (to Clients) so it is important to see which mode it is running in.

This is already done in the normal barebones version of FGU - some options are GM only for example.

Unless it is the ruleset I am using ... I should check that ... hmmm.

Just checked it with another ruleset and I am getting the same results.

The code I am using for checking this is quite straight forward ...



if not Session.isHost
then
Debug.chat("I AM THE CLIENT!!!!")
else
Debug.chat("I AM THE HOST!!!!")
end


... note I am only really interested in it being a client hence the "if not"


Okay you can ignore this completely now ... turns out I spelt Session.IsHost with a small 'i' instead of the capital. It was so easy to skip over when just reading lines of code.

Issue resolved.