Samking Posted April 17, 2020 Share Posted April 17, 2020 (edited) Hey all How i can change marker colors randomly between yellow,green and red ---0,255,0 green ---255,255,0 yellow --255,0,0 red Edited April 17, 2020 by Samking Link to comment
Moderators Patrick Posted April 17, 2020 Moderators Share Posted April 17, 2020 Only between this 3 color? local random_number = math.random(1, 3) -- pick a random number between [1, 3] local r, g, b if random_number == 1 then r, g, b = 255, 0, 0 elseif random_number == 2 then r, g, b = 0, 255, 0 elseif random_number == 3 then r, g, b = 0, 0, 255 end createMarker(0, 0, 3, "cylinder", 2, r, g, b) 1 Link to comment
Samking Posted April 17, 2020 Author Share Posted April 17, 2020 (edited) On 17/04/2020 at 09:17, Patrick said: Only between this 3 color? local random_number = math.random(1, 3) -- pick a random number between [1, 3] local r, g, b if random_number == 1 then r, g, b = 255, 0, 0 elseif random_number == 2 then r, g, b = 0, 255, 0 elseif random_number == 3 then r, g, b = 0, 0, 255 end createMarker(0, 0, 3, "cylinder", 2, r, g, b) Thanks, and in line 3 you should add local r, g, b = 0,0,0 else it will generate marker colors other than green,blue and red when using loop Edited April 17, 2020 by Samking 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