Raised This Month: $ Target: $400
 0% 

Color blend code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-25-2012 , 13:06   Color blend code
Reply With Quote #1

Hi, today i got one problem what i can not solve.
usually if that happen then i do not script for several weeks.
But today i decided to ask your help!

this is a color blend code what i made.
I dont see any bug here but there is a bug, its not working like i want.

I give him correct rgb value and rgb value what must be
mustrgb[] = must rgb value
gvar[Ent][6] = correct red value
gvar[Ent][7] = correct green value
gvar[Ent][8] = correct blue value

gvar[Ent][3] = power that -/+ correct value ( gvar[Ent][6] -= gvar[Ent][3] or gvar[Ent][6] += gvar[Ent][3] )

PHP Code:
                                              // Red Case
                                              
if ( gvar[Ent][6] != mustrgb[0] )
                                              {
                            if ( 
gvar[Ent][6] > mustrgb[0] - gvar[Ent][3] )
                            {    
                                
musttemp mustrgb[0] - gvar[Ent][6]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][6] = mustrgb[0]
                                }
                                else
                                {
                                    
gvar[Ent][6] -= gvar[Ent][3]
                                }
                            }

                            if ( 
gvar[Ent][6] < mustrgb[0] + gvar[Ent][3] )
                            {
                                
musttemp mustrgb[0] - gvar[Ent][6]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][6] = mustrgb[0]
                                }
                                else
                                {
                                    
gvar[Ent][6] += gvar[Ent][3]
                                }
                            }
                        }

                        
// Green Case
                        
if ( gvar[Ent][7] != mustrgb[1] )
                        {
                            if ( 
gvar[Ent][7] > mustrgb[1] - gvar[Ent][3] )
                            {    
                                
musttemp mustrgb[1] - gvar[Ent][7]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][7] = mustrgb[1]
                                }
                                else
                                {
                                    
gvar[Ent][7] -= gvar[Ent][3]
                                }
                            }

                            if ( 
gvar[Ent][7] < mustrgb[1] + gvar[Ent][3] )
                            {
                                
musttemp mustrgb[1] - gvar[Ent][7]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][7] = mustrgb[1]
                                }
                                else
                                {
                                    
gvar[Ent][7] += gvar[Ent][3]
                                }
                            }
                        }

                        
// Blue Case
                        
if ( gvar[Ent][8] != mustrgb[2] )
                        {
                            if ( 
gvar[Ent][8] > mustrgb[2] - gvar[Ent][3] )
                            {    
                                
musttemp mustrgb[2] - gvar[Ent][8]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][8] = mustrgb[2]
                                }
                                else
                                {
                                    
gvar[Ent][8] -= gvar[Ent][3]
                                }
                            }

                            if ( 
gvar[Ent][8] < mustrgb[2] + gvar[Ent][3] )
                            {
                                
musttemp mustrgb[2] - gvar[Ent][8]
                                if ( 
musttemp gvar[Ent][3] + )
                                {
                                    
gvar[Ent][8] = mustrgb[2]
                                }
                                else
                                {
                                    
gvar[Ent][8] += gvar[Ent][3]
                                }
                            }
                        } 
the problem is that not working at all.
only the red value seems to move but very wrong way.

So what is wrong on my code?
Thanks!

Last edited by .Dare Devil.; 04-26-2012 at 04:05.
.Dare Devil. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode