Estecka's Recent Forum Activity

  • Thanks. I had completely misunderstood how Function.ReturnValue was supposed to work.

    Somehow I thought it was meant to work inside the function and that it couldn't work outside of it.

  • Solved:

    trouble-operating-returnvalue_p1064184?#p1064184

    Problem Description

    After triggering a chain of functions that does literally nothing, the one function that does an actual thing quits giving the right result.

    Attach a Capx

    https://filebin.net/g3iiun5rydcxsar7

    Description of Capx

    A function "Zéro" changes its return value twice: first to 100, then under a specific condition to 0. the final result is displayed onscreen.

    When pressing Space, a function "Wreck" is called, it then calls another function which does nothing.

    Expected Result

    The condition to change Zéro()'s result 0 should always be right and thus, the function Zéro() should always return 0

    Steps to Reproduce Bug

    After running the project, simply press Space to call Wreck().

    -> The result of Zéro() changes to 100, and remains this way.

    Observed Result

    • The event 2 needs to be comparing Function.ReturnValue in order for the bug to happen.
    • The function called by Wreck() doesn't need to exist, but there need to be at least two chained calls.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Edge: (YES)

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    r233

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • korbaach

    So, you mean that if being returned the returnvalue of "One" instead of "Two", it's because the returnvalue of two isn't yet calculated when I request it?

    But then :

    Shouldn't I be returned 3 in the second case as well, instead of 10 ?

    So the code is the equivalent of:

    ReturnValue = 2*ReturnValue

    Which of coarse gets confused.

    Why does it confuse Construct? It's a thing I use all the time and again, for as long as it doesn't involve a function it works perfectly fine:

    -Set return value to 10

    -Set return value to 2*returnvalue

    will properly work, it's

    -Set return value to somefunction

    -Set return value to 2*returnvalue

    that messes up.

    I don't really see the relation here.

    ---

    To be clear I have worked around this in my project, at this point what I want is understanding why it behaves in such a weird way.

  • Why is it working this way?! Why does waiting nothing suddenly makes it work?

  • The best way I can think of is to simply erase the value you've just called from the array.

  • I don't think it's possible to dynamically build a reference toward a variable. However it is possible to build references toward a dictionnary's keys this way.

  • So, I have a project with two levels of function:

    "One" is some basic math operation, here I want it to arbitrary return 10

    "Two" 's are different fashion of reusing the formula, here I want it to arbitrary return twice the previous result, so 20

    I set the return value of "Two" only once in the code, and yet, it does not return the same value at different point of the code:

    • If I call the function from the Outside, it will indeed return 20
    • If I request the return value from the Inside of the function, it returns me the same value as "One"? Why?!

    Even if put multiple "set returnvalue", the simple fact of requesting a result from another function locks the "inner" returnvalue to the result of that function. If I'd use raw numbers, then requesting the returnvalue from the inside would give me the right result.

  • I found an absolutely brutal optimization. 3.500% faster !

    A string that used to take 10mn to process is now nailed in 17s !

    Let's suppose my string looks like this, where - represents junk data :

    ----DATA1-------DATA2------------------------DATA3------

    There is an awful lot of junk in-between the datas I want to collect, I only have use of 1 caracter out of 14.

    So, what I'm doing before processing the string, is filtering out all of the junk code thank to a single regex test:

    RegexReplace(TextBox.Text, ".+?(DATA[0-9]).+?", "giu", "| $1 |")

    which returns me an amazingly shorter string:

    |DATA1||DATA2||DATA3|------

    There's still a bit of junk at the end somehow, but so little compared to before I barely even care.

  • Sure, currently rewritting the OP.

    The bugs affect r230, however, firefox seems safe from this bug, sorry I omitted this.

  • Thank for the sugesstion.

    I tried to avoid "actual" loop so I could display the process progress in real time (not processing everything in a single tick) but making up a "fake" loopindex shouldn't be too hard, so I'll look into it.

    Let's work out how to use that g flag .

    I'm heavily relying on Pode's HTML plugin into this project, so I don't know whether you could read it without the plugin installed.

  • Mmh, I didn't think my climbing with any sort of helper. Just detecting which areas around the player are overlapping or not the scenery, no tiles would be set as more climbable than others.

    How badly are the helpers needed? I'm not familiar with these so I don't know how they help exactly.

    In the meantime I'll try to put my code into exectution.

  • Glad to be on-topic !

    Sorry I took so long, I forgot my way in.

    Here's my attempt at making a character able to hang to cliffs. Again I didn't take the time to even code it so I only have theory:

    The character is facing right, and is represented by the violet box.

    In order to hang to a cliff, an element of the scenery must be present in the red area on the top right (Detects a wall), but NOT in the green area. (Detects a "hole" in the wall for the character to hang to.)

Estecka's avatar

Estecka

Member since 21 Dec, 2015

None one is following Estecka yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies