DarkByte Posted June 28, 2016 Share Posted June 28, 2016 (edited) . Edited July 7, 2016 by Guest Link to comment
Simple0x47 Posted June 28, 2016 Share Posted June 28, 2016 (edited) Why just don't you use the cases. if var <= 25 then color = {0, 125, 0} elseif var <= 50 and var > 25 then color = {0, 150, 0} elseif var <= 75 and var > 50 then color = {0, 175, 0} end Edited June 29, 2016 by Guest Link to comment
DarkByte Posted June 29, 2016 Author Share Posted June 29, 2016 I want to make over 5 different values negative and positive colors, i have to write a lot of these...I know there is a simple way but i can't figure it out. Link to comment
Simple0x47 Posted June 29, 2016 Share Posted June 29, 2016 There's any limit of points? Link to comment
DarkByte Posted June 29, 2016 Author Share Posted June 29, 2016 For every acl group there's a limit. Player - 75 Moderator - 150 Super moderator - 300 Admin - 500 Link to comment
_DrXenon Posted June 29, 2016 Share Posted June 29, 2016 Ok so whats wrong with your code? When the points are 0, the color is white &when the points are 75 the color is fully green. You just need to change tocolor(0,calc,0,255) Right? Or what? Link to comment
Tails Posted June 29, 2016 Share Posted June 29, 2016 This is what you're looking for: local maxPoints = 75 function onCmd(cmd, myPoints) local color = (255 / maxPoints) * myPoints local r,g,b = 255-color, 255, 255-color outputChatBox("You have "..myPoints.." points.", r, g, b) end addCommandHandler("setPoints", onCmd, false) It goes from white to green. You can easily modify it and take the math to use it in your code. I suppose it'll get a little more difficult if you want to go from say, purple to orange, but this is all I can do for you. Why just don't you use the cases. Because math. Link to comment
DarkByte Posted June 30, 2016 Author Share Posted June 30, 2016 Ok so whats wrong with your code?When the points are 0, the color is white &when the points are 75 the color is fully green. You just need to change tocolor(0,calc,0,255) Right? Or what? Nope it's not what i want when it's 0 it's green and when it's 75 it's white. Link to comment
DarkByte Posted June 30, 2016 Author Share Posted June 30, 2016 Ok so whats wrong with your code?When the points are 0, the color is white &when the points are 75 the color is fully green. You just need to change tocolor(0,calc,0,255) Right? Or what? Nope it's not what i want when it's 0 it's green and when it's 75 it's white. @Tails - Thanks it's working now. Link to comment
DarkByte Posted June 30, 2016 Author Share Posted June 30, 2016 (edited) . Edited July 7, 2016 by Guest Link to comment
Tails Posted June 30, 2016 Share Posted June 30, 2016 You're welcome. But like I said, it gets a bit more difficult with other colors than red, green and blue. It may involve different kind of maths if you want to keep everything short and simple. I can't really help you with it, because I know very little about maths. Hopefully you'll figure it out or someone is able to help you. Good luck. Link to comment
_DrXenon Posted June 30, 2016 Share Posted June 30, 2016 Admin - Purple - R,G,B - 183,0,255 Admin - White - R,G,B - 255,255,255 So at start, G should be 255 as well as R; to be white. MaxPoints are 375; The G should be 0 by the end and the R should be 183. colorG = (255/maxPoints) * reputation colorR = ((255 - 183) / maxPoints ) * reputation tocolor(255 - colorR, 255 - colorG,255) That would probably work. It will start with white and end up with purple. Link to comment
_DrXenon Posted June 30, 2016 Share Posted June 30, 2016 And if that worked, you have probably understood the way you should do the rest of the colors. Link to comment
DarkByte Posted June 30, 2016 Author Share Posted June 30, 2016 Thanks to all who helped me. 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