User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15

Thread: Save more object in array with loop function part2

  1. #11
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    rubes's Avatar
    Join Date
    May 2011
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SolarB, why is it rewriting the x value of 10 that was already written?
    First I am cycling through the Y indexes based on a fast loop NObjects( "switch" ) times, then I cycle the Y with the formula NObjects( "switch" )+LoopIndex("AddBoxestoArray") which again the loop is based on NObjects ("box"). To me, this should keep the Y's unique and not writing over the previous entries

  2. #12
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleXNA Export Module
    daniele's Avatar
    Join Date
    Nov 2007
    Location
    italy
    Posts
    413
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SolarB View Post
    PS. I read your post again and tried what you said and it works but it's still buggy and very fiddly. It won't load anything if you try and load without closing the app but it will once you restart it, I don't know why. If you really don't need the expandability offered by the above method then this solution may be a possibility, but I personally wouldn't recommend it.

    Also unfortunately Array does not support writing values and strings at the same time, you would need to use another array set to strings, or store all values in one string array, eg. Write (str$(alt value x(active))) to Array(x,y), then retrieve them using Set Alt Val X("active") to Val(StrAtXY( "Array", X, Y)).


    Attachment 10601
    perfect, now I understand. I do not need to alterable values​​, but I have to work with the 'setting "string" my old project has changed because I have store string values ​​with commas, and therefore, are obliged to use x as a string array. I'm back now and I have not had time to check how it actually works your example, but with your example, you can replace number with string or is it impossible? last thing, since your example is different from what I had done Rubes, I can store values​​, such as all global variables, string variables and other parameters of other objects? I'm sorry, but I have little time to try it now, checking tomorrow with more attention. You've been really great, thank you for your help.
    if I set array as a string, I can store both strings and numbers, but if I set array as a number, I can only store numbers and this for a real rescue is very limited.

  3. #13
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Yes, you will have to set the array to string and then change all the array actions as above.

  4. #14
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Rubes: you are absolutely right, apologies, I hadn't noticed - your example works perfectly if you delete the group.good action from the last line.

    Ah yes, that's the amazing thing about coding, there's always a thousand ways to do the same thing!!


  5. #15
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleXNA Export Module
    daniele's Avatar
    Join Date
    Nov 2007
    Location
    italy
    Posts
    413
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SolarB View Post
    Rubes I'm afraid your method doesn't work because you are overwriting X,10 with value 2 directly after writing value 1 to the same X.

    Since it seems that Array does not like to mix and match XY and XYZ so I have stored the number of objects in Array(99,ObjectType,0) and now it will load properly.

    Daniele I have used XYZ since you are using more than one active. Using one active with directions/animation frames set to switch/box would be much easier since you would only have to run a fastloop that would create one object and then you could set it to switch or box, etc. and you would not need the Z dimension. However since I see you have already used directions for different sized models (of course you could use the 'scale' function if you wanted to resize) it was necessary to designate DimX as the type of object ie. switch/box (set in its variable 'ObjectType' upon creation as you point out in your last post - see near top of mfa), then the ID of the object as DimY (to be loaded by LoopIndex in the relevant fastloop), and DimZ (2, 3 and 4, as you have in your values) as Xpos (2), Ypos (3) and MODEL_SWITCH (4).

    The 3D array:

    X(Type) Y(ID) Z(xpos=1, ypos=2, colour/direction/variable=3) VALUE that is written to this position
    0 0 2 Xpos of first Switch
    0 0 3 Ypos of first Switch
    0 0 4 Colour of first Switch
    0 1 2 Xpos of second Switch
    0 1 3 Ypos of second Switch
    0 1 4 Colour of second Switch
    etc.
    1 0 2 Xpos of first Box
    1 0 3 Ypos of first Box
    1 0 4 Colour of first Box
    ...and so on.


    This way it will be easy for you (if you want) to have as many types of actives as you want AND as many of each type as you need AND as many variables and other values for each active as MMF can handle. You would just need to add more loops of similar nature to the LOAD group.

    Of course there may still be a more efficient way of doing this, if so, please chime in y'all!


    working MFA:

    Attachment 10600
    your example works fine, but has an error.
    Apparently, when you load, everything looks the same, but try to count the objects. if you save the project with 10 items, when you go to load, objects are now 11. this object in more, is hidden behind and you can not see, but try to move objects and find the 'hidden object. every time you save, the objects always increase. I tried to understand the advice concerning, but I have not found a solution, could you help me?

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Replace a function with a loop!
    By ogrgkyle in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 28th October 2013, 09:05 PM
  2. Help with save all variables function
    By SevenSails in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 20th December 2012, 10:39 PM
  3. [Question] Array object/recommended to save a game?
    By kusa in forum Android Export Module Version 2.0
    Replies: 5
    Last Post: 14th September 2012, 10:59 PM
  4. Super Function vs Fast Loop
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th June 2010, 06:47 PM
  5. Start loop as an object's action, like a function?
    By RedHades in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 14th April 2007, 03:26 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
  •