#Adventure Cards Macro
1 messages · Page 1 of 1 (latest)
Yes. Detect it is easy.
But, it's a string.
It might be language dependent though
That's their fault. ;P
That's why I choose the number.
No Adventure Cards for them!
It's harder to make a mistake.
I get what you mean though
I'll think how to add this then
done
work in 3 stages
Aditional stats on? will use it
Aditional stats off? will use rank
Aditional stats off no possible rank? will give 1
Great!
Nice fallbacks
So how does it know which card it has?
And where does it pull them from?
I did not undertand
I wipe every single item called "Adventure Card"
And add new one
They all just say "Adventure Card."
I was wondering how the item stores the data of which card it is
I also wondered if the item could have the name of the Adventure Card included, like Adventure Card: Love Interest.
I see.
i read a table result. I could grab something else.
So the user will have to make the table, correct?
Yes.
OK, so I would just name each item the table result name.
This would make horrible to wipe the cards.
Then if they name it "Adventure Card: Uh-Oh!" it'll use that.
I could add to description without pain
async function wipeAdventureCards(actorID) {
let character = game.actors.get(actorID);
let cards = character.items.filter(e => e.name===adventureCardName);
const ids = cards.map( card => card.id );
await character.deleteEmbeddedDocuments('Item', ids);
}
I would need to fix this
I can't predict what will be people tables.
Oh, you create the items, right?
The itens a create programmatily
You could add a flag on each of them.
async function createCard(actorID, imageLink) {
let rules = '';
let character = game.actors.get(actorID);
let data = [{
name: adventureCardName,
type: 'gear',
img: icon,
data: {
"description": `<img src="${imageLink}"/>`
}
}];
const createCard = await character.createEmbeddedDocuments('Item', data);
}
Yeah, inside of data, add a flags property.
Then you can search for those flags instead
I undertood.
So, I could put any name.
But, you could have a cool table, there you added the name of the items. But, for someone who only added the images, it'll be a mess. Ugly names.
No no, you just need to flag it with something like this...
flags:{
'swade-macros': {
type: 'Adventure Card'
}
}
Then when you want to wipe them, just search for that flag with item.getFlag('swade-macros', 'type')
The flag solution looks better. I'll make some tests.
But, what name the item will have?
I would just give it the name of the table result
Keep it simple. If users want something more meaningful, they can change the name of the Journal Entry.
I'll try
Flags are awesome. I use them a lot for a lot of different things.
I even use flags on drawings on a scene I'm bundling with a module. Then I search the flags for the thing I'm looking for.
let data = [{
name: adventureCardName,
type: 'gear',
img: icon,
data: {
"description": `<img src="${imageLink}"/>`,
flags:{
'swademacros': {
type: 'Adventure Card'
}
}
}
}];
@formal mirage just that?
let createCard = await character.createEmbeddedDocuments('Item', data);
createCard.setFlag('swademacros', 'type', 'Adventure Card');
this didn't work
Oh interesting. I guess add it in the data directly then
I like the new macro. The only thing odd I noticed was that it doesn't mark the cards as drawn in the table.
@half junco I also noticed an error because you assign the id to actorID but you try to reference it as actorid
This should fix it. I also updated the macro to create a variable for the selected table first and then use .drawMany() which then marks the card as drawn on the table.
Actually, I have a few other fixes I'm working on.
Thank you.
Something to consider is getting rid of wipeAdventureCards(). There are occasions when a player gets another card in the middle of a game such as interludes.
How can I clean old cards to give new ones then?
Add another button perhaps? I'm also trying to figure out how to deal only one card.
Also, I set resetTableAfterGiveCards to false. Once a card is drawn, it shouldn't be available again.
Not until a reset
Oh, maybe a reset would cover both wiping the card items and resetting the table
What problem is this?
Wiping cards
So we could add a Reset button that wipes the cards and resets the table
Let me know what you think of this. Need to head out for the evening. I can make more modifications after tomorrow.
Looks nice.
I think a Wipe Cards button should be added.
cool
small fix
use this to change something if you want
https://raw.githubusercontent.com/brunocalado/swademacros/main/macros/adventure-card-KRISTIAN.js