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

[Help needed] chat button and empty repeating section

First, let me explain what I'm trying to do : For my campaign, in the character sheet, I've got weapons (shooting and close combat). I want to speed up thing and ditch the ''open character sheet and click the button related to this weapon'' to attack. So, I've created macro which call to a specific weapon (repeating_weaponscac_$0_exemple). Now, I want to simplify it even further. The player would only need to select his token and click on a macro which will display a chat button with all available weapons (be it close combat or shooting) The problem is that player sometime have 2-3 or 4 weapons. And when I create the chat button, if I refer to (repeating_weaponscac_$4) and the player doesn't have a 4th weapon, I'm getting an ugly display in the chat : Is there any way to bypass this?
1574273560
Kraynic
Pro
Sheet Author
There are a couple chat menu generator scripts available at the moment, though I think they are only on the forums.&nbsp; I know that when using those, they only show the available options.&nbsp; As far as I know, using the api is the only way to automatically show only the available repeating entries. Menu Maker:&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/7478947/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/7478947/slug%7D</a> Universal Chat Menu:&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/7474530/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/7474530/slug%7D</a> I use the second one, and have been well satisfied with it.
1574275579
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
They are both excellent Scripts. I too went with UCM, mostly because of its centralized deployment. Menu Maker is a little more powerful with filtering and combining with other types of buttons.
I've checked MenuMaker a bit and it seems that it use abilities to create the chat button. Is that correct? I don't have any abilities right now in my character sheets. I'll look into UCM then.
1574280680
GiGs
Pro
Sheet Author
API Scripter
MenuMaker does create abilities, but I think it does so automatically - it would add the abilities to our character sheet for you. And I'm pretty sure you can use it the same way as UCM, by creating your own macros. I'm not suggesting you use MenuMaker over UCM (I wrote UCM, you should totally use that, haha), just wanted to correct a possible misconception.
Well, I've been tinkering a bit with both and I can't understand how to use them efficiently.&nbsp;
1574284301
GiGs
Pro
Sheet Author
API Scripter
Have you got either working at all? It's hard to give concrete advice without knowing some extra details, but for UCM:&nbsp; what is the button name for the attack? what is the name of attribute that shows the weapon name? Try replacing the ALLCAPS names in the basic macro below with the relevant names in your sheet. !chatmenu @{selected|character_id} @{selected|character_name}'s Weapons --repeating_weaponscac|WEAPONNAME|BUTTONNAME
Ok, Ill try to be more precise.&nbsp; I've been trying to use the UCM script. I've been able to call all ''rôle'' (skills) form a character and create buttons for them. But I don't know how to link the right formula when the button is cliked though. My character sheet relevant section: &lt;h2&gt;Rôle&lt;/h2&gt; &lt;fieldset class="repeating_role"&gt; &lt;select name="attr_roles"&gt; &lt;option value="Acrobat"&gt;Acrobat&lt;/option&gt; (and then several other options) (and I then indicate the level or that rôle (skill) with this: &lt;input type="number" name="attr_roleslvl" /&gt;
1574286531
GiGs
Pro
Sheet Author
API Scripter
you dont have a button in that section. Do you have a properly defined button? I think &nbsp;it would look something like this, but we need the buttons name: chatmenu @{selected|character_id} @{selected|character_name}'s Skills --repeating_role|roles|BUTTONNAME In this section you have three parts, separated by | --repeating_role|roles|BUTTONNAME the first is obviously the repeating section name. The second is name for the attribute you want displayed &nbsp;on the printout.&nbsp; The last is the name of the button (which will be something like roll_skill , but you remove the roll_ part).
1574294177
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
What sheet are you using?
1574294917
GiGs
Pro
Sheet Author
API Scripter
Its a custom one. I've helped in a few earlier questions.
1574295963

Edited 1574296025
The chat button is now working. !chatmenu @{selected|character_id} @{selected|character_name}'s Skills --repeating_role|roles|rolesdice One thing though, the power cards script related ta a role (skill) check is now not displaying correctly:
1574296149
GiGs
Pro
Sheet Author
API Scripter
It's very likely that the current version of UCM wont handle script macros in buttons - especially ones with reserved characters like }. Sorry about that! MenuMaker might handle them better.
1574300758

Edited 1574300809
Ahhh dang. Knew it was to good to be true. Thanks anyway, I'll check with the MenuMaker.
1574306504

