Difference between revisions of "MERVBot Tutorial"

From ASSS Wiki
Jump to: navigation, search
(Underlord's MERV Tutorial)
 
(Reduced size/cleaned up a bit. (In progress...))
Line 1: Line 1:
 
Here is the ever-popular MERVBot Tutorial by Underlord:
 
Here is the ever-popular MERVBot Tutorial by Underlord:
  
 
+
<div id="merv_toc" style="font-size: 12px; margin: 2em;">
<br /><div align="center"><big><b><big>MERVBot Tutorial</big></b></big><br />
+
Setup a MERVBot bot and project in visual c++<br />
 +
0) <a href="#0">Setting up a MERVBot bot</a><br />
 
<br />
 
<br />
(Written by Underlord)
 
<hr width="500" size="1" /></div>
 
 
<font size="2">&nbsp;</font><blockquote><font size="2">Setup a MERVBot bot and project in visual c++<br />
 
0) <a href="#0">Setting up a MERVBot bot</a><br />
 
  <br />
 
 
Command.cpp<br />
 
Command.cpp<br />
&nbsp;1)<a href="#1"> Player commands</a>
+
&nbsp;1) <a href="#1">Player commands</a> (!play, !squadA vs squadB)<br />
(!play, !squadA vs squadB)<br />
+
<br />
  <br />
 
 
Spawn.cpp<br />
 
Spawn.cpp<br />
&nbsp;2) <a href="#2">Event descriptions</a>
+
&nbsp;2) <a href="#2">Event descriptions</a> (describe events in spawn.cpp)<br />
(describe events in spawn.cpp)<br />
+
&nbsp;2) <a href="#2">Messaging </a>(&quot;*arena hi&quot;, &quot;:player:*scorereset)<br />
&nbsp;2) <a href="#2">Messaging </a>
+
&nbsp;3) <a href="#3">MervBot Timer</a> (do this in 10 seconds)(countdown[n])<br />
(&quot;*arena hi&quot;, &quot;:player:*scorereset)<br />
+
&nbsp;4) <a href="#4">Writing Functions</a> (bool IsInCenter(Player *p))<br />
&nbsp;3) <a href="#3">MervBot Timer</a>
+
<br />
(do this in 10 seconds)(countdown[n])<br />
 
&nbsp;4) <a href="#4">Writing Functions</a>
 
(bool IsInCenter(Player *p))<br />
 
  <br />
 
 
Useful operations<br />
 
Useful operations<br />
&nbsp;6) <a href="#6">Cycling players</a>
+
&nbsp;6) <a href="#6">Cycling players</a><br />
  <br />
+
&nbsp;7) <a href="#7">Check if pilot is in safe zone</a><br />
&nbsp;7) <a href="#7">Check if pilot is in safe zone</a>
+
&nbsp;8) <a href="#8">Random numbers</a><br />
  <br />
+
&nbsp;9) <a href="#9">Time without using countdown[n]</a><br />
&nbsp;8) <a href="#8">Random numbers</a>
+
10) <a href="#10">Storing data for pilots</a><br />
  <br />
+
11) <a href="#11">Output data in messages</a><br />
&nbsp;9) <a href="#9">Time without using countdown[n]</a>
+
12) <a href="#12">Input/Output to files</a><br />
  <br />
+
13) <a href="#13">Programming commands</a><br />
10) <a href="#10">Storing data for pilots</a>
 
  <br />
 
11) <a href="#11">Output data in messages</a>
 
  <br />
 
12) <a href="#12">Input/Output to files</a>
 
  <br />
 
13) <a href="#13">Programming commands</a>
 
  <br />
 
 
14) <a href="#14">Useful player data</a><br />
 
14) <a href="#14">Useful player data</a><br />
15) <a href="#15">Bot built in functions</a>
+
15) <a href="#15">Bot built in functions</a><br />
<br /><br />
+
<br />
 
Example Code<br />
 
Example Code<br />
  </font><blockquote><font size="2">a) <a href="#15a">No antiwarp in center of map</a>
+
<div style="margin-left: 2em">
    <br />
+
a) <a href="#15a">No antiwarp in center of map</a><br />
b) <a href="#15b">Setting freq size depending on how many pilots in game</a>
+
b) <a href="#15b">Setting freq size depending on how many pilots in game</a><br />
    <br />
+
c) <a href="#15c">Tracking kills and announcing when pilot gets 10 kills in a row without dying </a><br />
c) <a href="#15c">Tracking kills and announcing when pilot gets 10 kills in a row without dying </a>
+
d) <a href="#15d">Warp pilot to coord when they are in a certain region</a><br />
    <br />
+
e) <a href="#15e">Structures within structures</a><br />
d) <a href="#15d">Warp pilot to coord when they are in a certain region</a>
+
f) <a href="#15f">Tracking flag data</a><br />
    <br />
+
g) <a href="#15g">Way to do simple /!spam feature</a><br />
e) <a href="#15e">Structures within structures</a>
+
h) <a href="#15h">Implementing a simple stack to do &quot;next in line for several 'boxes' at once&quot;</a><br />
<br />
+
i) <a href="#15i">Reading any text from a .txt and printing it to pilot line by line</a><br />
f) <a href="#15f">Tracking flag data</a>
+
j) <a href="#15j">Example of printing player stats grid</a><br />
    <br />
+
k) <a href="#15k">Example of checking if any pilots are within a region</a><br />
g) <a href="#15g">Example way to do simple /!spam feature</a>
+
l) <a href="#15l">Example of functions to get a pilot's struct id info from a name or *player info</a><br />
    <br />
+
m) <a href="#15m">Example of creating a logfile name using date and squad names</a><br />
h) <a href="#15h">Example of implementing a simple stack to do &quot;next in line for several 'boxes' at once&quot;</a>
+
n) <a href="#15n">Sending messages to playing freqs or public and logging depending on status</a><br />
    <br />
+
o) <a href="#15o">Example of reading in all player/freqs to struct data</a><br />
i) <a href="#15i">Example of reading any text from a .txt and printing it to pilot line by line</a>
+
p) <a href="#15p">Example of finding MVP from struct data</a><br />
    <br />
+
q) <a href="#15q">Print time stamp of event</a><br />
j) <a href="#15j">Example of printing player stats grid</a>
+
r) <a href="#15r">Simple way to track player bomb/bullet damage stats</a><br />
    <br />
 
k) <a href="#15k">Example of checking if any pilots are within a region</a>
 
<br />
 
l) <a href="#15l">Example of functions to get a pilot's struct id info from a name or *player info</a>
 
    <br />
 
m) <a href="#15m">Example of creating a logfile name using date and squad names</a>
 
 
 
    <br />
 
n) <a href="#15n">Sending messages to playing freqs or public and logging depending on status</a>
 
    <br />
 
o) <a href="#15o">Example of reading in all player/freqs to struct data</a>
 
    <br />
 
p) <a href="#15p">Example of finding MVP from struct data</a>
 
    <br />
 
q) <a href="#15q">Print time stamp of event</a>
 
    <br />
 
r) <a href="#15r">Simple way to track player bomb/bullet damage stats</a>
 
    <br />
 
 
s) <a href="#15s">Simple way to print those stats</a><br />
 
s) <a href="#15s">Simple way to print those stats</a><br />
 
t) <a href="#15t">Make bot spectate specific coordinates</a>
 
t) <a href="#15t">Make bot spectate specific coordinates</a>
<br />
+
</div>
    </font></blockquote>
+
</div>
</blockquote>
+
 
<font size="2">  <br />
+
==Setting up a MERVBot bot (plugin)==
 
+
 
  </font><hr width="500" size="1" /><font size="2"><br />
+
MERVBot download site: &nbsp;http://catid.sscentral.com/
  <br />
+
 
  <a name="0"></a>
+
MERVBot Forum: &nbsp;http://www.ssforum.net/ &nbsp;(Development - MervBot forum)
  <b>[0] Setting up a MERVBot bot (plugin)</b><br />
 
 
 
    </font><blockquote><font size="2">MERVBot download site: &nbsp;<a href="http://catid.sscentral.com">http://catid.sscentral.com</a>
 
      <br />
 
      <br />
 
MERVBot Forum: &nbsp;<a href="http://www.ssforum.net">http://www.ssforum.net</a>
 
&nbsp;(Development - MervBot forum)<br />
 
      <br />
 
1) Download <a href="http://catid.sscentral.com/files/MERVBot.zip">MERVBot Build 37 (DLL 6.5)</a>
 
      <br />
 
      </font><blockquote><font size="2">Unzip MERVBot.zip into a new folder. (example c:program filescontinuummervbot)<br />
 
Unzip src.zip into &quot;/src&quot; subfolder of that new folder (example c:program filescontinuummervbotsrc)<br />
 
        </font></blockquote>
 
<font size="2">2) Download <a href="http://catid.sscentral.com/files/Tutorial.zip">DLL-plugin Tutorial</a>
 
<br />
 
        </font><blockquote>
 
<font size="2">    Unzip Tutorial.zip into &quot;/tutorial&quot; subfolder of that new folder. (example c:program filescontinuummervbotsrctutorial)<br />
 
(note spawn.h, spawn.cpp, and command.cpp are here)<br />
 
          </font><blockquote><font size="2">File descriptions:<br />
 
            </font></blockquote>
 
<font size="2">&nbsp;</font><blockquote>
 
<font size="2">spawn.h = declare/initialize globals<br />
 
  
 +
===Download [http://catid.sscentral.com/files/MERVBot.zip MERVBot Build 37 (DLL 6.5)]===
  
 +
<blockquote>Unzip MERVBot.zip into a new folder. (example c:\program files\continuum\mervbot)<br />
 +
Unzip src.zip into &quot;/src&quot; subfolder of that new folder (example c:\program files\continuum\mervbotsrc)<br />
 +
</blockquote>
  
 +
===Download [http://catid.sscentral.com/files/Tutorial.zip DLL-plugin Tutorial]===
  
 +
<blockquote>
 +
Unzip Tutorial.zip into &quot;/tutorial&quot; subfolder of that new folder. (example c:\program files\continuum\mervbot\src\tutorial)<br />
 +
(note spawn.h, spawn.cpp, and command.cpp are here)<br />
 +
<blockquote>File descriptions:<br />
 +
spawn.h = declare/initialize globals<br />
 
command.cpp = code for commands coming into bot (ie /!help, /!play, etc)<br />
 
command.cpp = code for commands coming into bot (ie /!help, /!play, etc)<br />
 +
spawn.cpp = code for main part of bot<br />
 +
</blockquote>
 +
Note: if you only want to execute someone's premade bot (.dll), skip to step 4 (Run your bot .dll), otherwise continue to learn how to make your own bot
 +
</blockquote>
  
 +
===Microsoft Visual c++===
  
 +
<ol>
 +
<li>Start Visual Studios 6.0.
 +
<li>Click the Drop Down Menu labeled &quot;File&quot; at the top left of your screen.
 +
<li>Click &quot;New&quot;.
 +
<li>On the next screen that comes up, choose from the Project tab, then Win32 Dynamic-Link Library
 +
<li>Select the &quot;/src&quot; folder as the base folder (example c:\program files\continuum\mervbot\src)
 +
<li>Name your project &quot;mybot&quot;. This will make a &quot;mybot&quot; subfolder in your &quot;src&quot; folder. Click OK. (example creates c:\program files\continuum\mervbot\src\mybot)<br />
 +
<li>Choose to create an &quot;Empty DLL project&quot;.
 +
<li>Click &quot;Finish&quot;.
 +
<li>Click the Drop Down Menu labbled &quot;Project&quot;.
 +
<li>Click &quot;Add To Project Files&quot;<br />
 +
<li>Copy only spawn.h, spawn.cpp, and command.cpp from the &quot;tutorial&quot; folder into the this new folder. (example from c:\program files\continuum\mervbot\src\tutorial to c:\program files\continuum\mervbot\src\mybot)
 +
<li>Click the Drop Down Menu labelled &quot;Build&quot;.
 +
<li>Click &quot;Build (dll name)&quot; - where the (dll name) is &quot;mybot&quot;
 +
<li>Go into your &quot;mybot&quot; folder and look for a folder named &quot;Debug&quot;
 +
(example c:\program files\continuum\mervbot\src\mybot\debug)
 +
<li>Your new DLL will be in that folder. (example mybot.dll)
 +
<li>Copy mybot.dll to your base folder that has mervbot.exe in it (example c:\program files\continuum\mervbot)
 +
</ol>
  
 +
===Run your bot dll===
  
spawn.cpp = code for main part of bot<br />
+
To run your bot you need your DLL (mybot.dll), Commands.txt, MERVBot.exe, MERVBot.ini, Operators.txt, Spawns.txt, subspace.bin, and zlib.dll all in one folder (example c:\program files\continuum\mervbot).
              </font></blockquote>
 
<font size="2">&nbsp;</font></blockquote>
 
<font size="2">&nbsp;</font><blockquote><font size="2">Note: if you only want to execute someone's premade
 
bot (.dll), skip to step 4 (Run your bot .dll), otherwise continue to learn
 
how to make your own bot<br />
 
                </font></blockquote>
 
<font size="2">3) Microsoft Visual c++<br />
 
                </font><blockquote><font size="2">1) Start Visual Studios 6.0<br />
 
                  <br />
 
  
2) Click the Drop Down Menu labbled &quot;File&quot; at the top left of your screen<br />
+
<ol>
                  <br />
+
<li>Edit spawns.txt (only one line of text in file needed)
  
3) Click &quot;New&quot;<br />
+
<blockquote>bot_name : pw_for_bot_name : arena: dll_plugin : optional_staff_password<br />
                  <br />
+
<blockquote>
 +
''Example:'' 2v2-Bot-League : botpw: 2v2a: 2v2league : staffpw<br />
 +
        <br />
 +
- You should create your bot name and pw using your Continuum client as you would create any new name. <br />
 +
- There is no * in front of staffpw. <br />
 +
- Bot needs to be on vip.txt or have moderator+ access to enter a zone.<br />
  
4) On the next screen that comes up, choose from the Project tab, then Win32 Dynamic-Link Library<br />
+
</blockquote>
                  <br />
+
</blockquote>
  
5) Select the &quot;/src&quot; folder as the base folder (example c:program filescontinuummervbotsrc)<br />
+
<li>Edit MERVBot.ini
                  <br />
 
  
6) Name your project &quot;mybot&quot;. This will make a &quot;mybot&quot; subfolder in your &quot;src&quot; folder. Click OK<br />
+
<pre>[Login]
(example creates c:program filescontinuummervbotsrcmybot)<br />
+
Zone=216.33.98.254:21000 // make that your zone IP:PORT available from zone.dat in Continuum dir
                  <br />
+
</pre>
  
7) Choose to create an &quot;Empty DLL project&quot;<br />
 
                  <br />
 
  
8) Click &quot;Finish&quot;<br />
+
<li>Edit operators.txt
                  <br />
+
          <blockquote>
 +
          access_level : name :<br />
 +
       
 +
''Example:''
 +
<pre>
 +
4:my_name:
 +
4:another_sysop:
 +
3:other_person:
 +
</pre>
  
9) Click the Drop Down Menu labbled &quot;Project&quot;<br />
+
</blockquote>
                  <br />
 
  
10) Click &quot;Add To Project Files&quot;<br />
+
<li>Run MERVBot.exe
                  <br />
+
<blockquote>
11) Copy only spawn.h, spawn.cpp, and command.cpp from the &quot;tutorial&quot; folder into the this new folder.<br />
+
Double click MERVBot.exe, the bot should now enter the zone<br />
(example from c:program filescontinuummervbotsrctutorial to c:program filescontinuummervbotsrcmybot)<br />
+
</blockquote>
                  <br />
 
12) Click the Drop Down Menu labelled &quot;Build&quot;<br />
 
                  <br />
 
  
13) Click &quot;Build (dll name)&quot; - where the (dll name) is &quot;mybot&quot;<br />
+
<li>Modify your MERVBot code<br />
                  <br />
+
<blockquote>
 +
You can open your MERVBot project by opening &quot;mybot.dsw&quot; file with visual c++.
 +
(example c:\program files\continuum\mervbot\src\mybot\mybot.dsw)
  
14) Go into your &quot;mybot&quot; folder and look for a folder named &quot;Debug&quot;<br />
+
Edit the spawn.h, spawn.cpp, and command.cpp to create your bot, then build,
(example c:program filescontinuummervbotsrcmybotdebug)<br />
+
copy your updated dll to your MERVBot.exe folder and then execute the bot.
                  <br />
 
  
15) Your new DLL will be in that folder. (example mybot.dll)<br />
+
Use the tutorial to get ideas on how to implement certain types of features into the bot.
                  <br />
+
</blockquote>
16) Copy mybot.dll to your base folder that has mervbot.exe in it (example c:program filescontinuummervbot)<br />
 
                  </font></blockquote>
 
  
<font size="2">    4) Run your bot dll:<br />
+
==Player Commands - (command.cpp)==
                  </font><blockquote><font size="2">To run your bot you need your .dll (mybot.dll), Commands.txt, MERVBot.exe,
 
MERVBot.ini, Operators.txt, Spawns.txt, subspace.bin, and zlib.dll all in
 
one folder (example c:program filescontinuummervbot)<br />
 
                    </font></blockquote>
 
<font size="2">&nbsp;</font><blockquote>
 
<font size="2">    Edit spawns.txt (only one line of text in file needed)<br />
 
  
   
+
<div align="left">This section describes how to implement player commands into MERVBot <br />
                      </font><blockquote><font size="2">bot_name : pw_for_bot_name : arena: dll_plugin : optional_staff_password<br />
+
(example: if you want /!test to make the bot respond with &quot;hi&quot;)<br />
                        </font><blockquote>
+
<br />
<font size="2">Example: 2v2-Bot-League : botpw: 2v2a: 2v2league : staffpw<br />
+
In command.cpp<br />
                          <br />
+
<pre>
- You should create your bot name and pw using your Continuum client as you would create any new name. <br />
+
void botInfo::gotCommand(Player *p, Command *c) {
                          <br />
+
switch (p->access) {
- There is no * in front of staffpw. <br />
+
case OP_Player:
                          <br />
+
{
- Bot needs to be on vip.txt or have moderator+ access to enter a zone.<br />
+
if (c->check("test"))
 
+
{
      </font></blockquote>
+
sendPrivate(p,"hi");
<font size="2">&nbsp;</font></blockquote>
+
}
 +
}
 +
</pre>
 +
You just put your player command where 'test' is, then what you want that command to do.<br />
 +
If you want the command to be for moderators you put it in the OP_Moderator section instead:
 +
<pre>
 +
case OP_Moderator:
 +
{ // Moderator-level commands
 +
}
 +
// Note: Moderators can do Player commands, SuperModerator can do Moderator and Player commands, etc.
 +
</pre>
  
<font size="2">Edit MERVBot.ini<br />
+
===How to have commands with numerical input - (ie !test 1)===
 +
<pre>
 +
if (c->check("test")) { // reads in test #, default to 1 if invalid number input
 +
int temp = 1;
  
     
+
if (isNumeric(c->final))
                          </font><blockquote><font size="2">[Login]<br />
+
temp = atoi(c->final);
Zone=216.33.98.254:21000 &nbsp; &nbsp;// make that your zone IP:PORT available from zone.dat in Continuum dir<br />
+
</pre>
        </font></blockquote>
 
  
<font size="2">       
+
===How to have player name as input - (ie !rank player)===
        Edit operators.txt<br />
+
<pre>
                            </font><blockquote>
+
if (c-&gt;check(&quot;rank&quot;)) {
<font size="2">          access_level : name :<br />
 
  
           
+
String player_name = c-&gt;final;
                              </font><blockquote><font size="2">Example: &nbsp; <br />
 
  
4:my_name:<br />
+
if (player_name.IsEmpty())&nbsp;&nbsp; &nbsp;// default name to self if invalid name
 +
player_name = p-&gt;name;
 +
</pre>
  
4:another_sysop:<br />
+
===How to have complicated input - (ie !squads squadA vs squadB _OR_ !squads teamA:squadA:teamB:squadB)===
  
3:other_person:<br />
+
You parse the c-&gt;final message looking for identifiers, then divide the string to get the values<br />
 
+
<pre>
              </font></blockquote>
+
&nbsp;else if (c-&gt;check(&quot;squads&quot;))<br />
<font size="2">&nbsp;</font><blockquote><font size="2">&nbsp;</font></blockquote>
+
&nbsp;{<br />
 
+
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadA, &quot;&quot;, 20);<br />
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadB, &quot;&quot;, 20);<br />
 
 
<font size="2">          Run MERVBot.exe<br />
 
                                  </font><blockquote>
 
<font size="2">                Double click MERVBot.exe, the bot should now enter the zone<br />
 
                                    </font></blockquote>
 
<font size="2">&nbsp;</font></blockquote>
 
<font size="2">&nbsp;</font></blockquote>
 
<font size="2">&nbsp;</font><blockquote>
 
<font size="2">&nbsp;</font><blockquote><font size="2">Modify your MERVBot code<br />
 
                                        </font><blockquote><font size="2">You can open your MERVBot project by opening &quot;mybot.dsw&quot; file with visual c++<br />
 
(example c:program filescontinuummervbotsrcmybotmybot.dsw)<br />
 
                                          <br />
 
Edit the spawn.h, spawn.cpp, and command.cpp to create your bot, then build,
 
copy your updated dll to your MERVBot.exe folder and then execute the bot.<br />
 
                                          <br />
 
Use the tutorial to get ideas on how to implement certain types of features into the bot.<br />
 
                                          </font></blockquote>
 
<font size="2">&nbsp;</font></blockquote>
 
<font size="2">&nbsp;</font></blockquote>
 
<font size="2"><br />
 
<a name="1"></a>
 
<b>[1] Player Commands - (command.cpp)</b><br />
 
  </font><blockquote>
 
<font size="2">&nbsp;</font><div align="left"><font size="2">This section describes how to implement player commands into MERVBot <br />
 
(example: if you want /!test to make the bot respond with &quot;hi&quot;)<br />
 
                                            <br />
 
In command.cpp<br />
 
    </font><blockquote><font size="2">void botInfo::gotCommand(Player *p, Command *c) {<br />
 
&nbsp;&nbsp; &nbsp;switch (p-&gt;access) {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case OP_Player:<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (c-&gt;check(&quot;test&quot;))<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,&quot;hi&quot;);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
      </font></blockquote>
 
<font size="2">You just put your player command where 'test' is, then what you want that command to do.<br />
 
If you want the command to be for moderators you put it in the OP_Moderator section instead<br />
 
      </font><blockquote><font size="2">case OP_Moderator:<br />
 
{&nbsp;&nbsp; &nbsp;// Moderator-level commands<br />
 
}<br />
 
        </font></blockquote>
 
<font size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Note: Moderators
 
can do Player commands, SuperModerator can do Moderator and Player commands,
 
etc<br />
 
        <br />
 
How to have commands with numerical input - (ie !test 1)<br />
 
        </font><blockquote><font size="2">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (c-&gt;check(&quot;test&quot;)) { // reads in test #, default to 1 if invalid number input<br />
 
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int temp = 1;<br />
 
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (isNumeric(c-&gt;final))<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;temp = atoi(c-&gt;final);<br />
 
          </font></blockquote>
 
<font size="2">          <br />
 
How to have player name as input - (ie !rank player)<br />
 
          </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;if (c-&gt;check(&quot;rank&quot;)) {<br />
 
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String player_name = c-&gt;final;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;char s[256];<br />
 +
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(s,c-&gt;final,255);<br />
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (player_name.IsEmpty())&nbsp;&nbsp; &nbsp;// default name to self if invalid name<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;int l= strlen(s) - 1;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;player_name = p-&gt;name;<br />
 
            </font></blockquote>
 
<font size="2">            <br />
 
How to have complicated input - (ie !squads squadA vs squadB _OR_ !squads teamA:squadA:teamB:squadB)<br />
 
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;you parse the c-&gt;final message
+
&nbsp;&nbsp;&nbsp; &nbsp;for (int i=0; i&lt;l; i++)<br />
looking for identifiers, then divide the string to get the values<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;{<br />
            <br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// team1 vs team2<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;else if (c-&gt;check(&quot;squads&quot;))<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadA, &quot;&quot;, 20);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadB, &quot;&quot;, 20);<br />
 
            <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char s[256];<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strncpy(s,c-&gt;final,255);<br />
 
            <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int l= strlen(s) - 1;<br />
 
            <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for (int i=0; i&lt;l; i++)<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// team1 vs team2<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
 
&nbsp;if ((s[i]==' ') &amp;&amp; (s[i+1]=='v') &amp;&amp; (s[i+2]=='s') &amp;&amp;
 
&nbsp;if ((s[i]==' ') &amp;&amp; (s[i+1]=='v') &amp;&amp; (s[i+2]=='s') &amp;&amp;
 
(s[i+3]==' '))<br />
 
(s[i+3]==' '))<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; s[i]=0;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; s[i]=0;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; strncpy(squadA, s,20);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; strncpy(squadA, s,20);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; s[i]=' ';<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; s[i]=' ';<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp; strncpy(squadB, &amp;(s[i+4]),20);<br />
 
&nbsp;&nbsp; strncpy(squadB, &amp;(s[i+4]),20);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; break;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; break;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// freq1:team1:freq2:team2<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// freq1:team1:freq2:team2<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (s[i] == ':')<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (s[i] == ':')<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char s2[256];<br />
+
&nbsp;&nbsp;char s2[256];<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;teamA = atoi(s);<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;teamA = atoi(s);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(s2,&amp;(s[i+1]),255);<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(s2,&amp;(s[i+1]),255);<br />
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;for (int j=0; j &lt; strlen(s2); j++)<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;for (int j=0; j &lt; strlen(s2); j++)<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (s2[j] == ':')<br />
+
&nbsp;if (s2[j] == ':')<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
+
&nbsp;{<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char s3[256];<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;char s3[256];<br />
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s2[j]=0;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;s2[j]=0;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadA,s2,20);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadA,s2,20);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s2[j]=':';<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;s2[j]=':';<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;strncpy(s3,&amp;(s2[j+1]),255);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(s3,&amp;(s2[j+1]),255);<br />
 
             <br />
 
             <br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for (int k=0;
+
&nbsp;&nbsp;&nbsp; &nbsp;for (int k=0;
 
k&lt;strlen(s3); k++)<br />
 
k&lt;strlen(s3); k++)<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;if (s3[k]==':')<br />
 
&nbsp;if (s3[k]==':')<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;teamB = atoi(s3);<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;teamB = atoi(s3);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadB,&amp;(s3[k+1]),20);<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;strncpy(squadB,&amp;(s3[k+1]),20);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;break;<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;break;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;}<br />
 
&nbsp;}<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 +
&nbsp;&nbsp;&nbsp; &nbsp;break;<br />
 +
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 +
&nbsp;}<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp; }<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
+
</pre>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }<br />
+
             </div>
             </font></div>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;<blockquote>// Example of a help menu (!help) spawn.h<br />
