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?
user.adjust_minutes() is the correct function to call to add or subtract minutes from the user's time bank. You need to understand that you
cannot subtract from the number of minutes that the user is given based on their security level using this function. What this function/method does is add or subtract from the user's "time bank", which normally has
0 minutes in. And you cannot go less than 0. This time bank is automatically added to their available time online.
I did not realize it was for the time bank. I read the source to find out the different commands I can use and I did not see in the help that it was to remove from the time bank. Thanks!
What you probably want to do instead is adjust the bbs.start_time property (in seconds). The user's time online is based on their time per day, time per call, minutes (time bank), the current time, and this
start time value. By adjusting the start time value you change their available time for the current "call".
Okay, excellent. I did use the bbs.start_time property and it works.
Thank you very much for the help.
Sysop: | MCMLXXIX |
---|---|
Location: | Prospect, CT |
Users: | 325 |
Nodes: | 10 (0 / 10) |
Uptime: | 147:35:25 |
Calls: | 507 |
Calls today: | 1 |
Messages: | 219696 |