Sure, StoryInit is a good place to initialize your variables. If there’s a character creation screen, you could also possibly put it there (so if you revisit that page you’ll roll a new character). You want to make sure it happens before you try to use or display the stats, and you want to make sure it doesn’t happen again unless you mean it to.
Rolls could look something like this: _roll
is a temporary variable that only exists for one page, since you probably don’t need to store it in the game history.
<<linkreplace "Roll the dice">>
<<set _roll to $STR + random(1,6) + random(1,6) + random(1,6)>>
You got: _roll
You needed: 15
<<if _roll >= 15>>[[passage B]]
<<else>>[[passage C]]
<</if>
<</linkreplace>>