User Tag List

Results 1 to 4 of 4

Thread: Find every instance in an Array

  1. #1
    Clicker Fusion 2.5SWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Colonial_Settler's Avatar
    Join Date
    Jun 2006
    Location
    Melbourne
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Find every instance in an Array

    I have a 128 x 64 array, and I want to loop through and find the X & Y dimensions of every entry equal to a specific value. So for example if the array contained the number "7" at indexes (1,10), (1,25), (5,10) and (32,64), then those array positions would be recorded into like a rich edit box, let's say.

    So at the moment I have:
    * Button clicked
    > Start Loop "vertical" 64 times

    * On Loop "vertical"
    > Start Loop "horizontal" 128 times

    * On Loop "horizontal"
    + ValueAtXY( "Array", LoopIndex("horizontal"), LoopIndex("vertical") ) = 7
    [Rich Edit Object] > Str$(LoopIndex("horizontal")) + "," + Str$(LoopIndex("vertical")) + ","

    Trouble is, I'm not getting anything. If I remove the 2nd condition under "On Loop horizontal" then sure enough, it appends every single loop index to the text.
    So the comparison condition doesn't work.
    Anyone know a better way to do this?

  2. #2
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,348
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    I don't see why it wouldn't work, but here's my method...
    Attached files Attached files

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,569
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Your pseudocode should work, its how you would iterate over a 2d array and compare values. Without seeing your code, one possible culprit is how your array object is configured. Is it set to be a text array or number array? Base 0 or base 1? Does it have its x/y/z bounds set properly? If its a text array, it won't return values direct, but you could convert the string to a value

  4. #4
    Clicker Fusion 2.5SWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Colonial_Settler's Avatar
    Join Date
    Jun 2006
    Location
    Melbourne
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks NaitorStudios and Pixelthief. You were right - my code was fine, it was a small oversight with the "type" of array the object was set to. Changed it from Text to Numbers and it worked right away.

Similar Threads

  1. Replies: 8
    Last Post: 6th May 2017, 05:56 AM
  2. Replies: 2
    Last Post: 7th October 2016, 09:35 PM
  3. Replies: 5
    Last Post: 17th February 2016, 05:00 PM
  4. Instance inherriting from Instance
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 10th June 2013, 06:25 AM
  5. Dynamic Array- find row index?
    By crugh in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 11th May 2007, 04:21 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
  •