Feche1320 Posted October 21, 2014 Share Posted October 21, 2014 Hello, I made this little (messy) script -- Size for the scrollbar.. (very messy and inefficient I think) local mapsleft, groups, pos, run = #_mapcache, 0, 0, 0, true while run do pos = pos + 1 if pos == 15 then groups = groups + 1 mapsleft = mapsleft - 15 pos = 0 end if mapsleft <= 15 then groups = groups + 1 run = false end end What this does it gives me the scrollbar height grouping maps by 15, I know there must be a better way.. thanks Link to comment
DiSaMe Posted October 21, 2014 Share Posted October 21, 2014 / % math.floor math.ceil Link to comment
Feche1320 Posted October 21, 2014 Author Share Posted October 21, 2014 / % math.floor math.ceil Yep I tought on those, but my maths skills are -9999.. Link to comment
Moderators IIYAMA Posted October 21, 2014 Moderators Share Posted October 21, 2014 outputChatBox(math.ceil(2.45645)) -- 3 outputChatBox(math.floor(2.45645)) -- 2 local groups = mapsleft/15 --[[ example value 97 97 / 15 = 6.4666666666667 math.ceil(6.4666666666667) -- 7 math.floor(6.4666666666667) -- 6 ]] local maxGroups = math.ceil(groups) -- groups rounded up. local minGroups = math.floor(groups) -- groups rounded down. local remainValue = mapsleft % 15 --[[ example value 37 37 % 15 = 7 What does this do? 37 - 15 = 22 22 - 15 = 7 7 remains. ]] Does this help out? 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