User Tag List

Results 1 to 5 of 5

Thread: Conditions within a loop?

  1. #1
    No Products Registered

    Join Date
    Dec 2015
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Conditions within a loop?

    Hi,

    I'm stuck in the following situation:

    I got an array that contains information about the cards that are in the player's hand this round. It looks like this:

    array_hand
    card type level quantity
    0 1 1
    1 1 2
    2 2 0
    3 2 1

    Next step is to create active objects (eqal to the sum of the quantity coloumn), give them the corresponding card type as an alterable value and sort them like that:

    Layout within the frame
    1
    0 1 2

    The creation of all of the cards (actives) happens within a fastloop. However, I need an if-condition within that loop to skip the lines where quantity = 0 and to create more instances where quantity > 1.

    I'm used to programming and skimmed through a lot of tutorials and forum posts already, but didn't manage to find an answer yet.

    Thanks a lot in advance!

    Regards,

    kons

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Hi and welcome! Create an On Loop condition in a new event. Then create a second condition and use the Compare two general values condition from the Special Conditions icon. Then rightclick the Array object and select Read Value from XY Position.

    Suppose the loop is called loopY. Then the expression should be something like: ValueAtXY( "Array", loopindex("loopY"), 2) = 0

    The event should now look like this:

    * On loop: "loopY"
    + ValueAtXY( "Array", loopindex("loopY"), 2) = 0

    - Do Actions

    Important: Unselect Base 1 index in the Array Object properties in the frame editor. This will make the first index be 0 instead if 1. This makes it easier to work with since loopindexes starts with 0. Also make sure it is set to Number Array.

  3. #3
    No Products Registered

    Join Date
    Dec 2015
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Popccorn,

    thanks for the fast reply! When I tried that yesterday, I wasn't able to insert a second condition to a "on loop" condition, thus my irritation. Obviously I made something wrong. I'll try that as soon as I get home.

    Best regards,

    kons

  4. #4
    No Products Registered

    Join Date
    Dec 2015
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worked like a charm! I never used this Special Condition, although it's so basic and great!

    Thanks for pointing me in the right direction!

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    No problem! Glad you worked it out!

Similar Threads

  1. Terminate fast loop mid-loop
    By JDWB in forum Fusion 2.5
    Replies: 8
    Last Post: 2nd November 2014, 04:14 PM
  2. Best way to implement for loop (and sub for loop)
    By CrystalNoir in forum Fusion 2.5
    Replies: 4
    Last Post: 23rd June 2014, 06:16 AM
  3. Replies: 7
    Last Post: 25th December 2012, 11:26 AM
  4. fast loop and loop index
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th May 2010, 01:43 AM
  5. Start loop "loop" 'Alterable Value A' times
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 9th May 2009, 07:26 AM

Posting Permissions

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