• variable

    From altere@DARKDIM to All on Wednesday, December 27, 2000 06:21:00
    Hrm. Is there easier way to set a variable with the total amount of credits a user has rather then reading from xtrn.dat or some other drop file?

    Currently I have it reading xtrn.dat and taking the credits line and that my 'credits' variable, is there any other way to do this?

    ---
    ■ Synchronet ■ Dark Dimension ßßS · telnet://dark.dimension-bbs.com · Hit Me!
  • From Digital Man to altere on Wednesday, December 27, 2000 04:22:30
    RE: variable
    BY: altere to All on Wed Dec 27 2000 02:21 pm

    Hrm. Is there easier way to set a variable with the total amount of credits user has rather then reading from xtrn.dat or some other drop file?

    Currently I have it reading xtrn.dat and taking the credits line and that my 'credits' variable, is there any other way to do this?

    Use the global variable: _USERON.CDT

    If you want to modify the user's credits, then use the function: ADJUST_USER_CREDITS

    Rob
  • From altere@DARKDIM to Digital Man on Wednesday, December 27, 2000 17:00:00
    RE: variable
    BY: Digital Man to altere on Wed Dec 27 2000 12:22 pm

    Use the global variable: _USERON.CDT

    If you want to modify the user's credits, then use the function: ADJUST_USER_CREDITS

    hrm, the adjust_user_credits won't work for what I'm doing as the amount of credits isn't ever the same, it's based on some things the user enters. Having said that I wanted to have a credits variable and add, mul, or whatever the user enters against that variable.

    ---
    ■ Synchronet ■ Dark Dimension ßßS · telnet://dark.dimension-bbs.com · Hit Me!
  • From altere@DARKDIM to All on Thursday, December 28, 2000 03:16:00
    RE: variable
    BY: altere to Digital Man on Thu Dec 28 2000 01:00 am

    Use the global variable: _USERON.CDT

    If you want to modify the user's credits, then use the function: ADJUST_USER_CREDITS

    hrm, the adjust_user_credits won't work for what I'm doing as the amount of credits isn't ever the same, it's based on some things the user enters. Hav

    Alright, perhaps some help with this.. This is just a piece of it and I've limited some things for testing.. Basically it asks for a few numbers from the user and add's subtracts, etc... Now, real basic here without adding or subtracting.

    int a_credit u_level mod_file
    set a_credit 10

    fopen mod_file O_CREAT|O_WRONLY "%nmoduser.dat"
    if_false
    print "error\r\n"
    return
    end_if

    fwrite mod_file a_credit
    fclose mod_file

    Now, this obviously creates the moduser.dat (i've verified) but it's just putting a blank line in there rather then 10. Now if the credit adjustment were going to be the same everytime then I would use adjust_credits but that isn't the case, a_credit will ALWAYS be different, I just set it to 10 for testing purposes. Any ideas? Oh, ignore u_level, once I fix a_credit I can fix u_level; I've commented out the level info so that what I'm showing here is actualy what I'm working with.




    ---
    ■ Synchronet ■ Dark Dimension ßßS · telnet://dark.dimension-bbs.com · Hit Me!
  • From Amcleod to altere on Thursday, December 28, 2000 04:12:08
    RE: variable
    BY: altere to All on Thu Dec 28 2000 11:16 am

    set a_credit 10
    fwrite mod_file a_credit

    It's been a looong time, but:

    1) Doesn't FWRITE output the integer in BINARY?
    2) On Little-endian (Intel-type) boxes, don't the low-order bytes come first? 3) With A_CREDIT set to "10" isn't that 0A 00 00 00 (in hex)?
    4) Isn't that equivilent to a LINEFEED followed by three NULLS?
    5) Didn't you say the file contained only a linefeed?

    I'd check the BAJA documentation looking for a verb called "FPRINT" and see if it did something different to "FWRITE" if I were you.

  • From Digital Man to altere on Thursday, December 28, 2000 05:48:57
    RE: variable
    BY: altere to Digital Man on Thu Dec 28 2000 01:00 am

    Use the global variable: _USERON.CDT

    If you want to modify the user's credits, then use the function: ADJUST_USER_CREDITS

    hrm, the adjust_user_credits won't work for what I'm doing as the amount of credits isn't ever the same, it's based on some things the user enters. Hav said that I wanted to have a credits variable and add, mul, or whatever the user enters against that variable.

    ADJUST_USER_CREDITS supports integer variables. Example:

    int i
    set i 10
    adjust_user_credits i

    You can modify _USERON.CDT as it is a read-only variable.

    Rob
  • From PistolGrip@WASTELND to Digital Man on Thursday, December 28, 2000 11:51:00
    RE: variable
    BY: Digital Man to altere on Thu Dec 28 2000 01:48 pm

    You can modify _USERON.CDT as it is a read-only variable.

    Should that be "can not" modify? :-)

    PG

    ---
    ■ Synchronet ■ WasteLand BBS ■ telnet://wasteland.darktech.org
  • From altere@DARKDIM to Amcleod on Friday, December 29, 2000 01:16:00
    RE: variable
    BY: Amcleod to altere on Thu Dec 28 2000 12:12 pm

    1) Doesn't FWRITE output the integer in BINARY?
    I'd check the BAJA documentation looking for a verb called "FPRINT" and see it did something different to "FWRITE" if I were you.

    *CLUEBAT* Um, ok.. I should have noticed that. I'm going to go hide in my corner now. :)

    ---
    ■ Synchronet ■ Dark Dimension ßßS · telnet://dark.dimension-bbs.com · Hit Me!
  • From altere@DARKDIM to Digital Man on Friday, December 29, 2000 01:17:00
    RE: variable
    BY: Digital Man to altere on Thu Dec 28 2000 01:48 pm

    ADJUST_USER_CREDITS supports integer variables. Example:

    I'll have to try this again with this method. Beats opening moduser.dat, but it didn't work for me the last time I tried it this way; I'll double check some things but either way I have a solution now. Thanks!

    ---
    ■ Synchronet ■ Dark Dimension ßßS · telnet://dark.dimension-bbs.com · Hit Me!
  • From Digital Man to PistolGrip on Friday, December 29, 2000 18:31:04
    RE: variable
    BY: PistolGrip to Digital Man on Thu Dec 28 2000 07:51 pm

    You can modify _USERON.CDT as it is a read-only variable.

    Should that be "can not" modify? :-)

    Correct. _USERON.CDT CANNOT be modified (it is a read-only variable).

    Rob