<font size="2">&nbsp;</font><blockquote><font size="2">// Example of a help menu (!help) spawn.h<br />
+
                                 <blockquote>void botInfo::gotHelp(Player *p, Command *c)<br />
                                 </font><blockquote><font size="2">void botInfo::gotHelp(Player *p, Command *c)<br />
 
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; if (!*c-&gt;final)<br />
 
&nbsp;&nbsp;&nbsp; if (!*c-&gt;final)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;4v4 Bot General Commands:&quot;);<br />
+
sendPrivate(p, &quot;4v4 Bot General Commands:&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;------------------------&quot;);<br />
+
sendPrivate(p, &quot;------------------------&quot;);<br />
 
         &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;!caps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
         &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;!caps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
     - get captain names&quot;);<br />
 
     - get captain names&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;!roster &lt;squad&gt;&nbsp;&nbsp;&nbsp;&nbsp; - get roster of a squad&quot;);<br />
+
sendPrivate(p, &quot;!roster &lt;squad&gt;&nbsp;&nbsp;&nbsp;&nbsp; - get roster of a squad&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;!schedule&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+
sendPrivate(p, &quot;!schedule&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
- get current schedule&quot;);<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sendPrivate(p,
 
- get current schedule&quot;);<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sendPrivate(p,
 
&quot;!score&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
 
&quot;!score&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
 
- get current score&quot;);<br />
 
- get current score&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
                                   </font></blockquote>
+
                                   </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2"><a name="2"></a>
+
 
<b>[2] Event Call Descriptions - in spawn.cpp</b><br />
+
==Event Call Descriptions - in spawn.cpp==
             </font><blockquote><font size="2">MERVBot is event based, so when making a bot you need to decide what will happen at certain events<br />
+
             <blockquote>MERVBot is event based, so when making a bot you need to decide what will happen at certain events<br />
 
Normal plugins need to consider what happens when bot enters arena, player enters arena, player leaves arena, <br />
 
Normal plugins need to consider what happens when bot enters arena, player enters arena, player leaves arena, <br />
 
player events like kill, shipchange, teamchange, spec, move then any other relevent events to your bot<br />
 
player events like kill, shipchange, teamchange, spec, move then any other relevent events to your bot<br />
Line 522: Line 428:
  
 
case EVENT_Term:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- called when DLL is unloaded<br />
 
case EVENT_Term:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- called when DLL is unloaded<br />
               </font></blockquote>
+
               </blockquote>
<font size="2">              <br />
+
              <br />
 
               <a name="3"></a>
 
               <a name="3"></a>
<b>[3] Messaging - How to use the messaging system</b><br />
+
==Messaging - How to use the messaging system==
 
                
 
                
                                                           </font><blockquote><font size="2">Private message - void sendPrivate(Player *player, char *msg);<br />
+
                                                           <blockquote>Private message - void sendPrivate(Player *player, char *msg);<br />
                 </font><blockquote><font size="2">Examples:<br />
+
                 <blockquote>Examples:<br />
 
a) sendPrivate(p,&quot;hi&quot;);<br />
 
a) sendPrivate(p,&quot;hi&quot;);<br />
 
b) String s=&quot;test&quot;; sendPrivate(p,s);<br />
 
b) String s=&quot;test&quot;; sendPrivate(p,s);<br />
 
c) String s=&quot;test&quot;; s += &quot;ing&quot;; sendPrivate(p,s);<br />
 
c) String s=&quot;test&quot;; s += &quot;ing&quot;; sendPrivate(p,s);<br />
                   </font></blockquote>
+
                   </blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">d) char captain1[20]; char captain2[20];<br />
+
&nbsp;<blockquote>d) char captain1[20]; char captain2[20];<br />
 
strncpy(captain1,&quot;&quot;,20); strncpy(captain2,&quot;&quot;,20);<br />
 
strncpy(captain1,&quot;&quot;,20); strncpy(captain2,&quot;&quot;,20);<br />
 
sendPrivate(p,(String) captain1 + &quot; and &quot; + (String) captain2 + &quot; are the captains.&quot;);<br />
 
sendPrivate(p,(String) captain1 + &quot; and &quot; + (String) captain2 + &quot; are the captains.&quot;);<br />
                     </font></blockquote>
+
                     </blockquote>
<font size="2">&nbsp;</font><blockquote>
+
&nbsp;<blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
  
<font size="2">&nbsp;</font><blockquote><font size="2">Team message - void sendTeamPrivate(Uint16 team, char *msg);<br />
+
&nbsp;<blockquote>Team message - void sendTeamPrivate(Uint16 team, char *msg);<br />
                           </font><blockquote><font size="2">Examples: <br />
+
                           <blockquote>Examples: <br />
 
a) sendTeamPrivate(8025,&quot;hi spec freq&quot;);<br />
 
a) sendTeamPrivate(8025,&quot;hi spec freq&quot;);<br />
 
b) Uint16 test=0; sendTeamPrivate(test,&quot;hi freq 0&quot;);<br />
 
b) Uint16 test=0; sendTeamPrivate(test,&quot;hi freq 0&quot;);<br />
                             </font></blockquote>
+
                             </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">Public message - void sendPublic(char *msg);<br />
+
&nbsp;<blockquote>Public message - void sendPublic(char *msg);<br />
                               </font><blockquote><font size="2">Example: sendPublic(&quot;*arena &quot; + (String) p-&gt;name + &quot; is now a captain&quot;);<br />
+
                               <blockquote>Example: sendPublic(&quot;*arena &quot; + (String) p-&gt;name + &quot; is now a captain&quot;);<br />
                                 </font></blockquote>
+
                                 </blockquote>
<font size="2">Chat channel message - void sendChannel(char *msg);<br />
+
Chat channel message - void sendChannel(char *msg);<br />
                                 </font><blockquote><font size="2">Example: sendChannel(&quot;hi chat channel&quot;);<br />
+
                                 <blockquote>Example: sendChannel(&quot;hi chat channel&quot;);<br />
                                   </font></blockquote>
+
                                   </blockquote>
<font size="2">Remote private message - void sendRemotePrivate(char *name, char *msg);<br />
+
Remote private message - void sendRemotePrivate(char *name, char *msg);<br />
                                   </font><blockquote><font size="2">Example: sendRemotePrivate(&quot;Player01&quot;, &quot;hi&quot;);<br />
+
                                   <blockquote>Example: sendRemotePrivate(&quot;Player01&quot;, &quot;hi&quot;);<br />
                                     </font></blockquote>
+
                                     </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">Note: to have bot print several lines of text fast it needs sysop in the
+
&nbsp;<blockquote>Note: to have bot print several lines of text fast it needs sysop in the
 
arena (sysop in arena bot first spawns to also) otherwise it'll print slow to avoid being
 
arena (sysop in arena bot first spawns to also) otherwise it'll print slow to avoid being
 
kicked for spam<br />
 
kicked for spam<br />
                                                             </font></blockquote>
+
                                                             </blockquote>
  
<font size="2">                                    <br />
+
                                    <br />
 
                                     <a name="4"></a>
 
                                     <a name="4"></a>
<b>[4] Timer - How to use the timing function</b><br />
+
==Timer - How to use the timing function==
 
                                      
 
                                      
                                                     </font><blockquote><font size="2">Setup number of timers and initialize:<br />
+
                                                     <blockquote>Setup number of timers and initialize:<br />
                                       </font><blockquote><font size="2">// spawn.h - specify how many timers<br />
+
                                       <blockquote>// spawn.h - specify how many timers<br />
                                         </font></blockquote>
+
                                         </blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">class botInfo<br />
+
&nbsp;<blockquote>class botInfo<br />
 
{<br />
 
{<br />
int countdown[10];&nbsp;&nbsp; // this gives you 10 timers</font></blockquote>
+
int countdown[10];&nbsp;&nbsp; // this gives you 10 timers</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">&nbsp;// spawn.h - initialize timers<br />
+
&nbsp;<blockquote>&nbsp;// spawn.h - initialize timers<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;public:<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;public:<br />
Line 582: Line 488:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;countdown[9] = 5*60; // 5 minutes<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;countdown[9] = 5*60; // 5 minutes<br />
                                             </font></blockquote>
+
                                             </blockquote>
<font size="2">                                            Using timer functions:<br />
+
                                            Using timer functions:<br />
                                             </font><blockquote><font size="2">&nbsp;&nbsp; // in spawn.cpp<br />
+
                                             <blockquote>&nbsp;&nbsp; // in spawn.cpp<br />
 
                                               <br />
 
                                               <br />
 
&nbsp;&nbsp; &nbsp;case EVENT_Tick:<br />
 
&nbsp;&nbsp; &nbsp;case EVENT_Tick:<br />
Line 597: Line 503:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// example: countdown[1] = 60;&nbsp; // change timer #1 value<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// example: countdown[1] = 60;&nbsp; // change timer #1 value<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
                                               </font></blockquote>
+
                                               </blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;Notes:&nbsp; - In the &quot;for&quot; loop, you want &quot;i &lt; 10&quot; to be the number of timers from spawn.h<br />
+
&nbsp;
 +
<blockquote>&nbsp;&nbsp; &nbsp;Notes:&nbsp; - In the &quot;for&quot; loop, you want &quot;i &lt; 10&quot; to be the number of timers from spawn.h<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- The timer is in seconds. EVENT_Tick is called once per second.<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- The timer is in seconds. EVENT_Tick is called once per second.<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- The timers decrease by one each second down, not stopping at 0.<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;- The timers decrease by one each second down, not stopping at 0.<br />
Line 605: Line 512:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(ie.&nbsp; case EVENT_PlayerDeath: { countdown[1] = 45;&nbsp; // set timer #1 to 45 sec<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(ie.&nbsp; case EVENT_PlayerDeath: { countdown[1] = 45;&nbsp; // set timer #1 to 45 sec<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;everytime someone dies)<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;everytime someone dies)<br />
                                                 </font></blockquote>
+
                                                 </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
  
<font size="2">                                              <br />
+
                                              <br />
 
                                                 <a name="5"></a>
 
                                                 <a name="5"></a>
<b>[5] Writing Functions</b><br />
+
==Writing Functions==
                                                </font><blockquote><blockquote><font size="2">Write your function in spawn.cpp at top of file in the //////// DLL &quot;import&quot; //////// section
+
<blockquote>
                                                     </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;//////// DLL &quot;import&quot; ////////<br />
+
<blockquote>Write your function in spawn.cpp at top of file in the //////// DLL &quot;import&quot; //////// section
                                                                                <br />
+
                                                     <blockquote>&nbsp;&nbsp; &nbsp;//////// DLL &quot;import&quot; ////////<br />
 +
          <br />
  
 
&nbsp;&nbsp; &nbsp;bool closeto(Player *p, int x, int y, int tolerance)&nbsp; // note uses abs() function declared elsewhere<br />
 
&nbsp;&nbsp; &nbsp;bool closeto(Player *p, int x, int y, int tolerance)&nbsp; // note uses abs() function declared elsewhere<br />
Line 625: Line 533:
 
                                                          
 
                                                          
 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }<br />
 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }<br />
</font></blockquote><font size="2">                                                        If
+
</blockquote>                                                        If
 
you want your function to have access to data from the spawn.h botInfo section<br />
 
you want your function to have access to data from the spawn.h botInfo section<br />
                                                         </font><blockquote><font size="2">public:<br />
+
                                                         <blockquote>public:<br />
 
&nbsp;&nbsp; &nbsp;botInfo(CALL_HANDLE given)<br />
 
&nbsp;&nbsp; &nbsp;botInfo(CALL_HANDLE given)<br />
 
&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;{<br />
Line 637: Line 545:
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // function here<br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // function here<br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />
                                                                                <br />
+
          <br />
 
Include function in spawn.h at bottom of file with the other functions<br />
 
Include function in spawn.h at bottom of file with the other functions<br />
                                                                                </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;public:<br />
+
          <blockquote>&nbsp;&nbsp; &nbsp;public:<br />
  
 
&nbsp;&nbsp; &nbsp;botInfo(CALL_HANDLE given)<br />
 
&nbsp;&nbsp; &nbsp;botInfo(CALL_HANDLE given)<br />
Line 646: Line 554:
  
 
&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;}<br />
                                                                                  <br />
+
            <br />
  
 
&nbsp;&nbsp; &nbsp;bool closeto(Player *p, int x, int y, int tolerance); <br />
 
&nbsp;&nbsp; &nbsp;bool closeto(Player *p, int x, int y, int tolerance); <br />
 
&nbsp; &nbsp; &nbsp;// your new function. note: w/o botInfo keyword and with a ;<br />
 
&nbsp; &nbsp; &nbsp;// your new function. note: w/o botInfo keyword and with a ;<br />
                                                                                  <br />
+
            <br />
  
 
&nbsp;&nbsp; &nbsp;void clear_objects();&nbsp; // functions already there<br />
 
&nbsp;&nbsp; &nbsp;void clear_objects();&nbsp; // functions already there<br />
  
&nbsp;&nbsp; &nbsp;void object_target(Player *p); // functions already there</font></blockquote>
+
&nbsp;&nbsp; &nbsp;void object_target(Player *p); // functions already there</blockquote>
  
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">Pass values by reference
+
&nbsp;<blockquote>Pass values by reference
                                                                                    </font><blockquote><font size="2">bool botInfo::closeto(Player *p, int&amp; x, int y, int tolerance) &nbsp;// note the &amp;<br />
+
              <blockquote>bool botInfo::closeto(Player *p, int&amp; x, int y, int tolerance) &nbsp;// note the &amp;<br />
                                                                                      <br />
+
                <br />
 
bool is_close = closeto(p,x,y,tolerance); &nbsp;// if x is changed in closeto() its saved here <br />
 
bool is_close = closeto(p,x,y,tolerance); &nbsp;// if x is changed in closeto() its saved here <br />
                                                                                      </font></blockquote>
+
                </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
  
<font size="2">&nbsp;</font><blockquote><font size="2">Pass array as parameter<br />
+
&nbsp;<blockquote>Pass array as parameter<br />
                                                                                        </font><blockquote><font size="2">int freqs[5];<br />
+
                  <blockquote>int freqs[5];<br />
                                                                                          <br />
+
                    <br />
 
my_function(freqs); &nbsp;// call function - notice freqs and not freqs[5] or freqs[]<br />
 
my_function(freqs); &nbsp;// call function - notice freqs and not freqs[5] or freqs[]<br />
                                                                                          <br />
+
                    <br />
 
void my_function(int freqs[]) {} &nbsp;// function - notice freqs[] and not freqs[5] or freqs<br />
 
void my_function(int freqs[]) {} &nbsp;// function - notice freqs[] and not freqs[5] or freqs<br />
                                                                                          </font></blockquote>
+
                    </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2"><a name="6"></a>
+
<a name="6"></a>
<b>[6] Cycling players- How to search through the players in the arena</b><br />
+
==Cycling players- How to search through the players in the arena==
                                                           </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
+
                                                           <blockquote>&nbsp;&nbsp; &nbsp;_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;while (parse)<br />
 
&nbsp;&nbsp; &nbsp;while (parse)<br />
Line 688: Line 596:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;parse = parse-&gt;next<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;parse = parse-&gt;next<br />
 
&nbsp;&nbsp;&nbsp; &nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; &nbsp; }<br />
                                                             </font></blockquote>
+
                                                             </blockquote>
<font size="2">                                                            <br />
+
                                                            <br />
                                                            <a name="7"></a><b>
+
 
[7] Checking if pilot is in a safe zone</b><br />
+
==Checking if pilot is in a safe zone==
                                                             </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;if (p-&gt;safety != 0)&nbsp; // pilot is in a safe zone<br />
+
                                                             <blockquote>&nbsp;&nbsp; &nbsp;if (p-&gt;safety != 0)&nbsp; // pilot is in a safe zone<br />
 
&nbsp;&nbsp; &nbsp;if (p-&gt;safety == 0)&nbsp; // pilot is NOT in a safe zone<br />
 
&nbsp;&nbsp; &nbsp;if (p-&gt;safety == 0)&nbsp; // pilot is NOT in a safe zone<br />
 
                                                               <br />
 
                                                               <br />
Line 700: Line 608:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (p-&gt;safety != 0)<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (p-&gt;safety != 0)<br />
                                                               </font></blockquote><font size="2"><br />
+
                                                               </blockquote><br />
                                                              <a name="8"></a>
+
 
<b>[8] Random number </b><br />
+
==Random number==
                                                               </font><blockquote><font size="2">Method 1 (completely random)<br />
+
                                                               <blockquote>Method 1 (completely random)<br />
                                                                 </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;#include &quot;time.h&quot;<br />
+
                                                                 <blockquote>&nbsp;&nbsp; &nbsp;#include &quot;time.h&quot;<br />
 
                                                                   <br />
 
                                                                   <br />
 
&nbsp;&nbsp; &nbsp;srand(time(NULL));<br />
 
&nbsp;&nbsp; &nbsp;srand(time(NULL));<br />
 
&nbsp;&nbsp; &nbsp;rand();<br />
 
&nbsp;&nbsp; &nbsp;rand();<br />
 
&nbsp;&nbsp; &nbsp;int temp = (int) (51 * ((float)rand()/RAND_MAX));&nbsp; // returns a random integer between 0 and 51<br />
 
&nbsp;&nbsp; &nbsp;int temp = (int) (51 * ((float)rand()/RAND_MAX));&nbsp; // returns a random integer between 0 and 51<br />
                                                                   </font></blockquote>
+
                                                                   </blockquote>
<font size="2">                                                                  <br />
+
                                                                  <br />
 
Method 2 (random pilot in arena)<br />
 
Method 2 (random pilot in arena)<br />
                                                                   </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;#include &lt;stdlib.h&gt;<br />
+
                                                                   <blockquote>&nbsp;&nbsp; &nbsp;#include &lt;stdlib.h&gt;<br />
 
                                                                     <br />
 
                                                                     <br />
 
&nbsp;&nbsp; &nbsp;int temp = GetTickCount() % getIngame();&nbsp; // getIngame() = how many pilots in arena<br />
 
&nbsp;&nbsp; &nbsp;int temp = GetTickCount() % getIngame();&nbsp; // getIngame() = how many pilots in arena<br />
Line 728: Line 636:
 
&nbsp;&nbsp; &nbsp;parse = parse-&gt;next;<br />
 
&nbsp;&nbsp; &nbsp;parse = parse-&gt;next;<br />
 
&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;}<br />
                                                                     </font></blockquote>
+
                                                                     </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">                                                                    <br />
+
                                                                    <br />
 
                                                                     <a name="9"></a>
 
                                                                     <a name="9"></a>
<b>[9] Tracking time not using countdown[n] </b><br />
+
==Tracking time not using countdown[n]==
                                                                     </font><blockquote><font size="2">&nbsp;&nbsp; &nbsp;#include &lt;stdlib.h&gt;<br />
+
                                                                     <blockquote>&nbsp;&nbsp; &nbsp;#include &lt;stdlib.h&gt;<br />
                                                                      <br />
+
<br />
 
&nbsp;&nbsp; &nbsp;int temp = GetTickCount(); // get time stamp<br />
 
&nbsp;&nbsp; &nbsp;int temp = GetTickCount(); // get time stamp<br />
 
&nbsp;&nbsp; &nbsp;// later in program<br />
 
&nbsp;&nbsp; &nbsp;// later in program<br />
 
&nbsp;&nbsp; &nbsp;temp = (GetTickCount() - temp)/1000; // how many seconds have passed<br />
 
&nbsp;&nbsp; &nbsp;temp = (GetTickCount() - temp)/1000; // how many seconds have passed<br />
                                                                      </font></blockquote>
