# $statcheck ! FUNC('$statcheck', Statname, Value, Bordervalue) ! ARGS[0] = Statname: the stat you need to compare to ! ARGS[1] = Value: the comparison value. This is the value your stat needs to be higher, or lower. ! ARGS[2] = Bordervalue: the value above (or under) the current situation cannot raise (or lower) the stat. It is like saying that this set to 50 (panty flashing) cannot make Sveta into a total exhibitionist (value 100), even if she does this every day. ! Bordervalue always has to be closer to the defined edge of the scale (0 or 100) than the Value! It cannot be the same value than the Value, but can be close to it (like func('$statcheck', pcs_agil, 70, 71) ) ! The result is given back in the RESULT variable, this should be the new value of Statname, unless it is -1, then the check failed ! Usage: if func('$statcheck', pcs_agil, 30, 50) >= 0: pcs_agil = func('$statcheck', pcs_agil, 30, 50) !If it is a stat lower than X check if ARGS[2] < ARGS[1]: if ARGS[0] < ARGS[1]: !if the difference between the current stat value and the border value is really big, your stat closes tha gap in increased tempo if ARGS[0]-ARGS[2] > 30: ARGS[0] -= 3 elseif ARGS[0]-ARGS[2] > 20: ARGS[0] -= 2 elseif ARGS[0]-ARGS[2] > 10: ARGS[0] -= 1 elseif ARGS[0]-ARGS[2] > 0 and rand(0,2) = 0: ARGS[0] -= 1 end RESULT = ARGS[0] else RESULT = -1 end !If it is a stat higher than X check elseif ARGS[2] > ARGS[1]: if ARGS[0] > ARGS[1]: !if the difference between the current stat value and the border value is really big, your stat closes tha gap in increased tempo if ARGS[2]-ARGS[0] > 30: ARGS[0] += 3 elseif ARGS[2]-ARGS[0] > 20: ARGS[0] += 2 elseif ARGS[2]-ARGS[0] > 10: ARGS[0] += 1 elseif ARGS[2]-ARGS[0] > 0 and rand(0,2) = 0: ARGS[0] += 1 end RESULT = ARGS[0] else RESULT = -1 end else cls & 'BAD ARGUMENT CHECK IN $statcheck, VALUE CANNOT BE 0!' end --- $statcheck ---------------------------------