Results 1 to 5 of 5

Thread: MakeCompass issue

  1. #1
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default MakeCompass issue

    I'm sure this has an easy fix but I cant figure it out. Basically I want my compass to move to between 355 and 5 degrees (North,+- a bit). RandomRange doesn't work because It finds a number between 5 and 355, but since I'm using the compass it should reset to 0 at 360. Does anyone know of a fix to this? Thanks.

    Simba Code:
    MakeCompass(randomrange(355, 5));


    Edit:

    Could I just make a case statement like:

    Case random(2) of

    0: MakeCompass(randomrange(0, 5));
    1: MakeCompass(randomrange(355, 359));
    Last edited by Nebula; 12-31-2011 at 01:02 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    I'm sure this has an easy fix but I cant figure it out. Basically I want my compass to move to between 355 and 5 degrees (North,+- a bit). RandomRange doesn't work because It finds a number between 5 and 355, but since I'm using the compass it should reset to 0 at 360. Does anyone know of a fix to this? Thanks.

    Simba Code:
    MakeCompass(randomrange(355, 5));


    Edit:

    Could I just make a case statement like:

    Case random(2) of

    0: MakeCompass(randomrange(0, 5));
    1: MakeCompass(randomrange(355, 359));
    Simba Code:
    MakeCompass(randomrange(355, 5));

    This would be the random range of 355 and 5, which means all numbers from 355 till to 5, i can be 215, it can be 100... etc etc.

    Try this:

    Simba Code:
    MakeCompass(randomrange(-5, 5));

    Not sure though if MakeCompass works with negative numbers.

    Edit: also have you tried ClickNorth yet?
    Hi

  3. #3
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    randomrange(-5, 5) wouldn't work since the compass goes from 0 to 360, not -180 to 180. I used cases and it works fine. I dont wan't to use MakeCompass(n) since that will make it perfectly north, which I think is unhuman if it goes perfectly north every time.

  4. #4
    Join Date
    Jan 2011
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Your cases solution is the best, I think.

    Although MakeCompass(n) doesn't really make the compass exactly north. I believe actually that if the compass is between 355 and 5, it doesn't do anything at all.

  5. #5
    Join Date
    Jun 2008
    Location
    United States
    Posts
    818
    Mentioned
    60 Post(s)
    Quoted
    90 Post(s)

    Default

    Simba Code:
    case RBool of

      True:  MakeCompass(RandomRange(0, 5));

      False: MakeCompass(RandomRange(355, 360));
    end;

    Erm, looks like I have been ninja'd.
    [10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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