Results 1 to 3 of 3

Thread: Tutorial for Dink

  1. #1
    Lesser Knight
    Join Date
    Dec 2003
    Posts
    50

    Default

    I made a tutorial for the dink smallwood editor. It may be here. You see, right now I can't log into the computer that has it ....at least I know some things that I need to put in....such as the moving...Oh, yeah...I also need to know how the random function for varialbes work. Does anyone know?

  2. #2
    Knight
    Join Date
    Oct 2003
    Location
    The Netherlands
    Posts
    65

    Default

    The command to get a random number is random(int max, plus this); which can be used like this:

    int &random = random(10,1);

    That creates a local variable &random with a value between 1 and 10.

    Or, from the DinkC Reference:

    #random()
    # Category: (none defined)
    # Prototype:
    # int random( int max, int plus_this );

    Random(10,1) would return a number between 1 and 10. Random(5,0) would
    return a number from 0 to 4. [Similar] to how C does it.

    [The use of "max" as the designator for the first number is misleading.
    The random() function is capable of generating any of "max" distinct integer
    values, in the range 0 to (max minus 1); then "plus_this" is added to the
    generated value to create the return value. The clearest example is
    random(2,0), which can generate either of two values, 0 or 1.

    More succinct wording courtesy of ManaUser: "<max> is the number of
    possible values and <plus_this> is the lowest possible value."

    Also note that it is perfectly valid for <plus_this> to be negative.
    "Random(5,-2)", for example, generates 2, 1, 0, -1, or -2.]
    - Simeon

    See here for my profile.

  3. #3
    Lesser Knight
    Join Date
    Dec 2003
    Posts
    50

    Default

    x.x I think I lost info on how to get it, plus I think I lost it completly...

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •