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

Unity value from d100 roll

November 10 (4 years ago)

Edited November 11 (4 years ago)

Hi!

In Warhammer we are rolling 1d100.

Some skills refer to the unity value of the rolled result.

I know that there is " $[[0]] " for using last roll in the same macro.

Is there any way to show only the unity value instead?

November 10 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

What do you mean by unity value?

November 10 (4 years ago)


GiGs said:

What do you mean by unity value?


When your roll is 51 unity value is 1, when it's 48 unity is 8.

November 10 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

If you don't mind it being out of order, you can do it like this:

[[ [[1d100]]%10]] $[[0]]
November 10 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Ah, the units value.

Whats the value with a roll of 40 or 50?


November 10 (4 years ago)


GiGs said:

Ah, the units value.

Whats the value with a roll of 40 or 50?



it's 10

November 10 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

I dont think you'll be able to do that without an API script and pro subscription.

Roll20 dice cant do conditional effects (this value is a 0 sometimes, and a 10 other times). Sometimes its possible with a very convoluted dice roll structure, but to do it in this case would require doing some things with the whole d100 roll, and different things with the units value, which you can't do at all.

Aaron's suggestion will work if you just want to display the units value, and can accept all results of 10, 20, 30, etc will be displayed as 0, and not as 10.

November 10 (4 years ago)

Edited November 10 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

Adjusted to get 10 for a 0:

[[ (([[1d100]]-1)%10)+1]] $[[0]]


November 10 (4 years ago)

Edited November 10 (4 years ago)
David M.
Pro
API Scripter

EDIT - crossed posted with Aaron. Ignore my second option. The default template trick would still work, though, to get them in the "right" order.

You can at least get the rolls in order by putting the inline rolls outside of the brackets, like this:

&{template:default} [[ [[1d100]]%10 ]] {{name=Funky Skill Roll}} {{d100 roll=$[[0]]}} {{Unity roll=$[[1]]}}

This doesn't solve the 0's instead of 10's problem, though. If you really want 10's and just want text display (aren't trying to compare the rolls programmatically), I suppose you could create a rollable table with 100 entries, with each entry having text like e.g. "Roll=60  |  Unity value=10". Then roll this table with [[1t[TableName]]].


November 10 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

Nice David!  Here it is adjusted for 0:

&{template:default} [[ (([[1d100]]-1)%10)+1 ]] {{name=Funky Skill Roll}} {{d100 roll=$[[0]]}} {{Unity roll=$[[1]]}}


November 10 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter


The Aaron said:

Adjusted to get 10 for a 0:

[[ (([[1d100]]-1)%10)+1]] $[[0]]

Very nice!

November 11 (4 years ago)

Edited November 11 (4 years ago)

Thanks for the cool idea!

Unfortunately it doesn't work in the wfrp4 template for weapons. Take a look:

/w gm &{template:wfrp4}  {{name=@{selected|character_name}}} {{title= Attack}} {{dice=[[(([[1d100]]-1)%10)+1 ]] cs01cs02cs03cs04cs05cs11cs22cs33cs44cs55cs66cs77cs88cf96cf97cf98cf99cf100 ]]}} {{against=[[  @{selected|MeleeTwohanded} ]]}} {{weapon=WarHammer}} {{range= }} {{damage=[[[[@{selected|current_sb}]] + 6]] + Penetrating $[[1]] +}} {{qualities= }} {{description= }} {{hitlocation=1}} ]]
I only get a result of 1-10 from the die roll. Another macro:

/w gm &{template:wfrp4}  {{name=@{selected|character_name}}} {{title= Attack}} [[(([[1d100]]-1)%10)+1 ]] {{dice=[[$[[0]]cs01cs02cs03cs04cs05cs11cs22cs33cs44cs55cs66cs77cs88cf96cf97cf98cf99cf100 ]]}} {{against=[[  @{selected|MeleeTwohanded} ]]}} {{weapon=WarHammer}} {{range= }} {{damage=[[[[@{selected|current_sb}]] + 6]] + Penetrating $[[1]] +}} {{qualities= }} {{description= }} {{hitlocation=1}} ]]


November 11 (4 years ago)
The Aaron
Roll20 Production Team
API Scripter

Yeah, it's definitely not going to work for that.  That's context that could have been helpful initially.  The only option here would be to have a custom API script that would report the Unity number separately, which would require the API, a Pro Subscriber Feature.

November 11 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

The problem with using this with a rolltemplate, is the template will only print the output its been programmed for.

Also, you'll want to put that long string (cs01cs02 etc) right on the d100.

So you can try something like

/w gm &{template:wfrp4}  {{name=@{selected|character_name}}} {{title= Attack}} [[ (([[1d100cs01cs02cs03cs04cs05cs11cs22cs33cs44cs55cs66cs77cs88cf96cf97cf98cf99cf100]]-1)%10)+1]] {{dice=$[[0]]}} {{against=[[  @{selected|MeleeTwohanded} ]]}} {{weapon=WarHammer}} {{range= }} {{damage=[[[[@{selected|current_sb}]] + 6]] + Penetrating $[[1]] +}} {{qualities= }} {{description=Units: $[[1]] }} {{hitlocation=1}} ]]

This shows the units value in the description section. If that rolltemplate allows you to create your own sections, you could try adding {{unity=$[[1]]}} instead.

November 12 (4 years ago)


GiGs said:

The problem with using this with a rolltemplate, is the template will only print the output its been programmed for.

Also, you'll want to put that long string (cs01cs02 etc) right on the d100.

So you can try something like

/w gm &{template:wfrp4}  {{name=@{selected|character_name}}} {{title= Attack}} [[ (([[1d100cs01cs02cs03cs04cs05cs11cs22cs33cs44cs55cs66cs77cs88cf96cf97cf98cf99cf100]]-1)%10)+1]] {{dice=$[[0]]}} {{against=[[  @{selected|MeleeTwohanded} ]]}} {{weapon=WarHammer}} {{range= }} {{damage=[[[[@{selected|current_sb}]] + 6]] + Penetrating $[[1]] +}} {{qualities= }} {{description=Units: $[[1]] }} {{hitlocation=1}} ]]

This shows the units value in the description section. If that rolltemplate allows you to create your own sections, you could try adding {{unity=$[[1]]}} instead.

It works perfectly! 

Thank you ALL, you are very helpfull :)