script help -> showing info on screen


(DWM|Commando) #1

hey my current map requires me to tell the people on the screen how far along their tank is built based on a number. The tank is 100% complete when the number is at 200, and 0% complete at 0, 50% at 100 and so on. Now i need a way to show this, and my current method is poor. Heres what i got

trigger show_allies_progress
	{		
		accum 2 abort_if_less_than 10
		wm_announce "The Allies are done 5% of their Tank!"

		accum 2 abort_if_less_than 20
		wm_announce "The Allies are done 10% of their Tank!"

		accum 2 abort_if_less_than 30
		wm_announce "The Allies are done 15% of their Tank!"

		accum 2 abort_if_less_than 40
		wm_announce "The Allies are done 20% of their Tank!"

		accum 2 abort_if_less_than 50
		wm_announce "The Allies are done 25% of their Tank!"

		accum 2 abort_if_less_than 60
		wm_announce "The Allies are done 30% of their Tank!"

		accum 2 abort_if_less_than 70
		wm_announce "The Allies are done 35% of their Tank!"

		accum 2 abort_if_less_than 80
		wm_announce "The Allies are done 40% of their Tank!"

		accum 2 abort_if_less_than 90
		wm_announce "The Allies are done 45% of their Tank!"

		accum 2 abort_if_less_than 100
		wm_announce "The Allies are done 50% of their Tank!"
		
		accum 2 abort_if_less_than 110
		wm_announce "The Allies are done 55% of their Tank!"

		accum 2 abort_if_less_than 120
		wm_announce "The Allies are done 60% of their Tank!"
		
		accum 2 abort_if_less_than 130
		wm_announce "The Allies are done 65% of their Tank!"

		accum 2 abort_if_less_than 140
		wm_announce "The Allies are done 70% of their Tank!"

		accum 2 abort_if_less_than 150
		wm_announce "The Allies are done 75% of their Tank!"

		accum 2 abort_if_less_than 160
		wm_announce "The Allies are done 80% of their Tank!"

		accum 2 abort_if_less_than 170
		wm_announce "The Allies are done 85% of their Tank!"

		accum 2 abort_if_less_than 180
		wm_announce "The Allies are done 90% of their Tank!"

		accum 2 abort_if_less_than 190
		wm_announce "The Allies are done 95% of their Tank!"
	}

so you can see each side will get a mouthful of lines till it stops at the percent they have complete.

I need to figure a way so i can tell them in one line. The way i can think of is to

