Resource icon

[Reusable] commandqueue 1.0

I give permission for this addon to be reused, modified, or ported by anyone
  1. Yes
I understand my submission will be rejected if it does not follow forum rules, Submissions guidelines, and/or file name conventions
  1. Yes
Have ya ever wanted to hold an tournament with a specific sequence of maps, but find it annoying that you have to manually change the map each time?

commandqueue is a QoL improvement for admins and hosts that adds a queue of commands that can be scheduled for execution at a later time. The command can be anything, though queuing up maps is the use case in mind.

Disabled by default. To enable, turn on the 2 added console vars. Then whitelist the commands you would like to queue. In console type
"cq_commandqueue 1" enables all commands in the mod
"cq_poponvote 1" Will now automatically execute popq on the first frame of the vote screen. popq description below.
"cq_whitelist map" The command "map" may now be queued. Replace map with any* you would like to queue.

* Some commands are perma-blacklisted e.g. promote as they should never be queued


poponvote.gif


What is a queue?

A queue is like a line at McDonalds. Ronald won't immediately serve you a burger when you arrive. You wait on a line, while Ronald serves all the customers who arrived before you. Only after that will he give you one. Additionally, Ronald serves the customers in the exact order in which they arrive (For the sake of argument let's just assume everyone in the world is a respectful person and doesn't cut). This exactly how command queue works. When you add a command, it isn't immediately executed. Instead, commands on the queue only execute when it is at the front of the line, and popq is called. In this analogy, calling popq is like Ronald finally giving one of his sweet, sweet burgers to the customer directly in front of him.

Basic commands

Code:
addq "your command"
Add "your command" to the queue. The command won't be executed immediately. Instead it goes into the queue, which will execute all the commands it sees in First-In-First-Out fashion
Example: addq "map map35"

Code:
popq
Executes the next command in the queue. This is done automatically after intermission when cq_poponvote is enabled. The command is subsequently removed from the queue.
Example: popq

Code:
showq
Displays all commands currently in the queue. The next command is at index {0}. The one after at is at index {1}, and so on...
Example: showq

showq_demo.png


Code:
helpq "cq_command"
Shows help for the specified command queue command. type it alone for the welcome message."
Example: helpq insertq

Advanced Commands

Code:
addfrontq "your command"
Adds "your command" to the front of the queue. Will execute next on popq. Good in an emergency situation.
Example: addfrontq "map map28"

Code:
editq "index" "your command"
changes the command at the specified index to your new command. showq to view indexes. Warning: the command will be overwritten. insertq to instead add at this index.
Example: editq 1 "map map01"

Code:
deleteq index
Deletes the command at the specified index. showq to view indexes.
Example: deleteq 2

Code:
insertq "index" "your command"
Inserts "your command" before the command at the specified index. showq to view indexes. addfrontq simply calls "insertq 0 yourcommand".
Example: inesertq 1 "map mapHC"

Code:
clearq
Clears the entire queue. DANGER! Queue is not recoverable after this operation.
Example: clearq -force

Ideas for usage

Tournaments

Events typically have an order of maps decided ahead of time. With one command, you can schedule the full sequence of maps. Let's say you want to host a Ring cup.

Code:
addq "clearscores;map map01";addq "map map02";addq "map map03";addq "map map04";addq "map map05"
Remember to enable each feature with cq_commandqueue, cq_poponvote, cq_whitelist clearscores, and cq_whitelist map

Repeating sequence

You can alias a command with addq in it. If that alias refers to itself, it will continuously queue that command. Let's say you want a "No Vote, Just SMK" server.

Code:
alias a1 "addq "map map51;a1"
alias a2 "addq "map map52;a2"
alias a3 "addq "map map53;a3"
alias a4 "addq "map map54;a4"
alias a5 "addq "map map55;a5"
alias a6 "addq "map mapHD;a5"
a1;a2;a3;a4;a5;a6
For this you will need to whitelist addq in addition to map

hostmod synergy

Make addq hm_voteable to allow users on the server to choose where they go next. Any conflicts? No problem! Just add both to the queue!
Careful: Only whitelist the commands you are comfortable with.

Acknowledgements
Tyron and co-authors of hostmod. Several components were re-used in this mod.
Author
cglitcher
Downloads
65
Views
480
First release
Last update
Rating
4.00 star(s) 1 ratings

Share this resource

Latest reviews

Welcome to releases!
cglitcher
cglitcher
Thanks! :)
Upvote 0
Top