Tr0n wrote:You've hit one thing Quest can't do (I think).
You're doing a comparison AND a computation in one thing.
Plus you have 2 computations in one set <> .
Just have this, and it should work:
Thanks! I'm pretty sure I'm reading your code correctly and understanding the logic behind it. I'm terribly new at programming in general, and have never been good at any sort of math. But I gotta say, having finally sat down and put my mind to programming (even if it's only scripting) is
intensely rewarding.
I'll try it out. Anyway, except to be hearing from me again soon -- I still have character creation, combat, and dialogue code to write. I promise I'll go as far as I possibly can in each situation before I bother the forum (no one likes to spoon-feed newbies). :)
EDIT:
Okay, here's how I adapted your code (along with some "upgrades" and simplifications to the mechanic in general):
script {
set numeric <nimble; 0>
set numeric <melee; 0>
set numeric <difficulty; 10>
set numeric <amazing; %difficulty% + 6>
set numeric <critical; %difficulty% - 6>
set numeric <roll; $rand(1;20)$>
set numeric <diffResult; %roll% + %nimble%>
set numeric <diffResult; %diffResult% + %melee%>
if ( %diffResult% >= %difficulty% ) and ( %diffResult% < %amazing% ) and ( %roll% < 20 ) then msg <Success.>
if ( %diffResult% >= %amazing% ) or ( %roll% = 20 ) then msg <Amazing success!>
if ( %diffResult% < %difficulty% ) and ( %diffResult% > %critical% ) and ( %roll% > 1 ) then msg <Failure.>
if ( %diffResult% < %critical% ) or ( %roll% = 1 ) then msg <Critical failure!>
}
I didn't realize that you couldn't put %roll% + %nimble& + %melee% all into one variable. Glad you caught me on that when you did, 'cause that would have stumped me for a while if I started tripping over it. :)