How do I do this Or Sentence ?

  • Don't read too much into the codes [the variable assignments], it is nonsensical.

    I am just wondering whether is it possible to fit two lines between "OR" statements.

  • Hi, as far as I know, you can't.

    You can only do Whatever=1 or Whatever =5 > trigger once, which only triggers the intended way, if whatever is not 1 or 5, but won't trigger again, if whatever is changed from 1 to 5 or 5 to 1. To do that, you can define a function, and simply call that. then you will have the right triggers and the event-code just once. If that is, what you want to achieve

  • Like this...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the solution, I wanted to do this too, but then it will show up in the Function object

    I want the function object to hold more "global" functions because everything in the function is visible across all scenes so

    Unless there is a way to isolate functions.

  • It's possible with compare two values. Like this :

    [attachment=0:siwxrdpz][/attachment:siwxrdpz]

  • Oh !

    That's interesting !

    But I am using the Trigger once condition so I guess I am out

    How do you even create that by the way ?

  • It's part of the System object.

    System - Compare two values, then type an expression using any of the standard mathematical forms.

    It's all in the manual: https://www.scirra.com/manual/78/expressions

  • Are you guys really sure, that it solves the problem, if the Value is changing from 0 to 6?

    It still just compares, "if Whatever=0 or Whatever=6" is true, then it triggers once (meaning triggering only if previously not true). But if you want to trigger once each occasion, that is not going to work in my understanding.

    Exapmle:

    Whatever = 8

    Whatever=0 or Whatever=6 is NOT TRUE > nothing happens

    Change Whatever to 0

    Whatever=0 OR Whatever=6 is TRUE for the first time > trigger once

    Change Whatever to 6

    Whatever=0 OR Whatever=6 remains TRUE > nothing happens, already triggered

    Seems to be the same problem as described already in an earlier post of mine.

    One question Toddler: why exactly does the function solution bother you? Where does ist show up, and why is that any problem? I don't want to convince you, I just think, I can learn something there, I don't know about Please explain.

  • Well then, if it must run once between 0 <-> 6 value permutations too, I guess you could use sub-events and a local flag variable. Like this :

    [attachment=0:2er37a7l][/attachment:2er37a7l]

  • variable vs. function

  • Local scope vs. global scope

  • Magistross, you are awesome.

  • Well then, if it must run once between 0 <-> 6 value permutations too, I guess you could use sub-events and a local flag variable. Like this :

    [attachment=0:2x3kw1dt][/attachment:2x3kw1dt]

    On a second look:

    flagExecute is set to 1 once if Whatever is changed to 0 or 6, also when changing from those numbers. However, flagExecute stays the same value (1) when Whatever changes drom 0 to 6 not solving the issue completely. Also while "flagExecute = 1" is true It is triggering all events included in "flagExecute = 1" every tick.

    Simply adding a "Set flagExecute to 0" at the end of the "flagExecute" event list should round it up

  • MultipleChoice flagExecute is a local variable. It get initialized to 0 implicitely every tick, no need to do anything !

  • Okay, there I learned something. I did not get, what local numbers are exactly used for.

    Can you also please explain then, if and why a function is a disadvantage in this case?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)