+
</blockquote>
<font size="2">                                                                    <br />
+
                                                                    <br />
                                                                      <a name="10"></a><b>
+
 
[10] Storing data for pilots</b><br />
+
==Storing data for pilots==
                                                                      </font><blockquote><font size="2">There are several ways to store data for pilots (ie tracking flagtime or kills in a period of time)<br />
+
<blockquote>There are several ways to store data for pilots (ie tracking flagtime or kills in a period of time)<br />
                                                                                                        <br />
+
                                  <br />
 
1) get/setTag - use if you only want to track data until pilot leaves arena then its erased<br />
 
1) get/setTag - use if you only want to track data until pilot leaves arena then its erased<br />
 
built in tags track by an ID that is reset when pilot leaves/enters arena, so loses track of data once they leave arena<br />
 
built in tags track by an ID that is reset when pilot leaves/enters arena, so loses track of data once they leave arena<br />
                                                                                                        <br />
+
                                  <br />
 
2) modified perm get/setTag - use if you want to track all pilots even if they leave (advantage - easier to sort by player)<br />
 
2) modified perm get/setTag - use if you want to track all pilots even if they leave (advantage - easier to sort by player)<br />
 
also can track near unlimited amount of pilots<br />
 
also can track near unlimited amount of pilots<br />
                                                                                                        <br />
+
                                  <br />
 
3) structs - use to track all pilots even if they leave, (advantage -
 
3) structs - use to track all pilots even if they leave, (advantage -
 
easier to sort by freqs), have to specify bound of players<br />
 
easier to sort by freqs), have to specify bound of players<br />
                                                                                                        <br />
+
                                  <br />
 
note: 2 and 3 are similar in effect, mostly the difference is in how you are able to search through data<br />
 
note: 2 and 3 are similar in effect, mostly the difference is in how you are able to search through data<br />
 
you need to decide which method of storing data is best for each bot depending on what it does<br />
 
you need to decide which method of storing data is best for each bot depending on what it does<br />
 
beware using modified perm get/setTag if bot is in an arena for long periods
 
beware using modified perm get/setTag if bot is in an arena for long periods
 
of time, data is not reset so the linkedlist could get huge<br />
 
of time, data is not reset so the linkedlist could get huge<br />
                                                                                                        <br />
+
                                  <br />
  
 
// initialize values in spawn.h at very top<br />
 
// initialize values in spawn.h at very top<br />
                                                                                                        <br />
+
                                  <br />
1) Built in get/setTag method</font></blockquote><blockquote><blockquote><font size="2">&nbsp;&nbsp; &nbsp;#define DMG_DEALT&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;0<br />
+
1) Built in get/setTag method</blockquote><blockquote><blockquote>&nbsp;&nbsp; &nbsp;#define DMG_DEALT&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;0<br />
 
&nbsp;&nbsp; &nbsp;#define DMG_TAKEN&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;1<br />
 
&nbsp;&nbsp; &nbsp;#define DMG_TAKEN&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;1<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;// in spawn.cpp initialize the values on arena-enter and player-enter<br />
 
&nbsp;&nbsp; &nbsp;// in spawn.cpp initialize the values on arena-enter and player-enter<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_ArenaEnter: {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_ArenaEnter: {<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;while (parse) // do for all pilots in arena when bot enters<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;while (parse) // do for all pilots in arena when bot enters<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Player *p = parse-&gt;item;&nbsp; // get pilot<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Player *p = parse-&gt;item;&nbsp; // get pilot<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_DEALT, 0); // initialize to 0<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_DEALT, 0); // initialize to 0<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_TAKEN, 0);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_TAKEN, 0);<br />
Line 779: Line 687:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,&quot;*watchdamage&quot;);&nbsp;
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,&quot;*watchdamage&quot;);&nbsp;
 
// optionally turn on player *watchdamage<br />
 
// optionally turn on player *watchdamage<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;parse = parse-&gt;next;&nbsp; // get next pilot<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;parse = parse-&gt;next;&nbsp; // get next pilot<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_PlayerEntering: {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_PlayerEntering: {<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_DEALT, 0); // initialize to 0<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_DEALT, 0); // initialize to 0<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_TAKEN, 0);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(p, DMG_TAKEN, 0);<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,&quot;*watchdamage&quot;);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,&quot;*watchdamage&quot;);<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;// then somewhere edit the tag values<br />
 
&nbsp;&nbsp; &nbsp;// then somewhere edit the tag values<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_WatchDamage:&nbsp; {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_WatchDamage:&nbsp; {<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// sets tag for k (shooter) to be old value plus damage dealt currently<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// sets tag for k (shooter) to be old value plus damage dealt currently<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT) + damage);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT) + damage);<br />
                                                                            <br />
+
      <br />
 
&nbsp;// how to retrieve the tag values<br />
 
&nbsp;// how to retrieve the tag values<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// as a command in spawn.h<br />
 
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// as a command in spawn.h<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;else if (c-&gt;check(&quot;showstats&quot;)) {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;else if (c-&gt;check(&quot;showstats&quot;)) {<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int temp = get_tag(p, DMG_TOTAL_DEALT);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;int temp = get_tag(p, DMG_TOTAL_DEALT);<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String s = &quot;You've done &quot;;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String s = &quot;You've done &quot;;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s += temp;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s += temp;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s += &quot; damage so far!&quot;;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;s += &quot; damage so far!&quot;;<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,s);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPrivate(p,s);<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;// kill tags when player leaves arena<br />
 
&nbsp;&nbsp; &nbsp;// kill tags when player leaves arena<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_PlayerLeaving: {<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case EVENT_PlayerLeaving: {<br />
                                                                            <br />
+
      <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;killTags(p);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;killTags(p);<br />
                                                                            </font></blockquote><font size="2">2) Modified permanent get/setTag method<br />
+
      </blockquote>2) Modified permanent get/setTag method<br />
                                                                                                            </font><blockquote><font size="2">// same as get/setTag with some modifications to the tag code, then can use tags exactly as above<br />
+
      <blockquote>// same as get/setTag with some modifications to the tag code, then can use tags exactly as above<br />
                                                                                                              <br />
+
                                        <br />
 
// spawn.h, add char name[20]; into struct PlayerTag<br />
 
// spawn.h, add char name[20]; into struct PlayerTag<br />
                                                                                                              </font><blockquote><font size="2">struct PlayerTag<br />
+
                                        <blockquote>struct PlayerTag<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; Player *p;<br />
 
&nbsp;&nbsp;&nbsp; Player *p;<br />
Line 828: Line 736:
 
&nbsp;&nbsp;&nbsp; int data;<br />
 
&nbsp;&nbsp;&nbsp; int data;<br />
 
};<br />
 
};<br />
                                                                                                                </font></blockquote>
+
                                          </blockquote>
<font size="2">// spawn.cpp, modifications<br />
+
// spawn.cpp, modifications<br />
                                                                                                                </font><blockquote><font size="2">case EVENT_PlayerLeaving:<br />
+
                                          <blockquote>case EVENT_PlayerLeaving:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = (Player*)event.p[0];<br />
+
&nbsp;&nbsp;&nbsp; Player *p = (Player*)event.p[0];<br />
                                                                                                                  <br />
+
                                            <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // killTags(p); &nbsp;// remove so tag not deleted on arena exit<br />
+
&nbsp;&nbsp;&nbsp; // killTags(p); &nbsp;// remove so tag not deleted on arena exit<br />
                                                                                                                  <br />
+
                                            <br />
                                                                                                                  </font></blockquote>
+
                                            </blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">int botInfo::get_tag(Player *p, int index)<br />
+
&nbsp;<blockquote>int botInfo::get_tag(Player *p, int index)<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; _listnode &lt;PlayerTag&gt; *parse = taglist.head;<br />
 
&nbsp;&nbsp;&nbsp; _listnode &lt;PlayerTag&gt; *parse = taglist.head;<br />
 
&nbsp;&nbsp;&nbsp; PlayerTag *tag;<br />
 
&nbsp;&nbsp;&nbsp; PlayerTag *tag;<br />
                                                                                                                    <br />
+
                                              <br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; tag = parse-&gt;item;<br />
+
tag = parse-&gt;item;<br />
                                                                                                                    <br />
+
                                              <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // if (tag-&gt;p == p)<br />
+
// if (tag-&gt;p == p)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (strcmp(tag-&gt;name,p-&gt;name)==0) &nbsp;// now tracking by player name, not ID<br />
+
if (strcmp(tag-&gt;name,p-&gt;name)==0) &nbsp;// now tracking by player name, not ID<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tag-&gt;index == index)<br />
+
if (tag-&gt;index == index)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return tag-&gt;data;<br />
+
&nbsp;&nbsp;&nbsp; return tag-&gt;data;<br />
                                                                                                                    <br />
+
                                              <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
                                                                                                                    <br />
+
                                              <br />
 
&nbsp;&nbsp;&nbsp; return 0;<br />
 
&nbsp;&nbsp;&nbsp; return 0;<br />
 
}<br />
 
}<br />
                                                                                                                    <br />
+
                                              <br />
 
void botInfo::set_tag(Player *p, int index, int data)<br />
 
void botInfo::set_tag(Player *p, int index, int data)<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; _listnode &lt;PlayerTag&gt; *parse = taglist.head;<br />
 
&nbsp;&nbsp;&nbsp; _listnode &lt;PlayerTag&gt; *parse = taglist.head;<br />
 
&nbsp;&nbsp;&nbsp; PlayerTag *tag;<br />
 
&nbsp;&nbsp;&nbsp; PlayerTag *tag;<br />
                                                                                                                    <br />
+
                                              <br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; tag = parse-&gt;item;<br />
+
tag = parse-&gt;item;<br />
                                                                                                                    <br />
+
                                              <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //if (tag-&gt;p == p)<br />
+
//if (tag-&gt;p == p)<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; if (strcmp(tag-&gt;name,p-&gt;name)==0) // now tracking by player name, not ID<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; if (strcmp(tag-&gt;name,p-&gt;name)==0) // now tracking by player name, not ID<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (tag-&gt;index == index)<br />
+
if (tag-&gt;index == index)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; tag-&gt;data = data;<br />
+
&nbsp;&nbsp;&nbsp; tag-&gt;data = data;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br />
+
&nbsp;&nbsp;&nbsp; return;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
}<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
                                                                                                                    <br />
+
                                              <br />
 
&nbsp;&nbsp;&nbsp; tag = new PlayerTag;<br />
 
&nbsp;&nbsp;&nbsp; tag = new PlayerTag;<br />
 
&nbsp;&nbsp;&nbsp; // tag-&gt;p = p; // not tracking by ID anymore<br />
 
&nbsp;&nbsp;&nbsp; // tag-&gt;p = p; // not tracking by ID anymore<br />
Line 882: Line 790:
 
&nbsp;&nbsp;&nbsp; tag-&gt;data = data;<br />
 
&nbsp;&nbsp;&nbsp; tag-&gt;data = data;<br />
 
&nbsp;&nbsp;&nbsp; taglist.append(tag);<br />
 
&nbsp;&nbsp;&nbsp; taglist.append(tag);<br />
}</font></blockquote>
+
}</blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">3) Using Struct's<br />
+
3) Using Struct's<br />
                                                                            </font><blockquote><font size="2">struct name&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
+
      <blockquote>struct name&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                                                                              <br />
+
        <br />
  
 
&nbsp;&nbsp; &nbsp;// variables&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
 
&nbsp;&nbsp; &nbsp;// variables&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
  
 
&nbsp;&nbsp; &nbsp;};<br />
 
&nbsp;&nbsp; &nbsp;};<br />
                                                                              <br />
+
        <br />
 
// Example: (in spawn.h)<br />
 
// Example: (in spawn.h)<br />
                                                                              </font><blockquote><font size="2">class botInfo<br />
+
        <blockquote>class botInfo<br />
 
{<br />
 
{<br />
                                                                                <br />
+
          <br />
 
struct freqdata {<br />
 
struct freqdata {<br />
 
int kills;<br />
 
int kills;<br />
 
&nbsp;int deaths; <br />
 
&nbsp;int deaths; <br />
 
};<br />
 
};<br />
                                                                                <br />
+
          <br />
 
freqdata freqs[100]; // 100 of those structs<br />
 
freqdata freqs[100]; // 100 of those structs<br />
                                                                                <br />
+
          <br />
 
// then access it in spawn.cpp using<br />
 
// then access it in spawn.cpp using<br />
 
freqs[56].kills = 1;<br />
 
freqs[56].kills = 1;<br />
                                                                                </font></blockquote>
+
          </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">                                                                                <br />
+
          <br />
                                                                                </font></blockquote>
+
          </blockquote>
<font size="2">                                                                                <a name="11"></a>
+
 
<b>[11] Output of data/messages</b><br />
+
==Output of data/messages==
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;using normal Strings<br />
 
&nbsp;&nbsp; &nbsp;using normal Strings<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// does *arena X pilots left in the game.<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// does *arena X pilots left in the game.<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; String s = &quot;*arena &quot;;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; String s = &quot;*arena &quot;;<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; s += temp;&nbsp; // some variable (int)<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; s += temp;&nbsp; // some variable (int)<br />
Line 923: Line 831:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; sendPublic(s)<br />               
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; sendPublic(s)<br />               
 
                                                                          
 
                                                                          
                                                       </font><blockquote><font size="2">OR<br />  
+
                                                       <blockquote>OR<br />  
 
                                                                          
 
                                                                          
                                                                      </font></blockquote>
+
</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">sendPublic(&quot;*arena &quot; + (String) temp + &quot; pilots left in the game.&quot;);<br />
+
&nbsp;<blockquote>sendPublic(&quot;*arena &quot; + (String) temp + &quot; pilots left in the game.&quot;);<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
  </font></blockquote>
+
  </blockquote>
  
<font size="2">                                                                              <br />
+
        <br />
 
&nbsp;&nbsp; &nbsp;example using sprintf to align/space data<br />
 
&nbsp;&nbsp; &nbsp;example using sprintf to align/space data<br />
                                                                                <br />
+
          <br />
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// output data
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// output data
 
will be in this approximate format (not lined up perfectly because of html)<br />
 
will be in this approximate format (not lined up perfectly because of html)<br />
                                                                                <br />
+
          <br />
 
             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//
 
             &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//
 
----------------------------------------------------------------------------------------<br />
 
----------------------------------------------------------------------------------------<br />
Line 953: Line 861:
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9999&nbsp; &nbsp; 99999&nbsp; 5&nbsp;&nbsp;
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9999&nbsp; &nbsp; 99999&nbsp; 5&nbsp;&nbsp;
 
&nbsp; &nbsp;3&nbsp; &nbsp;&nbsp; 0:04<br />
 
&nbsp; &nbsp;3&nbsp; &nbsp;&nbsp; 0:04<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char str[255];<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char str[255];<br />
 
               &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(&quot;*arena----------------------------------------------------------------------------------&quot;);<br />
 
               &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(&quot;*arena----------------------------------------------------------------------------------&quot;);<br />
Line 961: Line 869:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(str);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(str);<br />
 
               &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(&quot;*arena----------------------------------------------------------------------------------&quot;);<br />
 
               &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(&quot;*arena----------------------------------------------------------------------------------&quot;);<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// assuming existing freqs struct with data<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// assuming existing freqs struct with data<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for (pilot=freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for (pilot=freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
Line 967: Line 875:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// on freq squad so print stats<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// on freq squad so print stats<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char outString[255];<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;char outString[255];<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sprintf(outString,
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sprintf(outString,
 
&quot;*arena %-20s %12d %8d %3d %3d %10d %6d %2d %3d %3d:%02d&quot;,freqs[freq].pilots[pilot].name,<br />
 
&quot;*arena %-20s %12d %8d %3d %3d %10d %6d %2d %3d %3d:%02d&quot;,freqs[freq].pilots[pilot].name,<br />
Line 974: Line 882:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;freqs[freq].pilots[pilot].deaths,
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;freqs[freq].pilots[pilot].deaths,
 
freqs[freq].pilots[pilot].dmgdealt, freqs[freq].pilots[pilot].dmgtaken,freqs[freq].pilots[pilot].flags,<br />
 
freqs[freq].pilots[pilot].dmgdealt, freqs[freq].pilots[pilot].dmgtaken,freqs[freq].pilots[pilot].flags,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;freqs[freq].pilots[pilot].flagkills, freqs[freq].pilots[pilot].flagtime
 
&nbsp;freqs[freq].pilots[pilot].flagkills, freqs[freq].pilots[pilot].flagtime
 
/60, freqs[freq].pilots[pilot].flagtime %60);<br />
 
/60, freqs[freq].pilots[pilot].flagtime %60);<br />
Line 980: Line 888:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(outString);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sendPublic(outString);<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />
                                                                                <br />
+
          <br />
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// Notes: sprintf
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// Notes: sprintf
 
format = sprintf(output char string, spacing, variables)<br />
 
format = sprintf(output char string, spacing, variables)<br />
Line 986: Line 894:
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// Notes: doing
 
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// Notes: doing
 
%02d = put 0 in front if not 2 digits, %3d:%02d makes 0:04 format<br />
 
%02d = put 0 in front if not 2 digits, %3d:%02d makes 0:04 format<br />
                                                                                <br />
+
          <br />
                                                                                <br />
+
          <br />
                                                                                <a name="12"></a>
+
          <a name="12"></a>
<b>[12] Input/Output to files </b><br />
+
==Input/Output to files==
                                                                                </font><blockquote><font size="2">Input to file<br />
+
         
                                                                                  </font><blockquote><font size="2">// example reading from duel.ini looking for line that starts with MaxBoxes= then taking the next char as value to store as <br />
+
<blockquote>Input to file<br />
 +
<blockquote>// example reading from duel.ini looking for line that starts with MaxBoxes= then taking the next char as value to store as <br />
 
// MAX_BOXES (ie duel.ini = MaxBoxes=5)<br />
 
// MAX_BOXES (ie duel.ini = MaxBoxes=5)<br />
 
#include &lt;fstream&gt;<br />
 
#include &lt;fstream&gt;<br />
 
using namespace std;<br />
 
using namespace std;<br />
                                                                                    <br />
+
              <br />
 
ifstream file(&quot;duel.ini&quot;);<br />
 
ifstream file(&quot;duel.ini&quot;);<br />
 
&nbsp;&nbsp;&nbsp; char line[256];<br />
 
&nbsp;&nbsp;&nbsp; char line[256];<br />
                                                                                    <br />
+
              <br />
 
&nbsp;&nbsp;&nbsp; // read in MaxBoxes=X<br />
 
&nbsp;&nbsp;&nbsp; // read in MaxBoxes=X<br />
 
&nbsp;&nbsp;&nbsp; while (file.getline(line, 256))<br />
 
&nbsp;&nbsp;&nbsp; while (file.getline(line, 256))<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (CMPSTART(&quot;MaxBoxes=&quot;, line))<br />
+
if (CMPSTART(&quot;MaxBoxes=&quot;, line))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MAX_BOXES = atoi(&amp;(line[9]));<br />
+
&nbsp;&nbsp;&nbsp; MAX_BOXES = atoi(&amp;(line[9]));<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br />
+
&nbsp;&nbsp;&nbsp; break;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
}<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
                                                                                    </font></blockquote>
+
              </blockquote>
<font size="2">Output to file<br />                                                     
+
Output to file<br />                                                     
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                     </font><blockquote><font size="2">// normal char output<br />
+
                                     <blockquote>// normal char output<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
       </font><blockquote><font size="2">#include &lt;fstream&gt;<br />
+
       <blockquote>#include &lt;fstream&gt;<br />
  
  
 
using namespace std;<br />
 
using namespace std;<br />
  
                                                                                      <br />
+
                <br />
  
 
ofstream file(&quot;duelleaguestat.inc&quot;, ios::app); &nbsp; // app = put all data at end of file<br />
 
ofstream file(&quot;duelleaguestat.inc&quot;, ios::app); &nbsp; // app = put all data at end of file<br />
  
                                                                                      <br />
+
                <br />
  
 
file &lt;&lt; squad1&lt;&lt; endl; &nbsp;// squad1 = char[20]<br />
 
file &lt;&lt; squad1&lt;&lt; endl; &nbsp;// squad1 = char[20]<br />
Line 1,033: Line 942:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
   </font></blockquote>
+
   </blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                       // how to output String's
 
                                                       // how to output String's
 
to file (key is converting String to (char*) to file write)<br />         
 
to file (key is converting String to (char*) to file write)<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
</font><blockquote>
+
<blockquote>
<font size="2">String str = freqs[freq].slotname[slot];<br />
+
String str = freqs[freq].slotname[slot];<br />
  
 
str += &quot;, Repels: &quot; + (String)(int) t-&gt;repel;<br />
 
str += &quot;, Repels: &quot; + (String)(int) t-&gt;repel;<br />
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; <br />
 
&nbsp;&nbsp;&nbsp; <br />
  
Line 1,052: Line 961:
 
outf &lt;&lt; (char*) str;<br />                                         
 
outf &lt;&lt; (char*) str;<br />                                         
 
                                                                          
 
                                                                          
                                           </font></blockquote>
+
                                           </blockquote>
  
<font size="2">                                                                                                                              <br />
+
                                                        <br />
 
// date and time stamp<br />                                             
 
// date and time stamp<br />                                             
 
                                                                          
 
                                                                          
                                       </font><blockquote><font size="2">#include &quot;time.h&quot;<br />
+
                                       <blockquote>#include &quot;time.h&quot;<br />
                                                                                                                                                            <br />
+
                                                                                      <br />
 
char u[100];<br />
 
char u[100];<br />
 
time_t t=time(NULL);<br />
 
time_t t=time(NULL);<br />
Line 1,066: Line 975:
  
 
                                                                                        
 
                                                                                        
                                                                                      </font></blockquote>
+
                </blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
 
</blockquote>
 
</blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">Example reading input from file using &quot;GetPrivateProfileString&quot; (from rampage plugin)<br />
+
&nbsp;<blockquote>Example reading input from file using &quot;GetPrivateProfileString&quot; (from rampage plugin)<br />
                                                                                                                        </font><blockquote><font size="2">format of rampage.ini<br />
+
                                                  <blockquote>format of rampage.ini<br />
                                                                                                                          </font><blockquote><font size="2">7=is on a killing spree! (6:0)<br />10=is opening a can of whoop-ass! (9:0)<br />
+
        <blockquote>7=is on a killing spree! (6:0)<br />10=is opening a can of whoop-ass! (9:0)<br />
                                                                                                                            </font></blockquote>
+
                                                      </blockquote>
<font size="2">read input<br />
+
read input<br />
                                                                                                                            </font><blockquote><font size="2">rampageini.h<br />
+
                                                      <blockquote>rampageini.h<br />
                                                                                                                              </font><blockquote><font size="2">#pragma once<br />
+
                                                        <blockquote>#pragma once<br />
 +
 
 
#ifndef RAMPAGEINI_H<br />
 
#ifndef RAMPAGEINI_H<br />
 
#define RAMPAGEINI_H<br />
 
#define RAMPAGEINI_H<br />
                                                                                                                                <br />
+
                                                          <br />
 
#define NUM_RANKS 10<br />
 
#define NUM_RANKS 10<br />
 
#define BUFFER_LEN 256<br />
 
#define BUFFER_LEN 256<br />
                                                                                                                                <br />
