Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

FATE cards (result + competence + sentence) in the chat

1622209387

Edited 1623422359
Divers
Pro
Sheet Author
[EDIT] [SOLVED] Big thanks to The Aaron. Solution in one of the last posts ********************************** For the FATE game, I am interested in FATE cards (used instead of rolling FATE dices. It adds an aspect sentence. This sentence is linked to the "roll" result, bad vs good result. There is a FATE card deck, which is nice. But the result doesn't appear in the chat. And it is not bound to a competence. Is there a way to get a roll (From Rolling dice or from card deck), adding competence to the result of the roll, binding a sentence from the card deck, and displaying result in the chat... The only solution I can imagine is writing a tablesform scratch for the 81*2 = 162 couples  [result + sentence] :-/
1623233199
Divers
Pro
Sheet Author
Does anybody have an idea of how to achieve this ?
1623242506
The Aaron
Roll20 Production Team
API Scripter
Are the sentences: specific the the pattern of dice rolled? (+-++ is not the same as +++-) or specific too the number result? (+1 is always the same sentence) or are there multiple for each combination? ( there are many sentences that -1 might show)
1623249893
Divers
Pro
Sheet Author
I don't feel alone in this thread anymore ;-) Thanks ! Actually a "card" is a roll of 4 Fate Dices, the result (sum of the faces), and 2 sentences. not specific to the pattern not specific to the result multiple sentences for the same result For example [ "_++-", +1, Position of Strength, Perceptive], ["++--", 0, High Tension, Ebb &amp; Flow],&nbsp; ["__-+", 0, Neutral Discovery, Fair Play] <a href="https://rpggeek.com/image/1797336/deck-fate" rel="nofollow">https://rpggeek.com/image/1797336/deck-fate</a> Notices that the 2 sentences on the card are not linked together. =&gt; What we could do : draw a result according to the probability distribution (sum of 4 Fate Dices : 2 faces "+1", 2 faces "-1", 2 faces "0") show [result + selected competence] in the chat draw independently 2 sentences in a card pool. The pool is function of the result. There is one pool of sentences for each result. show those 2 sentences in the chat This solution would be nice. But I would have the 9 pools of sentences (from -4 to +4) to write by hand... ********************************************************* =&gt; What would be better : Draw a card from the character sheet (from a button associated to a competence) show in the chat the value of the competence, and the card (result + 2 sentences, I guess it is an image) To improve&nbsp; this : get "result" as variable, sending "result" + competence to the chat, with the 2 sentences
1623250197
Divers
Pro
Sheet Author
The Fate deck from roll20 : <a href="https://marketplace.roll20.net/browse/gameaddon/4980/the-deck-of-fate" rel="nofollow">https://marketplace.roll20.net/browse/gameaddon/4980/the-deck-of-fate</a>
1623250389
Divers
Pro
Sheet Author
To be more concise : I need to log in the chat [result, competence, 2 sentences]. With sentences linked to the result. Drawing a card from the Fate Deck is a pain as we loose the log of the rolls, and we have to remember and add by hand the competence.
1623251052
The Aaron
Roll20 Production Team
API Scripter
Would it work to have the card show up in the chat when you draw it?
1623251869
Divers
Pro
Sheet Author
oh yeah ! that would be great !! Minor improvement : show it side by side with the competence value ;-) If you have a solution to show the card in the chat, I could improve it ion a macro, or a "roll button".
1623253114
The Aaron
Roll20 Production Team
API Scripter
I don't actually play FATE, so I don't know what the competency value is, is that like a player's skill bonus?&nbsp; Assuming that's the case, showing it next to a card might be a bit difficult, but tell me all about it and we'll see. My idea would be to have an API script that watches for cards from a particular deck and then injects a message showing their face when they are visible on the table.&nbsp; That could be done pretty easily, particularly for a deck from an Addon as it will have a static id for every game it's added into.&nbsp; It will get a bit more complicated with additional information you want to show next to it, like which Character it's for.&nbsp; Cards are drawn by Players, so the Character would need to be inferred either by finding all the Characters that Player can control (hopefully 1) and displaying it, or by looking at the Speaking As field.
1623322175
Divers
Pro
Sheet Author
Thanks a lot for this nice ideas !! A "competence" is an integer, which is added to the roll result. ie if Competence1 is equal to 2, and the roll "++-_", we get 2+1=3 as the competence roll. The card, and hence the sentences, is associated to "1", and not to "3". Each player controls a unique character sheet, that means we could infer the character. Is it possible that the API ask for the competence ? Like rolls asking something to the player ?{Which competence?|Option1|Option2|Option3|Option4|Option5} ******************************** If we could draw a card from an API, or from a macro, a better idea could be to modify the Fate Character Sheet. As it is, it embeds roll buttons for each competence (send [Competence+roll result] to the chat. In that case, instead of rolling Fate dices, the competence button would send the competence to the chat, next to the card.
1623322513

Edited 1623322636
Divers
Pro
Sheet Author
I am wondering if we could find a solution publishable in the public Fate Character Sheet. I guess not as an API needs to be involved. I've found this : <a href="https://app.roll20.net/forum/post/7687278/script-dealer/?pageforid=7687278#post-7687278" rel="nofollow">https://app.roll20.net/forum/post/7687278/script-dealer/?pageforid=7687278#post-7687278</a> The author of this post thanks you " Once again, thanks to Scott C. The Aaron and GiGs for their time an patience." Thanks again !!
1623322873
Divers
Pro
Sheet Author
In this wiki page <a href="https://wiki.roll20.net/Button#Action_Button" rel="nofollow">https://wiki.roll20.net/Button#Action_Button</a> , I can see "Instead of using just normal macros in your rolls, you can choose to include API commands". So : Roll button in the character sheet =&gt; API which deals a card (send the card to the chat) =&gt; asks for the competence (send the name+value to the chat)
1623329128
The Aaron
Roll20 Production Team
API Scripter
Here's a few workflows that might work without modifying the character sheet: Player plays a card to the table, API whispers them a prompt for their competency (Possibly with buttons for each character they control, ordered by what's most likely based on Speaking As and tokens on the current page), when they've answered the prompt, display the card with the competency next to it. Player runs an API command via a button which specifies the competency (and possibly the character), the API then deals a card to the table and outputs it to chat with the competency. You're correct that modifying the Character Sheet to call an API would be the only way to tie into the deck system.&nbsp; I'd rather not get into character sheet mods. =D&nbsp; If you did do that, it would basically be like the second bullet above, or: Player runs an API command to declare the Character and Competency, then deals a card to the table to fulfill the check. I looked at the deck last night.&nbsp; Each card is named for the roll result, so I can get a total by finding the card object for the played card and checking its name.&nbsp; They are actually specific to the rolls, you can see the dice they represent in the stylized dice along the sides, but that information is not directly encoded in the information the API has access to.&nbsp; I'm not sure it's overly important either, but it is a detail. =D Realistically, I'm thinking doing the first and third bullets in a script is the way to go.&nbsp; That would let you automate as much of it as you wanted by editing the character sheet or creating abilities for each skill, etc, but still gives the players the excitement of drawing that next card.&nbsp; And later, someone could modify the Character Sheet to do the setup. Whatcha think?
1623335922
Divers
Pro
Sheet Author
That sounds great !! I follow you, the third bullet seems a good way to go. Easy to use, and everything in the chat. Embedin,g that in a character sheet on a roll button is not that important. (my mistake: what I call a "competence" is indeed a "skill", I will use the word "skill" from know on). I tried my best to do something... I managed to use the Dealer API, along with a query in a macro (with selected token): !deal --give 1 --Fate Dice Deck Skill = [[?{Skill value}]] I don't know how to send the card to the chat. improvement: I don't know how to get the result (from the name of the card), in order to add it with the skill value. Actually I don't know how to get the name of the card ^^ Yes, you're right, you can see the dices on the card. But that's an information we can forget.
1623337831

