VOTEDEF: Difference between revisions

From Zandronum Wiki
Tag: Source edit
(Alert users of the VOTEINFO page which has a more accurate documentation of the feature.)
 
Line 1: Line 1:
{{FeatureDraft|a future custom vote type implementation|additional={{Issue|1420}}, [http://zandronum.com/forum/showthread.php?tid=6193 forum thread]}}
{{FeatureDraft|a future custom vote type implementation|additional={{Issue|1420}}, [http://zandronum.com/forum/showthread.php?tid=6193 forum thread]
 
 
This page is a draft and the official implementation of custom vote types can be found under [[VOTEINFO]] instead.}}


<pre>
<pre>
Line 14: Line 17:
</pre>
</pre>


* '''Argument''' can be one of the following. If the argument is not given, the vote command will not take one.
*'''Argument''' can be one of the following. If the argument is not given, the vote command will not take one.
** <tt>int</tt>: an integer number, e.g. 5
**<tt>int</tt>: an integer number, e.g. 5
** <tt>float</tt>: decimal value, e.g. 3.14
**<tt>float</tt>: decimal value, e.g. 3.14
** <tt>player</tt>: a valid player, e.g. Doomcrate
**<tt>player</tt>: a valid player, e.g. Doomcrate
** <tt>string</tt>: a string, e.g. "hello, world"
**<tt>string</tt>: a string, e.g. "hello, world"
** <tt>map</tt>: a map name, e.g. "MAP01"
**<tt>map</tt>: a map name, e.g. "MAP01"


For <tt>int</tt> and <tt>float</tt> types, a value range must be given. This details what the minimum and maximum values for the vote are. Example:
For <tt>int</tt> and <tt>float</tt> types, a value range must be given. This details what the minimum and maximum values for the vote are. Example:
  Argument = int (0, 100) // integer argument ranging from 0 to 100
  Argument = int (0, 100) // integer argument ranging from 0 to 100  


* '''Action''' = CallACS (<number> / "<name>") - defines what happens if the vote passes. Currently, the only action is CallACS. A script number or name must be given for CallACS. The vote caller is the script activator (unless they left already before the vote passed, in which case the world executes it instead) and the script will be passed the vote parameter, if any:
*'''Action''' = CallACS (<number> / "<name>") - defines what happens if the vote passes. Currently, the only action is CallACS. A script number or name must be given for CallACS. The vote caller is the script activator (unless they left already before the vote passed, in which case the world executes it instead) and the script will be passed the vote parameter, if any:
** Int: the value as an integer
**Int: the value as an integer
** Float: the value converted to fixed point
**Float: the value converted to fixed point
** Player: the player index
**Player: the player index
** String: the parameter as a dynamic string
**String: the parameter as a dynamic string
** Map: the lump name of the map as a dynamic string
**Map: the lump name of the map as a dynamic string
* '''Description''' = <text> - Describes the vote. It will show up in the <tt>Call a Vote</tt> menu and the <tt>listvotetypes</tt> CCMD.
*'''Description''' = <text> - Describes the vote. It will show up in the <tt>Call a Vote</tt> menu and the <tt>listvotetypes</tt> CCMD.
* '''ForbidCVar''' = <cvarname> - sets the name of the cvar that forbids this vote type's usage. It defaults to <tt>sv_no<name>vote</tt>. If the cvar does not exist, it will be automatically created.
*'''ForbidCVar''' = <cvarname> - sets the name of the cvar that forbids this vote type's usage. It defaults to <tt>sv_no<name>vote</tt>. If the cvar does not exist, it will be automatically created.
* '''MenuRange''' = <min>, <max> - defines what is used as the value range for the call vote menu. For example fraglimit votes allow values up to 32767 but only 0-100 are used in the menu. Defaults to the value range given in the argument field.
*'''MenuRange''' = <min>, <max> - defines what is used as the value range for the call vote menu. For example fraglimit votes allow values up to 32767 but only 0-100 are used in the menu. Defaults to the value range given in the argument field.
* '''MenuStep''' = <value> - defines how much the value changes in the menu when arrow keys are used. Defaults to 1.
*'''MenuStep''' = <value> - defines how much the value changes in the menu when arrow keys are used. Defaults to 1.
* '''NoPassedLimit''' - If this call succeeds, the caller will not be forced to wait 10 minutes to call another vote of this kind.
*'''NoPassedLimit''' - If this call succeeds, the caller will not be forced to wait 10 minutes to call another vote of this kind.
* '''NotOnSelf''' - The vote cannot be called with the vote caller as the player value.
*'''NotOnSelf''' - The vote cannot be called with the vote caller as the player value.
* '''NotOnAdmin''' - The vote cannot be called with anyone in the admin list as the player value.
*'''NotOnAdmin''' - The vote cannot be called with anyone in the admin list as the player value.
* '''NotOnSpectators''' - The vote cannot be called with a spectator as the player value. Does not prevent the vote from being called on dead LMS players.
*'''NotOnSpectators''' - The vote cannot be called with a spectator as the player value. Does not prevent the vote from being called on dead LMS players.
* '''NotOnBots''' - The vote cannot be called with a bot as the player value.
* '''NotOnBots''' - The vote cannot be called with a bot as the player value.
* '''PlayerAsIndex''' - If the argument is a player, the player must be passed to the vote via index rather than name.
*'''PlayerAsIndex''' - If the argument is a player, the player must be passed to the vote via index rather than name.
* '''MapInRotation''' - With a map argument, the map must be in the map rotation.
*'''MapInRotation''' - With a map argument, the map must be in the map rotation.
* '''NeedsNextMap''' - A next map must be available for the vote to be called.
*'''NeedsNextMap''' - A next map must be available for the vote to be called.


Zandronum comes with stock, natively defined vote types. These have internal implementation and do not run ACS scripts.
Zandronum comes with stock, natively defined vote types. These have internal implementation and do not run ACS scripts.

Latest revision as of 09:35, 24 January 2024

Note: This article is a draft for a future custom vote type implementation. This is not supported in any current Zandronum version!
Additional information: Issue 1420 , forum thread


This page is a draft and the official implementation of custom vote types can be found under VOTEINFO instead.

VoteType <name>
{
    Argument = {int | float | string | player | map} [(minimum, maximum)]
    Action = CallACS (<scriptnumber> or "<scriptname>")
    Description = <string>
    ForbidCVar = <string>
    MenuRange = <value>, <value>
    MenuStep = <value>
    [Flags]
}
  • Argument can be one of the following. If the argument is not given, the vote command will not take one.
    • int: an integer number, e.g. 5
    • float: decimal value, e.g. 3.14
    • player: a valid player, e.g. Doomcrate
    • string: a string, e.g. "hello, world"
    • map: a map name, e.g. "MAP01"

For int and float types, a value range must be given. This details what the minimum and maximum values for the vote are. Example:

Argument = int (0, 100) // integer argument ranging from 0 to 100 
  • Action = CallACS (<number> / "<name>") - defines what happens if the vote passes. Currently, the only action is CallACS. A script number or name must be given for CallACS. The vote caller is the script activator (unless they left already before the vote passed, in which case the world executes it instead) and the script will be passed the vote parameter, if any:
    • Int: the value as an integer
    • Float: the value converted to fixed point
    • Player: the player index
    • String: the parameter as a dynamic string
    • Map: the lump name of the map as a dynamic string
  • Description = <text> - Describes the vote. It will show up in the Call a Vote menu and the listvotetypes CCMD.
  • ForbidCVar = <cvarname> - sets the name of the cvar that forbids this vote type's usage. It defaults to sv_no<name>vote. If the cvar does not exist, it will be automatically created.
  • MenuRange = <min>, <max> - defines what is used as the value range for the call vote menu. For example fraglimit votes allow values up to 32767 but only 0-100 are used in the menu. Defaults to the value range given in the argument field.
  • MenuStep = <value> - defines how much the value changes in the menu when arrow keys are used. Defaults to 1.
  • NoPassedLimit - If this call succeeds, the caller will not be forced to wait 10 minutes to call another vote of this kind.
  • NotOnSelf - The vote cannot be called with the vote caller as the player value.
  • NotOnAdmin - The vote cannot be called with anyone in the admin list as the player value.
  • NotOnSpectators - The vote cannot be called with a spectator as the player value. Does not prevent the vote from being called on dead LMS players.
  • NotOnBots - The vote cannot be called with a bot as the player value.
  • PlayerAsIndex - If the argument is a player, the player must be passed to the vote via index rather than name.
  • MapInRotation - With a map argument, the map must be in the map rotation.
  • NeedsNextMap - A next map must be available for the vote to be called.

Zandronum comes with stock, natively defined vote types. These have internal implementation and do not run ACS scripts.