thegamecracks's Forum Posts

  • 6 posts
  • It says BlockMoveable(21) on the first action because that's what the global variable, SelectedObject, contains.

    To keep things simple, I store the name and UID of the object that the player clicks/touches. That way, the last clicked object can easily be referred to. That's why "BlockMoveable(21)" and ".BBoxLeft" are separated, and not just simply written as BlockMoveable(21).BBoxLeft. It would be helpful to just replace the left part to get a different value I'm looking for, such as Player.BBoxLeft, or ButtonPressure.BBoxLeft.

    For the other parts, I'm not planning to allow the selection of multiple objects at once. Otherwise, I would have used the RTS Template as a guideline.

  • When combining two strings to create a variable, Construct 2 sees it as if it were a string, rather than a variable.

    If I'm not clear, I have an example.

    (Replace int with float, that's probably a mistake)

    Focus on the first action, Set Position, specifically on the X axis part of the statement. This is what I see when I read the line.

    • Combine the strings, "BlockMoveable(21)" and ".BBoxLeft" to create "BlockMoveable(21).BBoxLeft"
    • Convert BlockMoveable(21).BBoxLeft into a float value
    • Subtract 2 from the output

    I'm expecting a number (X coordinate) to come out of this line but instead, only -2 comes out.

    After some staring and thinking, I have concluded that the issue is that "BlockMoveable(21).BBoxLeft" was seen as a string, and therefore equates to nothing when converted to a float value.

    So what I'd like to happen is to have "BlockMoveable(21).BBoxLeft" be seen as a variable, rather than a string. Even if what I thought was the issue is wrong, I still want this end result.

  • Well, of course an infinite loop is gonna crash the system.

    And the "Wait 1 second" action is creating thousands upon thousands of "contexts" from which execution would resume from, and all that overhead needs memory... and looks like it needs a lot of it.

    Absolutely not a bug, it's something you should never do, like dividing by zero.

    I actually found it while creating something that supposedly isn't in a loop, and couldn't find the reason why it kept looping.

    In my work, the While condition was supposed to stop once a local variable reached under 1, which would be caused by a subtract action which was being repeated by the condition.

    I have now found my issue: Just like with Repeat, the While condition does not wait for the last loop to finish. The command that basically stops the loop occurs after a delay, which means there's a lot of time for other loops to start.

    Looks like there isn't any bug to see here. Thank you for reminding me of that.

    Though this kind of problem means anyone can crash someone else's computer in a game, so long as there's not a lot of memory to take before the user notices and attempts closing the browser.

  • Problem Description

    When the While condition is triggered, the tab freezes and the browser quickly allocates memory continously.

    Attach a Capx

    https://drive.google.com/open?id=15CaEM ... z33Q54Dz0k

    Description of Capx

    Quickly triggers the While condition which runs a "Wait 1 second" action, while a sprite's 2-frame animation works in the background.

    Steps to Reproduce Bug

    • Insert the While condition somewhere where it can be triggered
    • Add an action for the While condition to run (It can be anything)

    Observed Result

    Nothing shows up, and memory is quickly taken up (at a rate of 200-300MB) until forcefully closed by Task Manager or the computer freezes.

    Expected Result

    The sprite in the window should flash between two colours.

    Affected Browsers

    • Chrome: YES
    • FireFox: N/A
    • Internet Explorer: YES
    • Edge: YES

    Operating System and Service Pack

    Windows 10

    Construct 2 Version ID

    Release 249

    Notice: Have Task Manager ready to close the browser, or risk a computer crash. Make sure all work is saved and closed, in case Task Manager cannot close the browser.

  • I'm sorry, I like to keep efficient and use variables/booleans/text as little as possible. I can use a variable to fix this problem.

    Enjoy the ~30 minutes of writing above me. Or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • (This has been solved. Read the reply below this long post for the solution.)

    I require a condition that can emulate this, otherwise, the wrong thing could happen.

    (I can work with a wait command that can be stopped by an action)

    My scenario (If you get the idea, this post is over):

    • Player
    • Booleans:

    - Preparing (Prevents other actions while an action is in progress) (State is False)

    - FlashThrowReady (Takes note when a wait command has finished) (State is False)

    • Image Points

    - ImagePoint0 (Margin, center of Player)

    - ImagePoint1 (In front of the Player)

    • Flashbang
    • FlashbangPin
    • FlashbangStriker
    • Keyboard
    • Audio

    My input will be:

    Hold down T

    When T is pressed and Preparing is False, (Conditions met)

    Toggle Preparing (State now switched to True)

    Play "Pull Pin" at -10dB

    Wait 0.43 seconds (waits until a certain time in the audio passes)

    Spawn at Player, ImagePoint0, FlashbangPin (Graphical Use)

    Toggle FlashThrowReady (State now switched to True)

    Wait 5 seconds (When the next sub event should start)

    Sub Event, Is FlashThrowReady (State is True so continue)

    Spawn at Player, ImagePoint1, FlashbangStriker (Object for Graphical Use)

    Spawn at Player, ImagePoint1, FlashbangThrown (Object)

    Toggle FlashThrowReady (State now switched to False)

    Toggle Preparing (State now switched to False)

    What happens is:

    T is held down

    Pin spawns after 0.43 seconds

    FlashbangStriker and FlashbangThrown spawns after 5 seconds

    Everything is good, this is what should happen.

    Go through this again, except these inputs are now:

    Hold down T for 3.43 seconds

    Release T

    Hold down T

    If you read the script, what will happen is:

    T is held down

    Pin spawns after 0.43 seconds

    T is released, then held down (Remember: Preparing and ThrowFlashReady is back to False, Preparing is now True)

    FlashbangStriker and FlashbangThrown spawns (the objects were thrown)

    Pin spawns after 0.43 seconds (Now FlashThrowReady is True)

    FlashbangStriker and FlashbangThrown spawns after 2 seconds

    FlashbangStriker and FlashbangThrown spawns after 3 seconds

    The problem is, the first wait is still going on and the sub event will run when it finishes (spawning FlashbangStriker/Thrown because conditions meet).

    The idea is to discontinue the wait when I release T, so if "Wait (Time) Unless" is a thing and send the inputs again:

    • Since actions do not involve conditions, I shall say it also works like a "Wait for signal"

    When T is pressed and Preparing is False, (Conditions met)

    Toggle Preparing (State now switched to True)

    Play "Pull Pin" at -10dB

    Wait 0.43 seconds (waits until a certain time in the audio passes)

    Spawn at Player, ImagePoint0, FlashbangPin (Graphical Use)

    Toggle FlashThrowReady (State now switched to True)

    Wait 5 seconds unless Signal "Stop"

    Sub Event, Is FlashThrowReady

    Spawn at Player, ImagePoint1, FlashbangStriker (Object for Graphical Use)

    Spawn at Player, ImagePoint1, FlashbangThrown (Object)

    Toggle FlashThrowReady

    Toggle Preparing

    When T Released (Remember, not a sub event) (Triggered by "Release T")

    Signal "Stop" (Cancels Wait)

    Spawn at Player, ImagePoint1, FlashbangThrown (Object)

    Toggle FlashThrowReady (State now switched to False)

    Spawn at Player, ImagePoint1, FlashbangStriker (Object for Graphical Use)

    Toggle Preparing (State now Switched to False)

    Skipping over to when I release T,

    T is released, then held down (Remember: Preparing and ThrowFlashReady is back to False, Preparing is now True)

    FlashbangStriker and FlashbangThrown spawns (the objects were thrown)

    Pin spawns after 0.43 seconds (Now FlashThrowReady is True)

    FlashbangStriker and FlashbangThrown spawns after 5 seconds

    Problem solved. Instead of 3 flashbangs, only 2 spawns. One because I released to throw the grenade, and another because I dropped it (because I held it too long...? That's not what happens realistically but its funny to stun yourself)

    Over complicated scenario to show the easy solution.

  • 6 posts