Edited 1623337966
Divers
Pro
Sheet Author
I'va found this : <a href="https://app.roll20.net/forum/post/6223396/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6223396/slug%7D</a> , and cardInfo( { options } ) or drawCard(deckid) But I don't know how to use this :-/
1623338229
Divers
Pro
Sheet Author
Where can I find the id of a deck ??
1623338361
Divers
Pro
Sheet Author
I have seen the name of the cards. They are actually exactly the result of the roll : "+1", "0"... Easy to use... once I will figure out how to get the name of the card :-)
1623339550
Divers
Pro
Sheet Author
well well well that seems usefull wiki page : <a href="https://wiki.roll20.net/API:Objects#Deck" rel="nofollow">https://wiki.roll20.net/API:Objects#Deck</a> I don't know where to write obj.get("_id") to get my deck id. Or my card name obj.get("name") , or image obj.get("avatar") I've found as well the sendChat function. But once again doesn't know how to use it :-/ I guess I should plug all of this in a way ?
1623340006

Edited 1623341272
The Aaron
Roll20 Production Team
API Scripter
So, if you want to write the script, I can point you at some places to get started on learning the Roll20 API: Starter video by Nick O.:&nbsp; <a href="https://www.youtube.com/watch?v=jam2yx8btaQ" rel="nofollow">https://www.youtube.com/watch?v=jam2yx8btaQ</a> Discussions about the way the API works: <a href="https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern" rel="nofollow">https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern</a> <a href="https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1</a> <a href="https://app.roll20.net/forum/post/6237754/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6237754/slug%7D</a> The basic outline would be: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 on ( 'ready' ,() =&gt; { on ( 'add:graphic' ,( obj , prev ) =&gt; { // find if this is a Fate Card // if there is a request waiting for a card and this card is for that player // fulfill that request with this card // if there is no request for this player, issue one to the player with sendChat() }); on ( 'chat:message' , msg =&gt; { if ( 'api' === msg . type &amp;&amp; /^!fate-roll(\b\s|$)/i . test ( msg . content ) ){ let who = ( getObj ( 'player' , msg . playerid ) || { get : () =&gt; 'API' }). get ( '_displayname' ); // Validate input // if this is a new request, queue it up and wait for a card // if this is a followup for a card that was played with no request // process the results and output to the chat. } }); }); If that's more than you want to get into, I can write it over the weekend.
1623340945
Divers
Pro
Sheet Author
Great links! I will try to do my best ;-) I almost understand the outline :-) (so proud) Does&nbsp; 'api' === msg . type &amp;&amp; /^!fate-roll(\b\s|$)/i . test ( msg . content ) means the api should be named "fate-roll" ? What does playerIsGM ( msg . playerid ) checks ? Does it checks if the api is called by the GM ? Actually it should be called by any player.
1623341256
The Aaron
Roll20 Production Team
API Scripter
That first part checks for a command named: !fate-roll And you're right on that second part, that is a way to make it GM only.&nbsp; That's part of my default template and can definitely come out (I'll edit the above)
1623346030
Divers
Pro
Sheet Author
nice!
1623400028
Divers
Pro
Sheet Author
I have found a very usefull resource : the roll20 api github ! Where I can find scripts to copy-paste some line of code ;-) One is dealing with decks : <a href="https://github.com/Roll20/roll20-api-scripts/tree/master/Dealer" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/master/Dealer</a> I am on it.
1623408884

