• user.adjust_minutes -- Not working..?

    From Noisome Poison@VERT/DIGI52 to All on Wednesday, June 17, 2009 23:23:43
    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?

    Thanks,

    Noisome

    ---
    þ Synchronet þ Digital 52 - bbs.digital52.com
  • From Noisome Poison@VERT/DIGI52 to Noisome Poison on Wednesday, June 17, 2009 23:25:37
    Hey there, I have a basic script, when run it just runs:
    ...
    Thanks,

    Noisome


    Forgot to post:

    Synchronet BBS for Win32 Version 3.15a
    Revision a Jun 3 2009 05:05 SMBLIB 2.51 MSC 1200
    Copyright 2009 Rob Swindell - http://www.synchro.net
    JavaScript-C 1.7.0 2007-10-03
    WinSock 2.0
    Windows NT Version 5.0 (Build 2195) Service Pack 4

    ---
    þ Synchronet þ Digital 52 - bbs.digital52.com
  • From Digital Man@VERT to Noisome Poison on Wednesday, June 17, 2009 22:22:56
    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 þ [vert/cvs/bbs].synchro.net
  • From Noisome Poison@VERT/DIGI52 to Digital Man on Thursday, June 18, 2009 08:33:34

    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

    I'm just trying to reduce the user's time by five or ten minutes when a
    program is run. The get_time_left I was using was just to verify that the
    time has changed, and will be removed later on. Is there a better option to get the remaining time of the user than "bbs/user.get_time_left"?

    Sorry for my ignorance, but what is the 'T' exemption? I have changed everyone's level to the default level 15, with 15 minutes per day and a
    maximum of 15 minutes per call, and the user I'm testing this on is on that level, a regular user account.

    The door itself is not set on suspend time as well.

    Thanks for your help!

    Jeff

    ---
    þ Synchronet þ Digital 52 - bbs.digital52.com
  • From Digital Man@VERT to Noisome Poison on Thursday, June 18, 2009 17:26:51
    Re: Re: user.adjust_minutes -- Not working..?
    By: Noisome Poison to Digital Man on Thu Jun 18 2009 08:33 am


    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.

    I'm just trying to reduce the user's time by five or ten minutes when a program is run. The get_time_left I was using was just to verify that the time has changed, and will be removed later on. Is there a better option
    to get the remaining time of the user than "bbs/user.get_time_left"?

    bbs.get_time_left() is the correct method.

    Sorry for my ignorance, but what is the 'T' exemption?

    The "Time Online" exemption. See http://synchro.net/docs/user_editor.html#UserEditCommands for details.

    I have changed
    everyone's level to the default level 15, with 15 minutes per day and a maximum of 15 minutes per call, and the user I'm testing this on is on that level, a regular user account.

    Ah, okay good.

    The door itself is not set on suspend time as well.

    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.

    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".

    digital man

    Snapple "Real Fact" #161:
    The first TV network kids show in the U.S. was "Captain Kangaroo."

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Noisome Poison@VERT/DIGI52 to Digital Man on Friday, June 19, 2009 13:52:28
    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".

    digital man

    Okay, excellent. I did use the bbs.start_time property and it works.

    Thank you very much for the help.

    Noisome

    ---
    þ Synchronet þ Digital 52 - bbs.digital52.com
  • From Digital Man@VERT to Noisome Poison on Friday, June 19, 2009 14:20:19
    Re: Re: user.adjust_minutes -- Not working..?
    By: Noisome Poison to Digital Man on Fri Jun 19 2009 01:52 pm

    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!

    "Time bank" was never the official term (for Synchronet) - I used "minutes". They're like credits. You can buy "minutes" (with credits), for example. I know it's confusing and I'll see about using the term "time bank" more to clarify the usage of user "minutes".

    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.

    Ah, good.

    Thank you very much for the help.

    No problem.

    digital man

    Snapple "Real Fact" #41:
    Shrimp can only swim backward.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net