Feche1320 Posted October 21, 2014 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 www.host-ar.com.ar
Feche1320 Posted October 21, 2014 Author Posted October 21, 2014 / % math.floor math.ceil Yep I tought on those, but my maths skills are -9999.. www.host-ar.com.ar
Moderators IIYAMA Posted October 21, 2014 Moderators 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? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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