Edited 1623411917
Divers
Pro
Sheet Author
Step by step (updated with macro and Skill)... on('ready',()=&gt;{ log('-=&gt; fate-roll &lt;=-'); on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^!fate-roll(\b\s|$)/i.test(msg.content)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); const args = msg.content.split(/\s+--/); sendChat(who,"Compétence = "+args[1]); let deckChoice = "Fate Dice Deck"; let theDeck = findObjs({ _type: "deck", name: deckChoice })[0]; let cardid = drawCard(theDeck.id); let theCard = getObj("card",cardid); let result = theCard.get("name"); sendChat(who,"Roll = "+result); sendChat(who, "[Image]("+theCard.get("avatar")+".png)"); } }); }); Associated with a macro : !fate-roll --?{Skill|0} When the macro is launched : it asks for a the Skill value; then draws a card; send the Skill value, the name of the card (from "-4" to "+4" as character), and the avatar to the chat . What's next ? transform the card name to integer and add it to the skill value ask for the skill name, then get the value, display skill name on the chat I tried to cast the name of the card to an integer, but I didn't manage to do it. The js function parseInt() doesn't work as I have "+1" and not "1". Do you know how to do it ? Do I have to strip it before ? "+1" =&gt; "+" and "1" =&gt; if firstArg is + then ..., else if it is "-"...
1623411861
Divers
Pro
Sheet Author
As it is, everybody would be happy on the table :-)
1623417326