+
                                                          <br />
 
struct RampageSettings<br />
 
struct RampageSettings<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; char quotes[NUM_RANKS][BUFFER_LEN];<br />
 
&nbsp;&nbsp;&nbsp; char quotes[NUM_RANKS][BUFFER_LEN];<br />
 
};<br />
 
};<br />
                                                                                                                                <br />
+
                                                          <br />
 
void LoadSettings(RampageSettings &amp;setts);<br />
 
void LoadSettings(RampageSettings &amp;setts);<br />
                                                                                                                                <br />
+
                                                          <br />
 
#endif&nbsp;&nbsp;&nbsp; // RAMPAGEINI_H<br />
 
#endif&nbsp;&nbsp;&nbsp; // RAMPAGEINI_H<br />
                                                                                                                                </font></blockquote>
+
                                                          </blockquote>
<font size="2">rampageini.cpp<br />
+
rampageini.cpp<br />
                                                                                                                                </font><blockquote><font size="2">#include &quot;rampageini.h&quot;<br />
+
                                                          <blockquote>#include &quot;rampageini.h&quot;<br />
 
static char buffer[BUFFER_LEN];<br />
 
static char buffer[BUFFER_LEN];<br />
 
static char path[BUFFER_LEN];<br />
 
static char path[BUFFER_LEN];<br />
Line 1,117: Line 1,027:
 
&nbsp;&nbsp; &nbsp;}<br />
 
&nbsp;&nbsp; &nbsp;}<br />
 
}<br />                                                                   
 
}<br />                                                                   
                                                                 </font></blockquote>
+
                                                                 </blockquote>
<font size="2">&nbsp;</font></blockquote><font size="2">&nbsp;</font></blockquote><font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>&nbsp;</blockquote>&nbsp;</blockquote>
<font size="2"><a name="13"></a><b>
+
 
[13] Simple programming commands</b><br />                         
+
==Simple programming commands==
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                             </font><blockquote><font size="2">simple commands &nbsp; &nbsp;<br />
+
                                             <blockquote>simple commands &nbsp; &nbsp;<br />
 
                                                                          
 
                                                                          
                                                             </font><blockquote>
+
                                                             <blockquote>
<font size="2">&nbsp;&nbsp;&nbsp; declare/initialize variables &nbsp; // example: &nbsp;int
+
&nbsp;&nbsp;&nbsp; declare/initialize variables &nbsp; // example: &nbsp;int
 
temp; &nbsp;int temp2 = 1; &nbsp;temp2 = 3; &nbsp;<br />
 
temp; &nbsp;int temp2 = 1; &nbsp;temp2 = 3; &nbsp;<br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
Line 1,136: Line 1,046:
 
&nbsp;&nbsp;&nbsp; &nbsp;// example: if (a &gt; b) { a++; }<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;// example: if (a &gt; b) { a++; }<br />
  
                                                                                        <br />
+
                  <br />
  
 
  &nbsp;&nbsp; &nbsp;if (condition) {} else {} &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;if (condition) {} else {} &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
Line 1,142: Line 1,052:
 
}<br />
 
}<br />
  
                                                                                        <br />
+
                  <br />
  
 
  &nbsp;&nbsp; &nbsp;while (condition) {}&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;while (condition) {}&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;// example: while (b &gt; 0) { b--; }<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;// example: while (b &gt; 0) { b--; }<br />
  
                                                                                        <br />
+
                  <br />
  
 
  &nbsp;&nbsp; &nbsp;for (initialize; condition; increment){}&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;for (initialize; condition; increment){}&nbsp;&nbsp;
 
&nbsp;// example: for (a=1; a &lt; 10; a++) { a = a + b; }<br />         
 
&nbsp;// example: for (a=1; a &lt; 10; a++) { a = a + b; }<br />         
 
                                                                          
 
                                                                          
                                                     </font></blockquote>
+
                                                     </blockquote>
  
<font size="2">                                                                                        array<br />
+
                                                                                        array<br />
 
                                                                          
 
                                                                          
                                                               </font><blockquote><font size="2">single dimension<br />
+
                                                               <blockquote>single dimension<br />
 
                                                                          
 
                                                                          
                                                                 </font><blockquote><font size="2">int teams[100]; &nbsp; // create 100 hundred teams 0-99<br />
+
                                                                 <blockquote>int teams[100]; &nbsp; // create 100 hundred teams 0-99<br />
 
                                                                          
 
                                                                          
 
                                                                   <br />
 
                                                                   <br />
 
teams[50] = 1;<br />                                                     
 
teams[50] = 1;<br />                                                     
 
                                                                          
 
                                                                          
             </font></blockquote>
+
             </blockquote>
<font size="2">multi-dimensional<br />                                               
+
multi-dimensional<br />                                               
 
                                                                          
 
                                                                          
                   </font><blockquote><font size="2">int teams[100][50]; &nbsp;// multidimensional arry<br />
+
                   <blockquote>int teams[100][50]; &nbsp;// multidimensional arry<br />
 
                                                                          
 
                                                                          
 
                                                                     <br />
 
                                                                     <br />
 
teams[99][49] = 2;<br />                                                 
 
teams[99][49] = 2;<br />                                                 
 
                                                                          
 
                                                                          
                   </font></blockquote>
+
                   </blockquote>
<font size="2">variable size <br />                                                   
+
variable size <br />                                                   
 
                                                                          
 
                                                                          
                 </font><blockquote><font size="2">String *list = new String[amount+1]; // string array with size amount (variable) + 1;<br />
+
                 <blockquote>String *list = new String[amount+1]; // string array with size amount (variable) + 1;<br />
 
                                                                          
 
                                                                          
                                                                      <br />
+
<br />
 
list[amount-1] = &quot;hi&quot;;<br />                                             
 
list[amount-1] = &quot;hi&quot;;<br />                                             
 
                                                                          
 
                                                                          
                         </font></blockquote><font size="2">&nbsp;</font></blockquote>
+
                         </blockquote>&nbsp;</blockquote>
<font size="2">struct &nbsp; &nbsp;<br />                                             
+
struct &nbsp; &nbsp;<br />                                             
 
                                                                          
 
                                                                          
                         </font><blockquote><font size="2">&nbsp;&nbsp;&nbsp; struct name&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
                         <blockquote>&nbsp;&nbsp;&nbsp; struct name&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
+
&nbsp;<br />
  
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;<br />
 
&nbsp;<br />
  
Line 1,195: Line 1,105:
 
&nbsp;&nbsp; &nbsp;};<br />                                               
 
&nbsp;&nbsp; &nbsp;};<br />                                               
 
                                                                          
 
                                                                          
                         </font><blockquote><font size="2">// example:<br />
+
                         <blockquote>// example:<br />
 
struct freqdata {
 
struct freqdata {
 
int kills; int deaths; };<br />                                           
 
int kills; int deaths; };<br />                                           
Line 1,206: Line 1,116:
 
1; &nbsp;// access struct<br />                                           
 
1; &nbsp;// access struct<br />                                           
 
                                                                          
 
                                                                          
                               </font></blockquote><font size="2">&nbsp;</font></blockquote>
+
                               </blockquote>&nbsp;</blockquote>
  
<font size="2">                                                                                        switch &nbsp; &nbsp;<br />
+
                                                                                        switch &nbsp; &nbsp;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
  </font><blockquote><font size="2">switch (variable)&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
  <blockquote>switch (variable)&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp; <br />
 
&nbsp;&nbsp; <br />
  
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;{&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp; <br />
 
&nbsp;&nbsp; <br />
  
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case n:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case n:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <br />
+
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <br />
  
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{ } &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{ } &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp; &nbsp; <br />
 
&nbsp; &nbsp; <br />
  
Line 1,233: Line 1,143:
  
 
   &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case m:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
 
   &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case m:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <br />
+
&nbsp; &nbsp;&nbsp;&nbsp; <br />
  
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{&nbsp; } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{&nbsp; } &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
Line 1,240: Line 1,150:
  
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;break;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;<br />
  
  
Line 1,254: Line 1,164:
 
&nbsp;&nbsp; &nbsp;}<br />                                               
 
&nbsp;&nbsp; &nbsp;}<br />                                               
 
                                                                          
 
                                                                          
                             </font><blockquote><font size="2">&nbsp;</font><blockquote><font size="2">// Example:<br />
+
                             <blockquote>&nbsp;<blockquote>// Example:<br />
 
switch (p-&gt;ship) {<br />                                               
 
switch (p-&gt;ship) {<br />                                               
 
                                                                          
 
                                                                          
 
                                 <br />
 
                                 <br />
 
&nbsp;&nbsp;&nbsp; case SHIP_Warbird: &nbsp;{<br />
 
&nbsp;&nbsp;&nbsp; case SHIP_Warbird: &nbsp;{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p,&quot;You're in a warbird&quot;);<br />
+
sendPrivate(p,&quot;You're in a warbird&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } &nbsp;break;<br />               
+
} &nbsp;break;<br />               
 
                                                                          
 
                                                                          
 
                                                                 <br />
 
                                                                 <br />
 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; default:<br />
 
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; default:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;</font></blockquote><font size="2">&nbsp;</font></blockquote>
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; break;</blockquote>&nbsp;</blockquote>
  
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
  
<font size="2">                                                                                        <br />
+
                  <br />
                                                                                                        <b><a name="14"></a>
+
==Useful Player data==
[14] Useful Player data</b><br />
+
                                  <blockquote>
                                                                                                        </font><blockquote>
+
                                                                       
<font size="2">                                                                       
 
 
                                                         // useful data stored
 
                                                         // useful data stored
 
by MervBot about each player (player.h)<br />
 
by MervBot about each player (player.h)<br />
Line 1,295: Line 1,204:
 
p-&gt;score.wins = player kills from f2<br />
 
p-&gt;score.wins = player kills from f2<br />
 
p-&gt;score.losses = player deaths from f2<br />
 
p-&gt;score.losses = player deaths from f2<br />
                                                                                                          </font></blockquote>
+
                                    </blockquote>
<font size="2">                                                                                                          <br />
+
                                    <br />
                                                                                                          <br />
+
                                    <br />
<b><a name="15"></a> [15] Bot built in functions<br />
+
==Bot built in functions==
</b>
+
<blockquote>// useful MervBot commands to control what the bot is doing<br />
                                                                                                                                                                                                </font><blockquote><font size="2">// useful MervBot commands to control what the bot is doing<br />
+
                                                                                                                            <br />
                                                                                                                                                                                                  <br />
 
 
// player.cpp<br />
 
// player.cpp<br />
 
Player::move(Sint32 x, Sint32 y) &nbsp;// example &nbsp;me-&gt;move(512,512) - bot moves to coord 512 512<br />
 
Player::move(Sint32 x, Sint32 y) &nbsp;// example &nbsp;me-&gt;move(512,512) - bot moves to coord 512 512<br />
 
Player::clone(Player *p) // example &nbsp;me-&gt;clone(p) <br />
 
Player::clone(Player *p) // example &nbsp;me-&gt;clone(p) <br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
// dllcore.cpp (descriptions of functions in dllcore.h)<br />
 
// dllcore.cpp (descriptions of functions in dllcore.h)<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
BotEvent makeEcho&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (char *m);<br />
 
BotEvent makeEcho&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (char *m);<br />
 
BotEvent makeSay&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int t, int s, int i, char *m);<br />
 
BotEvent makeSay&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int t, int s, int i, char *m);<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
BotEvent makeShip&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int s);<br />
 
BotEvent makeShip&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int s);<br />
 
BotEvent makeTeam&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int t);<br />
 
BotEvent makeTeam&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (int t);<br />
Line 1,316: Line 1,224:
 
BotEvent makeSendPosition&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (bool reliable);<br />
 
BotEvent makeSendPosition&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (bool reliable);<br />
 
BotEvent makeDropFlags&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ();<br />
 
BotEvent makeDropFlags&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ();<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
BotEvent makeDeath&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Player *p);<br />
 
BotEvent makeDeath&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Player *p);<br />
 
BotEvent makeAttach&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Player *p);<br />
 
BotEvent makeAttach&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Player *p);<br />
Line 1,325: Line 1,233:
 
BotEvent makeDropBrick&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ();<br />
 
BotEvent makeDropBrick&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ();<br />
 
BotEvent makeFireWeapon&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (void *weapon_info);<br />
 
BotEvent makeFireWeapon&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (void *weapon_info);<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
BotEvent makeToggleObjects&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Uint16 player, Uint16 *objects, int num_objects);<br />
 
BotEvent makeToggleObjects&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Uint16 player, Uint16 *objects, int num_objects);<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
BotEvent makeSpawnBot&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
BotEvent makeSpawnBot&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
(char *name, char *password, char *staff, char *arena);<br />
 
(char *name, char *password, char *staff, char *arena);<br />
 
BotEvent makeChangeArena&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (char *name);<br />
 
BotEvent makeChangeArena&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (char *name);<br />
 
BotEvent makeChangeSettings&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (_linkedlist &lt;String&gt; *settings);<br />
 
BotEvent makeChangeSettings&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (_linkedlist &lt;String&gt; *settings);<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
// example how to use them:<br />
 
// example how to use them:<br />
                                                                                                                                                                                                  <br />
+
                                                                                                                            <br />
 
tell(makeFollowing(false));<br />
 
tell(makeFollowing(false));<br />
                                                                                                                                                                                                  <br />
+
                                                      <br />
 
// look in Commands.txt , command.cpp (core), or /!help to bot to see all bot external commands (example /!go &lt;arena&gt;)<br />
 
// look in Commands.txt , command.cpp (core), or /!help to bot to see all bot external commands (example /!go &lt;arena&gt;)<br />
                                                                                                                                                                                                  </font></blockquote>
+
                                                      </blockquote>
<font size="2">                                                                                                                                                                                                  <b><br />
+
 
Example Code</b><br />
+
==Example Code==
<br />
+
 
                                                                                                          <a name="15a"></a>
+
<a name="15a"></a>
 
a) No antiwarp in center of map (take green away and warn)<br />       
 
a) No antiwarp in center of map (take green away and warn)<br />       
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
   </font><blockquote><font size="2">// using function closeto() and abs()<br /></font></blockquote><font size="2">&nbsp;</font><blockquote><font size="2">bool closeto(Player *p, int x, int y, int tolerance) {<br />
+
   <blockquote>// using function closeto() and abs()<br /></blockquote>&nbsp;<blockquote>
 +
bool closeto(Player *p, int x, int y, int tolerance) {<br />
 
&nbsp;&nbsp;&nbsp; return (abs((p-&gt;tile.x) - x) &lt; tolerance) &amp;&amp; (abs((p-&gt;tile.y) - y) &lt; tolerance); }<br /><br />
 
&nbsp;&nbsp;&nbsp; return (abs((p-&gt;tile.x) - x) &lt; tolerance) &amp;&amp; (abs((p-&gt;tile.y) - y) &lt; tolerance); }<br /><br />
 
inline int abs(int n) {<br />
 
inline int abs(int n) {<br />
 
&nbsp;&nbsp;&nbsp; if (n &lt; 0)&nbsp;&nbsp;&nbsp; return -n;<br />
 
&nbsp;&nbsp;&nbsp; if (n &lt; 0)&nbsp;&nbsp;&nbsp; return -n;<br />
 
&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return n; }<br /><br />
 
&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return n; }<br /><br />
radius = 35; &nbsp;// global variable<br /></font></blockquote><font size="2">&nbsp;</font><blockquote><font size="2">case EVENT_PlayerMove: {<br />
+
radius = 35; &nbsp;// global variable<br /></blockquote>&nbsp;<blockquote>case EVENT_PlayerMove: {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = (Player*)event.p[0];<br /><br />
+
&nbsp;&nbsp;&nbsp; Player *p = (Player*)event.p[0];<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // no anti in center<br />
+
&nbsp;&nbsp;&nbsp; // no anti in center<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((p-&gt;ship != SHIP_Spectator) &amp;&amp; (p-&gt;awarp)) {<br />
+
&nbsp;&nbsp;&nbsp; if ((p-&gt;ship != SHIP_Spectator) &amp;&amp; (p-&gt;awarp)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (closeto(p, 512, 512, radius)){<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (closeto(p, 512, 512, radius)){<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*prize #-20&quot;);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*prize #-20&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*warn Antiwarp is not allowed in center.&quot;);<br />
 
&nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*warn Antiwarp is not allowed in center.&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /></font></blockquote>
+
&nbsp;&nbsp;&nbsp; }<br /></blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                                          
 
                                                                          
 
               <a name="15b"></a>
 
               <a name="15b"></a>
Line 1,368: Line 1,277:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
      </font><blockquote><font size="2">case EVENT_Tick: &nbsp;{<br /></font><blockquote><font size="2">if (countdown[0] == 0) { &nbsp; &nbsp; // assuming countdown[0] initialized to &gt; 0&nbsp; in spawn.h, freqchange=0;<br /></font></blockquote>
+
 
<font size="2">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
<blockquote>
 +
case EVENT_Tick: &nbsp;{<br />
 +
<blockquote>if (countdown[0] == 0) { &nbsp; &nbsp; // assuming countdown[0] initialized to &gt; 0&nbsp; in spawn.h, freqchange=0;<br />
 +
</blockquote>
 +
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
 
_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int count = 0;<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int count = 0;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (parse)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (parse)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;ship != SHIP_Spectator)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;ship != SHIP_Spectator)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ++count;<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ++count;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((count &gt; 24) &amp;&amp; (freqchange != 4))<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((count &gt; 24) &amp;&amp; (freqchange != 4))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; sendPublic(&quot;?set team:maxperteam:4&quot;);<br />
 
&nbsp;&nbsp;&nbsp; sendPublic(&quot;?set team:maxperteam:4&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s = &quot;Max freq size 4&nbsp; (&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s = &quot;Max freq size 4&nbsp; (&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += count;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += count;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; pilots in game)&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; pilots in game)&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqchange = 4;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqchange = 4;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
if ((count &lt; 25) &amp;&amp; (count &gt; 14) &amp;&amp; (freqchange !=
 
if ((count &lt; 25) &amp;&amp; (count &gt; 14) &amp;&amp; (freqchange !=
 
3))<br />
 
3))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; sendPublic(&quot;?set team:maxperteam:3&quot;);<br />
 
&nbsp;&nbsp;&nbsp; sendPublic(&quot;?set team:maxperteam:3&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s = &quot;Max freq size 3&nbsp; (&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s = &quot;Max freq size 3&nbsp; (&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += count;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += count;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; pilots in game)&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; pilots in game)&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqchange = 3;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqchange = 3;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /></font><blockquote><font size="2">countdown[0] = 120;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /><blockquote>countdown[0] = 120;<br />
}<br /></font></blockquote></blockquote><font size="2">                                         
+
}<br /></blockquote></blockquote>                                         
 
                                                                          
 
                                                                          
 
                                                     <a name="15c"></a>  c) Tracking kills and announcing when pilot gets 10 kills in a row without
 
                                                     <a name="15c"></a>  c) Tracking kills and announcing when pilot gets 10 kills in a row without
Line 1,409: Line 1,322:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                         </font><blockquote><font size="2">case EVENT_PlayerDeath:&nbsp; {<br /></font><blockquote><font size="2">// assuming tags are setup (see storing data section)<br />
+
                                                         <blockquote>case EVENT_PlayerDeath:&nbsp; {<br />
 +
<blockquote>// assuming tags are setup (see storing data section)<br />
 
set_tag(p,KILLS, 0); &nbsp;// pilot died, reset to 0 kills in a row<br />
 
set_tag(p,KILLS, 0); &nbsp;// pilot died, reset to 0 kills in a row<br />
 
set_tag(k, KILLS, get_tag(k, KILLS) + 1); &nbsp;// pilot killed someone, increment kills in a row by 1<br /><br />
 
set_tag(k, KILLS, get_tag(k, KILLS) + 1); &nbsp;// pilot killed someone, increment kills in a row by 1<br /><br />
if (get_tag(k,KILLS) == 10) &nbsp;sendPublic(&quot;*arena (String) k-&gt;name + &quot; has gotten 10 kills.&quot;);</font></blockquote></blockquote>
+
if (get_tag(k,KILLS) == 10) &nbsp;sendPublic(&quot;*arena (String) k-&gt;name + &quot; has gotten 10 kills.&quot;);</blockquote></blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                                          
 
                                                                          
 
                         <a name="15d"></a>
 
                         <a name="15d"></a>
Line 1,420: Line 1,334:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                 </font><blockquote><font size="2">// using functions closeto() and abs()<br /><br />
+
                 <blockquote>// using functions closeto() and abs()<br /><br />
 
bool closeto(Player *p, int x, int y, int tolerance) {<br />
 
bool closeto(Player *p, int x, int y, int tolerance) {<br />
  
Line 1,431: Line 1,345:
 
&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return n; }<br /><br />
 
&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return n; }<br /><br />
 
case EVENT_PlayerMove: &nbsp; &nbsp;{<br /><br />
 
case EVENT_PlayerMove: &nbsp; &nbsp;{<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (closeto(p, 509, 509, 2)) { &nbsp;// if pilot within 2 of map coord 509,509<br />
+
if (closeto(p, 509, 509, 2)) { &nbsp;// if pilot within 2 of map coord 509,509<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*warpto 509 504&quot;); &nbsp;// warp to coord 509,504<br /></font></blockquote>
+
&nbsp;&nbsp;&nbsp; sendPrivate(p, &quot;*warpto 509 504&quot;); &nbsp;// warp to coord 509,504<br /></blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                                          
 
                                                                          
 
                           <br />                                         
 
                           <br />                                         
Line 1,442: Line 1,356:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
           </font><blockquote><font size="2">&nbsp;&nbsp;&nbsp; // Declare in spawn.h<br /></font><blockquote><font size="2">&nbsp;&nbsp;&nbsp; struct playerstats<br />
+
           <blockquote>&nbsp;&nbsp;&nbsp; // Declare in spawn.h<br /><blockquote>&nbsp;&nbsp;&nbsp; struct playerstats<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char name[20];<br /><br />
+
char name[20];<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int kills;<br />
+
int kills;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int deaths;<br />
+
int deaths;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Uint16 points;<br />
+
Uint16 points;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Uint16 flagpoints;<br />
+
Uint16 flagpoints;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int flagtime;<br />
+
int flagtime;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int cflagtime;<br />
+
int cflagtime;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int flags;<br />
+
int flags;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int flagkills;<br /><br />
+
int flagkills;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int dmgdealt;<br />
+
int dmgdealt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int dmgtaken;<br /><br />
+
int dmgtaken;<br /><br />
 
&nbsp;&nbsp;&nbsp; };<br /><br />
 
&nbsp;&nbsp;&nbsp; };<br /><br />
 
&nbsp;&nbsp;&nbsp; struct freqdata<br />
 
&nbsp;&nbsp;&nbsp; struct freqdata<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; playerstats pilots[100];<br /><br />
+
playerstats pilots[100];<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int freqpoints;<br />
+
int freqpoints;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char freqname[20];<br />
+
char freqname[20];<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int freqflagpoints;<br />
+
int freqflagpoints;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Uint16 freqteam;<br />
+
Uint16 freqteam;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int freqflagtime;<br /><br />
+
int freqflagtime;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int flags;<br />
+
int flags;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int kills;<br />
+
int kills;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int deaths;<br />
+
int deaths;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int flagkills;<br /><br />
+
int flagkills;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int dmgdealt;<br />
+
int dmgdealt;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int dmgtaken;<br /><br />
+
int dmgtaken;<br /><br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int playercount;<br />
+
int playercount;<br />
 
&nbsp;&nbsp;&nbsp; };<br /><br />
 
&nbsp;&nbsp;&nbsp; };<br /><br />
&nbsp;&nbsp;&nbsp; freqdata freqs[100];<br /></font></blockquote>
+
&nbsp;&nbsp;&nbsp; freqdata freqs[100];<br /></blockquote>
<font size="2">// Initialize in spawn.cpp<br /></font><blockquote><font size="2">void botInfo::Clear()<br />
+
// Initialize in spawn.cpp<br /><blockquote>void botInfo::Clear()<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; // initialize/clear struct data<br />
 
&nbsp;&nbsp;&nbsp; // initialize/clear struct data<br />
 
&nbsp;&nbsp;&nbsp; for (int n=99; n&gt;=0; n--)<br />
 
&nbsp;&nbsp;&nbsp; for (int n=99; n&gt;=0; n--)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].freqteam=-1;<br />
+
freqs[n].freqteam=-1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].freqpoints=0;<br />
+
freqs[n].freqpoints=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].freqflagpoints=0;<br />
+
freqs[n].freqflagpoints=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].playercount=0;<br />
+
freqs[n].playercount=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].flags=0;<br />
+
freqs[n].flags=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].kills=0;<br />
+
freqs[n].kills=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].deaths=0;<br />
+
freqs[n].deaths=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].freqflagtime=0;<br />
+
freqs[n].freqflagtime=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].flagkills=0;<br />
+
freqs[n].flagkills=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].dmgdealt=0;<br />
+
freqs[n].dmgdealt=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].dmgtaken=0;<br />
+
freqs[n].dmgtaken=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int m = 99; m&gt;=0; m--)<br />
+
for (int m = 99; m&gt;=0; m--)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].deaths=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].deaths=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].kills=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].kills=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].points=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].points=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagpoints=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagpoints=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagtime=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagtime=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].cflagtime=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].cflagtime=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flags=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flags=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagkills=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].flagkills=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].dmgdealt=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].dmgdealt=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[n].pilots[m].dmgtaken=0;<br />
+
&nbsp;&nbsp;&nbsp; freqs[n].pilots[m].dmgtaken=0;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
}<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
}<br /></font></blockquote></blockquote><font size="2">&nbsp;</font><blockquote><font size="2">// Access data in spawn.cpp<br /></font><blockquote><font size="2">int freq = p-&gt;team;<br /><br />
+
}<br /></blockquote></blockquote>&nbsp;<blockquote>// Access data in spawn.cpp<br />
 +
