User Tag List

Results 1 to 7 of 7

Thread: Array + fastloop bug.

  1. #1
    No Products Registered

    Join Date
    Apr 2010
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Array + fastloop bug.

    (IF)upon preesing "K" (THEN) start loop "DRAW" 16 times

    (IF)On loop "DRAW" (AND) ValueAtXY("array",Loopindex("DRAW")mod4,Loopindex( "DRAW")/4)=1 (THEN) paste object into background.

    This code should read array but array position is allways [0,0]

    My array:
    [0][1][0][0]
    [0][0][0][0]
    [0][0][0][1]
    [0][0][1][0]



    When I use ini file it works but I need array.

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    Hello there QS,

    You have made a common mistake to those who are not familiar with modulo mathematics.

    ... Luckily for uncool reasons i am

    Two-Dimensional to One-Dimensional conversion.

    X=Loopindex("DRAW")mod4 \\Got that right !
    Y=(Loopindex("DRAW")-(Loopindex("DRAW")mod4))/4 \\Close..

    Seems silly i know; but consider this!!!

    1) MMF will round to whole numbers when using integer division.
    2) 7 / 4 = ~ 2
    3)

    luckily!!!... Subtracting the division overflow is easy azzz ! :grin:

    ALSO. Y=floor(Loopindex("DRAW")/4.0) works fine too :P

  3. #3
    No Products Registered

    Join Date
    Apr 2010
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    I know that, but I specifically want to order 7 divided by 4 gave the result 1. By this term, I know at which array point I am.

    see:
    loopindex is 7 so i must be here:
    [0][0][0][0]
    [0][0][X][0]
    [0][0][0][0]
    [0][0][0][0]
    position X=2=loopindex Mod 4. Y=1=loopindex/4=7/4

    The proplem is in array I can't read current position of array when I do it in loop...

  4. #4
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    7 / 4 = 1.75... which rounds to 2.

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    MMF does not round during integer division. MMF simply strips the result of it's decimals.

  6. #6
    Clicker Multimedia Fusion 2

    Join Date
    Jan 2007
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    Try to the current position before you use it.
    Set it to
    "Change Current Position -> Set X dimension index to... loopindex("DRAW") mod 4"
    "Change Current Position -> Set Y dimension index to... loopindex("DRAW") /4"

    Also, I advise you to turn off "Base 1 index" in the array properties, it's better to use 0-based index.
    In your example, where loopindex("DRAW")==7:
    7 mod 4 = 3 (not 2)
    7/4 = 1 (not 2 either, Seele. This is an integer)
    So the correct position is
    [0][0][0][0]
    [0][0][0][X]
    [0][0][0][0]
    [0][0][0][0]

    Also, some other common mistakes:
    -make sure you wrote the name of the loop correct
    -set the array to a number array, not text array

  7. #7
    No Products Registered

    Join Date
    Apr 2010
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Array + fastloop bug.

    "-set the array to a number array, not text array"
    Thanks man now it's works


Similar Threads

  1. Dynamic Array - Sort 2 dimension array by Column 1
    By Ryan in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 16th December 2012, 05:54 AM
  2. Dynamic Array to Binary Array problems
    By BREK in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 22nd March 2010, 11:48 PM
  3. fastloop logic / array help
    By kungsangun in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 22nd September 2009, 04:52 AM
  4. fastloop help
    By falkon in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 6th April 2008, 11:14 PM
  5. Bug: Fastloop
    By Sphax in forum File Archive
    Replies: 7
    Last Post: 15th November 2006, 11:36 PM

Posting Permissions

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