• Baja feasibility

    From Hausmaus@VERT/MIDNITE1 to Digital Man on Sat Nov 15 14:23:00 2003
    (NOTE: If anyone else besides DM has an answer to my questions, please let me know.)

    DM,

    I have a question for you concerning porting one of my doors from Pascal to possibly Baja. I'd like to try porting my door "The Magic Oracle" from
    Pascal to Baja. In a short nutshell, here's what it does from start to finish:

    Sees if INDEX.DAT is existant (a simple integer that tells how many lines of text are in the answer file). If not, count ANSWERS.DAT (a text file) and record in INDEX.DAT how many files there are.
    Get user's question.
    Pick random number from 1 to INDEX
    Get answer(index)
    Show answer(index)

    Now I know it sounds silly to be asking this, but is there random number capabilities in Baja? I've been reading over the docs and I haven't seen anything yet (or perhaps I skipped over it). I'd like to do it in Baja so it would be backwards-compatible with older versions of Sync, but if it can (or should be) written in JS, then I'll just wait until I can devote a little more time to learning JS.

    Ideas or suggestions?

    --HM

    ---
    ■ Synchronet ■ Midnight's Hour BBS - midnightshour.org
  • From PistolGrip@VERT/WASTELND to Hausmaus on Sat Nov 15 18:41:00 2003
    Re: Baja feasibility
    By: Hausmaus to Digital Man on Sat Nov 15 2003 02:23 pm

    Now I know it sounds silly to be asking this, but is there random number capabilities in Baja? I've been reading over the docs and I haven't seen anything yet (or perhaps I skipped over it). I'd like to do it in Baja so i would be backwards-compatible with older versions of Sync, but if it can (or should be) written in JS, then I'll just wait until I can devote a little mo time to learning JS.

    Sure, just use the RANDOM function.

    RANDOM <int_var> <#>
    args: dest num
    ---------------------
    Places a random number between 0 and num-1 into dest.

    PistolGrip
    ----------

    ---
    ■ Synchronet ■ WasteLand BBS ■ telnet://wasteland-bbs.com
  • From Hausmaus@VERT/MIDNITE1 to PistolGrip on Sat Nov 15 21:06:00 2003
    Re: Baja feasibility
    By: PistolGrip to Hausmaus on Sat Nov 15 2003 06:41 pm

    Sure, just use the RANDOM function.

    Okay, I feel like a dork now. ;)

    Thanks.

    --HM

    ---
    ■ Synchronet ■ Midnight's Hour BBS - midnightshour.org
  • From Digital Man@VERT to Hausmaus on Mon Nov 17 14:07:00 2003
    Re: Baja feasibility
    By: Hausmaus to Digital Man on Sat Nov 15 2003 02:23 pm

    Now I know it sounds silly to be asking this, but is there random number capabilities in Baja? I've been reading over the docs and I haven't seen anything yet (or perhaps I skipped over it). I'd like to do it in Baja so i would be backwards-compatible with older versions of Sync, but if it can (or should be) written in JS, then I'll just wait until I can devote a little mo time to learning JS.

    Ideas or suggestions?

    I would recommend writing it in JS instead. Both languages have a random number generation function in Synchronet.

    digital man

    Snapple "Real Fact" #29:
    On average a human will spend up to 2 weeks kissing in his/her lifetime.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Hausmaus@VERT/MIDNITE1 to Digital Man on Mon Nov 17 21:32:00 2003

    I would recommend writing it in JS instead. Both languages have a random num generation function in Synchronet.

    Okay, gotcha. I kinda figured you would say JS (just because it's more of a complete language, I guess-not quite sure what I'm trying to say).

    --HM


    ---
    ■ Synchronet ■ Midnight's Hour BBS - midnightshour.org