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

[FR] Casse-tête sur les macros

1622462647

Edited 1622552389
[FR]&nbsp; Bonjour, Je me met à la création de macro et je rencontre plusieurs problèmes. 1) Je souhaite savoir s'il est possible de mettre des conditions comme un if. Exemple tout bête, je souhaite attaquer avec une épée longue. Il faut donc que je lance 1d100 et si le résultat est inférieur à ma stat ça réussi (je vais prendre une Force de 60 pour quelque chose de concret). Dans le cas où je ne réussi pas rien ne se passe mais si je réussi alors je fais mes dommages par 1d6. Ainsi en pseudo-code cela donnerais : resultat = roll 1d100 if (resultat &nbsp; &lt; 60) then : &nbsp; &nbsp; roll 1d6 ifend J'ai tenté les solutions de ce topic :&nbsp; <a href="https://app.roll20.net/forum/post/3411341/fr-slash-en-condition-jet-de-des-et-relance-slash-roll-dice-condition-and-reroll-macro" rel="nofollow">https://app.roll20.net/forum/post/3411341/fr-slash-en-condition-jet-de-des-et-relance-slash-roll-dice-condition-and-reroll-macro</a> &nbsp;en testant les deux propositions de Silvyre sans API mais les deux ne fonctionne pas. 2) Je voudrais savoir s'il en possible de récupérer un résultat de dé pour l'utiliser plus tard. Exemple : j'ai ma vie qui est à 12/20. Je vais tapé l'ennemi et je réussi mon test de Force, je lance donc mon dé de dommage qui est 1d6. Imagine je fais 5, évidemment j'inflige 5 à l'ennemi et je récupère donc 5 pv me faisant donc 17/20. (Pour ceux connaissant MTG comparé ça avec le&nbsp; Lien de vie ). En pseudo-code ça donnerais : vie = 12 attaque = roll 1d100 //test de force dommage = roll 1d6 vie = vie+dommage Bien sûr, sur roll20 la vie sera spécifié par "@{selected|bar1}". Dans l'optique s'il est possible de faire des conditions if (voir première question) alors la vie actuel sera comparé à la vie max pour éviter d'avoir un surplus de vie actuel comme un 23/20 ^^ 3) Je voudrais savoir s'il est possible d'intégré plusieurs jet dans un dropdown. Toujours dans mon exemple, je souhaite attaque, je dis que j'utilise mon épée. Je dois donc faire tout mes lancés (touche et si réussi les dommages). Cela donne en macro roll : ?{Choisir une arme| &nbsp; &nbsp;Épée longue,#Force 1d6 | &nbsp; &nbsp;Dague,#Force 1d4} Problème : le jet de dégat (le d6 ou d4) ne se lance pas, même si je met un /r juste devant et même une virgule séparant la macro de #Force au d6 (ou d4). Je vous serais reconnaisant si vous avez des solutions à me prosposer à mes problèmes. Je tiens aussi à préciser que je n'ai pas l'accès au côté MJ et qu'il n'y a pas la possibilité d'utiliser l'API (enfin je crois que le MJ est premium donc il pourrait mais les non-premium je ne sais pas s'ils pourront même si le MJ l'installe dans la partie). Cordialement, Tenkuro [EN] Hello, I start to create macro and I have several problems. 1) I want to know if it is possible to put conditions like an if. Simple example, I want to attack with a long sword. So I have to roll 1d100 and if the result is lower than my stat it succeeds (I'll take a Strength of 60 for something concrete). In case I don't succeed nothing happens but if I succeed then I do my damage by 1d6. So in pseudo-code that would give: result = roll 1d100 if&nbsp; (result&nbsp; &lt; 60) then : &nbsp; &nbsp; roll 1d6 ifend. 2) I would like to know if it is possible to recover a dice result to use it later. Example: I have my life which is at 12/20. I'm going to hit the enemy and pass my Strength check, so I roll my damage die which is 1d6. Imagine I do 5, obviously I inflict 5 on the enemy and I therefore recover 5 hp making me 17/20. (For those familiar with MTG compared this with the Life Link). In pseudo-code that would give: pv = 12 attack = roll 1d100 //test de strength dammage = roll 1d6 pv = pv+dammage 3) I would like to know if it is possible to integrate several jets in a dropdown. Still in my example, I wish to attack, I say I use my sword. So I have to do all my throws (hit and if successful the damage). This gives in macro roll: ?{Weapon| &nbsp; &nbsp;Longsword,#Strenght 1d6 | &nbsp; &nbsp;Dagger,#Strenght 1d4} I would be grateful if you have any solutions to prospose me to my problems. I also want to clarify that I do not have access to the GM side and that there is no possibility to use the API (well I believe that the GM is premium so it could but the non- premium I don't know if they can even if the GM installs it in the game). Regards, Tenkuro
1622546465
Ziechael
Forum Champion
Sheet Author
API Scripter
Il existe quelques options non-API disponibles qui pourraient vous faciliter la vie si ce n'est une solution complète: A) /em strikes with their ?{Weapon|Longsword,Longsword for [[ [[ [[ [[ 1d100&lt;@{selected| stat } ]]d6|Dagger,Dagger for [[ [[ [[ [[ 1d100&lt;@{selected| stat } ]]d4} ]] + {@{selected|bar1},@{selected| hitpoints |max}}kl1]] - [[ {@{selected|bar1},@{selected| hitpoints |max}}kl1 ]] ]] damage and restoring $[[1]] health ($[[2]] to a max of @{selected| hitpoints |max})&nbsp; Ce premier produira un 0 ou des dégâts appropriés à l'arme, puis vous indiquera le montant guéri et la nouvelle santé avec un avertissement de valeur maximale. B) /em strikes with their ?{Weapon|Longsword,Longsword for [[ [[ 1d100&lt;@{selected| stat } ]]d6|Dagger,Dagger for [[ [[ 1d100&lt;@{selected| stat } ]]d4} ]] damage and restoring $[[1]] health (from [[@{selected|bar1}]] to a max of @{selected| hitpoints |max}) Le second est un peu plus simple avec juste une représentation visuelle de&gt; à de l'aspect curatif. Dans les deux cas, vous devrez remplacer les appels d'attributs en gras par la référence statistique correcte selon la feuille utilisée. Toutes mes excuses pour tout mauvais français, google translate a été utilisé partout!
Thank you Ziechael for your answer. From what I understand (and after the tests on a game), your solutions allow me to make two dice rolls in a dropdown but also to know how much life the character recovers from it. However, it does not automatically add to life itself, as I would like to do. Thank you again for your answer and the help given, it gave me a good lead to follow with the "$ [[0]]" and "kl1" that I did not know. Don't worry about your French, it's the same for me and English ^^ Google translate helps a lot :)
1622553771
Ziechael
Forum Champion
Sheet Author
API Scripter
Will let your translate handle if from here on out ;) Basic macros cannot edit attributes or values, they can only read them so without the API you won't be able to automatically add the value to the life sorry. The best is a visual representation to at least guide the manual editing of the value I'm afraid.
Okay. Well I still struggle to understand why so many [[before the strength tests. I just saw that my GM did a template test (purple box) and from what I saw this is an API feature. If this is the case, it could be that I lean to do the macro with the API, thus allowing me to do I add automatically to my value (ie @ {selected | bar1}. And surely much more than that.
1622562541
Ziechael
Forum Champion
Sheet Author
API Scripter
The additional [[ ]] brackets are to create nested inline rolls that can be called later (again, read only, no math compatibility) on their results... this gives us the $[[0]] etc functionality. Templates are not API functionality, they are standard chat functions. Certain sheets have built in template logic that will allow for conditional display but again, is all read only. If your GM (or more accurately, the game creator) has a pro subscription, and you can get them in add the tokenMod script (a must have for any API enabled game), then there is definitely more automation that can be added to the macro.