Edited 1574307279
GiGs said: It's very likely that the current version of UCM wont handle script macros in buttons - especially ones with reserved characters like }. Sorry about that! MenuMaker might handle them better. I've been playing around a bit with the UCM and I've been able to run the ammo script. The script symbols are mostly replaced (for exemple, @ is&nbsp;&amp; #64;). Could this mean that others scripts out there will work if all appropriate symbols are replaced? edit : typo
1574306638
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Could you post an example?
Np. I've written this bit in a macro : !chatmenu @{selected|character_id} Menu d'actions de @{selected|character_name} --title:Rôles --repeating_role|roles|rolesdice --title:Tir --repeating_weapons|weaponname|jet_total &nbsp;This give me some options : I then click on one of the weapons. As shown before, I'm getting a wall of text, which indicate me that something afoot : Buuuutttt, at the end of blue wall of text, I see this : This indicate me that even if I use a macro into the UCM system, it worked. And when I look at my character sheet for the Tir (shooting) button, it's written this way : So every bits over the !ammo script it not written with replaced symbols but the ammo script is. Which then let me think that others macro could work if appropriately tweaked. Complete text for the !ammo script : &amp;#13;!ammo &amp;#64;{character_id} &amp;#64;{chargeurfull} &amp;#91;&amp;#91;-1*{@{Recharge} + &amp;#63;{Tir automatique&amp;#63;|Non,0|Oui,-2}}&lt;1}&amp;#93;&amp;#93;) Is this a correct assumption?
Omg... I don't know what to say but it looks like that adding a &amp;#13; in front of a script does the trick when you need to run the script macro in buttons... I've tested the !ammo script AND the power cards script and it works.The character sheet code is now written down like this : &lt;button type="roll" name="roll_jet_total" value=" &amp;#13;!power {{ @{whispertoggle} --tokenid|@{selected|token_id} --emote|@{selected|token_name} tire avec son arme sur @{target|token_name} --target_list|@{target|token_id} --emotefont|font-family: New Century Schoolbook, serif; font-weight: bold; font-size:10pt; --border|1px solid #A9A9A9 --corners|10 --bgcolor|8d0709 --txcolor|#363636 --erowtx|#000000 --erowbg|#A9A9A9 --orowtx|#000000 --orowbg|#708090 --name|Attaque de tir --leftsub|@{vrainom} --rightsub|@{wpntype} --hroll||[[ [$MS] [NH] 4df - @{hurtlvl} + @{rolelvlwpn} + @{stunlvl} + @{qualiterir} + ?{Modificateur pour toucher la cible?|0|-3|-2|-1|+1|+2|+3} - ?{Niveau de difficulté pour atteindre la cible?|0}]] --soundfx|_audio,play,nomenu|@{bruittir} --?? $MS.total &lt; 0 ?? Marge d'échec :|[^MS], Tir raté. --?? $MS.total &gt;= 0 ?? Marge de succès :|[^MS], Tir réussi --?? $MS.total &gt;= 0 ?? $Test d’esquive :|[[ [$Esq] [NH] 4df - @{hurtlvl} + @{stunlvl} + @{esquivetotale}]] --?? $Esq.total &gt; $MS.total AND $MS.total &gt;= 0 ?? Esquive| La cible anticipe les tirs. --?? $Esq.total &lt;= $MS.total AND $MS.total &gt;= 0 ?? Esquive| La cible est touchée. --?? $Esq.total &lt;= $MS.total AND $MS.total &gt;= 0 ?? Niveau de blessure:|[[ [$DMG] [NH] 0d0 + @{INJ} - @{target|combined_personal_defense} ]] --?? $Esq.total &lt;= $MS.total AND $MS.total &gt;= 0 ?? alterbar|_target|@{target||token_id} _bar|1 _amount|-([^DMG]/2+[^MS]/2) _show|GM }} &amp;#13;!ammo &amp;#64;{character_id} &amp;#64;{chargeurfull} &amp;#91;&amp;#91;-1*{@{Recharge} + &amp;#63;{Tir automatique&amp;#63;|Non,0|Oui,-2}}&lt;1}&amp;#93;&amp;#93;) "&gt;&lt;/button&gt; And everything work fine. It doesn't alter the character sheet roll either.
1574312849

Edited 1574313396
GiGs
Pro
Sheet Author
API Scripter
Great! That does make sense, actually, it matches the syntax needed from the wiki for API buttons, but I dont know if I would have thought of it. That's very handy to know for when I do the script rewrite.
Quick question related to the subject : Is there a way to influence the display of the chat buttons? I know stylus can influence the way it look but not how it's displayed. (Exemple: all bunched, only one button per line, ( | ) separators between choices, etc)
1574371291

Edited 1574374154
GiGs
Pro
Sheet Author
API Scripter
If you have a rolltemplate, it can use that. You can add separators using code like this. --separator:| If you want to include multiple repeating sections in the same menu, you can put titles between them. See the thread Kraynic linked above for all the extra stuff you can add.
1574372629
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
GiGs said: See the thread Keith linked above for all the extra stuff you can add. I think that was Kraynic. :)
1574374186
GiGs
Pro
Sheet Author
API Scripter
I dont know why you edited my words, I clearly said Kraynic! ;)
1574376866
Kraynic
Pro
Sheet Author
One of those account names that starts with K.&nbsp; Close enough!&nbsp; :p