PDA

View Full Version : Roll on Table - receive an image?



Craftzero
September 20th, 2014, 14:22
I have created a table that has 50 rows. Each row has an image that I dragged onto it. What I'd like to do is have a player be able to roll on the table, and the image automatically be sent (shared) to them. Is this possible?

If I can't find a better way to do it, I'll have to have them roll on the table, I see which entry it is, go to my images, and drag/drop it onto their character. But that's a little clunky.

Basically, each row is a card with various effects (like the Torg deck, for us old timers). When a player has shown good roleplaying, I want to reward them with a card.

Any ideas/suggestions?

damned
September 20th, 2014, 14:39
Create Table. Set results to Hidden.

1 1 [image] Text
2 2 [Image] Text
3 3 [Image] Text
4 4 [Image] Text
5 5 [Image] Text
6 6 [Image] Text

Where [Image] is the image you drag onto the Table entry

If you do the roll then it will appear in your Chat along with the Image link.
Drag the Image link onto the Character Portrait and it will privately share with that player.

I couldnt get it to work for the Player doing the roll without the players being able to cheat and peek at the other images...

Craftzero
September 20th, 2014, 17:22
Thanks for helping me on this! But perhaps I'm doing something wrong. On my DM screen (below) I'm doing the rolling on the screen. The result shows up in the text box (where it says [Table] Inspiration Deck = Adv), I try to drag it - and what I'm actually dragging says, [TABLE] - and when I drop it on the player nothing happens.

7484

Ikael
September 20th, 2014, 18:08
Thanks for helping me on this! But perhaps I'm doing something wrong. On my DM screen (below) I'm doing the rolling on the screen. The result shows up in the text box (where it says [Table] Inspiration Deck = Adv), I try to drag it - and what I'm actually dragging says, [TABLE] - and when I drop it on the player nothing happens.

7484

Try clicking/dragging the shield-icon in chat next to question mark. That's the shortcut to your image :)

damned
September 21st, 2014, 04:35
Maybe this helps - I messed up the layer masking - will do again tonight.

7488

Craftzero
September 21st, 2014, 07:58
Yes, thank you both! It works great. I really appreciate it.

Irondrake
September 21st, 2014, 10:12
I didn't know tables supported images. That's good to know! Wonder how hard it would be to assign tokens based on rolled images from a table...so an army of kobolds didn't all look exactly the same without creating a separate NPC record for each one you wanted different.

Trenloe
September 22nd, 2014, 01:40
Wonder how hard it would be to assign tokens based on rolled images from a table...so an army of kobolds didn't all look exactly the same without creating a separate NPC record for each one you wanted different.
It's possible, but there would have to be a few areas of custom code:

Currently tokens are not supported as a linked record in a table - this would have to be changed.
The NPC record would need to be able to handle linking of a "token table" - so the code knows which table to use to get to the token.
Then the result of this table (once token linking has been coded) would have to be rolled in the background during the combat tracker onDrop event (when a single NPC was added to the combat tracker) or the CombatManager.addBattle code (for when an encounter was used to add the NPCs to the combat tracker) and the resulting token from the table roll be applied to the NPC token field in the combat tracker.

It's this last thing that might be difficult as rolling on a table is asynchronous (the code that kicks off the table roll doesn't wait for the result of the roll - you need to code for the result of the roll in a handle result function). So, in this case, it would probably be better to code the "dice" roll on a token table as a random number generator (LUA math.random) as part of this particular code, so that the result of the roll could be applied to the table and the token needed extracted all during the process of adding the NPC/s to the combat tracker - not having to code a separate table rolling/token applying handler.

So, it's all doable - there would have to be changes to the ruleset in question in a number of places.

Moon Wizard
September 22nd, 2014, 02:48
If you did this, I wouldn't use the rollable tables at all. I would just add ability to define "token sets" for NPC records, and add a handler in the CT onDrop event. Just generate a random number to pick the token to assign.

Cheers,
JPG

Irondrake
September 23rd, 2014, 05:03
Yeah Moons idea sounds less painful.

Trenloe
September 23rd, 2014, 05:37
A potentially quicker option (but needs manual editing of token file names) is to assign a token to an NPC, for example skeleton.png. Then have code that randomly assigns a number value (1-3, 1-4, 1-6 - whatever is the best) to the token name to give: skeleton_1.png, skeleton_2.png, skeleton_3.png etc.. Not as elegant as having a section in the NPC record where you can drag tokens and then use those at random, but less coding - especially on the GUI side.

