noob question - limiting range of an attribute

I want to say: display the speed of a character but want to have it within a certain range say 0-100. I have tried min and max expressions but I'm not getting expected results....Can anyone point me in the right direction.

thanks

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    min(100,max(0,self.Speed))

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • bubblegmkdbubblegmkd Member Posts: 12

    What if that was a range of an attribute....example game-current speed mph and I want to limit it to a range of 0-100?

  • bubblegmkdbubblegmkd Member Posts: 12

    This would just be for a display text behavior....

    thanks for the quick reply!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Did you try the expression I posted?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • bubblegmkdbubblegmkd Member Posts: 12

    I believe I have figured it out....but any suggestions would still be appreciated as it might help me streamline the process or give more food for thought.

    thank you!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    Suggestions about what? I'm happy to provide food for thought but not really sure what direction you're going in. Maybe you can describe more about what you're trying to do. The expression I posted should work...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.