-
March 31st, 2024, 19:28 #1
User.requestIdentity - invoke host function
If I understand correctly how User.requestIdentity works, it is used when it is necessary to generate a record. From what I've seen, the idea behind its use is that the creation is always done by the host, I imagine to avoid the generation of duplicate IDs.
The behavior should be this:
Event
--> if Host --> record generation
--> if client --> generation request to the host with indication of the host function that must perform the activity. The host function receives two parameters indicating whether it succeeded in creating a new ID and the ID to use.
Did I get it right?
Assuming that I have understood correctly how the code should be organized if instead of creating a single record, the request must perform the creation of n records (perhaps with a loop)?
I imagine if the event occurs on the host there would be no problem, but what about the client? Should the client make the request to generate inside a loop? And what happens if for each record generated, other subrecords must be generated (a nested list)?
What I need to generate I have a structure like this:
Code:<mylist1> <id-00001> ... fields <mylist2> <id-00001> ... other fields </id-00001> <id-00002> ... other fields </id-00002> </mylist2> </id-00001> <id-00002> ... fields <mylist2> <id-00001> ... other fields </id-00001> </mylist2> </id-00002> <id-00003> ... fields <mylist2> <id-00001> ... other fields </id-00001> <id-00002> ... other fields </id-00002> <id-00003> ... other fields </id-00003> </mylist2> </id-00003> ... </mylist1>
And what if I have to generate the entire mylist1 structure with all elements (id0001, id0002, etc.)?
Is there a way to invoke a function on the host, regardless of generating an ID? If that were the case, the host function would do the generation, so I wouldn't have to worry about duplicate IDs.
-
April 1st, 2024, 00:47 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,993
You should not use the User.requestIdentity for anything. It is purely a simple API to generate new character sheets, based on a few other settings.
If you want a Player client to send a request to the Host client to generate a record on a record not owned by the player, you should use a OOB message to send a request to the host, which the host can then use to add a new sub-record using the information in the OOB message. (For consistency, you can send the message on both Host and Player instances with a target of Host only; and the Host will handle either source.) There are many examples of that in the existing rulesets (in CoreRPG, it's used in DiceTowerManager, EffectManager, ItemManager, LanguageManager, and more.)
Regards,
JPG
-
April 2nd, 2024, 12:04 #3
-
April 2nd, 2024, 13:25 #4
Are you referring to the database id-XXXXX intermediate node name? If so, use DB.createChild without a "type": https://fantasygroundsunity.atlassia...DB#createChild
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 2nd, 2024, 16:09 #5
-
April 2nd, 2024, 16:32 #6Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 2nd, 2024, 19:15 #7
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks