Release [Release] RGB Editor + Overflow Fixed!

Hephaestus

New Member
Messages
3
Reaction score
7
Points
3
Hey all, I am new to Cabconmodding so i'm sorry if you aren't meant to release functions like this in this section, but lets get right into it.. i decided to help out the community and release a RGB editor & if you have any problems please contact me and i will try my best to help you!​

Picture:
647b91c1f4cf1b0bb905002be804dace.gif


How to edit a shader colour using my RGB editor:
Code:
ChangeColour()
{
    self iprintln("Select A Colour For The SHADER NAME HERE");
    self thread RGBEdit(SHADER HERE);//Example self.Elements["TitleBG"]
}

Function:
Code:
RGBEdit( Shader )
{
    self.RGBEditor = true; 
    //self LockMenu(); My lock menu function.
    self.curs = StrTok( "R|G|B", "|" );
    self.CRGB = 0;
    self.Elements["Rec"] = createRectangle( "", "", 23, 90, 89, 18, (0,0,0), "white", 2, 1 ); 
    self.Elements["BG"] = createRectangle( "", "", 23, -30, 90, 40, (0,0,0), "white", 0, 1 );    
    self.Elements["PosMark"] = createRectangle( "", "", 0, 0, 10, 4, (0.55, 0.55, 0.55), "white", 2, 1 );
      self.Elements["PosBars1"] = createRectangle( "", "", 0, 38, 4, 80, (1,1,1), "white", 1, 1 );
      self.Elements["MainBG"] = createRectangle( "", "", 23, 40, 90, 120, (0,0,0), "white", 0, .8 );
    self.Elements["pre"] = createText("CENTER", "CENTER", "DEFAULT", 1, 23, 90, 2, 1, "PREVIEW");
    RGB = "RGB";
    for( i = 0;i < 3;i++ )
    {
        self.curs[i] = 0;
        self.Markerpos[i] = 0;
        self.Elements["RGBT"+i] = createText("CENTER", "CENTER", "DEFAULT", 1, (i*23)-0, -20, 2, 1, self.curs[i]);
        self.Elements["RGB"+i] = createText("CENTER", "CENTER", "DEFAULT", 1, (i*23)-0, -40, 2, 1, RGB[i]);
    }
    self.Elements["RGB0"].color = (1,0,0);
    self.Elements["RGB1"].color = (0,1,0);
    self.Elements["RGB2"].color = (0,0,1);
    self DoAlpha();
    wait 0.25;
    while( 1 )
    {
        if(self adsButtonPressed() || self attackButtonPressed() )
        {
            self.curs[self.CRGB] += self AttackButtonPressed();
            self.curs[self.CRGB] -= self AdsButtonPressed();
            if(self.curs[self.CRGB] > 255) 
                self.curs[self.CRGB] = 0;
            if(self.curs[self.CRGB] < 0) 
                self.curs[self.CRGB] = 255;
            self.Elements["Rec"].color = ((self.curs[0])/255, (self.curs[1])/255, (self.curs[2])/255 );
            self.Elements["RGBT"+self.CRGB] setValue( self.curs[self.CRGB] );
           
            if(self AttackButtonPressed())
                self.Elements["PosMark"].y += .3;
           
            if(self adsButtonPressed())
               self.Elements["PosMark"].y -= .3;
       
            if(self.Elements["PosMark"].y < 0)
                self.Elements["PosMark"].y = 76.3;
               
            if(self.Elements["PosMark"].y > 76.3)
                self.Elements["PosMark"].y = 0;
               
            self.Markerpos[self.CRGB] = self.Elements["PosMark"].y;
        }
        if( self FragButtonPressed() )
        {
            self.CRGB += self FragButtonPressed();
            if( self.CRGB > 2 )
                self.CRGB = 0;
           
            self DoAlpha();
            self.Elements["PosMark"].y = self.Markerpos[self.CRGB];
           
            if( self.Elements["PosMark"].x > 23 ) 
                self.Elements["PosMark"].x = -23; 
               
            if( self.Elements["PosBars1"].x > 23 ) 
                self.Elements["PosBars1"].x = -23;
                             
            self.Elements["PosBars1"].x += 23;
            self.Elements["PosMark"].x += 23;
            wait 0.2;
        }
        if( self MeleeButtonPressed() )
        {
            self CloseRGB();
            //self UnlockMenu(); My unlock menu Function.
            self.RGBEditor = false;
            break;
        }
        if( self UseButtonPressed() )
        {
            self CloseRGB( Shader );
            //self UnlockMenu(); My unlock menu Function.
            self.RGBEditor = false;
            break;
        }
        wait 0.05;
    }
}
DoAlpha()
{
    for( v = 0;v < 3;v++ )
    {
        if( v != self.CRGB ) self.Elements["RGBT"+v].alpha = 0.4;
        else self.Elements["RGBT"+v].alpha = 1;
    }
}
CloseRGB( Shader )
{
    self.index = 0;
    if( IsDefined( Shader ) ) 
    Shader.color = ((self.curs[0])/255, (self.curs[1])/255, (self.curs[2])/255 );
    //self destroyAll(self.Elements); Just a function i use to destroy them all but you're not getting it lol.
   
    self.Elements["Rec"] destroy();
    self.Elements["BG"] destroy();
    self.Elements["PosMark"] destroy();
    self.Elements["PosBars1"] destroy();
    self.Elements["MainBG"] destroy();
    self.Elements["pre"] destroy();
}

How to fix the overflow:
Code:
if(isDefined(player.RGBEditor))
{
    RGB = "RGB";
    player.Elements["pre"] setSafeText("PREVIEW");
    for( i = 0;i < 3;i++ )
    {
        player.Elements["RGBT"+i] setvalue(player.curs[i]);
        player.Elements["RGB"+i] setSafeText(RGB[i]);
    }
}
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,745
Reaction score
2,830
Points
1,053
Good job! :smile: And welcome to cabconmodding.com!
 
Last edited:

Inactive Account

Old CCM Member
Premium Member
Messages
505
Reaction score
262
Points
913
Welcome new friend !
Realy good work, you can be sure I'm going to use it on my new menu who is coming :grinning: (+ credits)

Feel free to post more like this
BaD
 
Top