ACS menu with selection

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Jekyll Grim Payne
 
 
Posts: 1065
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

ACS menu with selection

Post by Jekyll Grim Payne »

Hey, is there a good tutorial/example of an ACS menu?

Basically, I need three options written on the screen (probably via hudmessage), a cursor (something like ">>" would do) and a way to let the player move that cursor via forward/backward and choose one of the options (which would give a result like changing a variable or running a script, of course) by pressing Use or something.
User avatar
Jekyll Grim Payne
 
 
Posts: 1065
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: ACS menu with selection

Post by Jekyll Grim Payne »

UPD: nvm, I got this to work.

Code: Select all

Script 245 (int buttons)
{
	int songmenu = 1;
	GiveInventory("PowerFrozen",1);
	setplayerproperty(0,1,PROP_TOTALLYFROZEN);
	fadeto(0,0,0,0.4,1.0);

	SETFONT("BIGFONT");

	hudmessage(s: "Claude Debussy - Claire De La Lune";
				HUDMSG_FADEOUT, 1, CR_GOLD, 0.4, 0.45, 60.0);
	hudmessage(s: "Camille Saint-Saens - Danse Macabre";
				HUDMSG_FADEOUT, 2, CR_GOLD, 0.4, 0.5, 60.0);
	hudmessage(s: "Chopin - Nocturne op.9 No.2";
				HUDMSG_FADEOUT, 3, CR_GOLD, 0.4, 0.55, 60.0);
	hudmessage(s: "Cancel";
				HUDMSG_FADEOUT, 4, CR_GOLD, 0.4, 0.6, 60.0);


	hudmessage(s: "Use forward/backward to move and Fire to select";
				HUDMSG_FADEOUT, 5, CR_BLUE, 0.5, 0.8, 60.0);


	while (True)
		{
		buttons = GetPlayerInput(0, INPUT_BUTTONS);

			if (buttons & BT_ATTACK)
				{
						if (songmenu == 1)
							{
								levelmusic = 6;
								ACS_Terminate(249,0);
								delay(35);
								ACS_Execute(249,0,0,0,0);
								hudmessage(s: "Playing Claude Debussy - Claire De La Lune";
									HUDMSG_FADEINOUT, 6, CR_BLUE, 0.5, 0.6, 3.0, 0.5, 0.5);
							}
						else if (songmenu == 2)
							{
								levelmusic = 7;
								ACS_Terminate(249,0);
								delay(35);
								ACS_Execute(249,0,0,0,0);
								hudmessage(s: "Playing Camille Saint-Saens - Danse Macabre";
									HUDMSG_FADEINOUT, 6, CR_BLUE, 0.5, 0.6, 3.0, 0.5, 0.5);
							}
						else if (songmenu == 3)
							{
								levelmusic = 8;
								ACS_Terminate(249,0);
								delay(35);
								ACS_Execute(249,0,0,0,0);
								hudmessage(s: "Chopin - Nocturne op.9 No.2";
									HUDMSG_FADEINOUT, 6, CR_BLUE, 0.5, 0.6, 3.0, 0.5, 0.5);
							}

						else
							{}

						fadeto(0,0,0,0.0,1.0);
						delay(25);
						TakeInventory("PowerFrozen",1);
						setplayerproperty(0,0,PROP_TOTALLYFROZEN);
						hudmessage(s: ""; HUDMSG_Plain, 1, 1, 0.0, 0.0, 1);
						hudmessage(s: ""; HUDMSG_Plain, 2, 1, 0.0, 0.0, 1);
						hudmessage(s: ""; HUDMSG_Plain, 3, 1, 0.0, 0.0, 1);
						hudmessage(s: ""; HUDMSG_Plain, 4, 1, 0.0, 0.0, 1);
						hudmessage(s: ""; HUDMSG_Plain, 5, 1, 0.0, 0.0, 1);
						terminate;
				}

			else if (buttons & BT_FORWARD)
				{
					songmenu = songmenu-1;
					if (songmenu < 1)
						{
							songmenu = 4;
						}
				}

			else if (buttons & BT_BACK)
				{
					songmenu = songmenu+1;
					if (songmenu > 4)
						{
							songmenu = 1;
						}
				}

						if (songmenu == 1)
				{
				hudmessage(s: ">>";
					HUDMSG_FADEOUT, 6, CR_GREEN, 0.2, 0.45, 1.0);
				}
			else if (songmenu == 2)
				{
				hudmessage(s: ">>";
					HUDMSG_FADEOUT, 6, CR_GREEN, 0.2, 0.5, 1.0);
				}
			else if (songmenu == 3)
				{
				hudmessage(s: ">>";
					HUDMSG_FADEOUT, 6, CR_GREEN, 0.2, 0.55, 1.0);
				}
			else if (songmenu == 4)
				{
				hudmessage(s: ">>";
					HUDMSG_FADEOUT, 6, CR_GREEN, 0.2, 0.6, 1.0);
				}

			delay(5);

		}
}
Locked

Return to “Editing (Archive)”