GetMapRotationInfo: Difference between revisions

From Zandronum Wiki
(3.1 is released, so Devfeature templates have been removed)
(Add example)
Tag: Source edit
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
int '''GetMapRotationInfo''' (int ''position'', int ''info'')
int '''GetMapRotationInfo''' (int ''position'', int ''info'')


==Usage==
== Usage ==
Retrieves information on a particular entry in the map rotation.


Retrieves information on a particular entry in the map rotation, indicated by the ''position'' parameter. Use 0 to get information on the current map (printed in green when the <tt>maplist</tt> [[Console Commands|console command]] is used). The ''info'' parameter can be one of the following:
=== Parameters ===
* ''position'': The index into the map rotation. This can be 0 to return the current map (printed in green when the <tt>maplist</tt> [[Console Commands|console command]] is used); otherwise it must be between 1 and the value returned by [[GetMapRotationSize]].
* ''info'': One of:
:*'''MAPROTATION_Name''' = 0
::The name of the map (e.g. "Entryway").
:*'''MAPROTATION_LumpName''' = 1
::The lump name of the map (e.g. "MAP01").
:*'''MAPROTATION_Used''' = 2
::Whether or not this map has already been played. Used maps are printed in red when the <tt>maplist</tt> [[Console Commands|console command]] is used.
:*'''MAPROTATION_MinPlayers''' = 3
::The minimum number of players required to load this level. If this is 0, then there's no minimum limit.
:*'''MAPROTATION_MaxPlayers''' = 4
::The maximum number of players allowed to load this level. If this is 64, then there's no maximum limit.


*'''MAPROTATION_Name''' = 0
=== Return value ===
The name of the map (e.g. "Entryway").
Returns the value of the given property of the specified map rotation entry.
*'''MAPROTATION_LumpName''' = 1
The lump name of the map (e.g. "MAP01").
*'''MAPROTATION_Used''' = 2
Whether or not this map has already been played. Used maps are printed in red when the <tt>maplist</tt> [[Console Commands|console command]] is used.
*'''MAPROTATION_MinPlayers''' = 3
The minimum number of players required to load this level. If this is 0, then there's no minimum limit.
*'''MAPROTATION_MaxPlayers''' = 4
The maximum number of players allowed to load this level. If this is 64, then there's no maximum limit.


[[category:ACS Functions]]
== Examples ==
<syntaxhighlight lang="c" line="1">
// This script prints the indices and names of the maps in the rotation when the map loads.
Script 1 OPEN {
int size = GetMapRotationSize();
Log(d: size, s: " maps are in the rotation.");
 
// Note: the list starts at 1; position 0 is the current map.
for (int i = 1; i <= size; i++)
{
Log(
d: i, s: ". ",
s: GetMapRotationInfo(i, MAPROTATION_LumpName), s: " - ",
s: GetMapRotationInfo(i, MAPROTATION_Name)
);
}
}
</syntaxhighlight>
 
== See also ==
* [[GetMapRotationSize]]
 
[[category:ACS functions]]

Latest revision as of 23:16, 21 August 2022

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

int GetMapRotationInfo (int position, int info)

Usage

Retrieves information on a particular entry in the map rotation.

Parameters

  • position: The index into the map rotation. This can be 0 to return the current map (printed in green when the maplist console command is used); otherwise it must be between 1 and the value returned by GetMapRotationSize.
  • info: One of:
  • MAPROTATION_Name = 0
The name of the map (e.g. "Entryway").
  • MAPROTATION_LumpName = 1
The lump name of the map (e.g. "MAP01").
  • MAPROTATION_Used = 2
Whether or not this map has already been played. Used maps are printed in red when the maplist console command is used.
  • MAPROTATION_MinPlayers = 3
The minimum number of players required to load this level. If this is 0, then there's no minimum limit.
  • MAPROTATION_MaxPlayers = 4
The maximum number of players allowed to load this level. If this is 64, then there's no maximum limit.

Return value

Returns the value of the given property of the specified map rotation entry.

Examples

// This script prints the indices and names of the maps in the rotation when the map loads.
Script 1 OPEN {
	int size = GetMapRotationSize();
	Log(d: size, s: " maps are in the rotation.");

	// Note: the list starts at 1; position 0 is the current map.
	for (int i = 1; i <= size; i++)
	{
		Log(
			d: i, s: ". ",
			s: GetMapRotationInfo(i, MAPROTATION_LumpName), s: " - ",
			s: GetMapRotationInfo(i, MAPROTATION_Name)
		);
	}
}

See also