Raised This Month: $ Target: $400
 0% 

random(256) in one case


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iLlegalzp
Member
Join Date: Dec 2015
Location: Burgas
Old 12-05-2015 , 17:03   random(256) in one case
Reply With Quote #1

So is it possible that the code below will give you become in a case that is not to add all the colors one by one and be in one case again all colors random (256) (to run arbitrary color of the 256?

PHP Code:
         case 0..5:
         {
            
rgbaura = {105105105}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell105105105kRenderNormal25);
         }
         case 
6..11
         {
            
rgbaura = {112128144}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell112128144kRenderNormal25);
         }
         case 
12..17:
         {
            
rgbaura = {190190190}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell190190190kRenderNormal25);
         }
         case 
18..23:
         {
            
rgbaura = {2525112}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell2525112kRenderNormal25);
         }
         case 
24..29:
         {
            
rgbaura = {00128}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell00128kRenderNormal25);
         }
         case 
30..35:
         {
            
rgbaura = {100149237}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell100149237kRenderNormal25);
         }
         case 
36..41:
         {
            
rgbaura = {132112255}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell132112255kRenderNormal25);
         }
         case 
42..47:
         {
            
rgbaura = {00255}
            
fm_set_rendering(ID_AURAkRenderFxGlowShell00255kRenderNormal25);
         }
         default:
         {
            
g_nemaura[ID_AURA] = 0
            rgbaura 
= {15000}
         }
      } 
iLlegalzp is offline
Send a message via Skype™ to iLlegalzp
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-05-2015 , 17:08   Re: random(256) in one case
Reply With Quote #2

I don't understand what you are asking.
__________________
Bugsy is offline
iLlegalzp
Member
Join Date: Dec 2015
Location: Burgas
Old 12-05-2015 , 17:35   Re: random(256) in one case
Reply With Quote #3

The code is for the nemesis aura, now i have to add all 256 colors one by one this is hard because i don't have enough time so i want to add all 256 colors in one case
iLlegalzp is offline
Send a message via Skype™ to iLlegalzp
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-05-2015 , 18:03   Re: random(256) in one case
Reply With Quote #4

Is there a mathematical relationship between the case and the respective RGB values?

Example, is there any relationship between:
case 12..17 and rgbaura = {190, 190, 190}
case 18..23 and rgbaura = {25, 25, 112}
__________________

Last edited by Bugsy; 12-05-2015 at 18:03.
Bugsy is offline
iLlegalzp
Member
Join Date: Dec 2015
Location: Burgas
Old 12-05-2015 , 18:31   Re: random(256) in one case
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Is there a mathematical relationship between the case and the respective RGB values?

Example, is there any relationship between:
case 12..17 and rgbaura = {190, 190, 190}
case 18..23 and rgbaura = {25, 25, 112}
every case number is +6 but i didn't undertand you what do you mena ?

for example

PHP Code:
            case 0..5:
            {
                
rgbaura = {2525112}
            }
            case 
6..11
            { 
only that ?
iLlegalzp is offline
Send a message via Skype™ to iLlegalzp
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-05-2015 , 19:08   Re: random(256) in one case
Reply With Quote #6

I was thinking, is there any way to mathematically derive 25,25,112 with the respecitve case 0..5. I dont think there is, they all look random
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-06-2015 , 22:11   Re: random(256) in one case
Reply With Quote #7

Basically, if you don't have a mathematical method (a forumula) for determining the what the R, G, and B values are for each case then it's not possible to not write them all out.

UNLESS, you are actually meaning that you want R to be random, G to be random, and B to be random (this will give you a random color every time). In this case, you can do this:

PHP Code:
rgbaura[0] = random(256);
rgbaura[1] = random(256);
rgbaura[2] = random(256); 
Also, you should never assign a whole array using an equal sign unless it is when you declare the variable (when you use "new"). In your case, you should assign each of the three values as shown above.
__________________

Last edited by fysiks; 12-06-2015 at 22:13.
fysiks is offline
iLlegalzp
Member
Join Date: Dec 2015
Location: Burgas
Old 12-07-2015 , 05:06   Re: random(256) in one case
Reply With Quote #8

Where exactly i have to add it ?
iLlegalzp is offline
Send a message via Skype™ to iLlegalzp
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-07-2015 , 05:13   Re: random(256) in one case
Reply With Quote #9

just delete switch and case and add this instead of it

PHP Code:
new red random_num(0,256)
new 
green rendom_num(0,256)
new 
blue random_num(0,256)

fm_set_rendering(ID_AURAkRenderFxGlowShellredgreenbluekRenderNormal25); 
Depresie is offline
Reply


Thread Tools
Display Modes

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 17:49.


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