<blockquote>int freq = p-&gt;team;<br /><br />
 
freqs[1].pilots[2].kills++;<br /><br />
 
freqs[1].pilots[2].kills++;<br /><br />
 
OR<br /><br />
 
OR<br /><br />
freqs[freq].deaths++;<br /></font></blockquote></blockquote><font size="2">                     
+
freqs[freq].deaths++;<br /></blockquote></blockquote>                     
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,514: Line 1,429:
 
f) Tracking flag data<br />                                           
 
f) Tracking flag data<br />                                           
 
                                                                          
 
                                                                          
                                                                  </font><blockquote><font size="2">Example GetPilot() function &nbsp;(using structs from example e)<br /></font><blockquote><font size="2">bool botInfo::GetPilot(Player *p)<br />
+
<blockquote>Example GetPilot() function &nbsp;(using structs from example e)<br /><blockquote>bool botInfo::GetPilot(Player *p)<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; // get a pilots freq/pilot id from struct<br />
 
&nbsp;&nbsp;&nbsp; // get a pilots freq/pilot id from struct<br />
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;team == freqs[freq].freqteam)<br />
+
if (p-&gt;team == freqs[freq].freqteam)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (pilot = freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
+
&nbsp;&nbsp;&nbsp; for (pilot = freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
if (strcmp(p-&gt;name,freqs[freq].pilots[pilot].name)==0)<br />
 
if (strcmp(p-&gt;name,freqs[freq].pilots[pilot].name)==0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br /><br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br /><br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
}<br /></font></blockquote></blockquote><font size="2">&nbsp;</font><blockquote><font size="2">Example way to track flag data using above struct/functions<br /></font><blockquote><font size="2">case EVENT_FlagGrab:<br />
+
}<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
</blockquote></blockquote>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GetPilot(p)) &nbsp;// function<br />
+
&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
<blockquote>Example way to track flag data using above struct/functions<br /><blockquote>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].flags++;<br />
+
case EVENT_FlagGrab:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].flags++;<br /><br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; if (GetPilot(p)) &nbsp;// function<br />
 +
&nbsp;&nbsp;&nbsp; {<br />
 +
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].flags++;<br />
 +
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].flags++;<br /><br />
 +
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
if (freqs[freq].pilots[pilot].flags &lt; 2) // didnt have a flag before,
 
if (freqs[freq].pilots[pilot].flags &lt; 2) // didnt have a flag before,
 
first flag<br />
 
first flag<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].cflagtime = GetTickCount();
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].cflagtime = GetTickCount();
 
&nbsp;// time stamp when picked up flag<br />
 
&nbsp;// time stamp when picked up flag<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /></font></blockquote></blockquote>
+
&nbsp;&nbsp;&nbsp; }<br /></blockquote></blockquote>
<font size="2">&nbsp;</font><blockquote><font size="2">Example way to track flag data using built in get/set tag (from catid flagbot)<br />
+
&nbsp;<blockquote>Example way to track flag data using built in get/set tag (from catid flagbot)<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                               </font><blockquote>
+
                                               <blockquote>
<font size="2">case EVENT_FlagGrab:<br />
+
case EVENT_FlagGrab:<br />
  
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
  
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set_tag(p, TAG_STAT_FS, get_tag(p, TAG_STAT_FS) + 1);<br />
+
&nbsp;&nbsp;&nbsp; set_tag(p, TAG_STAT_FS, get_tag(p, TAG_STAT_FS) + 1);<br />
  
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set_tag(p, TAG_FLAGTIMER, GetTickCount());<br />
+
&nbsp;&nbsp;&nbsp; set_tag(p, TAG_FLAGTIMER, GetTickCount());<br />
  
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />                             
+
}<br />                             
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                     </font></blockquote><font size="2">&nbsp;</font></blockquote><font size="2">&nbsp;</font><blockquote><font size="2">Get current flag times using struct format<br />
+
                     </blockquote>&nbsp;</blockquote>&nbsp;<blockquote>Get current flag times using struct format<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                   </font><blockquote><font size="2">void botInfo::SetFlagTimes()<br />
+
                                                   <blockquote>void botInfo::SetFlagTimes()<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; // set current flagtime for pilots/freqs<br />
 
&nbsp;&nbsp;&nbsp; // set current flagtime for pilots/freqs<br />
Line 1,566: Line 1,485:
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br />   
+
Player *p = parse-&gt;item;<br />   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                   <br />
 
                                                   <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GetPilot(p))<br />
+
if (GetPilot(p))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (freqs[freq].pilots[pilot].flags &gt; 0)<br />
+
&nbsp;&nbsp;&nbsp; if (freqs[freq].pilots[pilot].flags &gt; 0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (PilotOnSquad(p))<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (PilotOnSquad(p))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; freqs[freq].freqflagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;<br />
 
&nbsp;&nbsp;&nbsp; freqs[freq].freqflagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                     <br />
 
                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
freqs[freq].pilots[pilot].flagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;<br />
 
freqs[freq].pilots[pilot].flagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
freqs[freq].pilots[pilot].cflagtime = GetTickCount();<br />
 
freqs[freq].pilots[pilot].cflagtime = GetTickCount();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />         
+
&nbsp;&nbsp;&nbsp; }<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                           <br />
 
                                           <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
}<br />                                                                   
 
}<br />                                                                   
 
                                                                          
 
                                                                          
                                                           </font></blockquote>
+
                                                           </blockquote>
<font size="2">// side note: &nbsp;case EVENT_FlagDrop: {} gets called anytime theres a teamkill<br />
+
// side note: &nbsp;case EVENT_FlagDrop: {} gets called anytime theres a teamkill<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                   </font></blockquote><font size="2">         
+
                                                   </blockquote>         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,605: Line 1,524:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                             </font><blockquote><font size="2">declare and initialize variables in spawn.h<br />
+
                                             <blockquote>declare and initialize variables in spawn.h<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                     </font><blockquote><font size="2">class botInfo<br />
+
                                                     <blockquote>class botInfo<br />
 
{<br />
 
{<br />
 
bool spamready;<br />
 
bool spamready;<br />
Line 1,622: Line 1,541:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                     </font></blockquote>
+
                     </blockquote>
<font size="2">spawn.cpp - mark as spamready=true when 60 seconds up<br />           
+
spawn.cpp - mark as spamready=true when 60 seconds up<br />           
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                           </font><blockquote><font size="2">case EVENT_Tick:<br />
+
                                           <blockquote>case EVENT_Tick:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (countdown[0] == 1) &nbsp;{<br />
+
&nbsp;&nbsp;&nbsp; if (countdown[0] == 1) &nbsp;{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; spamready = true; &nbsp;// ready to spam again<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; spamready = true; &nbsp;// ready to spam again<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />         
+
&nbsp;&nbsp;&nbsp; }<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                               </font></blockquote><font size="2">             
+
                                               </blockquote>             
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,640: Line 1,559:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                           </font><blockquote><font size="2">case OP_Player:<br />
+
                           <blockquote>case OP_Player:<br />
 
{&nbsp;&nbsp;&nbsp; // Player-level commands<br />                       
 
{&nbsp;&nbsp;&nbsp; // Player-level commands<br />                       
 
                                                                          
 
                                                                          
Line 1,646: Line 1,565:
 
                                   <br />
 
                                   <br />
 
else if (c-&gt;check(&quot;spam&quot;))<br />
 
else if (c-&gt;check(&quot;spam&quot;))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
// zone announcement &quot;Need pilots to duel in ?go arena -pilotname&quot;<br />
 
// zone announcement &quot;Need pilots to duel in ?go arena -pilotname&quot;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (spamready == true)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (spamready == true)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; s += &quot;*zone Need pilots to duel in ?go &quot;;<br />
 
&nbsp;&nbsp;&nbsp; s += &quot;*zone Need pilots to duel in ?go &quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += arena;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += arena;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; - &quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot; - &quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += p-&gt;name;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += p-&gt;name;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; spamready=false;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; spamready=false;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; countdown[0] = SPAM_TIME * 60; // next spam time limit<br />
 
&nbsp;&nbsp;&nbsp; countdown[0] = SPAM_TIME * 60; // next spam time limit<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (countdown[0] &lt; 0)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (countdown[0] &lt; 0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; sendPrivate(p,&quot;Spam ability disabled.&quot;);<br />
 
&nbsp;&nbsp;&nbsp; sendPrivate(p,&quot;Spam ability disabled.&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else <br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String s;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += SPAM_TIME;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += SPAM_TIME;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; s += &quot; Minute timer between announcements. &quot;;<br />
 
&nbsp;&nbsp;&nbsp; s += &quot; Minute timer between announcements. &quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += countdown[0] / 60;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += countdown[0] / 60;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot;:&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot;:&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (countdown[0] % 60 &lt; 10)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (countdown[0] % 60 &lt; 10)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot;0&quot;;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += &quot;0&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += countdown[0] % 60;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s += countdown[0] % 60;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; s += &quot; minutes left before next spam allowed.&quot;;<br />
 
&nbsp;&nbsp;&nbsp; s += &quot; minutes left before next spam allowed.&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, s);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, s);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />         
+
&nbsp;&nbsp;&nbsp; }<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                 </font></blockquote><font size="2">&nbsp;</font></blockquote><font size="2">           
+
                                                 </blockquote>&nbsp;</blockquote>           
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,693: Line 1,612:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                           </font><blockquote><font size="2">//spawn.h declare variables<br />
+
                                                           <blockquote>//spawn.h declare variables<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                             </font><blockquote><font size="2">class botInfo<br />
+
                                                             <blockquote>class botInfo<br />
 
{<br />
 
{<br />
 
Player *next[99][99];<br />
 
Player *next[99][99];<br />
Line 1,710: Line 1,629:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                             </font></blockquote>
+
                             </blockquote>
<font size="2">// spawn.cpp MoveUp function<br />                                       
+
// spawn.cpp MoveUp function<br />                                       
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                       </font><blockquote><font size="2">void botInfo::MoveUp(int pos, int box)<br />
+
                       <blockquote>void botInfo::MoveUp(int pos, int box)<br />
 
{<br />
 
{<br />
 
&nbsp;&nbsp;&nbsp; // moves up the next line for that box and decrement box's nextcount<br />
 
&nbsp;&nbsp;&nbsp; // moves up the next line for that box and decrement box's nextcount<br />
 
&nbsp;&nbsp;&nbsp; if (nextcount[box] &gt; 0)<br />
 
&nbsp;&nbsp;&nbsp; if (nextcount[box] &gt; 0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; nextcount[box]--;<br />             
+
nextcount[box]--;<br />             
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,724: Line 1,643:
 
&nbsp;&nbsp;&nbsp; for (pos = pos; pos &lt; MAX_NEXT - 1; pos++)<br />
 
&nbsp;&nbsp;&nbsp; for (pos = pos; pos &lt; MAX_NEXT - 1; pos++)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; next[box][pos] = next[box][pos + 1];<br />
+
next[box][pos] = next[box][pos + 1];<br />
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
                                                                          
 
                                                                          
Line 1,732: Line 1,651:
 
}<br />                                                                   
 
}<br />                                                                   
 
                                                                          
 
                                                                          
                                                                      </font></blockquote>
+
</blockquote>
<font size="2">&nbsp;</font></blockquote>
+
&nbsp;</blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                                          
 
                                                                          
 
                                                                 <a name="15i"></a>
 
                                                                 <a name="15i"></a>
Line 1,740: Line 1,659:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                 </font><blockquote><font size="2">#include &lt;fstream&gt;<br />
+
                                                                 <blockquote>#include &lt;fstream&gt;<br />
 
using namespace std;<br />                                               
 
using namespace std;<br />                                               
 
                                                                          
 
                                                                          
Line 1,746: Line 1,665:
 
                   <br />
 
                   <br />
 
case OP_Player:<br />
 
case OP_Player:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (c-&gt;check(&quot;schedule&quot;))<br />
+
&nbsp;&nbsp;&nbsp; if (c-&gt;check(&quot;schedule&quot;))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // read in schedule from schedule.txt<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // read in schedule from schedule.txt<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifstream file(&quot;schedule.txt&quot;);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifstream file(&quot;schedule.txt&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char line[256];<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char line[256];<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                   <br />
 
                                                                   <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (file.getline(line, 256))<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (file.getline(line, 256))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, line);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPrivate(p, line);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; file.close();<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; file.close();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } <br />         
+
&nbsp;&nbsp;&nbsp; } <br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                           </font></blockquote><font size="2">  
+
                                                           </blockquote>  
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,770: Line 1,689:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                          </font><blockquote><font size="2">// spawn.cpp &nbsp; (see &quot;structures within structures&quot; example for variable declarations, varibale freqcount = # of freqs)<br />
+
<blockquote>// spawn.cpp &nbsp; (see &quot;structures within structures&quot; example for variable declarations, varibale freqcount = # of freqs)<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,808: Line 1,727:
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char str[255];<br />               
+
char str[255];<br />               
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                     <br />
 
                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendFreqs(&quot;---------------------------------------------------&quot;);<br />
+
sendFreqs(&quot;---------------------------------------------------&quot;);<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                     <br />
 
                                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sprintf(str, &quot;Squad: %-20s K&nbsp; D TK DMG DEALT TAKEN&quot;, freqs[freq].freqname);<br />
+
sprintf(str, &quot;Squad: %-20s K&nbsp; D TK DMG DEALT TAKEN&quot;, freqs[freq].freqname);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendFreqs(str);<br />               
+
sendFreqs(str);<br />               
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                       <br />
 
                                                       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendFreqs(&quot;---------------------------------------------------&quot;);<br />
+
sendFreqs(&quot;---------------------------------------------------&quot;);<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                     <br />
 
                                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (pilot=freqs[freq].playercount-1; pilot &gt;= 0; pilot--)<br />
+
for (pilot=freqs[freq].playercount-1; pilot &gt;= 0; pilot--)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sprintf(str, &quot;%-20s
+
&nbsp;&nbsp;&nbsp; sprintf(str, &quot;%-20s
 
%8d %2d %2d %9d %5d&quot;, freqs[freq].pilots[pilot].name, freqs[freq].pilots[pilot].kills,<br />
 
%8d %2d %2d %9d %5d&quot;, freqs[freq].pilots[pilot].name, freqs[freq].pilots[pilot].kills,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].deaths, freqs[freq].pilots[pilot].teamkills,
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].deaths, freqs[freq].pilots[pilot].teamkills,
 
freqs[freq].pilots[pilot].dmgdealt,<br />
 
freqs[freq].pilots[pilot].dmgdealt,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].dmgtaken);<br />
 
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].dmgtaken);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendFreqs(str);<br />
+
&nbsp;&nbsp;&nbsp; sendFreqs(str);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />                             
+
}<br />                             
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,841: Line 1,760:
 
       sprintf(str, &quot;TOTAL:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
 
       sprintf(str, &quot;TOTAL:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
 
       %2d %2d %2d %9d %5d&quot;, freqs[freq].kills, freqs[freq].deaths, <br />
 
       %2d %2d %2d %9d %5d&quot;, freqs[freq].kills, freqs[freq].deaths, <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].teamkills, freqs[freq].dmgdealt, freqs[freq].dmgtaken);<br />
+
&nbsp;&nbsp;&nbsp; freqs[freq].teamkills, freqs[freq].dmgdealt, freqs[freq].dmgtaken);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendFreqs(str);<br />
+
sendFreqs(str);<br />
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
                                                                          
 
                                                                          
Line 1,851: Line 1,770:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
   </font></blockquote><font size="2">                                                         
+
   </blockquote>                                                         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,858: Line 1,777:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
           </font><blockquote><font size="2">// see GetPilotName(name) function in other example, returns *player as TempPlayer from name<br />
+
           <blockquote>// see GetPilotName(name) function in other example, returns *player as TempPlayer from name<br />
 
// closeto() function from several previous examples<br />               
 
// closeto() function from several previous examples<br />               
 
                                                                          
 
                                                                          
Line 1,867: Line 1,786:
 
&nbsp;&nbsp;&nbsp; // return true if teamA has a pilot in the box, otherwise false<br />
 
&nbsp;&nbsp;&nbsp; // return true if teamA has a pilot in the box, otherwise false<br />
 
&nbsp;&nbsp;&nbsp; for (int tempplayercount = freqs[0].playercount-1; tempplayercount &gt;= 0; tempplayercount--)<br />
 
&nbsp;&nbsp;&nbsp; for (int tempplayercount = freqs[0].playercount-1; tempplayercount &gt;= 0; tempplayercount--)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (GetPilotName(freqs[0].pilots[tempplayercount].name))<br />
+
if (GetPilotName(freqs[0].pilots[tempplayercount].name))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (closeto(TempPlayer,
+
&nbsp;&nbsp;&nbsp; if (closeto(TempPlayer,
 
coordX, coordY, 73) &amp;&amp; (TempPlayer-&gt;ship != SHIP_Spectator))<br />
 
coordX, coordY, 73) &amp;&amp; (TempPlayer-&gt;ship != SHIP_Spectator))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                      <br />
+
<br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
 
}<br />                                                                   
 
}<br />                                                                   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
     </font></blockquote><font size="2">                                                       
+
     </blockquote>                                                       
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,885: Line 1,804:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                      </font><blockquote><font size="2">// see struct examples for variable info<br />
+
<blockquote>// see struct examples for variable info<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,899: Line 1,818:
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
 
&nbsp;&nbsp;&nbsp; for (freq=freqcount-1; freq&gt;=0; freq--)<br />
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;team == freqs[freq].freqteam)<br />
+
if (p-&gt;team == freqs[freq].freqteam)<br />
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (pilot = freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
+
&nbsp;&nbsp;&nbsp; for (pilot = freqs[freq].playercount-1; pilot&gt;=0; pilot--)<br />
 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
if (strcmp(p-&gt;name,freqs[freq].pilots[pilot].name)==0)<br />
 
if (strcmp(p-&gt;name,freqs[freq].pilots[pilot].name)==0)<br />
  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,927: Line 1,846:
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br />   
+
Player *p = parse-&gt;item;<br />   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
       <br />
 
       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // convert both to lowercase to compare<br />
+
// convert both to lowercase to compare<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char pname[20];&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
char pname[20];&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(pname,p-&gt;name,20);<br />  
+
strncpy(pname,p-&gt;name,20);<br />  
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
         <br />
 
         <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char nname[20];&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
char nname[20];&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(nname,name,20);<br />       
+
strncpy(nname,name,20);<br />       
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
   <br />
 
   <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; tolower(pname);<br />
+
tolower(pname);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; tolower(nname);<br />               
+
tolower(nname);<br />               
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                     <br />
 
                                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (strcmp(pname,nname)==0)<br />
+
if (strcmp(pname,nname)==0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TempPlayer = p;<br />
+
&nbsp;&nbsp;&nbsp; TempPlayer = p;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return true;<br />
+
&nbsp;&nbsp;&nbsp; return true;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />                             
+
}<br />                             
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                       <br />
 
                                                       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
 
&nbsp;&nbsp;&nbsp; return false;<br />
Line 1,970: Line 1,889:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
</font></blockquote><font size="2">                                                           
+
</blockquote>                                                           
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 1,977: Line 1,896:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                      </font><blockquote><font size="2">&nbsp;&nbsp;&nbsp; // create log file name (squadA and squadB external char[20] variables)<br />
+
<blockquote>&nbsp;&nbsp;&nbsp; // create log file name (squadA and squadB external char[20] variables)<br />
 
&nbsp;&nbsp;&nbsp; char u[100];<br />
 
&nbsp;&nbsp;&nbsp; char u[100];<br />
 
&nbsp;&nbsp;&nbsp; time_t t=time(NULL);<br />
 
&nbsp;&nbsp;&nbsp; time_t t=time(NULL);<br />
Line 2,008: Line 1,927:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                      </font></blockquote>
+
</blockquote>
<font size="2">                                                                       
+
                                                                       
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,017: Line 1,936:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
   </font><blockquote><font size="2">// teamA, teamB, logname global variables<br />
+
   <blockquote>// teamA, teamB, logname global variables<br />
 
void botInfo::sendFreqs(char *msg)<br />
 
void botInfo::sendFreqs(char *msg)<br />
 
{<br />
 
{<br />
Line 2,025: Line 1,944:
 
&nbsp;&nbsp;&nbsp; if (teammsgs == false)<br />
 
&nbsp;&nbsp;&nbsp; if (teammsgs == false)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; s.prepend(&quot;*arena &quot;,7);<br />
+
s.prepend(&quot;*arena &quot;,7);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(s);<br />
+
sendPublic(s);<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; else<br />
 
&nbsp;&nbsp;&nbsp; else<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendTeamPrivate(8025,msg);<br />
+
sendTeamPrivate(8025,msg);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendTeamPrivate(teamA,msg);<br />
+
sendTeamPrivate(teamA,msg);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendTeamPrivate(teamB,msg);<br />
+
sendTeamPrivate(teamB,msg);<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; if (gameon == true)<br />
 
&nbsp;&nbsp;&nbsp; if (gameon == true)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ofstream outf(logname, ios::app);<br />
+
ofstream outf(logname, ios::app);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outf &lt;&lt; msg &lt;&lt; endl;<br />
+
outf &lt;&lt; msg &lt;&lt; endl;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outf.close();<br />
+
outf.close();<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
}<br />                                                                   
 
}<br />                                                                   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
           </font></blockquote><font size="2">                                                 
+
           </blockquote>                                                 
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,050: Line 1,969:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                     </font><blockquote><font size="2">// see structures within structures example for freqs[] declaration<br />
+
                                                                     <blockquote>// see structures within structures example for freqs[] declaration<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,066: Line 1,985:
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br />   
+
Player *p = parse-&gt;item;<br />   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
   <br />
 
   <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;ship != SHIP_Spectator)<br />
