[SBARINFO] Weaponammo clip

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
NightFright
Spotlight Team
Posts: 1379
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

[SBARINFO] Weaponammo clip

Post by NightFright »

I have problems getting proper Boom color coding to work with this code regarding clip ammo:

Code: Select all

               		// BOOM COLORS
               		IfCVarInt fullhud_boom, 1, equal
               		{
                  		DrawString HUDFONT_DOOM, white, "%", 104, -29;
	         		DrawString HUDFONT_DOOM, white, "%", -85, -29;

                  		// AMMO
                  		weaponammo clip       		{ drawnumber 3, HUDFONT_DOOM, gold, ammo1, 44, -29, 0, red, 50, green, 101; }
   	         		weaponammo shell || rocketammo 	{ drawnumber 3, HUDFONT_DOOM, gold, ammo1, 44, -29, 0, red, 12, green,  26; }
   	         		weaponammo cell       		{ drawnumber 3, HUDFONT_DOOM, gold, ammo1, 44, -29, 0, red, 75, green, 151; }
 
                  		// HEALTH
                  		IfHealth 101% { DrawNumber 3, HUDFONT_DOOM, blue, health, 90, -29; }
	          		else { DrawNumber 3, HUDFONT_DOOM, gold, health, 90, -29, 0, red, 25, green, 51; }

                  		// ARMOR
                  		DrawNumber 3, HUDFONT_DOOM, red, armor, -99, -29, 0;
	          		DrawNumber 3, HUDFONT_DOOM, green, armor, whennotzero, -99, -29, 0, green, 100, blue, 101;
               		}
               		else
               		{
                  		DrawString HUDFONT_DOOM, untranslated, "%", 104, -29;
	         		DrawString HUDFONT_DOOM, untranslated, "%", -85, -29;
	          		DrawNumber 3, HUDFONT_DOOM, untranslated, ammo1, 44, -29;
	          		DrawNumber 3, HUDFONT_DOOM, untranslated, health, 90, -29;
	          		DrawNumber 3, HUDFONT_DOOM, untranslated, armor, -99, -29;
               		}
Basically clip behaves like shell or rocketammo, turning yellow only at values of 25-13 and red 12-0 insead of 100-26 and 25-0, respectively. Other ammo types (shell, rocketammo, cell) work fine.
User avatar
NightFright
Spotlight Team
Posts: 1379
Joined: Fri May 02, 2008 12:29 pm
Location: Germany

Re: [SBARINFO] Weaponammo clip

Post by NightFright »

OK, it looks like this thing with "||" just doesn't work. If I put shell and rocketammo as two separate entries again, everything works just as intended.

Return to “Scripting”