Irondrake
September 24th, 2014, 00:18
Hmmm, not a bad thought either. Something else to consider is shapeshifters. A way to have a user be able to select which token they will use instead of it always being random without an additional NPC record. Of course that only works if their stats don't change. In the current implementation of 5E, the stats change completely for druids...hmm, rethinking...

Craftzero
September 24th, 2014, 03:05
Not to derail where the conversation is going (because it is interesting!) - I do have to say I've run into a problem.

The table works perfectly when I originally set it up - I dragged the images out to each of the appropriate rows, and when I rolled on the table, I could see the image in the chat area by clicking on it. Unfortunately - if I log out and back into Fantasy Grounds - the images will suddenly start showing up as blank. They're still in the same exact folder, and the table looks perfect - but the 'cards' themselves are blank. Any ideas?

(First image is what it looks like before I got out, second image is what it looks like after I log out and back in)

7524

7523

damned
September 24th, 2014, 04:22
how can you derail the thread by bringing it back to where it started? :)

i havent had time to investigate but Ive been seeing something similar with the Pulp Photo Tokens module I put out earlier...

If I close FG and re-open I can only see a couple of tokens in the pack until I cose and re-open the module.
I will retest on 3.0.8 later and will log it as an issue if it persists...
Suggest you do the same - update to 3.0.8 and retest...

Craftzero
September 24th, 2014, 21:57
Confirmed: I tested with 3.0.8, and the table does not 'remember' images stored on it between sessions.

damned
September 24th, 2014, 22:17
Did you use a module to store the images?
Does opening and closing the module re-enable the images?

You need to log this in the https://www.fantasygrounds.com/forums/showthread.php?21870-Test-release-v3-0-8/page9 thread too.

Craftzero
September 25th, 2014, 03:01
No, the images were dragged and dropped into the Images folder (\\fantasy grounds\campaigns\(campaign name)\images)

How can I add them to a module, if that's my problem?

Craftzero
September 27th, 2014, 15:00
Hey Damned, I've done a little work, and I'm bringing in those cards into a module. Because once I do that - it works, and it 'remembers' the cards. But I have a quick question.

I took the FGBattle Maps module as an example of a module that contains images. I thought it the best place to start. I started stripping out the images of streets and the like and replacing them with the names of the cards (all 61 of 'em!).

However, I got to what I thought was the end, and found two sections that worried me: <library> and <lists>. They currently contain some odd references, and <lists> has lines for each of those battlemap streets again! Do I need to do what I did in the <image> section again in the <lists>? Or can I delete both those sections with a sigh of relief? :) (Or can you point me to a tutorial on how to decode this if you're not sure?)

7547

damned
September 27th, 2014, 15:07
hmmm... if you are doing it that way - you most likely will need to edit these too...

the easiest way to do it is to start a blank campaign and add images and tables and just export those using /export

if you have no other images or tables you could do the same with your current campaign - just exporting images and tables. even if you do have some others you can always open the xml up and remove the extras - this is probably much quicker than creating one from scratch... although there are advantages to creating a module the way you are doing it...

Craftzero
September 27th, 2014, 15:10
although there are advantages to creating a module the way you are doing it...
Yes indeed, butting my head against a wall, lol!

Do you know where I could learn some of what this language means, what I can change and what I can't?

(and thanks for your help, as always)

Ikael
September 27th, 2014, 15:15
Hey Damned, I've done a little work, and I'm bringing in those cards into a module. Because once I do that - it works, and it 'remembers' the cards. But I have a quick question.

I took the FGBattle Maps module as an example of a module that contains images. I thought it the best place to start. I started stripping out the images of streets and the like and replacing them with the names of the cards (all 61 of 'em!).

However, I got to what I thought was the end, and found two sections that worried me: <library> and <lists>. They currently contain some odd references, and <lists> has lines for each of those battlemap streets again! Do I need to do what I did in the <image> section again in the <lists>? Or can I delete both those sections with a sigh of relief? :) (Or can you point me to a tutorial on how to decode this if you're not sure?)

7547

The library element is required if you want to display your module content library window. If you use approach Damned described it will do the work for you. Doing it manually grants you more flexibility if you need to do something special. If you export, then your module is usable only in the ruleset you used to export.

Craftzero
September 27th, 2014, 15:30
Excellent! Thank you both!