Using a random value as a parameter

Hello everyone, I hope you all are well.

I ask for help here, how can I save a value that I obtained in a random (for example; 1 to 20), to use as a counter/var later?

Example:
main:
  random 1 20
  set data.rng random (?)
  jump result

result:
  if (>= $stats.rng 11):
    add_xp str rng (? Equal to the value obtained in RNG)

How can I make this happen? I know that if I assign a fixed value, I can do it, but I wanted to use the value generated by random and I don’t know how to do it.


Like the noob syndrome, for some reason after I posted this here, I remembered the $ and (integer/var) rule. Since I know there are always questions on the forum, instead of deleting the question, I’ll leave how to do it in case someone comes here in the future. The command is;

set data.var (random x y)

replace the X and Y values ​​with the Minimum (X) and the Maximum (Y). Then just call the value with $ to use. In the case for what I need, which is for this grind, it is;

add_xp skillid $data.var

So in my own example, it works like this;

Example:
main:
  set data.var (random 1 20)
  jump result

result:
  if (>= $stats.rng 11):
    "Wow! Now I have +%{$data.var} points!"
    add_xp skillid $data.var

Sorry for the trouble. +You cannot use 0, it has to be at least 1. If you use 0, it may give an error at some point, if the random value becomes 0 and the system needs to add it.