Author Topic: Multiple bots? Sure, but...  (Read 1521 times)

Alright, I have a problem, a big problem. As some of you may know, Copybots V3 will be ready soon and will have multiple copy support, well the RTB Pref and making more than one bot works and all but, in having more than one bot for one client, we need a copy swapping command.
And in that is where the problem lies, you see I have tried everything I can think of to make a copy swapping command, but it never worked.

Please, if anyone has any helpful information, please do not hesitate to post.
Thank you in advance.



Edit: Look at the posts after the OP for more information on the problem.
« Last Edit: September 24, 2009, 06:24:11 PM by Gamefandan »

What exactly do you mean by "copy swapping command"? You didn't really explain it.

What exactly do you mean by "copy swapping command"? You didn't really explain it.

I can't really explain it, I'll show you the part of the script:







if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
   if(!$RTB::RTBR_ServerControl_Hook)
   exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
   RTB_registerPref("Copies per player","Gameplay","$Copies::Amount","int 0 300","Script_Copybots",3,0,0);
}
else
{
   $Copies::Amount = 3;
}


$copyTotal = 0;
$Mahcopycount = 0;
$Copystuff = $Mahcopycount;

function serverCmdcopy(%client)
{
   if($Mahcopycount>=0)
   {
      if($Mahcopycount==$Copies::Amount)
      {
         return;
         cancel();
         $Mahcopycount = $Mahcopycount -1;
         Messageclient(%client,0,"<color:FF0000>Silly truffle, you have too many copies! :D");
      }
      %bot = new AIplayer(%bot)
      {
             datablock=playernojet; position=%client.player.getTransform();
      };

      $Mahcopycount = $Mahcopycount +1;

    MessageClient(%client,0,"\c3You have cloned yourself.");
    //Stuff for bot clearing
    $copyBots[$copyTotal] = %bot;
    $copyTotal++;
   
       %bot.isCopy = 1;
       %client.bot = %bot;
   %rawr = %client.player;
   %client.player = %bot;
   %client.applyBodyParts();
   %client.applyBodyColors();
   %client.player = %rawr;
   %bot.setScale("1 1 1");
   %bot.setMoveObject(%client.player);
   //%bot.setShapeName(%client.name);
   //We can only pretend. :(
   %bot.accent = %client.accent;
   %bot.faceName = %client.faceName;
   %bot.decalName = %client.decalName;
   %bot.accent = %client.accent;
   %bot.accentColor = %client.accentColor;
   %bot.chest = %client.chest;
   %bot.chestColor = %client.chestColor;
   %bot.hat = %client.hat;
   %bot.hatColor = %client.hatColor;
   %bot.headColor = %client.HeadColor;
   %bot.hip = %client.hip;
   %bot.hipColor = %client.hipColor;
   %bot.larm = %client.larm;
   %bot.larmColor = %client.larmcolor;
   %bot.lhand = %client.lhand;
   %bot.lhandcolor = %client.lhandcolor;
   %bot.lleg = %client.lleg;
   %bot.llegcolor = %client.llegcolor;
   %bot.pack = %client.pack;
   %bot.packcolor = %client.packcolor;
   %bot.rarm = %client.rarm;
   %bot.rarmcolor = %client.rarmcolor;
   %bot.rhand = %client.rhand;
   %bot.rhandcolor = %client.rhandcolor;
   %bot.rleg = %client.rleg;
   %bot.rlegcolor = %client.rlegcolor;
   %bot.secondPack = %client.secondpack;
   %bot.secondPackColor = %client.secondPackColor;
   %client.bot = %bot;
   }
}

function servercmdcopytoggle(%client, %toggle)
{
   %bot.name = $Mahcopycount;
   %toggle = %bot.name;
   %bot = %toggle;
}







Destiny, if you look at the script you should be able to figure out my problem.

Wait, so by copy swapping you mean you're turning into the bot? Atleast that's what it looks like. If so, try using %client.setControlObject(%bot);

EDIT: Also, "$Mahcopycount" will make it you can only have 3 copy bots on the entire server. You need to do something like $Mahcopycount[%id] to make it per player.
« Last Edit: September 24, 2009, 04:56:10 AM by Destiny/Zack0Wack0 »

Wait, so by copy swapping you mean you're turning into the bot? Atleast that's what it looks like. If so, try using %client.setControlObject(%bot);
No, look, say I make a copy, it is set to %client.bot, thus letting all the commands work FOR ONLY THAT BOT, now say I make another copy, then %client.bot is set ti that one and all commands for only THAT bot. I need a command that will toggle the copy that has %client.bot to a different one, alright?



EDIT: Also, "$Mahcopycount" will make it you can only have 3 copy bots on the entire server. You need to do something like $Mahcopycount[%id] to make it per player.

Damn. I'll go fix that now.
« Last Edit: September 24, 2009, 06:27:07 PM by Gamefandan »

Tom

You need to add a good system to keep track of all a client's bot first.

You need to add a good system to keep track of all a client's bot first.

Add:

Code: [Select]
%client.botlist = %client.botlist SPC %bot;
Remove:

Code: [Select]
%client.botlist = trim(strReplace(" "@%client.botlist@" "," "@%bot@" "," "));
Loop:

Code: [Select]
for(%i = 0; %i < getWordCount(%client.botlist); %i++)
     echo(getWord(%client.botlist,%i));

Wouldn't an array work? Oh wait, I don't know how to use arrays.  :cookieMonster:

Wouldn't an array work? Oh wait, I don't know how to use arrays.  :cookieMonster:

It's much simpler than an array and uses less variables.

Torquescript doesn't even have arrays.
« Last Edit: September 24, 2009, 08:21:01 PM by Ephialtes »

Torquescript doesn't even have arrays.

Well, it's got a naming system, which most people just refer to as arrays.

You could use a SimSet but the order of the bots might swap around occasionally and you'd have to be sure to clean it up later to avoid memory leaks.

You could use a SimSet but the order of the bots might swap around occasionally and you'd have to be sure to clean it up later to avoid memory leaks.

What's wrong with the simple, one-variable system I used? :/

What's wrong with the simple, one-variable system I used? :/

I'm not seeing how it will work.

Simsets don't have limitations, and are easier to manage.