Subj : user.adjust_minutes -- Not working..?
To   : Noisome Poison
From : Digital Man
Date : Wed Jun 17 2009 10:22 pm

 Re: user.adjust_minutes -- Not working..?
 By: Noisome Poison to All on Wed Jun 17 2009 11:23 pm

> Hey there, I have a basic script, when run it just runs:
>
> // Begin program
> load("sbbsdefs.js");
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(-5)
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(5)
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(-5)
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(-5)
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> //End Program
>
> The time is not adjusted by a negative 5 minutes the first time.  The
> second adjustment is a postive 5 minutes, which works.  The third
> adjustment, a negative 5 minutes works.  The fourth adjustment, another
> negative 5 minutes does not adjust the time.
>
> It seems only a positive adjustment works then a negative adjustment.
>
> //Begin Second program
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(5);
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(-6);
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(7);
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(-20);
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> user.adjust_minutes(9);
> console.writeln(bbs.get_time_left());
> console.writeln(user.get_time_left());
> //End second program
>
> Then I did 5 adjustments in this order: 5, -6, 7, -20, 9
> The following results were, starting with seconds at 862: 1162, 802, 1222,
> 322, 862
>
> This is a bit odd since it should not begin and end with the same time
> left, +21 minutes, -26 minutes.  I even went +21 mins, -31 mins with the
> same seconds count at the beginning and end.
>
> Am I running something wrong?

I'm not really sure what you're trying to do.

The user.get_time_left() function requires an argument which indicates the
start time (e.g. login time) to base the time-left calculation on. If the user
represented by the 'user' object when this script is run has the 'T' exemption,
then the user.get_time_left() return value is never going to change and the
start-time argument value (if supplied) is irrelevant. You need to make sure
the account doesn't have the 'T' exemption if you actually want the
user.adjust_minutes() call to have an effect.

The bbs.get_time_left() return value will also not change if the current user
has the 'T' exemption.

                                           digital man

Snapple "Real Fact" #180:
The first VCR was made in 1956 and was the size of a piano.

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net