Edited 1623417344
Divers
Pro
Sheet Author
The macro with a dropdown menu which asks for the skill name, and get the skill value !fate-roll --?{Skill value |Athlétisme,@{selected|Skill-Athlétisme} |Burglary,@{selected|Skill-Burglary} |Contacts,@{selected|Skill-Contacts} } I've extracted only 3 skills, but there are more. The code is a little bit longer. It works great. It need a token to be selected. Next step : I'd like the skill name to be sent to the chat. Don't know how to do it.
1623417916
The Aaron
Roll20 Production Team
API Scripter
You should be able to get the number from the name with parseInt(): let num = parseInt(theCard.get('name')); Outputting formatted messages with a Template Literal is pretty straight forward after you get used to the syntax: sendChat('', `${who} used ${skillName} and got ${num+skillNum}`);
1623418114
Divers
Pro
Sheet Author
Actually, parsint() function works great on signed char (-4 to +4)... My error was that I tried: result = parseInt(result); Which casts an int value into a char variable... With an additional dummy variable, it works great
1623418417
Divers
Pro
Sheet Author
Great !! Thanks :-) My question now is how to get the skill name AND value from the dropdown menu. And then with your formatting suggestion it will work. I guess.
1623419634
The Aaron
Roll20 Production Team
API Scripter
If you put them in like this: !fate-roll --?{Skill value |Athlétisme,@{selected|Skill-Athlétisme} --Athlétisme |Burglary,@{selected|Skill-Burglary} --Burglary |Contacts,@{selected|Skill-Contacts} --Contacts } Then you can get the name as args[2]
1623420902

Edited 1623421187
Divers
Pro
Sheet Author
I swear I've got the same solution on my own :D ... for once ;-) !fate-roll --?{Skill |Athlétisme -- @{selected|Skill-Athlétisme} |Burglary -- @{selected|Skill-Burglary} } And parse inside the API script. Wow ! It works great !! A great Thank you !!&nbsp; The script is very usefull, works great, and I improved my skills !
1623422279

