Feature Idea: Conditional Expressions

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.
  • What do you all think about a feature in the expression editor to get a condition? That is, using a condition in part of an expression, 0 meaning false and 1 meaning true. This would save many lines of code, as events could be done far more simply. For example

    Always: Add 1 to Y
    Object is overlapping Backdrop: Subtract 1 from Y

    could be done as

    Always: Subtract (isOverlappingBackdrop("Active")*2)-1

    This is a rather simple example, but the concept could be applied to far more situations.

    Thoughts?

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

  • Jacob. For my beedy little brain this is simpler:

    Always: Add 1 to Y
    Object is overlapping Backdrop: Subtract 1 from Y

    I would rather have more lines of code and have it Marv simpler.

    Marv

    458 TGF to CTF 2.5+ Examples and games
    Please login to see this link.

  • I too prefer less lines of code, especially because it becomes tedious to work with it after a while. There was an extension that allowed for these kinds of conditions within expressions, Jacob. I just don't remember how flexible it was. You could try searching the forum?

    Please login to see this link. - Metroidvania RPG (Win/OSX/linux & PS4/Vita/Wii U)

  • I'll do that. Probably a better example for my first post would be:

    Always: Set X to X+(0-isLeftPressed+isRightPressed)*isOverlappingBackdrop

    Which handles horizontal movement and backdrop collisions in one event.

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

  • Quote from nivram

    Jacob. For my beedy little brain this is simpler:

    Always: Add 1 to Y
    Object is overlapping Backdrop: Subtract 1 from Y

    I would rather have more lines of code and have it Marv simpler.

    Marv


    I think Jacob is asking to allow both? But yeah, I can see how that is simpler.

    Please login to see this link. by KetchupMaster - A must have for any web developer!
    Please login to see this link.

  • Well, I meant it as an added feature, but even as a replacement it would work more or less the same

    isOverlappingBackdrop( "Active" ) = 1;

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

  • I think making an extension with these functions would not be as hard as it sounds. I understand you'd like MMF to directly have these functions added, but an extension could basically read the situations and allow for the functions to work. You could even build your own interpreter before all your events and use however many functions you want, although I understand this beats the purpose. I like the idea, though! :)

    Please login to see this link. - Metroidvania RPG (Win/OSX/linux & PS4/Vita/Wii U)

  • I agree with Jacob on this.

    In most languages, what we think of as conditions, actions, and expressions, are just functions. In php, for example, look at mkdir function that creates a directory. Here's how to use it as an MMF2 action:

    mkdir("./blah");

    Here's how to use it as an MMF2 condition:

    if (mkdir("./blah")) echo "success"; //will echo success if the directory is created

    Here's how to use it as an MMF2 expression.

    $success = mkdir("./blah"); //$success becomes true if directory is created

    Of course I understand MMF must be kept simple and user friendly too, so it's probably a good idea to keep our actions, conditions, expressions system, but I can definitely see how having many conditions as expressions would add a lot more clarity and simplicity to my code.

  • The only thing that makes this method different than actual conditions, is that it would be non-selective. There would be no selection of objects that fit the condition. Unless there were a Compare Two Specific Values condition, but I don't know if that would possible.

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

Participate now!

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