Why is there no ELSE condition?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hi guys!

    Why is it always the really simple things that cause me the biggest headaches?? haha.

    Okay, so normally when I program, I simply put an else statement in my code but Fusion 2.5 doesn't seem to offer me any way to do that.

    MY PROBLEM:
    I put in two statements;

    If user presses [I] on keyboard AND object is invisible THEN make object visible.
    If user presses [I] on keyboard AND object is visible THEN make object invisible.

    It works fine the first line but the second line doesn't work. I think that's because the condition was already changed by the previous line so it actions both lines in the same loop (so usually I would use an ELSE statement to avoid that from happening).

    I need:
    If object is invisible then make visible ELSE make invisible.

    How do I do that in Fusion 2.5 ?? Thanks

  • Try to reverse event order in the event list :) >>> err... this would also revert the problem... sorry XD
    You may need additional flagging, as Coldfire said!

    also, take a look at past threads, it's often asked, i.e.:
    Please login to see this link.

    Also, you may want to check "immediate if" object, that can handle as many "elses" as you may think of XD

    a selection of my Fusion examples can be found Please login to see this link.

  • Thanks guys.

    Reversing the order broke it the other way around sadly... :( (now it stays invisible upon the key press)

    Flags works perfectly :) I love how simple that is... thanks ColdFire, this will save me a lot of headaches :)

    I did try searching the forums first but I didn't find anything. Apparently the word "else" on its own is too common to search and my "else statement" or "else condition" found nothing related. I also find the help files in Fusion rarely bring up anything I'm looking for :(

  • Quote

    Reversing the order broke it the other way around sadly... (now it stays invisible upon the key press)

    Uhh yes, you're absolutely correct, my fault!
    I remember fixing some similar problem with this solution, but I can't remember which :(
    I typed too quickly without checking in depth, and ultimately maybe my issue was not so similar...

    Toggling a flag is the perfect solution!


    As for searching this huge forum resource,
    I often find that I get more convenient results searching "clickteam *******" on google,
    then searching with the forum search feature... so that could be another test to try.

    Good luck with your game :)

    a selection of my Fusion examples can be found Please login to see this link.

  • For better performance and and organization, you should put your if(){} events in a deactivated group and then activate it and run a fast loop. Deactivate the group on each of the On loop events. This method is identical to if(){} and offers the best performance.

    If you need to run a sub-loop inside the if(){} group (only for event organization), instead of deactivating the group in each event, run a loop at the end of the action list, and on this loop, deactivate the if(){} group. This allows you to use as many sub-groups as you like with minimal performance overhead if you want a bunch of nested groups like that.

    Snail

  • this one is off the cuff, so don't punish me if you have a better idea. :)

    group of events
    if press I activate
    if invisible make visible and deactivate
    if visible make invisible and deactivate

  • You're fine, Dascribe. :)

    You can see using a fast loop, however, that you don't add any extra conditions to the event. You just deactivate the group when one of the events runs. Your method would definitely work but it'll add more processing overhead.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!