Author Topic: Color change  (Read 4003 times)

Can someone tell me what's going on here?

$CityRPG::food::stateCount = 0;

$CityRPG::food::color[$CityRPG::food::stateCount++] = "FF0000";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Dying";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "FF6600";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Starving";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "FFBB00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Content";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "FFFF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Satisfied";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "DDFF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Full-up";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "AAFF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Overfed";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "88FF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Stuffed";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "66FF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Bloated";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "44FF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Engorged";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "22FF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Obese";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "00FF00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Bursting";

$CityRPG::food::color[$CityRPG::food::stateCount++] = "FFAA00";
$CityRPG::food::state[$CityRPG::food::stateCount] = "Whale-Like";

I still don't understand how it changes the color. I would love to integrate this into something else I am working on.

The "FF0000, FF6600, FFBB00" and so on stand for colors.

Post the code for the other thing you're working on, it depends on where you're using it and how.
Those are hexcodes though and can be used like this inside a string: <color:FFFFFF>
Any text after that will be the color you input, this is a good website to find the color you're looking for.

Code: [Select]
// Hunger
%hexColor = $CityRPG::food::color[CityRPGData.getData(%client.bl_id).valueHunger];
%hungerName = $CityRPG::food::state[CityRPGData.getData(%client.bl_id).valueHunger];
%client.CityRPGPrint = %client.CityRPGPrint SPC "\c6Hunger: <color:" @ %hexColor @ ">" @ %hungerName;

I know the FFFFFF means html color... I am just wondering how it changes with its name. I don't want to spill the beans on what I am working on. But the color changes with the name. I just want to know how that would work with a (number)  Being changed

« Last Edit: July 31, 2014, 10:26:45 PM by JackofTrades »

I know the FFFFFF means html color... I am just wondering how it changes with its name. I don't want to spill the beans on what I am working on. But the color changes with the name. I just want to know how that would work with a (number)  Being changed


It's adding 1 to stateCount, and they are the same number. The color and the status are the same number.

We could help you a lot more if you show us what you are doing.

I would like for money to change color when your amount changes example... 100 = green 1000 = blue 10000 = red...


function serverCmdmoney(%guy)
{
   %money = %guy.money;
   if(%money == 100)
      %color = "\c0";
   if(%money == 1000)
      %color = "\c2";
   if(%money == 1000)
      %color = "\c1";
   messageClient(%guy, '', %color @ %money);
}

Depending on the color you use, \cnumber can work. Use /colortest ingame to see the colors.


function serverCmdmoney(%guy)
{
   %money = %guy.money;
   if(%money == 100)
      %color = "\c0";
   if(%money == 1000)
      %color = "\c2";
   if(%money == 1000)
      %color = "\c1";
   messageClient(%guy, '', %color @ %money);
}

Depending on the color you use, \cnumber can work. Use /colortest ingame to see the colors.

It's that easy?

It's that easy?
Using Crowns way, it'll only be that color if it's exactly that number.


function serverCmdmoney(%guy)
{
   %money = %guy.money;
   if(%money <= 100)
      %color = "\c0";
   if(%money <= 1000 && %money > 100)
      %color = "\c2";
   if(%money <= 10000 && %money > 1000)
      %color = "\c1";
   messageClient(%guy, '', %color @ %money);
}

Depending on the color you use, \cnumber can work. Use /colortest ingame to see the colors.
That should work a little better. Now it will stay the same color regardless of the amount until a new level is reached, and then it'll switch colors.

It's that easy?

That is not plug-and-play. If you want somebody to do this for you, go post in Suggestions and Requests. However that shows you how to do it.

That should work a little better. Now it will stay the same color regardless of the amount until a new level is reached, and then it'll switch colors.
That's kinda dumb how you laid that out..


function serverCmdmoney(%guy)
{
   %money = %guy.money;
   if(%money <= 100)
      %color = "\c0";
   else if(%money <= 1000)
      %color = "\c2";
   else
      %color = "\c1";
   messageClient(%guy, '', %color @ %money);
}



%guy?

You can name the variables whatever you like. %guy, %client, %this (though this ones incorrect by standard), %gameconnection, %playerclient, etc. You could even write it function serverCmdMoney(%AFGsaf8dgfsd9SDFdfsdsa) if you were so inclined.

You can name the variables whatever you like. %guy, %client, %this (though this ones incorrect by standard), %gameconnection, %playerclient, etc. You could even write it function serverCmdMoney(%AFGsaf8dgfsd9SDFdfsdsa) if you were so inclined.

Oh okay. Just making sure.