User Tag List

Results 1 to 7 of 7

Thread: Creating a toggle function with Active System Box

  1. #1
    No Products Registered

    Join Date
    Oct 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating a toggle function with Active System Box

    Hi,

    I'm trying to create an active system box which when clicked changes to a different colour, and when clicked again changes back. I also need to update an INI file on each click.

    For some reason, I can only get it to work for the first click- but it won't return. Have I missed something obvious?

    The sequence goes:

    1) Start of Frame

    Load toggle state from INI (on or off) save to [Box] internal value A


    2) When user clicks with left button on [Box]
    + [Box] Internal value A = 0

    Toggle to ON (change colour of [Box]
    and update INI


    3) When user clicks with left button on [Box]
    + [Box] Internal value A = 1

    Toggle to OFF (change colour of [Box]
    and update INI


    That should work right? I've tried adding Run Once per Loop and I've tried using counters instead of internal values.

    Let me know if an example file would be useful and I'll try to upload it.
    I'm using MMF2 Standard, build 242.

    Thanks in Advance,
    toast0r

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Creating a toggle function with Active System Box

    That code won't work. It'll see that it is off, so turn it on - then see that it is on, so turn it off.

    Instead, make it so if you click the button then it toggles a flag using the toggle facility. Then in the next two events make it check whether or not that flag is on and act accordingly.
    .:::.Joshtek.:::.

  3. #3
    No Products Registered

    Join Date
    Oct 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating a toggle function with Active System Box

    Thanks Joshtek - your solution works perfectly - I knew it would be something obvious!

    Out of interest though, why is it that the other code didn't work? Surely if the button in only being clicked a single time it should never get as far as the third line of code for turning it back (if you see what I mean).

    Thanks for the help.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating a toggle function with Active System

    MMF runs all events that begin with "user clicks on ..." when you click on something. It doesn't matter if one line runs properly (ie passes all the conditions) it will run the others anyway.

    So in your case clicking on the box will make it always run both lines 2 and 3. It also runs the lines one after the other, not both at once, so that's why changing the box's value in line two makes line 3 succeed.

    Like this:

    User clicks on a box and internal value is 0:
    2) When user clicks with left button on [Box]
    + [Box] Internal value A = 0
    Set internal value to 1

    So the internal value is now 1. Then it runs this line, because it starts with "user clicks on" as well:
    3) When user clicks with left button on [Box]
    + [Box] Internal value A = 1
    Set internal value to 0

    So the internal value is now 0 again.

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating a toggle function with Active System

    That makes much more sense - thanks for clearing that up.

    Slightly off topic I guess but is there a way to make MMF wait for a given time from passing a condition to carrying out the required action?

    ie.
    1) [Active Object 1] colides with [Active Object 2]
    Wait 10 seconds THEN destroy [Active Object 2]

    or would I have to create a timer 'every 1 second add 1' or similar?

    Thanks for all the help, much appreciated.

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    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)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Creating a toggle function with Active System

    Quote Originally Posted by toast0r
    or would I have to create a timer 'every 1 second add 1' or similar?
    Yes, that (or similar).
    .:::.Joshtek.:::.

  7. #7
    No Products Registered

    Join Date
    Oct 2006
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Creating a toggle function with Active System

    Thought so.

    Thanks!

Similar Threads

  1. How do i use the 'Replace color function' for Active Objects?
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 22nd April 2014, 02:24 PM
  2. Creating a system of teleporters
    By Storsorgen in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st May 2013, 04:04 PM
  3. Inventory System: Fast Function Obj, String Tokenizer Obj
    By dcrew in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 7th September 2012, 07:00 AM
  4. [BUG] Active system box
    By qenio in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 6th August 2011, 01:06 PM
  5. Active System Box
    By Jeff in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 9th March 2011, 07:23 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
  •