PDA

View Full Version : hud_set_help_text scoring system



S3anyBoy
February 3rd, 2010, 10:11 PM
Making a scoring system, have the score defined as a long int, etc. Having problems actually displaying the score on the HUD. My idea was to create a hud_help_text for every possible score (right now multiples of 50 between 0 and 10k) which I did, and then used a script to display them when the score is whatever

ex:


(cond
((= score 7200)(hud_set_help_text score_7200))
((= score 7250)(hud_set_help_text score_7250))
((= score 7300)(hud_set_help_text score_7300))
)Problem is I already have a script about twice as long as longcat, and I can't even fit the 50-10k score thing in because I guess I'm hitting some sort of limit for script length (~3300 lines I start having problems) So I'm trying to figure out a better way to do this, but I'm pretty much drawing a blank.

I thought of trying something like:


((= score[variable] #)(hud_set_help_text "score_"score[variable] ))
Is there any way to do something like that, so that'd I'd only need 1 line and it would pull the value of the score integer variable and input it in the place after the underscore? It seems like it should be possible but I can't figure it out.

Hell even another type of scoring system would be fine too.

Dwood
February 3rd, 2010, 10:45 PM
Set the timer.

S3anyBoy
February 3rd, 2010, 10:51 PM
Set the timer.
Yea, but the timer has 3 sets of 0s, minutes, seconds, and 1/100ths seconds, and you can only set minutes and seconds, so it can't be numbers ending in 50. Plus there's the whole problem with you can't have higher than 59 seconds or minutes, it just carries over, and you cant even set the minutes higher than like 19 anyway.

Unless I'm missing something, I messed around with it a bit but it didn't really seem like a good solution.

Dwood
February 4th, 2010, 06:51 AM
While I can see where your problem is, Just have a hud text for each range instead of 1 hud text for every single one you want. If you don't want to do that the only thing you can do is learn how to make things in Open Sauce.

S3anyBoy
February 4th, 2010, 11:13 AM
While I can see where your problem is, Just have a hud text for each range instead of 1 hud text for every single one you want.
So then the HUD would have to say something like "you have somewhere between 2000 and 3000 points, I'm not sure of the exact number though." ?
Is there really not another way to do this?

Dwood
February 4th, 2010, 12:27 PM
Not without OS

ShadowSpartan
February 4th, 2010, 04:32 PM
Not without OS
Don't tell people stuff like that unless you are 100% positive that it cannot be done. CAD created a scoring system as seen right here (http://www.modacity.net/forums/showpost.php?p=510606&postcount=572), so you are wrong, it can be done without OS.

S3anyBoy, try private messaging CAD and see if he will help you out.

CtrlAltDestroy
February 4th, 2010, 06:35 PM
Don't tell people stuff like that unless you are 100% positive that it cannot be done. CAD created a scoring system as seen right here (http://www.modacity.net/forums/showpost.php?p=510606&postcount=572), so you are wrong, it can be done without OS.

S3anyBoy, try private messaging CAD and see if he will help you out.

I messaged this to him, but I'm just going to post it here so everyone can see how it was done:

The general concept of what i did was break up the score variable into its comprising digits, then used cutscene titles to display the individual digits on the hud. The issue with this is that you can only have 4 active cutscene titles on the screen at one time, so i broke the number into two sets of digits. The first set, the ten-thousands and thousands place, and the second set, the hundreds, tens, and ones place (which is really only two digits when it comes down to scripting, as my scores always go in multiples of at least ten, so the final digit is always 0).

How i broke the score variable down to its individual digits took some creative scripting, as haloscript doesnt have any integer division/modulo functions. The gist of it was i divided the entire score variable by, say, 1000. For a five digit score, this would result in a value between 0 and 99. I tested this value to see if it was between 0 and 1. If so, the first two digits would be "00", if it was between 1 and 2, then the first two digits would be "01", and so on to 99.

I took the resulting value (between 0 and 99) and multiplied it back by 1000, then subtracted it from the original score variable. This would give me the final 3 digits (hundreds, tens, ones). Because I only worked in points in multiples of 10, i can then divide this value by ten, and then test these values in the same way i mentioned earlier. If the value was between 0 and 1, the final three digits would be "000", if it was between 1 and 2, the final three digits would be "010", and so on, onto "990".

Splitting up the digits in this way meant I only use two cutscene titles maximum at a time, and that you only need, at most, 200 "if" tests, rather than 9,999 or so. This method allows it so you can still do a wave counter in much the same way.

Dwood
February 4th, 2010, 06:42 PM
Cool, did not know that.