accum 2 trigger_if_equal 1 self 1_percent
accum 2 trigger_if_equal 2 self 2_percent
so you can see id have to create more than 400 lines of code to show that (not including all the brackets to start each #_percent part of the script.

so my question is can anyone think of a way that i can get it to display the exact (or clost to it) amount the team has of the tank complete in a smaller amount of script and ultimatly more efficient way?

(the variable for their progress is globalAcuum 2, just so you can work it into the script.)


(Ifurita) #2

From Tactical, which is close to the way you are think about doing it, but i’d stick to 20%, 40%, etc. Remember, you also don’t want to create so much noise that they completely miss it.


time_counter
{

	trigger count
	{
		globalaccum 0 abort_if_equal 121
		globalaccum 0 inc 1
	}

	trigger time_output
	{
		globalaccum 0 trigger_if_equal 65 time_counter display45
		globalaccum 0 trigger_if_equal 66 time_counter display46
		globalaccum 0 trigger_if_equal 67 time_counter display47
		globalaccum 0 trigger_if_equal 68 time_counter display48
		globalaccum 0 trigger_if_equal 69 time_counter display49
		globalaccum 0 trigger_if_equal 60 time_counter display50
		globalaccum 0 trigger_if_equal 61 time_counter display51
		globalaccum 0 trigger_if_equal 62 time_counter display52
		globalaccum 0 trigger_if_equal 63 time_counter display53
		globalaccum 0 trigger_if_equal 64 time_counter display54
<snip>

and


	trigger display45
	{
		wm_announce "You finished the run in 45 seconds"
	}

	trigger display46
	{
		wm_announce "You finished the run in 46 seconds"
	}

	trigger display47
	{
		wm_announce "You finished the run in 47 seconds"
	}
<snip>


(DWM|Commando) #3

i already thought about that iffy, the second part of my post, which would take more than 400 lines not including brackets lol
i was looking for a shorter way to do exactly what that does, maybe a complex loop one of you smarter people have designed i don’t know.
but thanks anyway

EDIT: heres what i dont want

		globalAccum 2 trigger_if_equal 5 self axis_1
		globalAccum 2 trigger_if_equal 6 self axis_1
		globalAccum 2 trigger_if_equal 7 self axis_1
		globalAccum 2 trigger_if_equal 8 self axis_1
		globalAccum 2 trigger_if_equal 9 self axis_1
		globalAccum 2 trigger_if_equal 10 self axis_1
		globalAccum 2 trigger_if_equal 11 self axis_2
		globalAccum 2 trigger_if_equal 12 self axis_2
		globalAccum 2 trigger_if_equal 13 self axis_2
		globalAccum 2 trigger_if_equal 14 self axis_2
		globalAccum 2 trigger_if_equal 15 self axis_2
		globalAccum 2 trigger_if_equal 16 self axis_3
		globalAccum 2 trigger_if_equal 17 self axis_3
		globalAccum 2 trigger_if_equal 18 self axis_3
		globalAccum 2 trigger_if_equal 19 self axis_3
		globalAccum 2 trigger_if_equal 20 self axis_3
		globalAccum 2 trigger_if_equal 21 self axis_4
		globalAccum 2 trigger_if_equal 22 self axis_4
		globalAccum 2 trigger_if_equal 23 self axis_4
		globalAccum 2 trigger_if_equal 24 self axis_4
		globalAccum 2 trigger_if_equal 25 self axis_4
		globalAccum 2 trigger_if_equal 26 self axis_5
		globalAccum 2 trigger_if_equal 27 self axis_5
		globalAccum 2 trigger_if_equal 28 self axis_5
		globalAccum 2 trigger_if_equal 29 self axis_5
		globalAccum 2 trigger_if_equal 30 self axis_5
		globalAccum 2 trigger_if_equal 31 self axis_6
		globalAccum 2 trigger_if_equal 32 self axis_6
		globalAccum 2 trigger_if_equal 33 self axis_6
		globalAccum 2 trigger_if_equal 34 self axis_6
		globalAccum 2 trigger_if_equal 35 self axis_6
		globalAccum 2 trigger_if_equal 36 self axis_7
		globalAccum 2 trigger_if_equal 37 self axis_7
		globalAccum 2 trigger_if_equal 38 self axis_7
		globalAccum 2 trigger_if_equal 39 self axis_7
		globalAccum 2 trigger_if_equal 40 self axis_7
		globalAccum 2 trigger_if_equal 41 self axis_8
		globalAccum 2 trigger_if_equal 42 self axis_8
		globalAccum 2 trigger_if_equal 43 self axis_8
		globalAccum 2 trigger_if_equal 44 self axis_8
		globalAccum 2 trigger_if_equal 45 self axis_8
		globalAccum 2 trigger_if_equal 46 self axis_9
		globalAccum 2 trigger_if_equal 47 self axis_9
		globalAccum 2 trigger_if_equal 48 self axis_9
		globalAccum 2 trigger_if_equal 49 self axis_9
		globalAccum 2 trigger_if_equal 50 self axis_9
		globalAccum 2 trigger_if_equal 51 self axis_10
		globalAccum 2 trigger_if_equal 52 self axis_10
		globalAccum 2 trigger_if_equal 53 self axis_10
		globalAccum 2 trigger_if_equal 54 self axis_10
		globalAccum 2 trigger_if_equal 55 self axis_10
		globalAccum 2 trigger_if_equal 56 self axis_11
		globalAccum 2 trigger_if_equal 57 self axis_11
		globalAccum 2 trigger_if_equal 58 self axis_11
		globalAccum 2 trigger_if_equal 59 self axis_11
		globalAccum 2 trigger_if_equal 60 self axis_11
		globalAccum 2 trigger_if_equal 61 self axis_12
		globalAccum 2 trigger_if_equal 62 self axis_12
		globalAccum 2 trigger_if_equal 63 self axis_12
		globalAccum 2 trigger_if_equal 64 self axis_12
		globalAccum 2 trigger_if_equal 65 self axis_12
		globalAccum 2 trigger_if_equal 66 self axis_13
		globalAccum 2 trigger_if_equal 67 self axis_13
		globalAccum 2 trigger_if_equal 68 self axis_13
		globalAccum 2 trigger_if_equal 69 self axis_13
		globalAccum 2 trigger_if_equal 70 self axis_13
		globalAccum 2 trigger_if_equal 71 self axis_14
		globalAccum 2 trigger_if_equal 72 self axis_14
		globalAccum 2 trigger_if_equal 73 self axis_14
		globalAccum 2 trigger_if_equal 74 self axis_14
		globalAccum 2 trigger_if_equal 75 self axis_14
		globalAccum 2 trigger_if_equal 76 self axis_15
		globalAccum 2 trigger_if_equal 77 self axis_15
		globalAccum 2 trigger_if_equal 78 self axis_15
		globalAccum 2 trigger_if_equal 79 self axis_15
		globalAccum 2 trigger_if_equal 80 self axis_15

followed by all of those axis_1 that say what to display

dont forget this goes to 200 :S


(carnage) #4

havent scripted for a while so ime a bit rusty so my syntax may not be perfect



trigger show_allies_progress
{
target announce ten
target announce twenty
target announce thirty
target announce fourty
target announce fifty
target announce sixty
target announce seventy
target announce eighty
target announce ninety
target announce done
}


trigger announce
{

target ten
{
globalaccum 1 abort_if_no_equil_to 20
wm_announce "The tank is 10% done"
}

target twenty
{
globalaccum 1 abort_if_no_equil_to 40
wm_announce "The tank is 20% done"
}

target thirty
{
globalaccum 1 abort_if_no_equil_to 60
wm_announce "The tank is 30% done"
}

target fourty
{
globalaccum 1 abort_if_no_equil_to 80
wm_announce "The tank is 40% done"
}

target fifty
{
globalaccum 1 abort_if_no_equil_to 100
wm_announce "The tank is 50% done"
}

target sixty
{
globalaccum 1 abort_if_no_equil_to 120
wm_announce "The tank is 60% done"
}

target seventy
{
globalaccum 1 abort_if_no_equil_to 140
wm_announce "The tank is 10% done"
}

target eighty
{
globalaccum 1 abort_if_no_equil_to 160
wm_announce "The tank is 80% done"
}

target ninety
{
globalaccum 1 abort_if_no_equil_to 180
wm_announce "The tank is 90% done"
}

target done
{
globalaccum 1 abort_if_no_equil_to 200
wm_announce "The tank finshed"
// any extra commands for when the tank is constructed
}

}



(DWM|Commando) #5

hmm the only problem is that what if the progress is at 36, or 61 or 87, they wouldnt know… but i like that, i think i could make it work if i used some abort_if_greater_than and abort_if_less than to try to pin it to a 10% range… its a good idea, i’ll see what i can do with it.
thanks


(Ifurita) #6

Why is showing accuracy to 1% so important? What I find is that the wm_announce messages often lag other events, so you could be displaying x% but actually be much higher.


(DWM|Commando) #7

yea, what i meant was i would narrow it dow nto groups of percents like 5-10, 11-15, 16-20 and so on, but with caranages way i can just narrow it down to 0-10, 11-20, and so on. so it will use minimal code, i’ll post it when i finish it


(Ifurita) #8

Yeah, but you could have done that with the example you originally posted.


(DWM|Commando) #9

no… i never had anything like htat, where i call them all, then cancel them with sets of greater_than or less_thans.
hers what i got now


	trigger show_allies_progress
	{		
		trigger self allies_announce_10
		trigger self allies_announce_20
		trigger self allies_announce_30
		trigger self allies_announce_40
		trigger self allies_announce_50
		trigger self allies_announce_60
		trigger self allies_announce_70
		trigger self allies_announce_80
		trigger self allies_announce_90
		trigger self allies_announce_91
	}
	
	trigger allies_progress_10
	{
		globalAccum 2 abort_if_greater_than 20
		wm_announce "The Allies are done 1 - 10% of their Tank!"
	}
	
	trigger allies_progress_20
	{
		globalAccum 2 abort_if_less_than 21
		globalAccum 2 abort_if_greater_than 40
		wm_announce "The Allies are done 11 - 20% of their Tank!"
	}
	
	trigger allies_progress_30
	{
		globalAccum 2 abort_if_less_than 41
		globalAccum 2 abort_if_greater_than 60
		wm_announce "The Allies are done 21 - 30% of their Tank!"
	}

	trigger allies_progress_40
	{
		globalAccum 2 abort_if_less_than 61
		globalAccum 2 abort_if_greater_than 80
		wm_announce "The Allies are done 31 - 40% of their Tank!"
	}
	
	trigger allies_progress_50
	{
		globalAccum 2 abort_if_less_than 81
		globalAccum 2 abort_if_greater_than 100
		wm_announce "The Allies are done 41 - 50% of their Tank!"
	}
	
	trigger allies_progress_60
	{
		globalAccum 2 abort_if_less_than 101
		globalAccum 2 abort_if_greater_than 120
		wm_announce "The Allies are done 51 - 60% of their Tank!"
	}

	trigger allies_progress_70
	{
		globalAccum 2 abort_if_less_than 121
		globalAccum 2 abort_if_greater_than 140
		wm_announce "The Allies are done 61 - 70% of their Tank!"
	}
	
	trigger allies_progress_80
	{
		globalAccum 2 abort_if_less_than 141
		globalAccum 2 abort_if_greater_than 160
		wm_announce "The Allies are done 71 - 80% of their Tank!"
	}
	
	trigger allies_progress_90
	{
		globalAccum 2 abort_if_less_than 161
		globalAccum 2 abort_if_greater_than 180
		wm_announce "The Allies are done 81 - 90% of their Tank!"
	}
	
	trigger allies_progress_91
	{
		globalAccum 2 abort_if_less_than 181
		globalAccum 2 abort_if_greater_than 200
		wm_announce "The Allies are done more than 90% of their Tank!"
	}

P.S. this is all in the game manager, so using “self” in the trigger should work right?


(carnage) #10

if i can make a surgestion,

i done think you anouncments of 21-30 are realy needed
it seems like its getting very tenical and i think players would just prefer a simple anouncment

maby its just me but the ranges remind me of historgrams then that makes me think of statistics lesson, not something i wana think about when playing ET


(DWM|Commando) #11

well what else can i say? they are at 40%? even if they are at 31?


(carnage) #12

with my surgestion 40 wouldnt anaunce untill it reaches 40%

and while the anouncment is showing the players would know that the counter may still being increased

so it just lets them know that the 40% marker has been reached

my method way intended to be trigerd every time the counter was changed then check for a significant value, if one is found then anounce the current progress… perhaps your idea was to trigger on a timer so the progress could be checked any time?


(DWM|Commando) #13

ohh i see what you mean, but this is wehre its my fault, i didnt explain how it increases, it can increase by 1 or up to 15 each time, so it could pass right over 40 and 40 never know it. If it was increasing by a solid number each time your method would work, but since its increasing at a variable each time, it wouldnt, thats why i did the greaterthan lessthan thing. its very complicated how hte script works, but when i release the map it will make sense why i had to do it like that


(carnage) #14

ah i see

good luck with your map, cant w8 to get more info on this


(The Wanderer) #15

Printing a message on the screen is not a very good method. Like Ifurita said you can end up flooding the screen with messages and a lot of times people end up completely ignoring those things anyway.
A better way is to put actual items in game that display the status of completion and place these items on locations where you can’t miss them, such as next to spawn areas or chockepoints. For example you can put a counter that displays the percentage completed.
It’s very easy to do something like this with a bunch of script movers. I put together a very small example map with a counter that goes from 0-99, and increments everytime a button is pressed.
You can use something similar for your map.

I don’t have any hosting space and i was too lazy to look around the web for free space so i just renamed the map to .jpg and uploaded it on imageshack. Maybe somebody else wil be nice enough and host it(it’s only 20K anyway).
To download it just click on the link below, download the file, and rename it to counter.pk3
Hopefully it should work.
http://img303.imageshack.us/img303/731/counter3lx.jpg


(DWM|Commando) #16

well i dont think it’ll be spamming, thats pretty much the only text taht people will be seeing from the map, and its every minute, so 2 lines of text a minute. but i like your idea, but it might be more of a beta 2 sort of thing, or if i have time to add it. i still have some work to do, but i woul really like to use that