Shirty's Recent Forum Activity

  • I'm on a deadline so, I can't really look into this just yet, i have this code checked in a repo with a tag, so I should be able to find it again.

    Once my deadline is over I will make sure but I was very tired when I posted this so, its more likely i just didn't realize i was calling ToggleConversationLockOff() somewhere after the call to ToggleConversationLockOn(). Still to be safe I will check.

  • I will look into it again with a fresh mind.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ... Mostly because there is no need for an Else when you have a condition like yours...

    I actually put that extra condition because i had some strange behavior. With the extra condition, I wasn't getting any issues.

    Couple of things. You have a local variable which will be reset immediately (i.e. next tick).....

    Ah yes, thanks, was a bit tired when I made this post, it was supposed to be static variable, I don't think it should have effected this though. Just to be clear, when running the "Toggle.." function, the "WriteToLog" function seemed to have been called twice, which made me wonder if there could be a reason for this.

    ... Plus we can't see other things, like how you are calling the functions, the log messages themselves, etc.

    edit: not to mention you don't need 2 functions to do this, unless this is just experimenting

    Yea, I think i was not clear enough in explaining the problem, the issue seemed very much to happen in the same function call. I was asking here about the else statement to be sure the else in construct functions the way I expect it too. My codebase has become quite large and I'm trying to be sure about how things work, before digging through it.

    Sometimes having 2 functions makes code clearer to read and easier to return to I should probably not call it toggle though if it has 2 functions...

    In the absolute, Else is supposed to indeed be executed if and only if the previous event hasn't been executed, like in a regular if/else statement in any other coding language.

    Thanks.

  • Hello everyone,

    Okay I wasn't sure really where to post this, I feel like its something buggy is happening but I'm not sure.

    In the attachement i have a picture of a function that toggles a local variable. A strange thing happens when I execute the function with the else statement and no extra check, the else statement seems to run even though the previous statement runs.

    It seems like the else statement runs because the variable I checked is changed in the condition prior to the else statement.

    Does the else statement in construct work like a typical programming language else, or does it actually behind the scenes check if the variable is different then what is stated in the condition?

Shirty's avatar

Shirty

Member since 4 Jan, 2015

None one is following Shirty yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies