Braus's Recent Forum Activity

  • Local variable TheHighest

    Sprite>Pick highest

    _____Set highest to the highest instance value

    Sub ____ System > pick all

    _________ Sprite > Compare instance variable =? TheHighest

    _________System > compare 2 values ... Sprite.PickedCount =? 1

    ___________________actions run if there is only 1 TheHighest

    _________Else

    ___________________actions run if there is more then 1 TheHighest

    I was doing something like that but I forgot to include the "compare 2 values" condition in the same event of the two others. Thank you.

  • I need to check the values of the same variable in the 25 instances and get the instance that have the highest value if it is unique or request that the user changes the equal values. I believe I will need to use the "Sprite>Pick highest" event but I don't know how to build it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I found the error thanks to your example.

    Thank you.

  • I tried your script but I am still don't getting the result I want.

    Just one instance may have 10 as value if not, I need to ask the user choose one of them to set as 10.

    I also need to know if the user did not activate all the instances (clicking them). This is the reason that I am checking if all the instances are activated or not.

  • I changed the script for this:

    Pick all Sprite
    Sprite is active
    Pick all Sprite
    Pick Sprite where Sprite.quant = 10
    Sprite.PickedCount  >= (greater or equal) 1
    Sprite.PickedCount  > 1 => action
    Else => action
    Else => action[/code:3su1hr6i]
    
    The problems are:
    [ul]
    	[li]I cannot confirm if all the sprites are active. I just can check if all the Sprites are not active (e.g. nothing happens If I have one instance activated)[/li]
    	[li]I cannot confirm If none of my instances does not have the value 10, only if has 1 or more.[/li]
    [/ul]
  • Thanks.

    I am doing this:

    Pick all Sprite
    

    Sprite is active (I am checking if the user clicked in each sprite)

    >> Pick Sprite where Sprite.quant = 10

    >>>>Sprite.PickedCount > 1 (to check if exist more than an instance with 10 value in its variable) => action

    >>>>Else => action

    Else => action[/code:3cyi3ss4]

    But it is not working.

  • I have 10 instances with a local variable (quant) and I need to check if two or more variables have a 10 as value (because it is not allowed) and if at least one variable has a 10 as value (it's a necessary condition).

  • I am storing these numbers in variables and subtract one by other like I exemplified above. I just need to format the result.

  • Hi

    I have two two different times in ms and I need to subtract one by other and get a result with 3 decimal digits.

    Example:

    Right => 0.187 - 0.165 = 0.021

    I am getting 0.214 instead 0.021

    Any help?

  • It was a little challenge =]

    Sorry the delay and thanks for the help.

    As I have more than 5 text objects it's better if I use a function for this, right? I will give it a try.

  • Hey guys

    I still need a little help here.

    I have figured out part of the problem: I inverted the operators. So the right is: round((variable*percent)*100)/100

    But if the value have cents, instead of 1,001.32, I am getting 1001.32. I need to rounded the value (remove the cents) to get 1,001 but I really need to get 1,001.32

  • Hey jeffige

    Thank you so much for this solution.

    I am having two issues now :

    • During the sum, I need to add a percent of the value and I need to keep this format: 1.32. For this, I am using round((variable*0.02)/100)*100 but sometime I get only 0. Other example: if I have 2985 and I use round((variable*0.05)/100)*100 I am getting 100 instead of 149.25
    • At the end I am using your instructions and I am not getting the cents (1,001.32). I believe it happens because the another issue.
Braus's avatar

Braus

Member since 17 Jul, 2015

None one is following Braus yet!

Trophy Case

  • 9-Year Club
  • Email Verified

Progress

10/44
How to earn trophies