+
if (p-&gt;ship != SHIP_Spectator)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (closeto(p, coordX, coordY, 73))<br />
+
&nbsp;&nbsp;&nbsp; if (closeto(p, coordX, coordY, 73))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // look for freq in struct<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // look for freq in struct<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bool foundfreq=false;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bool foundfreq=false;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
       <br />
 
       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq=freqcount-1;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq=freqcount-1;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
       <br />
 
       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while ((freq&gt;=0) &amp;&amp; (foundfreq==false))<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while ((freq&gt;=0) &amp;&amp; (foundfreq==false))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; if (p-&gt;team == freqs[freq].freqteam)<br />
 
&nbsp;&nbsp;&nbsp; if (p-&gt;team == freqs[freq].freqteam)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; foundfreq=true;<br />
+
foundfreq=true;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freq].pilots[freqs[freq].playercount].name,
+
strncpy(freqs[freq].pilots[freqs[freq].playercount].name,
 
p-&gt;name, 20);<br />
 
p-&gt;name, 20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].playercount++;&nbsp;&nbsp;&nbsp;
+
freqs[freq].playercount++;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq--;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq--;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
       <br />
 
       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // didnt find freq in struct so add new freq<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // didnt find freq in struct so add new freq<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (foundfreq == false)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (foundfreq == false)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (manualsquads == false)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (manualsquads == false)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].freqname,
+
strncpy(freqs[freqcount].freqname,
 
p-&gt;squad, 20);<br />                                                   
 
p-&gt;squad, 20);<br />                                                   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                             <br />
 
                             <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (freqcount == 0)<br />
+
if (freqcount == 0)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; teamA = p-&gt;team;<br />
+
&nbsp;&nbsp;&nbsp; teamA = p-&gt;team;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(squadA,
+
&nbsp;&nbsp;&nbsp; strncpy(squadA,
 
p-&gt;squad, 20);<br />
 
p-&gt;squad, 20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; teamB = p-&gt;team;<br />
+
&nbsp;&nbsp;&nbsp; teamB = p-&gt;team;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(squadB,
+
&nbsp;&nbsp;&nbsp; strncpy(squadB,
 
p-&gt;squad, 20);<br />
 
p-&gt;squad, 20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;team == teamA)<br />
+
if (p-&gt;team == teamA)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].freqname,squadA,20);<br />
+
&nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].freqname,squadA,20);<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
       <br />
 
       <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (p-&gt;team == teamB)<br />
+
else if (p-&gt;team == teamB)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].freqname,squadB,20);<br />
+
&nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].freqname,squadB,20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; freqs[freqcount].freqteam = p-&gt;team;<br />         
 
&nbsp;&nbsp;&nbsp; freqs[freqcount].freqteam = p-&gt;team;<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                     <br />
 
                                                                     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].pilots[0].name, p-&gt;name, 20);<br />
 
&nbsp;&nbsp;&nbsp; strncpy(freqs[freqcount].pilots[0].name, p-&gt;name, 20);<br />
 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
     <br />
 
     <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freqcount].playercount++;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freqcount].playercount++;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqcount++;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqcount++;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
}<br />                                                                   
 
}<br />                                                                   
Line 2,181: Line 2,100:
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; while (parse)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br />   
+
Player *p = parse-&gt;item;<br />   
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                           <br />
 
                                           <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((p-&gt;ship != SHIP_Spectator)
+
if ((p-&gt;ship != SHIP_Spectator)
 
&amp;&amp; ((p-&gt;team == teamA) || (p-&gt;team == teamB)))<br />
 
&amp;&amp; ((p-&gt;team == teamA) || (p-&gt;team == teamB)))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // freq 100, team A<br />
+
&nbsp;&nbsp;&nbsp; // freq 100, team A<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // set freq<br />
+
&nbsp;&nbsp;&nbsp; // set freq<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq = 0;<br />  
+
&nbsp;&nbsp;&nbsp; freq = 0;<br />  
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                             <br />
 
                                             <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (p-&gt;team == teamB)<br />
+
&nbsp;&nbsp;&nbsp; if (p-&gt;team == teamB)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq = 1;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freq = 1;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                               <br />
 
                                               <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // number of pilots on freq counted so far, starts 0<br />
+
&nbsp;&nbsp;&nbsp; // number of pilots on freq counted so far, starts 0<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pilot = freqs[freq].playercount;<br />
+
&nbsp;&nbsp;&nbsp; pilot = freqs[freq].playercount;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                               <br />
 
                                               <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // pilot name<br />
+
&nbsp;&nbsp;&nbsp; // pilot name<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freq].pilots[pilot].name, p-&gt;name, 20);<br />
+
&nbsp;&nbsp;&nbsp; strncpy(freqs[freq].pilots[pilot].name, p-&gt;name, 20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // time stamp for playing time<br />
+
&nbsp;&nbsp;&nbsp; // time stamp for playing time<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].cplaying_time = GetTickCount();<br />
+
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].cplaying_time = GetTickCount();<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                               <br />
 
                                               <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // slot name<br />
+
&nbsp;&nbsp;&nbsp; // slot name<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (freqs[freq].playercount &lt; NUMBER_PILOTS)<br />
+
&nbsp;&nbsp;&nbsp; if (freqs[freq].playercount &lt; NUMBER_PILOTS)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
strncpy(freqs[freq].slotname[pilot], p-&gt;name, 20);<br />
 
strncpy(freqs[freq].slotname[pilot], p-&gt;name, 20);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br />
+
<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // increment freq player count<br />
+
&nbsp;&nbsp;&nbsp; // increment freq player count<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].playercount++;<br />
+
&nbsp;&nbsp;&nbsp; freqs[freq].playercount++;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                               <br />
 
                                               <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // if freq not already have name, give it player squad name<br />
+
&nbsp;&nbsp;&nbsp; // if freq not already have name, give it player squad name<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((manualsquads == false) &amp;&amp; (strlen(p-&gt;squad) &gt; 0))<br />
+
&nbsp;&nbsp;&nbsp; if ((manualsquads == false) &amp;&amp; (strlen(p-&gt;squad) &gt; 0))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freq].freqname, p-&gt;squad, 20);<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; strncpy(freqs[freq].freqname, p-&gt;squad, 20);<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,235: Line 2,154:
 
                                               <br />
 
                                               <br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set player ship<br />
 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // set player ship<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].ship = p-&gt;ship + 1;<br />
+
&nbsp;&nbsp;&nbsp; freqs[freq].pilots[pilot].ship = p-&gt;ship + 1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
}<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
+
parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; }<br />
 
}<br />                                                         
 
}<br />                                                         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                       </font></blockquote><font size="2">                                     
+
                       </blockquote>                                     
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,250: Line 2,169:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
       </font><blockquote><font size="2">&nbsp;&nbsp;&nbsp; int highest=-20;<br />
+
       <blockquote>&nbsp;&nbsp;&nbsp; int highest=-20;<br />
 
&nbsp;&nbsp;&nbsp; int mvp=0;<br />                                       
 
&nbsp;&nbsp;&nbsp; int mvp=0;<br />                                       
 
                                                                          
 
                                                                          
Line 2,257: Line 2,176:
 
&nbsp;&nbsp;&nbsp; for (pilot = freqs[mvpteam].playercount-1; pilot &gt;=0; pilot--)<br />
 
&nbsp;&nbsp;&nbsp; for (pilot = freqs[mvpteam].playercount-1; pilot &gt;=0; pilot--)<br />
 
&nbsp;&nbsp;&nbsp; {<br />
 
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (((freqs[mvpteam].pilots[pilot].kills
+
if (((freqs[mvpteam].pilots[pilot].kills
 
* 2) - freqs[mvpteam].pilots[pilot].deaths) &gt; highest)<br />
 
* 2) - freqs[mvpteam].pilots[pilot].deaths) &gt; highest)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mvp = pilot;<br />
+
&nbsp;&nbsp;&nbsp; mvp = pilot;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; highest = (freqs[mvpteam].pilots[pilot].kills
+
&nbsp;&nbsp;&nbsp; highest = (freqs[mvpteam].pilots[pilot].kills
 
* 2) - freqs[mvpteam].pilots[pilot].deaths;<br />
 
* 2) - freqs[mvpteam].pilots[pilot].deaths;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
}<br />
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
&nbsp;&nbsp;&nbsp; }<br />                                               
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                 </font></blockquote><font size="2">                           
+
                                 </blockquote>                           
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,274: Line 2,193:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                             </font><blockquote><font size="2">#include &quot;time.h&quot;<br />
+
                                             <blockquote>#include &quot;time.h&quot;<br />
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,286: Line 2,205:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                             </font></blockquote><font size="2">                               
+
                             </blockquote>                               
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
Line 2,293: Line 2,212:
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
                                                                        </font><blockquote><font size="2">// spawn.cpp (see data section for how to setup set_tag)<br />
+
  <blockquote>// spawn.cpp (see data section for how to setup set_tag)<br />
 
// see clientprot.h for weapon information<br />
 
// see clientprot.h for weapon information<br />
 
<br />
 
<br />
 
case EVENT_WatchDamage:<br />
 
case EVENT_WatchDamage:<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (PLAYING) &nbsp;// if tracking stats<br />
+
&nbsp;&nbsp;&nbsp; if (PLAYING) &nbsp;// if tracking stats<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
if ((wi.type == PROJ_PBomb) &amp;&amp; (p-&gt;name != k-&gt;name))<br />
 
if ((wi.type == PROJ_PBomb) &amp;&amp; (p-&gt;name != k-&gt;name))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT)
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT)
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_BOMB_TAKEN, get_tag(p, DMG_BOMB_TAKEN)
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_BOMB_TAKEN, get_tag(p, DMG_BOMB_TAKEN)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_TOTAL_TAKEN, get_tag(p, DMG_TOTAL_TAKEN)
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_TOTAL_TAKEN, get_tag(p, DMG_TOTAL_TAKEN)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (wi.type == PROJ_BBullet)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (wi.type == PROJ_BBullet)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_BULLET_DEALT, get_tag(k, DMG_BULLET_DEALT)
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_BULLET_DEALT, get_tag(k, DMG_BULLET_DEALT)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT)
 
&nbsp;&nbsp;&nbsp; set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_BULLET_TAKEN, get_tag(k, DMG_BULLET_TAKEN)
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_BULLET_TAKEN, get_tag(k, DMG_BULLET_TAKEN)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_TOTAL_TAKEN, get_tag(k, DMG_TOTAL_TAKEN)
 
&nbsp;&nbsp;&nbsp; set_tag(p, DMG_TOTAL_TAKEN, get_tag(k, DMG_TOTAL_TAKEN)
 
+ damage);<br />
 
+ damage);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />         
+
&nbsp;&nbsp;&nbsp; }<br />         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
   </font></blockquote><font size="2">                                                         
+
   </blockquote>                                                         
 
                                                                          
 
                                                                          
 
                                                                          
 
                                                                          
 
                           <a name="15s"></a>
 
                           <a name="15s"></a>
s) Simple way to print those stats<br />                            
+
s) Simple way to print those stats<br />
 
                                                                          
 
                                                                          
                                                                       
+
 
                                                      </font><blockquote><font size="2">case OP_Moderator:<br />
+
<blockquote>
{<br />
+
<pre>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (c-&gt;check(&quot;showstats&quot;))<br />
+
case OP_Moderator:
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
{
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(&quot;Showing stats:&quot;);<br />
+
if (c-&gt;check(&quot;showstats&quot;))
                                                                       
+
{
                                                                       
+
&nbsp;&nbsp;&nbsp; sendPublic(&quot;Showing stats:&quot;);
                                                                       
+
                                   
               <br />
+
                
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
&nbsp;&nbsp;&nbsp; _listnode &lt;Player&gt; *parse = playerlist-&gt;head;             
_listnode &lt;Player&gt; *parse = playerlist-&gt;head;<br />              
+
 
                                                                       
+
 
                                                                       
+
&nbsp;&nbsp;&nbsp; while (parse)  
                                                                       
+
&nbsp;&nbsp;&nbsp; {
<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while (parse) <br />
+
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (get_tag(p, DMG_TOTAL_DEALT) &gt; 0)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Player *p = parse-&gt;item;<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
                                                                       
+
char str[256];
                                                                       
+
&nbsp;&nbsp;&nbsp; sprintf(str, &quot;(%-20s Dmg Dealt: Total %0004d, Bomb %0004d, Bullet %0004d&nbsp; Dmg TAKEN: Total %0004d, Bomb %0004d, Bullet %0004d)&quot;,
                                                                       
+
p-&gt;name, get_tag(p,DMG_TOTAL_DEALT), get_tag(p,DMG_BOMB_DEALT), get_tag(p,DMG_BULLET_DEALT),
              <br />
+
get_tag(p,DMG_TOTAL_TAKEN), get_tag(p,DMG_BOMB_TAKEN), get_tag(p,DMG_BULLET_TAKEN));
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
sendPublic(str);
&nbsp;&nbsp;&nbsp; if (get_tag(p, DMG_TOTAL_DEALT) &gt; 0)<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
+
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char str[256];<br />
+
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
+
}
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sprintf(str, &quot;(%-20s Dmg Dealt: Total
+
</pre>
%0004d, Bomb %0004d, Bullet %0004d&nbsp; Dmg TAKEN: Total %0004d, Bomb %0004d,
+
     </blockquote><a name="15t"></a>
Bullet %0004d)&quot;, <br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; p-&gt;name, get_tag(p,DMG_TOTAL_DEALT),
 
get_tag(p,DMG_BOMB_DEALT), get_tag(p,DMG_BULLET_DEALT), <br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get_tag(p,DMG_TOTAL_TAKEN), get_tag(p,DMG_BOMB_TAKEN),
 
get_tag(p,DMG_BULLET_TAKEN));<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sendPublic(str);<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; parse = parse-&gt;next;<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />        
 
                                                                       
 
                                                                       
 
                                                                       
 
     </font></blockquote><font size="2"><a name="15t"></a>
 
 
t) Make bot spectate specific coordinates<br />
 
t) Make bot spectate specific coordinates<br />
                                                                                                                                                                                                                                                                                  </font><blockquote><font size="2">// make bot spectate the coord 512,600<br />
+
 
// possible use - capturing weapon packets in a specific region<br />
+
<blockquote>
                                                                                                                                                                                                                                                                                    <br />
+
<pre style="font-size: 11px">
tell(makeFollowing(false));<br />
+
// make bot spectate the coord 512,600
tell(makeFlying(true));<br />
+
// possible use - capturing weapon packets in a specific region
me-&gt;move(512 * 16, 600 * 16);<br />
+
 
tell(makeSendPosition(true));<br />
+
tell(makeFollowing(false));
                                                                                                                                                                                                                                                                                </font></blockquote>
+
tell(makeFlying(true));
 +
me-&gt;move(512 * 16, 600 * 16);
 +
tell(makeSendPosition(true));
 +
</pre>
 +
</blockquote>
 
</blockquote></blockquote>
 
</blockquote></blockquote>

Revision as of 00:08, 11 February 2005

Here is the ever-popular MERVBot Tutorial by Underlord:

Setup a MERVBot bot and project in visual c++
0) <a href="#0">Setting up a MERVBot bot</a>

Command.cpp
 1) <a href="#1">Player commands</a> (!play, !squadA vs squadB)

Spawn.cpp
 2) <a href="#2">Event descriptions</a> (describe events in spawn.cpp)
 2) <a href="#2">Messaging </a>("*arena hi", ":player:*scorereset)
 3) <a href="#3">MervBot Timer</a> (do this in 10 seconds)(countdown[n])
 4) <a href="#4">Writing Functions</a> (bool IsInCenter(Player *p))

Useful operations
 6) <a href="#6">Cycling players</a>
 7) <a href="#7">Check if pilot is in safe zone</a>
 8) <a href="#8">Random numbers</a>
 9) <a href="#9">Time without using countdown[n]</a>
10) <a href="#10">Storing data for pilots</a>
11) <a href="#11">Output data in messages</a>
12) <a href="#12">Input/Output to files</a>
13) <a href="#13">Programming commands</a>
14) <a href="#14">Useful player data</a>
15) <a href="#15">Bot built in functions</a>

Example Code

a) <a href="#15a">No antiwarp in center of map</a>
b) <a href="#15b">Setting freq size depending on how many pilots in game</a>
c) <a href="#15c">Tracking kills and announcing when pilot gets 10 kills in a row without dying </a>
d) <a href="#15d">Warp pilot to coord when they are in a certain region</a>
e) <a href="#15e">Structures within structures</a>
f) <a href="#15f">Tracking flag data</a>
g) <a href="#15g">Way to do simple /!spam feature</a>
h) <a href="#15h">Implementing a simple stack to do "next in line for several 'boxes' at once"</a>
i) <a href="#15i">Reading any text from a .txt and printing it to pilot line by line</a>
j) <a href="#15j">Example of printing player stats grid</a>
k) <a href="#15k">Example of checking if any pilots are within a region</a>
l) <a href="#15l">Example of functions to get a pilot's struct id info from a name or *player info</a>
m) <a href="#15m">Example of creating a logfile name using date and squad names</a>
n) <a href="#15n">Sending messages to playing freqs or public and logging depending on status</a>
o) <a href="#15o">Example of reading in all player/freqs to struct data</a>
p) <a href="#15p">Example of finding MVP from struct data</a>
q) <a href="#15q">Print time stamp of event</a>
r) <a href="#15r">Simple way to track player bomb/bullet damage stats</a>
s) <a href="#15s">Simple way to print those stats</a>
t) <a href="#15t">Make bot spectate specific coordinates</a>

Setting up a MERVBot bot (plugin)

MERVBot download site:  http://catid.sscentral.com/

MERVBot Forum:  http://www.ssforum.net/  (Development - MervBot forum)

Download MERVBot Build 37 (DLL 6.5)

Unzip MERVBot.zip into a new folder. (example c:\program files\continuum\mervbot)

Unzip src.zip into "/src" subfolder of that new folder (example c:\program files\continuum\mervbotsrc)

Download DLL-plugin Tutorial

Unzip Tutorial.zip into "/tutorial" subfolder of that new folder. (example c:\program files\continuum\mervbot\src\tutorial)
(note spawn.h, spawn.cpp, and command.cpp are here)

File descriptions:

spawn.h = declare/initialize globals
command.cpp = code for commands coming into bot (ie /!help, /!play, etc)
spawn.cpp = code for main part of bot

Note: if you only want to execute someone's premade bot (.dll), skip to step 4 (Run your bot .dll), otherwise continue to learn how to make your own bot

Microsoft Visual c++

  1. Start Visual Studios 6.0.
  2. Click the Drop Down Menu labeled "File" at the top left of your screen.
  3. Click "New".
  4. On the next screen that comes up, choose from the Project tab, then Win32 Dynamic-Link Library
  5. Select the "/src" folder as the base folder (example c:\program files\continuum\mervbot\src)
  6. Name your project "mybot". This will make a "mybot" subfolder in your "src" folder. Click OK. (example creates c:\program files\continuum\mervbot\src\mybot)
  7. Choose to create an "Empty DLL project".
  8. Click "Finish".
  9. Click the Drop Down Menu labbled "Project".
  10. Click "Add To Project Files"
  11. Copy only spawn.h, spawn.cpp, and command.cpp from the "tutorial" folder into the this new folder. (example from c:\program files\continuum\mervbot\src\tutorial to c:\program files\continuum\mervbot\src\mybot)
  12. Click the Drop Down Menu labelled "Build".
  13. Click "Build (dll name)" - where the (dll name) is "mybot"
  14. Go into your "mybot" folder and look for a folder named "Debug" (example c:\program files\continuum\mervbot\src\mybot\debug)
  15. Your new DLL will be in that folder. (example mybot.dll)
  16. Copy mybot.dll to your base folder that has mervbot.exe in it (example c:\program files\continuum\mervbot)

Run your bot dll

