Download [Script] Numeric Display

Arch

Legions Developer
So this is my first script that I am releasing to the community that is not packaged in with a UI. I called it Numeric Display because, well, it is a numeric and graphic display of the energy and health bars, as well as the ammo of your weapon and your item (grenade). Preview seen below.

NumericDisplay.png


The top three boxes are the actual display. Green and Blue are Health and Energy and the two White bars/text are Weapon and Grenade ammo count (in percentage form). The bars next to them eat away as you use energy, lose health, etc and change color. They change to an Orange color (text and bar) when the percentage goes below 50% and to a red color when it goes below 25%. The first image is them all full, the second image is them eaten away a bit, and the third is them with nothing (dead).

The 3 littler images below the boxes are text displays they pop up a bit under your crosshair at certain percentages. "Low Ammo" comes up when your ammo gets below 25% and "Out of Ammo" is pretty self explanatory. "Low health" pops up when your health goes below 25%.

The default anchor point of this is left side, middle (vertical) of screen. If you want to change it, figure it out. :p

Update 1: Added a BG. Organized it a bit better. Added a bar and text for the Core(s). Made the warnings blink orange and red (Thanks to Volt Cruelerz for this).

Update 2:(5/25/12) Moved them all into one bar, including the speed display and the clock. Turned off a bunch of hud elements that had little to no use while using this script. Picture below.
Legions%202012-05-25%2011-30-01-75.png


Left to right
Health -- Energy -- Core -- Speed -- Clock -- Grenades -- Ammo

Place the contents of the zip into live/mods/autoexec.

Download:
V1
V2
Special Thanks To...
NightHawk: I borrowed two of the functions from his AmmoWarning script to track the ammo. As well as helping me with getting it to display correctly.​
Volt Cruelerz: For helping me with a lot of the logic that I didn't know well. And for making that color changing bar script (I used a different method as he did but it is still the same base idea).​
Triad: For helping me to get the progress bars to display correctly.​
 

Volt Cruelerz

Legions Developer
I'll probably mod this to function the same way mine does with the coloration and post it on here if you want me to.
 

k e v i n

Private Tester
for those wondering what arch's script looks like...this is what your screen may look like....the bars are on the left side which shows your health, ammo, and boost

numeric display.jpg
 

Volt Cruelerz

Legions Developer
You should really add a background image for it so that the bars show up.

edit: Done. This version has been streamlined a bit (you had a lot of redundant code) and could be more, but I figured I'd just go ahead and give this to you. Now, color changes are smooth and the health/ammo warnings flash yellow/red. Download
 

Arch

Legions Developer
You should really add a background image for it so that the bars show up.

edit: Done. This version has been streamlined a bit (you had a lot of redundant code) and could be more, but I figured I'd just go ahead and give this to you. Now, color changes are smooth and the health/ammo warnings flash yellow/red. Download
I actually thought the same thing and I did make one. I also added the core bar into the mix.
 

stefygraff

Private Tester
very nice, but it needs more details and more statistical into.It would be nice to see "successful caps %" "MA's %" of shots and stuff like this. and make it reset after each game(but save the info in a specific place)
 

Arch

Legions Developer
very nice, but it needs more details and more statistical into.It would be nice to see "successful caps %" "MA's %" of shots and stuff like this. and make it reset after each game(but save the info in a specific place)
Theoretically, you could mod RockeyRex's script to do that.

edit: Done. This version has been streamlined a bit (you had a lot of redundant code) and could be more, but I figured I'd just go ahead and give this to you. Now, color changes are smooth and the health/ammo warnings flash yellow/red. Download
I tried this but, honestly, I prefer the way my method changes the colors. Even though it may not be the most practical. I do like that flickering warning though. I am curious about this. What do the numeric values of "schedule" do anyways?
Code:
schedule($FlickerRate, 0, "warningFlash");

Oh and btw, I had a fun time trying to type into the console before commenting out those echo statements. ;)
 

Volt Cruelerz

Legions Developer
$FlickerRate is a variable I created and is defined IIRC as 200. I didn't want to use magic numbers so you can change that without concern of things breaking. Just set it to a different number.

schedule() simply calls a given function after a given time. In this case, $FlickerRate is the given time (200 milliseconds). To quote the torque manual...

int SimObject::schedule ( float time,
string method,
string args...
)
Delay an invocation of a method.
Parameters:
time The number of milliseconds after which to invoke the method. This is a soft limit.
method The method to call.
args The arguments with which to call the method.
Returns:
The numeric ID of the created schedule. Can be used to cancel the call.

Frankly, I don't know what the middle 0 does, but that's something I've always seen so i didn't remove it. It doesn't seem to matter what it is though. Perhaps it is unnecessary. Idk.
 

Arch

Legions Developer
very nice, but it needs more details and more statistical into.It would be nice to see "successful caps %" "MA's %" of shots and stuff like this. and make it reset after each game(but save the info in a specific place)
"server/scripts/stats"
 

Belberith

Legions Developer
Frankly, I don't know what the middle 0 does, but that's something I've always seen so i didn't remove it. It doesn't seem to matter what it is though. Perhaps it is unnecessary. Idk.

The second parameter is an "optional" object ID of the function being scheduled, i.e. the ID of the object that the function is a child of. This parameter is only partially optional in that if you are using schedule() as a function all by itself, the parameter must be there but can either be the ID of the function's parent object or 0. For example: schedule(1000, 0, "flag_delete", %flag_ID); or: schedule(1000, %flag_ID, "flag_delete", %flag_ID);

However if you are calling schedule() as a child of an object, the parameter is not needed. For example: %flag.schedule(1000, "delete");

So in general just put 0 and TorqueScript will be happy even though, as you noticed, this detail is not actually in the TS manual. :p
 

Fixious

Test Lead
You should really add a background image for it so that the bars show up.

edit: Done. This version has been streamlined a bit (you had a lot of redundant code) and could be more, but I figured I'd just go ahead and give this to you. Now, color changes are smooth and the health/ammo warnings flash yellow/red. Download
This doesn't have a background behind the bars, which is what I'd like to have. Can has?
 

Volt Cruelerz

Legions Developer
I haven't looked at the code in months, but IIRC, the background should be drawn by the script. I'm at work now but I'll try to remember to check when I get home.
 

Fixious

Test Lead
Aye! I downloaded Pure's version he sent me via IRC and it didn't have a bg. Just downloaded V1 and it looks good. Thanks.
 
Top