Edited 1623423106
Divers
Pro
Sheet Author
[SOLVED] If someone is interested, here is the complete solution (Edit the first post to notice it's solved). API : on('ready',()=&gt;{ log('-=&gt; fate-roll &lt;=-'); on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^!fate-roll(\b\s|$)/i.test(msg.content)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); const args = msg.content.split(/\s+--/); let skill = args[1]; let skillValue = args[2]; sendChat(who,skill+" ("+skillValue+")"); let deckChoice = "Fate Dice Deck"; let theDeck = findObjs({ _type: "deck", name: deckChoice })[0]; let cardid = drawCard(theDeck.id); let theCard = getObj("card",cardid); let result = theCard.get("name"); sendChat(who,"+ Roll ("+result+")"); let sumResult = parseInt(result)+parseInt(skillValue); sendChat(who,"Résultat = "+sumResult); sendChat(who, "[Image]("+theCard.get("avatar")+".png)"); } }); }); Macro: !fate-roll --?{Skill |Athlétisme, Athlétisme --@{selected|Skill-Athlétisme} |Burglary, Burglary --@{selected|Skill-Burglary} |Contacts, Contacts --@{selected|Skill-Contacts} |Crafts, Crafts --@{selected|Skill-Crafts} |Subterfuge, Subterfuge --@{selected|Skill-Subterfuge} |Conduite, Conduite --@{selected|Skill-Conduite} |Empathie, Empathie --@{selected|Skill-Empathie} |Fight, Fight --@{selected|Skill-Fight} |Découverte, Découverte --@{selected|Skill-Découverte} |Connaissance, Connaissance --@{selected|Skill-Connaissance} |Vigilance, Vigilance --@{selected|Skill-Vigilance} |Physique, Physique --@{selected|Skill-Physique} |Provocation, Provocation --@{selected|Skill-Provocation} |Rapport, Rapport --@{selected|Skill-Rapport} |Ressources, Ressources --@{selected|Skill-Ressources} |Tirer, Tirer --@{selected|Skill-Tirer} |Discrétion, Discrétion --@{selected|Skill-Discrétion} |Volonté, Volonté --@{selected|Skill-Volonté} } Usage: Works with a set of skills for the Character Sheet "Fate by Evil Hat". To make it work with another Fate Character Sheet, change the name of the skills in the macro:&nbsp; each "Skill-name_of_the_skill" as in @{selected|Skill-Athlétisme} Should be the name of a skill in the character sheet Attributes. In game : select a token, clic on the macro. It seems the deck can be depleted. In this case, reshuffle the deck.
1623426747
Divers
Pro
Sheet Author
Next improvement would be to use the roll template from the character sheet.
1623506722
The Aaron
Roll20 Production Team
API Scripter
That's nice! Here's some minor edits that should make it more efficient and fault tolerant: on('ready',()=&gt;{ log('-=&gt; fate-roll &lt;=-'); const deckChoice = "Fate Dice Deck"; const theDeck = findObjs({ _type: "deck", name: deckChoice })[0]; const msgPlayerAndGM = (pid,msg) =&gt; { let who = (getObj('player',pid)||{get:()=&gt;'API'}).get('_displayname'); sendChat("FateRoll",`/w "${who}" ${msg}`); if(!playerIsGM(pid)){ sendChat("FateRoll",`/w "gm" ${msg}`); } }; on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^!fate-roll(\b\s|$)/i.test(msg.content)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); if(!theDeck){ msgPlayerAndGM(msg.playerid, `&lt;div&gt;The ${deckChoice} is not installed!&lt;/div&gt;`); return; } const args = msg.content.split(/\s+--/); if(args.length&lt;3){ sendChat("FateRoll",`/w "${who}" &lt;div&gt;Usage: &lt;code&gt;!fate-roll --Skill Name --Skill Value&lt;/code&gt;&lt;/div&gt;`); return; } let skill = args[1].trim(); let skillValue = args[2].trim(); let cardid = drawCard(theDeck.id); if(!cardid){ shuffleDeck(theDeck.id); cardid = drawCard(theDeck.id); if(!cardid) { msgPlayerAndGM(msg.playerid,`&lt;div&gt;Shuffled ${deckChoice} but could not draw a card.&lt;/div&gt;`); return; } } let theCard = getObj("card",cardid); let result = theCard.get("name"); let sumResult = parseInt(result)+parseInt(skillValue); sendChat(who,`&lt;div&gt;&lt;div&gt;${skill} (${skillValue})&lt;/div&gt;&lt;div&gt; + Roll (${result})&lt;/div&gt;&lt;div&gt;Résultat = ${sumResult}&lt;/div&gt;&lt;div&gt;[Image](${theCard.get("avatar")}.png)&lt;/div&gt;&lt;/div&gt;`); } }); }); Grabs the deck once at the beginning of the script.&nbsp; It won't change during the script's running, so no need to grab it over and over. Checks if the deck exists and reports to the player and gm (if the player wasn't a gm) that the deck is missing, then doesn't do anything else. Checks that the right number of arguments were passed, stops processing and provides a usage statement if they weren't. Checks that a card was drawn, attempts to shuffle and draw again if it failed, then reports the second failure to the player and GM (if the player wasn't a gm).&nbsp; That can happen if someone has all the cards from a deck so there's nothing to shuffle in.&nbsp; You could automate a recall from everyone's hands in that case but I'll leave that for now. Grouped all the output into a single sendChat call with minimal formatting. You'll need to do that if you go to using the roll template anyway, and it keeps things together better in the chat. Cheers!
1623519707
Divers
Pro
Sheet Author
Wow ! Very usefull improvments !!