To run your bot you need your DLL (mybot.dll), Commands.txt, MERVBot.exe, MERVBot.ini, Operators.txt, Spawns.txt, subspace.bin, and zlib.dll all in one folder (example c:\program files\continuum\mervbot).

  1. Edit spawns.txt (only one line of text in file needed)
    bot_name : pw_for_bot_name : arena: dll_plugin : optional_staff_password

    Example: 2v2-Bot-League : botpw: 2v2a: 2v2league : staffpw

    - You should create your bot name and pw using your Continuum client as you would create any new name.
    - There is no * in front of staffpw.
    - Bot needs to be on vip.txt or have moderator+ access to enter a zone.

  2. Edit MERVBot.ini
    [Login]
    Zone=216.33.98.254:21000	// make that your zone IP:PORT available from zone.dat in Continuum dir
    


  3. Edit operators.txt

    access_level : name :

    Example:

    4:my_name:
    4:another_sysop:
    3:other_person:
    
  4. Run MERVBot.exe

    Double click MERVBot.exe, the bot should now enter the zone

  5. Modify your MERVBot code

    You can open your MERVBot project by opening "mybot.dsw" file with visual c++. (example c:\program files\continuum\mervbot\src\mybot\mybot.dsw)

    Edit the spawn.h, spawn.cpp, and command.cpp to create your bot, then build, copy your updated dll to your MERVBot.exe folder and then execute the bot.

    Use the tutorial to get ideas on how to implement certain types of features into the bot.

    Player Commands - (command.cpp)

    This section describes how to implement player commands into MERVBot

    (example: if you want /!test to make the bot respond with "hi")

    In command.cpp

    void botInfo::gotCommand(Player *p, Command *c) {
    	switch (p->access) {
    	case OP_Player:
    		{
    			if (c->check("test"))
    			{
    				sendPrivate(p,"hi");
    			}
    		}
    

    You just put your player command where 'test' is, then what you want that command to do.
    If you want the command to be for moderators you put it in the OP_Moderator section instead:

    case OP_Moderator:
    {	// Moderator-level commands
    }
    	// Note: Moderators can do Player commands, SuperModerator can do Moderator and Player commands, etc.
    

    How to have commands with numerical input - (ie !test 1)

    	if (c->check("test")) { // reads in test #, default to 1 if invalid number input
    		int temp = 1;
    
    		if (isNumeric(c->final))
    			temp = atoi(c->final);
    

    How to have player name as input - (ie !rank player)

    	if (c->check("rank")) {
    
    		String player_name = c->final;
    
    		if (player_name.IsEmpty())    // default name to self if invalid name
    			player_name = p->name;
    

    How to have complicated input - (ie !squads squadA vs squadB _OR_ !squads teamA:squadA:teamB:squadB)

    You parse the c->final message looking for identifiers, then divide the string to get the values

     else if (c->check("squads"))<br />
     {<br />
         strncpy(squadA, "", 20);<br />
         strncpy(squadB, "", 20);<br />
                <br />
         char s[256];<br />
         strncpy(s,c->final,255);<br />
                <br />
         int l= strlen(s) - 1;<br />
                <br />
         for (int i=0; i<l; i++)<br />
         {<br />
             // team1 vs team2<br />
           
     if ((s[i]==' ') && (s[i+1]=='v') && (s[i+2]=='s') &&
    (s[i+3]==' '))<br />
             {<br />
               s[i]=0;<br />
               strncpy(squadA, s,20);<br />
               s[i]=' ';<br />
           
       strncpy(squadB, &(s[i+4]),20);<br />
               break;<br />
             }<br />
             <br />
             // freq1:team1:freq2:team2<br />
             if (s[i] == ':')<br />
             {<br />
      char s2[256];<br />
           
         teamA = atoi(s);<br />
           
         strncpy(s2,&(s[i+1]),255);<br />
                <br />
           
         for (int j=0; j < strlen(s2); j++)<br />
           
    	 if (s2[j] == ':')<br />
           
    	 {<br />
           
    	     char s3[256];<br />
                <br />
           
    	     s2[j]=0;<br />
           
    	     strncpy(squadA,s2,20);<br />
           
    	     s2[j]=':';<br />
           
    	     <br />
           
    	     strncpy(s3,&(s2[j+1]),255);<br />
                <br />
           
    	     for (int k=0;
    k<strlen(s3); k++)<br />
           
    	       
     if (s3[k]==':')<br />
           
    	       
     {              
         <br />
           
    	       
         teamB = atoi(s3);<br />
           
    	       
         strncpy(squadB,&(s3[k+1]),20);<br />
           
    	       
         break;<br />
           
    	       
     }<br />
           
    	     break;<br />
           
    	 }<br />
                 break;<br />
             }<br />
          }<br />
    

     </blockquote>

     
    // Example of a help menu (!help) spawn.h
    void botInfo::gotHelp(Player *p, Command *c)

    {
        if (!*c->final)
        {
    sendPrivate(p, "4v4 Bot General Commands:");
    sendPrivate(p, "------------------------");
            sendPrivate(p, "!caps               - get captain names");
    sendPrivate(p, "!roster <squad>     - get roster of a squad");
    sendPrivate(p, "!schedule           - get current schedule");
            sendPrivate(p, "!score              - get current score");
           

     

    Event Call Descriptions - in spawn.cpp

    MERVBot is event based, so when making a bot you need to decide what will happen at certain events

    Normal plugins need to consider what happens when bot enters arena, player enters arena, player leaves arena,
    player events like kill, shipchange, teamchange, spec, move then any other relevent events to your bot
    just worry about events that are relevent to the tasks your bot is doing

    // Timer

    case EVENT_Tick:      - called 1x/sec, decrementing each countdown[n] by 1, use for time triggered events

    // Arena Events

    case EVENT_ArenaEnter:         - called when bot enters arena

    case EVENT_ArenaSettings:     - called when bot gets arena settings

    case EVENT_ArenaLeave:        - called when bot exits arena

    case EVENT_ArenaListEntry:     - called when bot gets an entry from the arena list (esc-a)

    case EVENT_ArenaListEnd:     - called when bot reads last entry of arena list (esc-a)

    // Flag Events

    case EVENT_FlagGrab:        - called when a pilot picks up a loose flag

    case EVENT_FlagDrop:        - called when a pilot drops a flag (timer runs out)

    case EVENT_FlagMove:        - called when a flag moves

    case EVENT_FlagVictory:        - called when a team wins flag game (gets all flags)

    case EVENT_FlagReward:        - called when theres a periodic flag reward given

    // Timed Game

    case EVENT_TimedGameOver:    - called when a timed game is over (like speed zone game)

    // Soccer

    case EVENT_SoccerGoal:        - called when a soccer goal is scored

    case EVENT_BallMove:        - called when a soccer ball moves

    // Receive file

    case EVENT_File:        - called when a file is received (*getfile)

    // Player events

    case EVENT_PlayerEntering:    - called when a pilot enters the arena

    case EVENT_PlayerMove:        - called when a pilot's ship moves

    case EVENT_PlayerWeapon:    - called when a pilot fires a weapon
    case EVENT_WatchDamage:        - called when a pilot takes damage (bot must have /*watchdamage on for them)

    case EVENT_PlayerDeath:        - called when a pilot dies

    case EVENT_PlayerScore:        - called when a pilot changes their score (?scorereset)

    case EVENT_PlayerPrize:        - called when a pilot gets a prize (green)

    case EVENT_PlayerShip:        - called when a pilot ship changes

    case EVENT_PlayerSpec:        - called when a pilot spectates

    case EVENT_PlayerTeam:        - called when a pilot changes freqs

    case EVENT_PlayerLeaving:    - called when a pilot exits arena (esc-q, ?go <arena>, or lagout)

    // Bot events

    case EVENT_SelfShipReset:    - called when bot's ship gets reset

    case EVENT_SelfPrize:        - called when bot gets a prize (green)

    case EVENT_SelfUFO:        - called when bot toggles UFO mode

    case EVENT_PositionHook:    - called when "Core is requesting the DLL to send a position packet"

    // Brick

    case EVENT_BrickDropped:    - called when a pilot uses a brick

    // Objects

    case EVENT_ObjectToggled:    - called when a .lvz object is toggled on/off

    // Turrets

    case EVENT_CreateTurret:    - called when a pilot attaches to another pilot (f7)

    case EVENT_DeleteTurret:    - called when a pilot detaches from a turret

    // Messages

    case EVENT_Chat:        - called when bot gets a chat message

    case EVENT_LocalCommand:    - called when bot gets a player command from arena

    case EVENT_LocalHelp:        - called when bot gets a player !help command

    case EVENT_RemoteCommand:    - called when bot gets a command from outside arena

    case EVENT_RemoteHelp:        - called when bot gets a player !help command from outside arena

    case EVENT_Init:        - called when DLL is loaded

    case EVENT_Term:        - called when DLL is unloaded

                 
    <a name="3"></a>

    Messaging - How to use the messaging system

    Private message - void sendPrivate(Player *player, char *msg);
    Examples:

    a) sendPrivate(p,"hi");
    b) String s="test"; sendPrivate(p,s);
    c) String s="test"; s += "ing"; sendPrivate(p,s);

     
    d) char captain1[20]; char captain2[20];

    strncpy(captain1,"",20); strncpy(captain2,"",20);
    sendPrivate(p,(String) captain1 + " and " + (String) captain2 + " are the captains.");

     
     
     
    Team message - void sendTeamPrivate(Uint16 team, char *msg);
    Examples:

    a) sendTeamPrivate(8025,"hi spec freq");
    b) Uint16 test=0; sendTeamPrivate(test,"hi freq 0");

     
     
    Public message - void sendPublic(char *msg);
    Example: sendPublic("*arena " + (String) p->name + " is now a captain");

    Chat channel message - void sendChannel(char *msg);

    Example: sendChannel("hi chat channel");

    Remote private message - void sendRemotePrivate(char *name, char *msg);

    Example: sendRemotePrivate("Player01", "hi");
     
     
    Note: to have bot print several lines of text fast it needs sysop in the

    arena (sysop in arena bot first spawns to also) otherwise it'll print slow to avoid being kicked for spam

                                       
    <a name="4"></a>

    Timer - How to use the timing function

    Setup number of timers and initialize:
    // spawn.h - specify how many timers
     
    class botInfo

    {

    int countdown[10];   // this gives you 10 timers
     
     // spawn.h - initialize timers

        
            public:
            botInfo(CALL_HANDLE given)
            {
            countdown[0] = 0;
            countdown[1] = 60; // 60 seconds
            //
            // initialize values
            //
            countdown[9] = 5*60; // 5 minutes

                                               Using timer functions:
       // in spawn.cpp


        case EVENT_Tick:
        {
            for (int i = 0; i < 10; ++i)
                --countdown[i];

            if (countdown[1] == 2) // when timer #1 hits two seconds
            {
            // do stuff here when timer #1 hits 2 seconds
            // example: sendPublic("two seconds left, setting timer to 1 minute");
            // example: countdown[1] = 60;  // change timer #1 value
            }

     

        Notes:  - In the "for" loop, you want "i < 10" to be the number of timers from spawn.h

            - The timer is in seconds. EVENT_Tick is called once per second.
            - The timers decrease by one each second down, not stopping at 0.

            - You can change the value of the countdown[n]'s in other parts of the program
            (ie.  case EVENT_PlayerDeath: { countdown[1] = 45;  // set timer #1 to 45 sec
            everytime someone dies)

     
                                                  
    <a name="5"></a>

    Writing Functions

    Write your function in spawn.cpp at top of file in the //////// DLL "import" //////// section
        //////// DLL "import" ////////


        bool closeto(Player *p, int x, int y, int tolerance)  // note uses abs() function declared elsewhere
        {
                // return if player p is in area of square with center x,y and radius = tolerance

            return (abs((p->tile.x) - x) < tolerance) && (abs((p->tile.y) - y) < tolerance);


                    }

    If

    you want your function to have access to data from the spawn.h botInfo section

    public:

        botInfo(CALL_HANDLE given)
        {

       // then you need to make your spawn.cpp function in the format:

            bool botInfo::closeto(Player *p, int x, int y, int tolerance)
            {
              // function here
             }

    Include function in spawn.h at bottom of file with the other functions

        public:

        botInfo(CALL_HANDLE given)

        {

        }

        bool closeto(Player *p, int x, int y, int tolerance);
         // your new function. note: w/o botInfo keyword and with a ;

        void clear_objects();  // functions already there

        void object_target(Player *p); // functions already there
     
     
     
    Pass values by reference
    bool botInfo::closeto(Player *p, int& x, int y, int tolerance)  // note the &


    bool is_close = closeto(p,x,y,tolerance);  // if x is changed in closeto() its saved here

     
     
    Pass array as parameter
    int freqs[5];


    my_function(freqs);  // call function - notice freqs and not freqs[5] or freqs[]

    void my_function(int freqs[]) {}  // function - notice freqs[] and not freqs[5] or freqs

     

    <a name="6"></a>

    Cycling players- How to search through the players in the arena

        _listnode <Player> *parse = playerlist->head;

        
        while (parse)
        {
            Player *p = parse->item;

            // do functionality here
            // Example 1: sendPrivate(p,"*watchdamage"); // turns on all pilot's watchdamage
            // Example 2: if (p->safety != 0) sendPrivate(p,"*spec"); // spec all pilots in safe zone

            parse = parse->next
          }

                                                               

    Checking if pilot is in a safe zone

        if (p->safety != 0)  // pilot is in a safe zone

        if (p->safety == 0)  // pilot is NOT in a safe zone

        To detect a pilot entering a safe zone do:

            case EVENT_PlayerMove:
            {
                if (p->safety != 0)


    Random number

    Method 1 (completely random)
        #include "time.h"


        srand(time(NULL));
        rand();
        int temp = (int) (51 * ((float)rand()/RAND_MAX));  // returns a random integer between 0 and 51

                                                                     

    Method 2 (random pilot in arena)

        #include <stdlib.h>


        int temp = GetTickCount() % getIngame();  // getIngame() = how many pilots in arena

        _listnode <Player> *parse = playerlist->head;
        while (parse)
        {
            Player *p = parse->item;

            if (p->ship != SHIP_Spectator){  // if not in spec
            if (!(--temp) {  // decrement temp, if its 0, make this pilot rabbit
                rabbit = p;
                break;
                }}
        parse = parse->next;
        }

     
                                                                       
    <a name="9"></a>

    Tracking time not using countdown[n]

        #include <stdlib.h>


        int temp = GetTickCount(); // get time stamp
        // later in program
        temp = (GetTickCount() - temp)/1000; // how many seconds have passed

                                                                        

    Storing data for pilots

    There are several ways to store data for pilots (ie tracking flagtime or kills in a period of time)


    1) get/setTag - use if you only want to track data until pilot leaves arena then its erased
    built in tags track by an ID that is reset when pilot leaves/enters arena, so loses track of data once they leave arena

    2) modified perm get/setTag - use if you want to track all pilots even if they leave (advantage - easier to sort by player)
    also can track near unlimited amount of pilots

    3) structs - use to track all pilots even if they leave, (advantage - easier to sort by freqs), have to specify bound of players

    note: 2 and 3 are similar in effect, mostly the difference is in how you are able to search through data
    you need to decide which method of storing data is best for each bot depending on what it does
    beware using modified perm get/setTag if bot is in an arena for long periods of time, data is not reset so the linkedlist could get huge

    // initialize values in spawn.h at very top

    1) Built in get/setTag method
        #define DMG_DEALT        0

        #define DMG_TAKEN        1

        // in spawn.cpp initialize the values on arena-enter and player-enter
        
            case EVENT_ArenaEnter: {

                _listnode <Player> *parse = playerlist->head;

                while (parse) // do for all pilots in arena when bot enters
                {
                    Player *p = parse->item;  // get pilot

                    set_tag(p, DMG_DEALT, 0); // initialize to 0
                    set_tag(p, DMG_TAKEN, 0);
                
                    sendPrivate(p,"*watchdamage");  // optionally turn on player *watchdamage

                    parse = parse->next;  // get next pilot
                    }
                }

            case EVENT_PlayerEntering: {

                set_tag(p, DMG_DEALT, 0); // initialize to 0
                set_tag(p, DMG_TAKEN, 0);

                sendPrivate(p,"*watchdamage");

        // then somewhere edit the tag values

            case EVENT_WatchDamage:  {

                // sets tag for k (shooter) to be old value plus damage dealt currently
                set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT) + damage);

     // how to retrieve the tag values

            // as a command in spawn.h

            else if (c->check("showstats")) {

                int temp = get_tag(p, DMG_TOTAL_DEALT);

                String s = "You've done ";
                s += temp;
                s += " damage so far!";

                sendPrivate(p,s);

        // kill tags when player leaves arena

            case EVENT_PlayerLeaving: {

                killTags(p);

    2) Modified permanent get/setTag method
    // same as get/setTag with some modifications to the tag code, then can use tags exactly as above


    // spawn.h, add char name[20]; into struct PlayerTag

    struct PlayerTag

    {
        Player *p;
        char name[20];
        int index;
        int data;
    };

    // spawn.cpp, modifications

    case EVENT_PlayerLeaving:

    {
        Player *p = (Player*)event.p[0];

        // killTags(p);  // remove so tag not deleted on arena exit

     
    int botInfo::get_tag(Player *p, int index)

    {
        _listnode <PlayerTag> *parse = taglist.head;
        PlayerTag *tag;

        while (parse)
        {
    tag = parse->item;

    // if (tag->p == p)
    if (strcmp(tag->name,p->name)==0)  // now tracking by player name, not ID
    if (tag->index == index)
        return tag->data;

    parse = parse->next;
        }

        return 0;
    }

    void botInfo::set_tag(Player *p, int index, int data)
    {
        _listnode <PlayerTag> *parse = taglist.head;
        PlayerTag *tag;

        while (parse)
        {
    tag = parse->item;

    //if (tag->p == p)
           if (strcmp(tag->name,p->name)==0) // now tracking by player name, not ID
    if (tag->index == index)
    {
        tag->data = data;
        return;
    }
    parse = parse->next;
        }

        tag = new PlayerTag;
        // tag->p = p; // not tracking by ID anymore
        strncpy(tag->name, p->name, 20); // tracking by player name
        tag->index = index;
        tag->data = data;
        taglist.append(tag);

    }
     

    3) Using Struct's

    struct name                    

        {                         

        // variables                  

        };

    // Example: (in spawn.h)

    class botInfo

    {

    struct freqdata {
    int kills;
     int deaths;
    };

    freqdata freqs[100]; // 100 of those structs

    // then access it in spawn.cpp using
    freqs[56].kills = 1;

     
             

    Output of data/messages

             

        using normal Strings

             

            // does *arena X pilots left in the game.

             

             String s = "*arena ";
             s += temp;  // some variable (int)
             s += " pilots left in the game.";
             sendPublic(s)

    OR
     
    sendPublic("*arena " + (String) temp + " pilots left in the game.");


            

        example using sprintf to align/space data

             
                // output data

    will be in this approximate format (not lined up perfectly because of html)

             
                //


                // Squad: squadname       PTS     FPTS    K    D  DMG DEALT TAKEN   F  FK    FLT
                // ----------------------------------------------------------------------------------------

                            //
    

    PlayerA          

             10000        500 
     116  101                
      9999     99999 10 150 980:55
              

     // PlayerB                        500        200     7     5                9999    99999  5      3     0:04

             

                char str[255];

                              sendPublic("*arena----------------------------------------------------------------------------------");

                sprintf(str, "*arena Squad: %-20s   PTS     FPTS   K   D  DMG DEALT  TAKEN  F  FK    FLT",freqs[freq].freqname);
                sendPublic(str);

                              sendPublic("*arena----------------------------------------------------------------------------------");

                // assuming existing freqs struct with data
                for (pilot=freqs[freq].playercount-1; pilot>=0; pilot--)
                {
                    // on freq squad so print stats
                    char outString[255];

             

                    sprintf(outString, "*arena %-20s %12d %8d %3d %3d %10d %6d %2d %3d %3d:%02d",freqs[freq].pilots[pilot].name,
                    freqs[freq].pilots[pilot].points, freqs[freq].pilots[pilot].flagpoints, freqs[freq].pilots[pilot].kills,
                    freqs[freq].pilots[pilot].deaths, freqs[freq].pilots[pilot].dmgdealt, freqs[freq].pilots[pilot].dmgtaken,freqs[freq].pilots[pilot].flags,
             freqs[freq].pilots[pilot].flagkills, freqs[freq].pilots[pilot].flagtime /60, freqs[freq].pilots[pilot].flagtime %60);
                    
                    sendPublic(outString);
                }

             

                // Notes: sprintf format = sprintf(output char string, spacing, variables)
                // Notes: s = chars, d = integer, - = left align, right align default
                // Notes: doing %02d = put 0 in front if not 2 digits, %3d:%02d makes 0:04 format

             

    <a name="12"></a>

    Input/Output to files

    Input to file
    // example reading from duel.ini looking for line that starts with MaxBoxes= then taking the next char as value to store as

    // MAX_BOXES (ie duel.ini = MaxBoxes=5)

    1. include <fstream>

    using namespace std;

    ifstream file("duel.ini");
        char line[256];

        // read in MaxBoxes=X
        while (file.getline(line, 256))
        {
    if (CMPSTART("MaxBoxes=", line))
    {
        MAX_BOXES = atoi(&(line[9]));
        break;
    }
        }

    Output to file


    // normal char output


    #include <fstream>


    using namespace std;


    ofstream file("duelleaguestat.inc", ios::app);   // app = put all data at end of file


    file << squad1<< endl;  // squad1 = char[20]

    file << " vs "<< endl;

    file << squad2<< endl;  // squad2 = char[20]


                                                         // how to output String's
    

    to file (key is converting String to (char*) to file write)


    String str = freqs[freq].slotname[slot];

    str += ", Repels: " + (String)(int) t->repel;

                       

    outf << endl;

    outf << (char*) str;

                                                           

    // date and time stamp

    #include "time.h"


    char u[100];
    time_t t=time(NULL);
    tm *tmp = localtime(&t);
    strftime(u,99,"%c",tmp);
    sendPublic("Date and time: " + (String) u);


     
     
    Example reading input from file using "GetPrivateProfileString" (from rampage plugin)
    format of rampage.ini
    7=is on a killing spree! (6:0)
    10=is opening a can of whoop-ass! (9:0)

    read input

    rampageini.h
    #pragma once
    1. ifndef RAMPAGEINI_H
    2. define RAMPAGEINI_H


    1. define NUM_RANKS 10
    2. define BUFFER_LEN 256


    struct RampageSettings
    {
        char quotes[NUM_RANKS][BUFFER_LEN];
    };

    void LoadSettings(RampageSettings &setts);

    1. endif    // RAMPAGEINI_H

    rampageini.cpp

    #include "rampageini.h"

    static char buffer[BUFFER_LEN];
    static char path[BUFFER_LEN];

    1. include "../algorithms.h"
    2. define WIN32_LEAN_AND_MEAN
    3. include <windows.h>


    char *rank_type[10] = {
        "7",
        "10",
    };

    void LoadSettings(RampageSettings &setts)
    {
        GetCurrentDirectory(BUFFER_LEN - 64, path);
        strcat(path, "\rampage.ini");


        for (int i = 0; i < NUM_RANKS; ++i)
        {
            GetPrivateProfileString("Comments", rank_type[i], "-ERROR-", setts.quotes[i], BUFFER_LEN, path);
        }
    }

     
     
     

    Simple programming commands

    simple commands    

        declare/initialize variables   // example:  int temp;  int temp2 = 1;  temp2 = 3;  
                                                // bool check = true; check = false;


        if (condition) {}                // example: if (a > b) { a++; }


        if (condition) {} else {}             // example: if (b <= 0) { b--; } else { a++; }


        while (condition) {}                // example: while (b > 0) { b--; }


        for (initialize; condition; increment){}    // example: for (a=1; a < 10; a++) { a = a + b; }

                                                                                           array
    single dimension
    int teams[100];   // create 100 hundred teams 0-99


    teams[50] = 1;

    multi-dimensional

    int teams[100][50];  // multidimensional arry


    teams[99][49] = 2;

    variable size

    String *list = new String[amount+1]; // string array with size amount (variable) + 1;


    list[amount-1] = "hi";

     

    struct    

        struct name          

     

        {                           

        // variables                 


        };

    // example:

    struct freqdata { int kills; int deaths; };


    freqdata freqs[100]; // 100 of those structs


    freqs[56].kills = 1;  // access struct

     
                                                                                           switch    
    switch (variable)          

      

        {                            

            case n:              

            { }                      

            break;                        

                                              

            case m:            

            {  }                           

            break;            


            


            default:


            break;


        }

     
    // Example:

    switch (p->ship) {


        case SHIP_Warbird:  {
    sendPrivate(p,"You're in a warbird");
    }  break;


            default:

                break;
     
     
     
                     

    Useful Player data

    // useful data stored by MervBot about each player (player.h)


    p->name = player name stored as char[20]
    p->squad = player squad stored as char[20]
    p->ship = ship (0-7) enumerated as SHIP_Warbird, SHIP_Spectator, etc..
    p->safety = if ship is in safety zone (boolean)
    p->bounty = player bounty
    p->energy = player energy (have bot with *energy on to get accurate readings)
    p->flagCount = how many flags player is holding

    p->team = player frequency
    p->(burst, repel, thor, brick, decoy, rocket, portal) = how many items of that type player has
    p->(stealth, cloak, xradar, awarp, ufo, flash, safety, shields, supers) = if player has that item on (boolean)

    p->score.killPoints = player kill points
    p->score.flagPoints = player flag points
    p->score.wins = player kills from f2
    p->score.losses = player deaths from f2

                                       

    Bot built in functions

    // useful MervBot commands to control what the bot is doing


    // player.cpp
    Player::move(Sint32 x, Sint32 y)  // example  me->move(512,512) - bot moves to coord 512 512
    Player::clone(Player *p) // example  me->clone(p)

    // dllcore.cpp (descriptions of functions in dllcore.h)

    BotEvent makeEcho                (char *m);
    BotEvent makeSay                (int t, int s, int i, char *m);

    BotEvent makeShip                (int s);
    BotEvent makeTeam                (int t);
    BotEvent makeGrabFlag            (int f);
    BotEvent makeSendPosition        (bool reliable);
    BotEvent makeDropFlags            ();

    BotEvent makeDeath                (Player *p);
    BotEvent makeAttach                (Player *p);
    BotEvent makeDetach                ();
    BotEvent makeFollowing            (bool f);
    BotEvent makeFlying                (bool f);
    BotEvent makeBanner                (BYTE *b);
    BotEvent makeDropBrick            ();
    BotEvent makeFireWeapon            (void *weapon_info);

    BotEvent makeToggleObjects        (Uint16 player, Uint16 *objects, int num_objects);

    BotEvent makeSpawnBot            (char *name, char *password, char *staff, char *arena);
    BotEvent makeChangeArena        (char *name);
    BotEvent makeChangeSettings        (_linkedlist <String> *settings);

    // example how to use them:

    tell(makeFollowing(false));

    // look in Commands.txt , command.cpp (core), or /!help to bot to see all bot external commands (example /!go <arena>)

    Example Code

    <a name="15a"></a> a) No antiwarp in center of map (take green away and warn)


    // using function closeto() and abs()
     

    bool closeto(Player *p, int x, int y, int tolerance) {
        return (abs((p->tile.x) - x) < tolerance) && (abs((p->tile.y) - y) < tolerance); }

    inline int abs(int n) {
        if (n < 0)    return -n;
        else        return n; }

    radius = 35;  // global variable
     
    case EVENT_PlayerMove: {

        Player *p = (Player*)event.p[0];

        // no anti in center
        if ((p->ship != SHIP_Spectator) && (p->awarp)) {
            if (closeto(p, 512, 512, radius)){
                sendPrivate(p, "*prize #-20");
                sendPrivate(p, "*warn Antiwarp is not allowed in center.");
            }

        }


                  <a name="15b"></a>
    

    b) Setting freq size depending on how many pilots in game


    case EVENT_Tick:  {

    if (countdown[0] == 0) {     // assuming countdown[0] initialized to > 0  in spawn.h, freqchange=0;

                    _listnode <Player> *parse = playerlist->head;
            int count = 0;

            while (parse)
            {
                Player *p = parse->item;

                if (p->ship != SHIP_Spectator)
                ++count;

                parse = parse->next;
            }

            if ((count > 24) && (freqchange != 4))
            {
                sendPublic("?set team:maxperteam:4");
                String s;
                s = "Max freq size 4  (";
                s += count;
                s += " pilots in game)";
                sendPublic(s);
                freqchange = 4;
            }

            if ((count < 25) && (count > 14) && (freqchange != 3))
            {
                sendPublic("?set team:maxperteam:3");
                String s;
                s = "Max freq size 3  (";
                s += count;
                s += " pilots in game)";
                sendPublic(s);
                freqchange = 3;

            }
    countdown[0] = 120;
    }
                                                        <a name="15c"></a>  c) Tracking kills and announcing when pilot gets 10 kills in a row without
    

    dying


    case EVENT_PlayerDeath:  {
    // assuming tags are setup (see storing data section)

    set_tag(p,KILLS, 0);  // pilot died, reset to 0 kills in a row
    set_tag(k, KILLS, get_tag(k, KILLS) + 1);  // pilot killed someone, increment kills in a row by 1

    if (get_tag(k,KILLS) == 10)  sendPublic("*arena (String) k->name + " has gotten 10 kills.");


                            <a name="15d"></a>
    

    d) Warp pilot to coord when they are in a certain region


    // using functions closeto() and abs()

    bool closeto(Player *p, int x, int y, int tolerance) {

        return (abs((p->tile.x) - x) < tolerance) && (abs((p->tile.y) - y) < tolerance); }

    inline int abs(int n) {

        if (n < 0)    return -n;

        else        return n; }

    case EVENT_PlayerMove:    {

    if (closeto(p, 509, 509, 2)) {  // if pilot within 2 of map coord 509,509

        sendPrivate(p, "*warpto 509 504");  // warp to coord 509,504


                              
    <a name="15e"></a>

    e) Structures within structures (spawn.h botinfo)


        // Declare in spawn.h
        struct playerstats

        {
    char name[20];

    int kills;
    int deaths;
    Uint16 points;
    Uint16 flagpoints;
    int flagtime;
    int cflagtime;
    int flags;
    int flagkills;

    int dmgdealt;
    int dmgtaken;

        };

        struct freqdata
        {
    playerstats pilots[100];

    int freqpoints;
    char freqname[20];
    int freqflagpoints;
    Uint16 freqteam;
    int freqflagtime;

    int flags;
    int kills;
    int deaths;
    int flagkills;

    int dmgdealt;
    int dmgtaken;

    int playercount;
        };

        freqdata freqs[100];
    // Initialize in spawn.cpp
    void botInfo::Clear()

    {
        // initialize/clear struct data
        for (int n=99; n>=0; n--)
        {
    freqs[n].freqteam=-1;
    freqs[n].freqpoints=0;
    freqs[n].freqflagpoints=0;
    freqs[n].playercount=0;
    freqs[n].flags=0;
    freqs[n].kills=0;
    freqs[n].deaths=0;
    freqs[n].freqflagtime=0;
    freqs[n].flagkills=0;
    freqs[n].dmgdealt=0;
    freqs[n].dmgtaken=0;

    for (int m = 99; m>=0; m--)
    {
        freqs[n].pilots[m].deaths=0;
        freqs[n].pilots[m].kills=0;
        freqs[n].pilots[m].points=0;
        freqs[n].pilots[m].flagpoints=0;
        freqs[n].pilots[m].flagtime=0;
        freqs[n].pilots[m].cflagtime=0;
        freqs[n].pilots[m].flags=0;
        freqs[n].pilots[m].flagkills=0;
        freqs[n].pilots[m].dmgdealt=0;
        freqs[n].pilots[m].dmgtaken=0;
    }
        }

    }
     
    // Access data in spawn.cpp
    int freq = p->team;

    freqs[1].pilots[2].kills++;

    OR

    freqs[freq].deaths++;


                   <a name="15f"></a>
    

    f) Tracking flag data

    Example GetPilot() function  (using structs from example e)
    bool botInfo::GetPilot(Player *p)

    {
        // get a pilots freq/pilot id from struct
        for (freq=freqcount-1; freq>=0; freq--)
    if (p->team == freqs[freq].freqteam)
        for (pilot = freqs[freq].playercount-1; pilot>=0; pilot--)
            if (strcmp(p->name,freqs[freq].pilots[pilot].name)==0)
                return true;

        return false;
    }

     

    Example way to track flag data using above struct/functions

    case EVENT_FlagGrab:
    {
        if (GetPilot(p))  // function
        {
            freqs[freq].pilots[pilot].flags++;
            freqs[freq].flags++;

            if (freqs[freq].pilots[pilot].flags < 2) // didnt have a flag before, first flag
                freqs[freq].pilots[pilot].cflagtime = GetTickCount();  // time stamp when picked up flag

        }
     
    Example way to track flag data using built in get/set tag (from catid flagbot)


    case EVENT_FlagGrab:


    {


        set_tag(p, TAG_STAT_FS, get_tag(p, TAG_STAT_FS) + 1);


        set_tag(p, TAG_FLAGTIMER, GetTickCount());


    }


     
     
    Get current flag times using struct format


    void botInfo::SetFlagTimes()

    {
        // set current flagtime for pilots/freqs
        _listnode <Player> *parse = playerlist->head;
       
        while (parse)
        {
    Player *p = parse->item;



    if (GetPilot(p))
        if (freqs[freq].pilots[pilot].flags > 0)
        {
            if (PilotOnSquad(p))
                freqs[freq].freqflagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;



            freqs[freq].pilots[pilot].flagtime += (GetTickCount() - freqs[freq].pilots[pilot].cflagtime)/1000;
            freqs[freq].pilots[pilot].cflagtime = GetTickCount();
        }



    parse = parse->next;
        }
    }

    // side note:  case EVENT_FlagDrop: {} gets called anytime theres a teamkill



                                             
    <a name="15g"></a>

    g) Example way to do simple /!spam feature (allowed 1x/60s)


    declare and initialize variables in spawn.h


    class botInfo

    {
    bool spamready;
    int SPAM_TIME;



    public:
        botInfo(CALL_HANDLE given)
        {
        spamready = true;
        SPAM_TIME = 60;


    spawn.cpp - mark as spamready=true when 60 seconds up


    case EVENT_Tick:

    {
        if (countdown[0] == 1)  {
            spamready = true;  // ready to spam again
        }



                                               

    command.cpp - handle !spam command


    case OP_Player:

    {    // Player-level commands



    else if (c->check("spam"))
        {
            // zone announcement "Need pilots to duel in ?go arena -pilotname"
            if (spamready == true)
                {
                String s;
                s += "*zone Need pilots to duel in ?go ";
                s += arena;
                s += " - ";
                s += p->name;
                sendPublic(s);
             
                spamready=false;
                countdown[0] = SPAM_TIME * 60; // next spam time limit
                }
            else if (countdown[0] < 0)
            {
                sendPrivate(p,"Spam ability disabled.");
            }
            else
                {
                String s;
                s += SPAM_TIME;
                s += " Minute timer between announcements. ";
                s += countdown[0] / 60;
                s += ":";
                if (countdown[0] % 60 < 10)
                    s += "0";
                s += countdown[0] % 60;
                s += " minutes left before next spam allowed.";
                sendPrivate(p, s);
                }
        }


     


                                                  <a name="15h"></a>
    

    h) Example of implementing a simple stack to do "next in line for several 'boxes' at once"


    //spawn.h declare variables


    class botInfo

    {
    Player *next[99][99];
    int MAX_NEXT;
    int nextcount[99];



    public:
        botInfo(CALL_HANDLE given)
        {
        MAX_NEXT = 8;


    // spawn.cpp MoveUp function


    void botInfo::MoveUp(int pos, int box)

    {
        // moves up the next line for that box and decrement box's nextcount
        if (nextcount[box] > 0)
    nextcount[box]--;



        for (pos = pos; pos < MAX_NEXT - 1; pos++)
        {
    next[box][pos] = next[box][pos + 1];
        }



        next[box][MAX_NEXT] = 0;
    }

     


                                                                    <a name="15i"></a>
    

    i) Example of reading any text from a .txt and printing it to pilot line by line


    #include <fstream>

    using namespace std;



    case OP_Player:
    {
        if (c->check("schedule"))
        {
            // read in schedule from schedule.txt
            ifstream file("schedule.txt");
            char line[256];



            while (file.getline(line, 256))
            {
                sendPrivate(p, line);
            }
            file.close();
        }



                                                                    <a name="15j"></a>
    

    j) Example of printing player stats grid


    // spawn.cpp   (see "structures within structures" example for variable declarations, varibale freqcount = # of freqs)



    void botInfo::DisplayPlayers()
    {
        // Display Match player/freq stats in this format  (not aligned b/c of html but aligned in bot)
        // ---------------------------------------------------
        // Squad: squad_name_1             K  D TK DMG DEALT TAKEN
        // ---------------------------------------------------
        // Player_1                       0  0  0         0     0
        // Player_2                       0  0  0         0     0
        // TOTAL:                      0  0  0         0     0
        // ---------------------------------------------------
        // Squad: squad_name_2             K  D TK DMG DEALT TAKEN

        // ---------------------------------------------------
        // Player_3                       0  0  0         0     0
        // Player_4                       0  0  0         0     0
        // Player_5                       0  0  0         0     0
        // TOTAL:                      0  0  0         0     0
        // ---------------------------------------------------



        for (freq=freqcount-1; freq>=0; freq--)
        {
    char str[255];



    sendFreqs("---------------------------------------------------");



    sprintf(str, "Squad: %-20s K  D TK DMG DEALT TAKEN", freqs[freq].freqname);
    sendFreqs(str);



    sendFreqs("---------------------------------------------------");



    for (pilot=freqs[freq].playercount-1; pilot >= 0; pilot--)
    {
        sprintf(str, "%-20s %8d %2d %2d %9d %5d", freqs[freq].pilots[pilot].name, freqs[freq].pilots[pilot].kills,
                freqs[freq].pilots[pilot].deaths, freqs[freq].pilots[pilot].teamkills, freqs[freq].pilots[pilot].dmgdealt,
                freqs[freq].pilots[pilot].dmgtaken);
        sendFreqs(str);
    }



            sprintf(str, "TOTAL:                      %2d %2d %2d %9d %5d", freqs[freq].kills, freqs[freq].deaths,
        freqs[freq].teamkills, freqs[freq].dmgdealt, freqs[freq].dmgtaken);
    sendFreqs(str);
        }



        sendFreqs("---------------------------------------------------");
    }



              <a name="15k"></a> k) Example of checking if any pilots are
    

    within a region


    // see GetPilotName(name) function in other example, returns *player as TempPlayer from name

    // closeto() function from several previous examples



    bool botInfo::FreqAInBox()
    {
        // return true if teamA has a pilot in the box, otherwise false
        for (int tempplayercount = freqs[0].playercount-1; tempplayercount >= 0; tempplayercount--)
    if (GetPilotName(freqs[0].pilots[tempplayercount].name))
        if (closeto(TempPlayer, coordX, coordY, 73) && (TempPlayer->ship != SHIP_Spectator))
            return true;



        return false;
    }



                  <a name="15l"></a>
    

    l) Example of functions to get a pilot's struct id info from a name or *player info


    // see struct examples for variable info



    // return struct freq/pilot id from *player info
    bool botInfo::GetPilot(Player *p)

    {

        // return freq, pilot of a player p

        for (freq=freqcount-1; freq>=0; freq--)

    if (p->team == freqs[freq].freqteam)

        for (pilot = freqs[freq].playercount-1; pilot>=0; pilot--)
                    if (strcmp(p->name,freqs[freq].pilots[pilot].name)==0)

                return true;



        return false;

    }



    // return *player as TempPlayer info from p->name info
    bool botInfo::GetPilotName(char *name)
    {
        // get pilot from a name, return as TempPlayer
        _listnode <Player> *parse = playerlist->head;



        while (parse)
        {
    Player *p = parse->item;



    // convert both to lowercase to compare
    char pname[20];           
    strncpy(pname,p->name,20);



    char nname[20];           
    strncpy(nname,name,20);



    tolower(pname);
    tolower(nname);



    if (strcmp(pname,nname)==0)
    {
        TempPlayer = p;
        return true;
    }



    parse = parse->next;
        }
        return false;
    }

    // note: better to implement these functions as passing values by reference instead of using global variables
    // just easier to not have to be declaring different int freq, int pilot all the time



                <a name="15m"></a>
    

    m) Example of creating a logfile name using date and squad names


        // create log file name (squadA and squadB external char[20] variables)

        char u[100];
        time_t t=time(NULL);
        tm *tmp = localtime(&t);
        strftime(u,99,"%y",tmp);
        logname = "c:\Program Files\Continuum\logs\";
        logname += u;
        logname += "y";
        strftime(u,99,"%m",tmp);
        logname += u;
        logname += "m";
        strftime(u,99,"%d",tmp);
        logname += u;
        logname += "d";
        logname += squadA;
        logname += " vs ";
        logname += squadB;
        strftime(u,99,"%I",tmp);
        logname += u;
        logname += "h";
        strftime(u,99,"%M",tmp);
        logname += u;
        logname += "m";
        logname += ".txt";



    // example name created:  03y01m27dBLACKDRaGON vs Integral05h08m.txt
    // format  year, month, day, squadA vs squadB, hour, minute



     <a name="15n"></a>
    

    n) Example of sending messages to playing freqs or public and logging depending on status


    // teamA, teamB, logname global variables

    void botInfo::sendFreqs(char *msg)
    {
        char *mmsg = "*arena";
        String s = msg;
       
        if (teammsgs == false)
        {
    s.prepend("*arena ",7);
    sendPublic(s);
        }
        else
        {
    sendTeamPrivate(8025,msg);
    sendTeamPrivate(teamA,msg);
    sendTeamPrivate(teamB,msg);
        }
        if (gameon == true)
        {
    ofstream outf(logname, ios::app);
    outf << msg << endl;
    outf.close();
        }
    }



                              <a name="15o"></a>
    

    o) Example of reading in all player/freqs to struct data


    // see structures within structures example for freqs[] declaration



    // to get freqs in a game where there are several freqs
    void botInfo::GetFreqs()
    {
        // read pilots into freq struct data from ingame and on playing freqs



        _listnode <Player> *parse = playerlist->head;
       
        while (parse)
        {
    Player *p = parse->item;



    if (p->ship != SHIP_Spectator)
        if (closeto(p, coordX, coordY, 73))
        {
            // look for freq in struct
            bool foundfreq=false;



            freq=freqcount-1;



            while ((freq>=0) && (foundfreq==false))
            {
                if (p->team == freqs[freq].freqteam)
                {
            foundfreq=true;
            strncpy(freqs[freq].pilots[freqs[freq].playercount].name, p->name, 20);
            freqs[freq].playercount++;   
                }
                freq--;
            }



            // didnt find freq in struct so add new freq
            if (foundfreq == false)
            {
                if (manualsquads == false)
                {
            strncpy(freqs[freqcount].freqname, p->squad, 20);



            if (freqcount == 0)
                    {
                teamA = p->team;
                strncpy(squadA, p->squad, 20);
                    }
                    else
                    {
                teamB = p->team;
                strncpy(squadB, p->squad, 20);
                    }
                }
                else
                {
            if (p->team == teamA)
                strncpy(freqs[freqcount].freqname,squadA,20);



            else if (p->team == teamB)
                strncpy(freqs[freqcount].freqname,squadB,20);
                }
               
                freqs[freqcount].freqteam = p->team;



                strncpy(freqs[freqcount].pilots[0].name, p->name, 20);
                           



                freqs[freqcount].playercount++;
                freqcount++;
            }
        }
    parse = parse->next;
        }
    }



    // to get freqs in a game where there are only two teams
    void botInfo::GetFreqs()
    {
        // read pilots into freq struct data from ingame and on playing freqs
        _listnode <Player> *parse = playerlist->head;
       
        while (parse)
        {
    Player *p = parse->item;



    if ((p->ship != SHIP_Spectator) && ((p->team == teamA) || (p->team == teamB)))
    {
        // freq 100, team A
        // set freq
        freq = 0;



        if (p->team == teamB)
            freq = 1;



        // number of pilots on freq counted so far, starts 0
        pilot = freqs[freq].playercount;



        // pilot name
        strncpy(freqs[freq].pilots[pilot].name, p->name, 20);
        // time stamp for playing time
        freqs[freq].pilots[pilot].cplaying_time = GetTickCount();



        // slot name
        if (freqs[freq].playercount < NUMBER_PILOTS)
            strncpy(freqs[freq].slotname[pilot], p->name, 20);

        // increment freq player count
        freqs[freq].playercount++;



        // if freq not already have name, give it player squad name
        if ((manualsquads == false) && (strlen(p->squad) > 0))
            strncpy(freqs[freq].freqname, p->squad, 20);



                // set player ship
        freqs[freq].pilots[pilot].ship = p->ship + 1;
    }
    parse = parse->next;
        }
    }



                                            <a name="15p"></a>
    

    p) Example of finding MVP from struct data (2*kills - deaths formula)


        int highest=-20;

        int mvp=0;



        for (pilot = freqs[mvpteam].playercount-1; pilot >=0; pilot--)
        {
    if (((freqs[mvpteam].pilots[pilot].kills

    • 2) - freqs[mvpteam].pilots[pilot].deaths) > highest)

    {
        mvp = pilot;
        highest = (freqs[mvpteam].pilots[pilot].kills

    • 2) - freqs[mvpteam].pilots[pilot].deaths;

    }
        }



                                                         <a name="15q"></a>
    

    q) Print time stamp of event


    #include "time.h"



    char u[100];
    time_t t=time(NULL);
    tm *tmp = localtime(&t);
    strftime(u,99,"%c",tmp);
    sendPublic("Current date and time: " + (String) u);



                                                       <a name="15r"></a>
    

    r) Simple way to track player bomb/bullet damage stats


    // spawn.cpp (see data section for how to setup set_tag)

    // see clientprot.h for weapon information

    case EVENT_WatchDamage:
    {
        if (PLAYING)  // if tracking stats
        {
            if ((wi.type == PROJ_PBomb) && (p->name != k->name))
            {
                set_tag(k, DMG_BOMB_DEALT, get_tag(k, DMG_BOMB_DEALT) + damage);
                set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT) + damage);
                set_tag(p, DMG_BOMB_TAKEN, get_tag(p, DMG_BOMB_TAKEN) + damage);
                set_tag(p, DMG_TOTAL_TAKEN, get_tag(p, DMG_TOTAL_TAKEN) + damage);
            }
            else if (wi.type == PROJ_BBullet)
            {
                set_tag(k, DMG_BULLET_DEALT, get_tag(k, DMG_BULLET_DEALT) + damage);
                set_tag(k, DMG_TOTAL_DEALT, get_tag(k, DMG_TOTAL_DEALT) + damage);
                set_tag(p, DMG_BULLET_TAKEN, get_tag(k, DMG_BULLET_TAKEN) + damage);
                set_tag(p, DMG_TOTAL_TAKEN, get_tag(k, DMG_TOTAL_TAKEN) + damage);
            }
        }



                              <a name="15s"></a>
    

    s) Simple way to print those stats


    case OP_Moderator:
    {
    	if (c->check("showstats"))
    	{
    	    sendPublic("Showing stats:");
                                         
                  
    	    _listnode <Player> *parse = playerlist->head;             
    
    
    	    while (parse) 
    	    {
    	        Player *p = parse->item;
    
    	        if (get_tag(p, DMG_TOTAL_DEALT) > 0)
    	        {
    		char str[256];
    	    sprintf(str, "(%-20s Dmg Dealt: Total %0004d, Bomb %0004d, Bullet %0004d  Dmg TAKEN: Total %0004d, Bomb %0004d, Bullet %0004d)",
    	p->name, get_tag(p,DMG_TOTAL_DEALT), get_tag(p,DMG_BOMB_DEALT), get_tag(p,DMG_BULLET_DEALT),
    	get_tag(p,DMG_TOTAL_TAKEN), get_tag(p,DMG_BOMB_TAKEN), get_tag(p,DMG_BULLET_TAKEN));
    	sendPublic(str);
    	        }
    	        parse = parse->next;
    	    }
    	}
    
    <a name="15t"></a>

    t) Make bot spectate specific coordinates

    // make bot spectate the coord 512,600
    // possible use - capturing weapon packets in a specific region
    
    tell(makeFollowing(false));
    tell(makeFlying(true));
    me->move(512 * 16, 600 * 16);
    tell(makeSendPosition(true));