quackgyver's Forum Posts

  • Check the layer opacity and the tilemap opacity in the Properties Bar.

    The issue isn't opacity, because otherwise I wouldn't have been able to see the cursor changing into the selected tile.

  • I've never had this issue with Construct before, but for some reason I can't place tiles using the Tilemap object.

    The tiles show up just fine in the sidebar, and I can select them so that the cursor changes into the chosen tile. However when I click on the tile area in order to place the tile, nothing happens. The tile simply doesn't show up.

    Does anyone know what's causing this?

  • I've deployed my game to a web server, and I'm using mod_rewrite to rewrite paths under the game's folder into a query param - which is in turn then read by the Construct game.

    For the sake of discussion, we can assume that the game is deployed to /foo and that /foo/bar is rewritten into /foo?hello=bar.

    The problem is that Browser.QueryString returns completely empty when this mod_rewrite rule is applied (i.e. while /foo/bar is being rewritten into /foo?hello=bar), whereas if I navigate directly to the param then it works (i.e. if I write /foo?hello=bar directly).

    For troubleshooting purposes I've placed an index.php file in the same folder as the game where I've run var_dump($_GET) to ensure that the param outputs correctly while the mod_rewrite rule is active, and it works as expected.

    So my question is, what could possibly cause Browser.QueryString to return an empty string while mod_rewrite is used, despite the fact that the $_GET variable works just fine outside of the Construct game?

  • You say it should be one or the other, so which would your actions apply to?

    It would apply to the instances that were picked as part of the condition that returned true. In other words, any instance that returns true for an OR condition would be picked.

    If picking was reset between or conditions, that is what would happen. Which isn't what currently happens, but that was the provided example of what would happen if picking was reset.

    I don't understand, if OR-conditions un-pick instances that don't return true as part of an OR-condition, why would it not un-pick instances in the provided example?

  • + Sprite X < 500

    + OR: Sprite Y < 500

    You'd expect this to run actions with all Sprite instances picked that are left of X=500 or above Y=500. If it resets picking for every condition, it becomes essentially just "Y < 500" by itself, which will look broken again.

    I would expect this OR-condition to either pick all of the instances that are to the left of X=500, or pick all of the instances that are above Y=500. Even as we're talking about this, I struggle to think of what else it could logically do.

    Based on this thread, it sounds like what would happen is that it would pick all of the sprite instances that are to the left of X=500, while un-picking all of the sprite instances that are above Y=500. Is that what is supposed to happen?

    You could file a suggestion, but based on the problems I've shown, I don't see a better way it could work unfortunately! Then there's also backwards compatibility: we can't just change how thousands of existing projects work...

    Would it be possible to add a true OR condition? Or would that require fundamentally changing the way things work.

  • In my project I'm referencing music files by name.

    For some reason, if I move music files into subfolders in an attempt to organize them, they stop playing in-game.

    To make things stranger, this only happens for most- rather than all music files.

    My understanding is that folders are for organizing in the editor rather than for referencing, but despite that I'm able to reproduce the effect by moving music files in and out of subfolders.

    Why does putting audio files in subfolders have this effect?

  • That's a nice solution, though wouldn't it be more straight-forward to do something along the lines of:

     var OriginalMessage = "foo foo foo foo foo foo foo foo" 
     var MaxWidth = 10 
     var Index = 0 
     
     // For each word 
     foreach tokencount( OriginalMessage, " " ) 
     	Index = Index + 1 
     	CurrentWord = tokenat( OriginalMessage, Index, " ") 
     	var Line = "" 
     	var Message "" 
     
     	// The Line can fit more words
     	if ( len( Phrase ) + len( CurrentWord ) ) < MaxWidth 
     		Line = Line + CurrentWord 
     
     		// Add the last line in loop 
     		if Index == tokencount( OriginalMessage, " " ) 
     			Phrase = Phrase + newline + Line 
     
     	// Line is full, clear it 
     	else 
     		Phrase = Phrase + newline + Line 
     		Line = CurrentWord 
    

    I still think that this could somehow be expressed through a formula though. I wonder if anyone here has figured it out without looping.

  • Only idea that comes to mind is to use a tiledbackground object and use the "set face object" from the 3dshape with that.

    Yeah that's what I'm talking about. When you map an image to the face of a 3D shape, it's anchored to the same corner on every side.

  • Does anyone know of a good formula for word-wrapping based on an variable length limit?

    I.e. if I have String and the length limit is Foo, is there a good formula for splitting String in the right places so that it inserts line breaks where the lines would otherwise have exceeded the length limit?

    Thanks in advance.

  • When resizing a 3D shape that uses images for its faces, the face images are always anchored to the same corner on every side of the shape.

    Because of this it's impossible to tile 3D shapes seamlessly unless they're the exact size of their textures, because as soon as you reduce the size of a 3d shape it also shifts the position of its face images in ways that will often cause texture tiling issues.

    Is there any way to control the anchor/origin point for the images that are used as face images for 3D shapes?

  • Is there reason why Local_Loop_Done doesn't reset on each loop in this context?

    I thought that local variables are supposed to reset on every loop unless they're set to "Static", but in this case the local variable never seems to reset?

    In the documentation it says:

    By default, local variables reset to their initial value whenever entering their scope (usually every tick)

    Which to me sounds like it's supposed to reset the variable whenever whenever the root condition that evaluates "Script_Block_Is_Busy" and "Script_Keep_Looping" returns true.

    However instead, the variable never seems to reset as long as these root-level bools return true.

    Why is that?

    EDIT:

    I figured it out. I was expecting the variable to reset on every "For each"-loop, thinking that every such loop would count as "entering the scope" of the root event outside of the "For each"-loop.

    However, local variables won't reset inside a "For each"-loop if it was defined outside of the loop. This means that it'll only reset during ticks that take place outside of the "For each"-loop.

  • But the implication is that you want to change the animation on the ones that are carrying a torch, so since it couldn't find any then it's correct to apply to 0 instances. If you want to apply to PlayerObjects because Firefly is lit, you have to ask yourself, which PlayerObjects? Because none of them are carrying a torch.

    I don't think the implication is that I only want to affect PlayerObjects that are carrying torches, because carrying torches is only one of the two conditions for changing the PlayerObject's animation.

    If I didn't want to change the PlayerObject's animation in both cases, then I wouldn't have put it in an event with an "OR"-condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ohh interesting, it picks 0 players due to failing the first condition, therefore doesn't change the animation?

    This is what I heard recently, yes.

    I would have guessed: after failing the first condition and 2nd condition succeeds, the SOL would have been reset when evaluating the 2nd condition, therefore changing all existing player's animation.

    Yes this is also the behavior that I would expect - i.e. I would expect an OR condition that doesn't trigger to simply fall back to allowing the picking of all of its related object types.

    Dev may weigh in on this later but he’ll probably refer to the manual, or refer to the suggestions platform or bug tracker. At this point in time the way or works probably won’t change because they are worried about keeping backwards comparability.

    This is why I think it would be great to have a "True OR"-statement, where "TOR" could be used in a way that doesn't affect the picking negatively while also allowing for backwards compatibility. :-)

  • Your observation show that it doesn’t reset the picking after each false condition. There’s probably some utility in that.

    I wouldn't say that it doesn't reset the picking. I'd say that it actively picks 0 instances of every condition that isn't triggered as part of the OR statement.

    In other words:

    IF A

    OR IF B

    OR IF C

    In the above case one object type would be picked if true, but the other two object types would also be picked but with 0 instances.

    Actually unless you have multiple instances of things using system compares is an ideal solution to avoid the picking or non picking.

    Unfortunately not every condition can easily be translated into "Compare two values", because a lot of conditions aren't available as expressions.

    Also, sometimes you need to be able to pick objects through an OR condition, such as when working with instances. There are a lot of cases where one of the OR-conditions might regard an instance of ObjectA while the other OR-condition regards every instance of ObjectB. In such a case you wouldn't necessarily want ObjectA or ObjectB to be excluded from the subsequent events.

    Imagine this scenario:

    IF PlayerObject is carrying a torch

    OR if FireflyObject is lit

    THEN change PlayerObject's animation to EyesSquinting

    In the above condition, PlayerObject would be un-selected if the FireflyObject fires true, and as a result you wouldn't be able to change PlayerObject's animation.

  • For as long as I've used Construct, I've assumed that "OR" works the same way as you'd expect an OR condition to work in any other programming language - i.e. the code runs if any of the provided conditions fire true.

    However, I learned just recently that "OR" in Construct actually functions like an AND condition, because what it apparently does is that it fires true if any of the conditions are true, but it *also* picks 0 instances of the conditions that return false.

    In other words, the following event:

    IF playerA.Something

    OR playerB.Something

    Doesn't translate into:

    Pick playerA.Something if true

    Or pick playerB.Something if true

    It actually translates into:

    Pick playerA.Something if true, and pick 0 instances of playerB

    Pick playerB.Something if true, and pick 0 instances of playerA

    To me this doesn't make sense, because it's inconsistent with how the toolkit otherwise works. All object types are always available to the user even if they weren't explicitly picked as part of an event, so why should an "OR" condition suddenly negate them from being picked just because they didn't fire? "OR" means "either 1 or 2", not "1 and no instances of 2".

    The reason why I'm bringing this up is because the way that the OR condition works prevents you from being able to utilize any object types inside of an event where those object types didn't fire as part of the event's OR conditions.

    In other words, let's say that you want to change JSON1 if JSON1.foo returns true OR if JSON2.foo returns true. Now you can't do that, because if JSON2.foo fires true then 0 instances of JSON1 are picked.

    I can't think of any use cases where Construct's way of doing "OR" is needed in order to be able to achieve effects that would otherwise be convoluted, but I can think of several use cases where Construct's way of doing "OR" makes it impossible to do certain types of events that are important to be able to do and which otherwise require complex workarounds.

    I guess my questions at this point are:

    - Has this been discussed before?

    - Is there a reason why "OR" works the way it does?

    - Has it always been like this?

    - Are there any plans for adding a "True OR" condition? I'd love to see a "TOR".