SheriFF Posted June 21, 2017 Share Posted June 21, 2017 What i am trying to make is a character creator system where the stats as age, height and weight must be selected using a scrollbar.The problem is that i can't think of an algorithm to do this Example : at the height scrollbar the player can choose between 150 and 250 cm. I need an algorithm to work with the guiScrollBarGetScrollPositon and transform it in a value between 150 and 250, how can i do this? ( a general formula would help alot ) Link to comment
Addlibs Posted June 21, 2017 Share Posted June 21, 2017 minValue + scrollbarPosition * (maxValue - minValue) where minValue would be 150 and maxValue 250, you would get something like 2 Link to comment
pa3ck Posted June 21, 2017 Share Posted June 21, 2017 58 minutes ago, MrTasty said: minValue + scrollbarPosition * (maxValue - minValue) where minValue would be 150 and maxValue 250, you would get something like That works great if the scrollbarPosition is ranging between 0 - 1, but AFAIK the GUI scrollbar is ranging between 0 - 100, so a division by 100 would need to be added minValue + scrollbarPosition / 100 * (maxValue - minValue) 1 Link to comment
SheriFF Posted June 22, 2017 Author Share Posted June 22, 2017 @MrTasty @pa3ck thanks alot for your help, works just perfect <3 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now