User Tag List

Results 1 to 5 of 5

Thread: The object scoping problems

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Dec 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The object scoping problems

    PosX is the Alterable Value 1 of the and the (both are active objects). It's the X position on the checkerboard of these objects.
    +PosX of = 1
    +PosX of = 19
    • Destroy
    • Destroy
    This event has to remove all the from the position which is equal to 1 and all of the from the column number 19, if there is at least one of these objects in the correct column in the same time. Yeah, everything works well, objects are removed only from the first and 19th columns. This is only an quick example.

    I have two problems:
    First:
    +PosX of = 1
    +PosX of = 19
    • Destroy
    The expectations: if there are the objects on the position 1 and 19 in the same time, destroy them.
    Result: None of them dies.
    I don't really know how to solve this problem. Well, I'm sure it's because Fusion scopes elements in that way: let's pick one of --> check if it's on the position 1 and 19 in the same time --> it can't be, so that is false --> do not trigger the event.

    Second:
    I give the qualifier "" to and .
    + PosX of = 1
    + PosX of = 19
    • Destroy
    • Destroy
    The expectations: if there is at least one object with qualifier on the position 1 and at least one on the 19, destroy them.
    Result: you know, nothing happens.

    Halp pliz0rd. Do you know any tricky solution to fix these problems?
    Sorry for my "englando" English.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    I have two problems:
    First:
    +PosX of = 1
    +PosX of = 19
    • Destroy
    The expectations: if there are the objects on the position 1 and 19 in the same time, destroy them.
    Result: None of them dies.
    I don't really know how to solve this problem. Well, I'm sure it's because Fusion scopes elements in that way: let's pick one of --> check if it's on the position 1 and 19 in the same time --> it can't be, so that is false --> do not trigger the event.
    Correct, this will check all objects that have both "1" and "19" values in PosX,
    such an object obviously doesn't exist.

    If you want to destroy two objects when positions 1 and 19 are taken,
    you could behave in some different ways, i.e.:

    when an object is on position 1, fire a loop "check_19"

    on loop "check_19"
    + posx of =19
    destroy
    start loop "check_1"

    on loop "check_1"
    + posx of =1
    destroy

    same reversed starting for position 19

    I would suggest using an underlying array as a structure for this kind of things, this may ease (and clean) checkings a little.

    Second problem seems really similar to first one, if I got it correctly.


    Another solution with qualifier :

    Always
    >>> set global string "pos1_19" to 0
    >>> count , loop name "check_positions"


    on each one of , loop name "check_positions"
    + posx=1
    >>> add 1 to "pos1_19"

    on each one of , loop name "check_positions"
    + posx=19
    >>> add 1 to "pos1_19"

    global string "pos1_19"=2
    >>> set global string "pos1_19" to 0
    >>> start loop "destroy 1"
    >>> start loop "destroy 19"
    etc.

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Sumo's Avatar
    Join Date
    Jul 2008
    Posts
    642
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It's probably because Fusion is checking the same object for both X Positions which is why the actions aren't triggering. Try adding the condition Active > Pick or Count > "Pick active at random" to your code, maybe that will change something. You could also fastloop through the number of objects and test their positions that way. Or maybe toggle a flag when one of the positions is checked. Then check to see if that flag is ON before checking the second position. If it is ON and the second position is correct, then delete both and turn the flag OFF.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Chrille's Avatar
    Join Date
    Jul 2006
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit: D'oh! Someone beat me to it

    The events won't trigger, because it will check if "posX" of is both 1 AND 19, which is impossible. You can't check if there is one with the value 1 and one with 19 in just one event.

    Here's a solution that could work. Use a separate Active Object, I'll refer to it as . Then code it like this:

    + Always
    - Turn Flag 1 Off
    - Turn Flag 2 Off

    + PosX of = 1
    - Turn Flag 1 On

    + PosX of = 19
    - Turn Flag 2 On

    + PosX of = 1
    + Flag 1 of = On
    + Flag 2 of = On
    - Destroy

    + PosX of = 19
    + Flag 1 of = On
    + Flag 2 of = On
    - Destroy

    You could probably apply this solution to the second problem as well.

    There are cleaner and better ways of doing this though. If you're going to code several situations similiar to this, you're better of coming up with some sort of function to reduce the amount of events. You could use an array combined with a loop to check positions for example.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Dec 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for these ideas and ready to use examples. Unfortunately, can't check them now because here - in Poland is late hour and I'm tired after whole day. But I think they will fit very well for my project. If not I will ask for more help.
    If someone else have any other tricky, universal or crazy ideas for this topic, go on - type it. I appreciate your help guys

Similar Threads

  1. Replies: 2
    Last Post: 25th June 2015, 04:59 PM
  2. A Guide to Basic Object Scoping in Fusion 2.5
    By Danny in forum Clickteam Guides, Tutorials and Examples
    Replies: 0
    Last Post: 10th January 2014, 02:15 PM
  3. Having problems using the FTP object...
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 20th September 2010, 10:01 PM
  4. Problems with Object selecting
    By TotallyTurton in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 5th February 2008, 10:25 AM
  5. ftp object problems
    By Jason in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th March 2007, 09:16 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
  •