Automated Messages
From PunksBusted
A lot of people have trouble with displaying messages on their server using the PB_SV_Task Command. In a post on the PsB CoD 2 forum I came up with a method to show easily - I hope - just how to use this command to make console 'say' messages.
Command Overview
The basic command is: PB_SV_TASK X Y "say <message>" and here we will discover the values required for X and Y in the command based on how many messages you want to display and the delay between messages showing.
To get an equal time between displaying say messages on your server, you can use the following simple maths:
- A =number of messages to display
- B = the time delay between displaying messages
Then the 'Y' value for all messages is:
- Y = (B* Number of messages) + the X value of the first say task
So what does that mean in English?
Lets say you have 5 messages to display and you want 30 seconds between each message and that you want the first one to start 10 seconds after you start the server.
Right, the X value in the first task statement is 10 (as you wanted) and the successive X value for the tasks is 30 more than the last (so the second is 40, the third 70, etc).
The Y value never changes and must include the 10 second offset of the first message, so the Y value for all messages (from the equation above) is (30*5) + 10 = 160 seconds.
So your task list will look like this:
pb_sv_task 10 160 "say Message1" pb_sv_task 40 160 "say Message2" // 30 second delay + the 10 second X value above pb_sv_task 70 160 "say Message3" // 30 second delay + the 40 second X value above pb_sv_task 100 160 "say Message4" // etc pb_sv_task 130 160 "say Message5"
In this example, the messages will repeat 160 seconds after the first message. Your first message will repeat at 160 seconds (not 170!), which is 30 seconds after the last message appeared at 130 seconds. So you have 30 second gap between all messages.
Thats only applies if you want your messages to display evenly spaced. If you want them all jumbled up and looking random, make the Y values all different.
Ultimately, regardless of how you set this up, the last 'X' value should be less than the Y values, otherwise the messages will mix up.
A variation on this is if you want a number of messages, 'A', to display evenly over 'B' number of seconds. In this case, the difference between the 'X' values in the pb_sv_task statement is:
- dX = B/A
Your 'Y' values, again never change, can be calculated by:
- Y = B + the X value of the first say task
For example: You want 5 messages to display over 240 seconds (4 minutes) and you want the first message to display 10 seconds after server start (ie, the first task X value is 10). The difference between the 'X' values must be 240/5 = 48 and all 'Y' values must be 240 + 10 = 250. So your task list will look like this:
pb_sv_task 10 250 "say Message1" pb_sv_task 58 250 "say Message2" // 48 second delay + the 10 second X value above pb_sv_task 106 250 "say Message3" // 48 second delay + the 58 second X value above pb_sv_task 154 250 "say Message4" // 48 second delay + the 106 second X value above pb_sv_task 202 250 "say Message5" //etc
Add the delay of 48 seconds between the last message and the first message repeating and the total is 250 - your 'Y' value.
--Dewed up scope 17:36, 5 April 2007 (EDT)
