[ACS] [SOLVED] Aligned HudMessage

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
fr blood
Frequent Poster Miles card holder
Posts: 992
Joined: Wed Mar 06, 2013 4:04 pm
Location: France

[ACS] [SOLVED] Aligned HudMessage

#1

Post by fr blood » Mon Jan 30, 2017 7:48 pm

Hellow everyone, all is said in the title how can I make hudmessage to be aligned depending on player screen/aspect ratio.

I used the normal way by editing each line's x position but here if I changed the resolution it will end up in a big fail.

Thanks for the help.
Last edited by fr blood on Tue Jan 31, 2017 4:13 pm, edited 1 time in total.

Catastrophe
Retired Staff / Community Team Member
Posts: 2559
Joined: Sat Jun 02, 2012 2:44 am

Re: [ACS] Aligned HudMessage

#2

Post by Catastrophe » Tue Jan 31, 2017 2:49 am

For death race I used a strange workaround where the message you were trying to print was followed by "\n\n\n\n\n\n\n\n\n\n\n\n..... @@@@@@@@@@@@@@@@@@@@@@@@" so that I could manually align them as the spam of @ symbols would make the x position of each message the same, as long as there were more @ characters than the message you were trying to print.

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

Re: [ACS] Aligned HudMessage

#3

Post by SwordGrunt » Tue Jan 31, 2017 2:56 am

What if you do SetHudSize first? That sounds exactly like what you need here.

https://zdoom.org/wiki/SetHudSize

User avatar
fr blood
Frequent Poster Miles card holder
Posts: 992
Joined: Wed Mar 06, 2013 4:04 pm
Location: France

Re: [ACS] Aligned HudMessage

#4

Post by fr blood » Tue Jan 31, 2017 4:13 pm

I tried it SwordGrunt, but in the end the compilation didn't worked for "Coordinate Behavior" options.

Anyway I found a solution, here is an example if you guys are looking for the same thing.

Code: Select all

HudMessage(s:"Utility Menu\n\n",
		   s:SpecialColor(1),s:"Pickups\n\n",
                   s:SpecialColor(2),s:"Sentry\n\n",
		   s:SpecialColor(3),s:"Weapons\n\n",
		   s:SpecialColor(4),s:"Suits\n\n",
		   s:SpecialColor(5),s:"Support\n\n",
		   s:SpecialColor(6),s:"Destroy";
		   HUDMSG_PLAIN,8430+PlayerNumber(),CR_WHITE,0.4,0.28,0.2);	
		   
function str SpecialColor(int typ)
{
	if(typ == 1)
	{//Pickups
		if(CheckInventory("UtilitySlot1") == 0)return "\cd";//green
		else return "\cq";//dark green
	}
	else if(typ == 2)
	{//Sentry
		if(CheckInventory("UtilitySlot1") == 1)return "\cd";//green
		else return "\cq";//dark green
	}	
	else if(typ == 3)
	{//Weapons
		if(CheckInventory("UtilitySlot1") == 2)return "\cd";//green
		else return "\cq";//dark green
	}
	else if(typ == 4)
	{//Suits
		if(CheckInventory("UtilitySlot1") == 3)return "\cd";//green
		else return "\cq";//dark green
	}
	else if(typ == 5)
	{//Support
		if(CheckInventory("UtilitySlot1") == 4)return "\cd";//green
		else return "\cq";//dark green
	}
	else if(typ == 6)
	{//Destroy
		if(CheckInventory("UtilitySlot1") == 5)return "\cg";//red
		else return "\cr";//dark red
	}
	return "\cc";//white
}	     
Thank for the help.

Post Reply