Author Topic: Setup Leechbot Guide Beo900's Edition.  (Read 7935 times)

Offline killziky

  • Newbie
  • *
  • Join Date: Jun 2010
  • Posts: 46
  • Reputation 0
    • View Profile
Setup Leechbot Guide Beo900's Edition.
« on: July 30, 2010, 06:41:24 AM »
########################################################
######FINISHED FINAL (for now)######################
######Better leecher scripts can easily be made############
######Please follow all directions######################
######Will always attempt to join the game the leader is in#####
########################################################

****FIXES****
Always attempts to join the game the leader is in (even when full)
No longer keeps trying to join games that have not been created by the leader.
Should have perfect synchronizing with the leader even when a game is missed!
*****MORE FIXES*****
---Solved the massive amounts of FTJ games from the leader, the bot will now go to character sleect screen and log back on to clear his text.
---Thanks to zexxx, the bot will now read the mesage sent from the leader when he joins a game instead of spamming /f l (english only, i think)
---Made the time of the leecher joining the games quicker (put all the actions into 1 part instead of using the join game case.
---Will now send the message to d2nt manager to increment the game number for multiple cd key use
---Increased the time to wait before checking if partied to leader to ~40 seconds (some games are slower then others)


So I finally got a baal follow bot working for D2NT 3.0, which will attempt to join the game created by the (leader) once he is inside the game. This requires the follower and the bot to be on the friends list.

Below is the script for the follow bot to use.

Code: [Select]
function NTMain()
{

Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");

NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");

NTA_Initialize(); // 10

var _leader = "iMake_Fg"; // Name of leader's character in game (exactly)

if(!NTTM_CheckAct())
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}

if(me.areaid != 109)
   {
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
return;
}

if(!NTM_TakeWaypoint(109))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
return;
}
   }

NTTMGR_TownManager();

NTTM_TownMove("portalspot");

for(i = 0; i <= 200; i++)
{
if(NTC_InMyParty(_leader))
break;

Delay(200);
}

while(me.areaid == 109 && NTC_InMyParty(_leader))
{
NTM_UsePortal("BluePortal", 131, _leader); // 50
Delay(5000);

}

NTP_DoPrecast(true);

while(NTC_InMyParty(_leader))
{
Delay(1000);
}


NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");

}

Copy this code to a notepad document and click 'save as' then all files (default is for it to save as text document) and name it ''NTBaalLeech.ntj'' and put it inside the bots folder.


Go to the character config file and add in the line
NTConfig_Script.push("NTBaalLeech.ntj");
where all the other ones are (Only load this script with followbot..)

''Killziky writes''

i like having my scripts sorted so i put them in their own little column like this
Code: [Select]
         //follow config
    //------------------------------------------------------------------------------
NTConfig_Leader = "Whyxxxxxxment"
    //NTConfig_Script.push("NTBaalLeechFight.ntj"); NTConfig_KillBaal = true;
  NTConfig_Script.push("NTDiabloLeechFight.ntj");
    //------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Boss configuration
//------------------------------------------------------------------------------


NTConfig_Script.push("NTAncientTunnels.ntj");

''Killziky is done!''

Now copy and paste this code into a new notepad called NTBotLeech.ntj
Put this file in D2NT\D2NT\Scripts
You will see NTBot.ntj and NTMap.ntj in this folder already.


Code: [Select]
var gameMinLength      = 90000;   // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)

var unableToConnectRetry   = 5;      // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry      = 260;      // time in minutes to retry connecting on a realm down (default is 120 minutes)
var disconnectedRetry      = 5;      // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry      = 5;      // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout   = 20000;   // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout   = 5000;   // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout      = 2000;   // time in milliseconds to wait for a please wait popup
var createGameThreshold      = 5000;      // time in milliseconds to wait between making games
var createGameThresholdRandom   = 1000;      // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout      = 15000;   // time in milliseconds to register a failed to create game
var waitInLineTimeout      = 60000;   // time in milliseconds to wait in lines for a create game (60 second default)
var characterSelectDelay   = 1000;      // time in milliseconds to wait before selecting a character on the char screen
var loginDelay         = 1000;      // time in milliseconds to wait before submitting login information
var clickDelay         = 500;      // wait X milliseconds before next action after a click event
var textDelay         = 500;      // wait X milliseconds before next action after inserting text into a textbox
var clickDelayRandom      = 500;      // random amount of time to add to a click
var textDelayRandom      = 500;      // random amount of time to add to a text set
var gameDoesNotExistDelayMin   = 500;   // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax   = 500;   // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout   = 1000;   // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterGame      = true;   // join chat after leaving a game
var joinRandomChannel      = false;      // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat      = "345";      // leave blank to not join a private channel
var waitBeforeEnterChatMin   = 1000;      // min how long to wait before entering chat
var waitBeforeEnterChatMax   = 2000;      // max how long to wait before entering chat
var waitInChatBeforeActionsMin   = 2000;      // min how long to wait before joining channel
var waitInChatBeforeActionsMax   = 3000;      // max how long to wait before joining channel
var JoinFromChat = true;
var leaderAccountName = "xxx"; // leader account name here
var gamepassword = '';
var samegame = '';
var oldgame = '';
var check = 1;

// DONT EDIT ANYTHING BELOW THIS

// D2NT Manager Command
const D2NT_MGR_LOADING = 1;
const D2NT_MGR_READY = 2;
const D2NT_MGR_LOGIN = 3;
const D2NT_MGR_CREATE_GAME = 4;
const D2NT_MGR_INGAME = 5;
const D2NT_MGR_RESTART = 6;
const D2NT_MGR_CHICKEN = 7;
const D2NT_MGR_PRINT_STATUS = 8;
const D2NT_MGR_PRINT_LOG = 9;

var lastGameMade = GetTickCount();
var lastGameStatus = 0;
var nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameFailed = false;

Include("libs/controlInfo.ntl");
//Include("joinBotSettings.ntl");

var controlData = new controlInfo();

var game = '';

function NTMain()
{
   Delay(1000);

   var _ingame = false;

   controlData.clickDelay = clickDelay;
   controlData.textDelay = textDelay;
   controlData.clickDelayRandom = clickDelayRandom;
   controlData.textDelayRandom = textDelayRandom;

   while(1)
   {
      if(me.ingame)
      {
         if(!inGameAt)
            inGameAt = GetTickCount();

         if(!_ingame)
         {
            if(Load("NTBot/NTBotGame.ntj"))
            {
               _ingame = true;

if(me.playtype > 0)
sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
else
sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);

               lastGameStatus = 2; // in game successful
            }
         }

         Delay(1000);
      }
      else
      {
         if(_ingame)
         {
            _ingame = false;

            sendEventToOOG(D2NT_MGR_READY, "", 0);
         }

         locationAction(controlData.getLocation());

         Delay(500);
      }
   }
}

function locationAction(location)
{
   switch(location.id)
   {
 
   case 3: // Lobby Chat
      if(!chatActionsDone)
      {
         chatActionsDone = true;
         Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
 
         if(joinRandomChannel || joinChannelInChat != "")
         {
            Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
            Delay(1000);
         }
      }
 

      if(JoinFromChat){
    if(check == 1)
{
    sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
    outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
    check = check + 1;
}

         game = '';
         Delay(1000);
         if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
         {
            var errors = '';
            var found_leader = false;
            lines = chat.GetText();
         if (lines.length > 1)
            for (var friend = 0; friend < lines.length; friend++)
            {
          if (undefined!==lines[friend + 1])
            if (lines[friend + 1].lastIndexOf('game called') > -1 && lines[friend].lastIndexOf(leaderAccountName) > -1)
               {
                  game = '';
                  found_leader = true;
                  var regOfflineEnglish=/^\d\s?:\s?(\w*)\s?,\s?offline\s*$/gi;
              var regGameNameEnglish=/^\s*(called\s)?([\w\s-]*\w)?(\.)*$/gi;
             
                  if (lines[friend].match(regOfflineEnglish))
                  {
                     errors += (errors == '' ? '' : ' ') + 'leader is offline';
                     Delay(5000);
                  }
                  if (lines[friend + 1].match(regGameNameEnglish))
                  {
                game = lines[friend + 1].substring(lines[friend + 1].lastIndexOf('called')+7,lines[friend + 1].lastIndexOf('.'));
                  }
                  if (game != '' && game != samegame && game != oldgame)
                  {
                     controlData.click(controlData.controls.lobby.button.join);
Delay(200);
                 controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (200);
controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
Delay (200);
         controlData.click(controlData.controls.lobby.join.button.joinGame);
check = 1;
                  }
                  else
                  {
                     if(!errors)
                     {
                        errors = 'leader is not in game.';
                     }
                  }
               }
            }
            if (!found_leader && joinChannelInChat)
            {
               if (errors)
                  Say('Errors : ' + errors);
               //else
               //   Say('I couldn\'t find the leader in my friend list.');
               Delay(1500);
            }
         }
         else
         {
            if (joinChannelInChat)
               Say('I can\'t read the chat!');
            Delay(1500);
         }
         
      }
   errors = '';
   if(game != '')
      samegame = game;

      break;



 
     
   case 1:   // Lobby
      if(location.id == 1 && joinChatAfterGame)
      {
         Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
         controlData.click(controlData.controls.lobby.button.enterChat);
         break;
      }

      if(GetTickCount() >= nextGameMake)
      {
         lastGameFailed = false;

         switch(lastGameStatus)
         {
         case 0:
            controlData.click(controlData.controls.lobby.button.create);
            nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         case 1: // game failed, rollover to reset timer
            inGameAt = GetTickCount(); // reset inGameAt, to wait how long we should have waited..
            lastGameFailed = true;
         case 2:
            outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         }
      }
      else
         timeoutDelay(nextGameMake-GetTickCount(), location);
      break;

   case 2: // Waiting In Line
      if(GetTickCount()-lastGameMade > waitInLineTimeout)
         controlData.click(controlData.controls.lobby.inLine.button.cancel);
      break;

   case 4: // Create Game
        if(!controlData.get(controlData.controls.lobby.create.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.join);
            Delay (500);
            controlData.click(controlData.controls.lobby.button.create);
            Delay (500);
        }
      sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

      RunGC(); // run garbage collector between each game

      locationTimeout(5000, location);

      lastGameMade = GetTickCount();
      lastGameStatus = 1; // pending creation
      break;

   case 5: // Join Game
        if(!controlData.get(controlData.controls.lobby.join.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.create);
            Delay (1000);
            controlData.click(controlData.controls.lobby.button.join);
            Delay (1000);
        }
        if (game != '')
        {
            controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (100);
            //controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
            //Delay (100);
    controlData.click(controlData.controls.lobby.join.button.joinGame);
        }
check = 1;
    lastGameStatus = 1; // pending creation
      break;

   case 6: // Ladder
      break;

   case 7: // Channel List
      break;

   case 8: // Main Menu
      if(controlData.getCurrentRealmIndex() == me.gatewayid)
      {
         outputGameLength();
         controlData.click(controlData.gameTypes[me.playtype]);
      }
      else
         controlData.click(controlData.controls.mainMenu.button.gateway);
      break;

   case 9: // Login
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
      Delay(loginDelay);

      controlData.setText(controlData.controls.login.editBox.accountName, me.account);

      sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);

      locationTimeout(5000, location);
      break;

   case 10: // Login Error (this is a fatal error, so stop)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
      Delay(3500);
      break;

   case 11: // Unable To Connect
      timeoutDelay(unableToConnectRetry*60*1000, location)
      controlData.click(controlData.controls.login.unableToConnect.button.ok);
      break;

   case 12: // Character Select
      var _time, _control;

      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

      for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
      {
         _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
         if(_control && _control.GetText() != undefined)
            break;

         Delay(500);
      }

      if(_time < characterScreenTimeout)
      {
         Delay(characterSelectDelay);

         controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
         controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);

         // reset last game made, so it doesnt make a game immediately
         inGameAt = 0;
         setNextGameMake();
      }
      else
      {
         controlData.click(controlData.controls.characterSelect.button.exit);
         timeoutDelay(realmDownRetry*60*1000, location);
      }
      break;

   case 13: // Realm Down - Character Select screen
      controlData.click(controlData.controls.characterSelect.button.exit);
      timeoutDelay(realmDownRetry*60*1000, location);
      break;

   case 14: // Character Select - Disconnected
      timeoutDelay(disconnectedRetry*60*1000, location);
      controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
      break;

   case 15: // New Character
      break;   

   case 16: // Character Select - Please Wait popup
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
      break;

   case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
      controlData.click(controlData.controls.lobby.lostConnection.button.ok);
      break;

   case 18: // D2 Splash
      controlData.click(controlData.controls.d2Splash.textBox.copyright);
      break;

   case 19: // Login - Cdkey In Use
      timeoutDelay(cdkeyInUseRetry*60*1000, location);
      controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
      break;

   case 20: // Single Player - Select Difficulty
      RunGC(); // run garbage collector between each game

      controlData.click(controlData.singlePlayerDifficulties[me.diff]);
      break;

   case 21: // Main Menu - Connecting
      if(!locationTimeout(connectingToBnetTimeout, location))
         controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
      break;

   case 22: // Login - Invalid Cdkey (classic or xpac)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
      Delay(3500);
      break;   

   case 23: // Character Select - Connecting
      if(!locationTimeout(characterScreenTimeout, location))
         controlData.click(controlData.controls.characterSelect.button.exit);
      break;

   case 24: // Server Down - not much to do but wait..
      break;

   case 25: // Lobby - Please Wait
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
      break;

   case 26: // Lobby - Game Name Exists
      //sendEventToOOG(D2NT_MGR_PRINT_LOG, "Game already exists", 0);

      //inGameAt = 0;
      //lastGameStatus = 0;
      //setNextGameMake();
this.controls.lobby.button.quit
      locationTimeout(15000, location);
      break;

   case 27: // Gateway Select
      controlData.clickRealmEntry(me.gatewayid);
      controlData.click(controlData.controls.gateway.button.ok);
      break;

   case 28: // Lobby - Game Does Not Exist

Delay(160000); // 40 seconds longer then leader's min game time, edit yourself
controlData.click(controlData.controls.lobby.button.quit)
Delay(1000);
controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1)
oldgame = game;

      break;
   }
}

function sendEventToOOG(locationId, statusString, pendingTime)
{
   return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}

function setNextGameMake()
{
   lastGameMade = GetTickCount();
   nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
   inGameAt = 0;
   chatActionsDone = false;
}

function outputGameLength()
{
   if(inGameAt)
   {
      duration = GetTickCount() - inGameAt;

      inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
   }
}

function locationTimeout(time, location)
{
   endtime = GetTickCount() + time;

   while(controlData.getLocation().id == location.id && endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(500);
   }

   return (controlData.getLocation().id != location.id);
}

function timeoutDelay(time, location)
{
   endtime = GetTickCount() + time;

   while(endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(1000);
   }
}

function getRandomString(_length)
{
   _retString = "";
   _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";

   while(_length--)
   {
      _retString += _charSet.charAt(Random(0, _charSet.length-1));
      Delay(1);
   }

   return _retString;
}

(no longer uses /f l command, english only) ''Killziky Likes''


Code: [Select]
var gameMinLength      = 90000;   // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)

var unableToConnectRetry   = 5;      // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry      = 260;      // time in minutes to retry connecting on a realm down (default is 120 minutes)
var disconnectedRetry      = 5;      // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry      = 5;      // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout   = 20000;   // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout   = 5000;   // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout      = 2000;   // time in milliseconds to wait for a please wait popup
var createGameThreshold      = 5000;      // time in milliseconds to wait between making games
var createGameThresholdRandom   = 1000;      // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout      = 15000;   // time in milliseconds to register a failed to create game
var waitInLineTimeout      = 60000;   // time in milliseconds to wait in lines for a create game (60 second default)
var characterSelectDelay   = 1000;      // time in milliseconds to wait before selecting a character on the char screen
var loginDelay         = 1000;      // time in milliseconds to wait before submitting login information
var clickDelay         = 500;      // wait X milliseconds before next action after a click event
var textDelay         = 500;      // wait X milliseconds before next action after inserting text into a textbox
var clickDelayRandom      = 500;      // random amount of time to add to a click
var textDelayRandom      = 500;      // random amount of time to add to a text set
var gameDoesNotExistDelayMin   = 500;   // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax   = 500;   // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout   = 1000;   // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterGame      = true;   // join chat after leaving a game
var joinRandomChannel      = false;      // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat      = "345";      // leave blank to not join a private channel
var waitBeforeEnterChatMin   = 1000;      // min how long to wait before entering chat
var waitBeforeEnterChatMax   = 2000;      // max how long to wait before entering chat
var waitInChatBeforeActionsMin   = 2000;      // min how long to wait before joining channel
var waitInChatBeforeActionsMax   = 3000;      // max how long to wait before joining channel
var JoinFromChat = true;
var leaderAccountName = "beo70";
var gamepassword = '';
var samegame = '';
var oldgame = '';
var check = 1;

// DONT EDIT ANYTHING BELOW THIS

// D2NT Manager Command
const D2NT_MGR_LOADING = 1;
const D2NT_MGR_READY = 2;
const D2NT_MGR_LOGIN = 3;
const D2NT_MGR_CREATE_GAME = 4;
const D2NT_MGR_INGAME = 5;
const D2NT_MGR_RESTART = 6;
const D2NT_MGR_CHICKEN = 7;
const D2NT_MGR_PRINT_STATUS = 8;
const D2NT_MGR_PRINT_LOG = 9;

var lastGameMade = GetTickCount();
var lastGameStatus = 0;
var nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameFailed = false;

Include("libs/controlInfo.ntl");
//Include("joinBotSettings.ntl");

var controlData = new controlInfo();

var game = '';

function NTMain()
{
   Delay(1000);

   var _ingame = false;

   controlData.clickDelay = clickDelay;
   controlData.textDelay = textDelay;
   controlData.clickDelayRandom = clickDelayRandom;
   controlData.textDelayRandom = textDelayRandom;

   while(1)
   {
      if(me.ingame)
      {
         if(!inGameAt)
            inGameAt = GetTickCount();

         if(!_ingame)
         {
            if(Load("NTBot/NTBotGame.ntj"))
            {
               _ingame = true;

if(me.playtype > 0)
sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
else
sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);

               lastGameStatus = 2; // in game successful
            }
         }

         Delay(1000);
      }
      else
      {
         if(_ingame)
         {
            _ingame = false;

            sendEventToOOG(D2NT_MGR_READY, "", 0);
         }

         locationAction(controlData.getLocation());

         Delay(500);
      }
   }
}

function locationAction(location)
{
   switch(location.id)
   {
 
   case 3: // Lobby Chat
      if(!chatActionsDone)
      {
         chatActionsDone = true;
         Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
 
         if(joinRandomChannel || joinChannelInChat != "")
         {
            Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
            Delay(1000);
         }
      }
 
      if(JoinFromChat){

    if(check == 1)
{
    sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
    outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
    check = check + 1;
}
         game = '';
         if (joinChannelInChat)
Delay (1000);
//Say('Locating the leader : '+leaderAccountName);
 
         Say('/f l');
         Delay(1000);
         if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
         {
            var errors = '';
            var found_leader = false;
            lines = chat.GetText();
            for (var friend = 0; friend < lines.length; friend++)
            {
               if (lines[friend].lastIndexOf(': '+leaderAccountName+',') > -1)
               {
                  game = '';
                  found_leader = true;
                  var regOfflineEnglish=/^\d\s?:\s?(\w*)\s?,\s?offline\s*$/gi;
                  var regGameNameEnglish=/^\s*(the\s)?(game\s)?([\w\s-]*\w)\s\(private\)\.\s*$/gi;
                  var regGameNameFrench=/^\s*(la\s)?(partie\s)?([\w\s-]*\w)\s\(priv[^\)]*\)\.\s*$/gi;

                  if (lines[friend].match(regOfflineEnglish))
                  {
                     errors += (errors == '' ? '' : ' ') + 'leader is offline';
                  }
                  if (lines[friend + 1].match(regGameNameEnglish) && lines[friend+1].substr(1, 1) != ':')
                  {
                     game = lines[friend + 1].replace(regGameNameEnglish, "$3");
                  }
                  if (!game && lines[friend + 1].match(regGameNameFrench) && lines[friend+1].substr(1, 1) != ':')
                  {
                     game = lines[friend + 1].replace(regGameNameFrench, "$3");
                  }

                  if (game != '' && game != samegame && game != oldgame)
                  {
                     controlData.click(controlData.controls.lobby.button.join);
Delay(200);
                 controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (200);
controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
Delay (200);
         controlData.click(controlData.controls.lobby.join.button.joinGame);
check = 1;
                  }
                  else
                  {
                     if(!errors)
                     {
                        errors = 'leader is not in game.';
                     }
                  }
               }
            }
            if (!found_leader && joinChannelInChat)
            {
               if (errors)
                  Say('Errors : ' + errors);
               else
                  Say('I couldn\'t find the leader in my friend list.');
               Delay(1500);
            }
         }
         else
         {
            if (joinChannelInChat)
               Say('I can\'t read the chat!'); 
         }
         
      }


errors = '';

if(game != '')
samegame = game;

      break;
 
     
   case 1:   // Lobby
      if(location.id == 1 && joinChatAfterGame)
      {
         Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
         controlData.click(controlData.controls.lobby.button.enterChat);
         break;
      }

      if(GetTickCount() >= nextGameMake)
      {
         lastGameFailed = false;

         switch(lastGameStatus)
         {
         case 0:
            controlData.click(controlData.controls.lobby.button.create);
            nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         case 1: // game failed, rollover to reset timer
            inGameAt = GetTickCount(); // reset inGameAt, to wait how long we should have waited..
            lastGameFailed = true;
         case 2:
            outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         }
      }
      else
         timeoutDelay(nextGameMake-GetTickCount(), location);
      break;

   case 2: // Waiting In Line
      if(GetTickCount()-lastGameMade > waitInLineTimeout)
         controlData.click(controlData.controls.lobby.inLine.button.cancel);
      break;

   case 4: // Create Game
        if(!controlData.get(controlData.controls.lobby.create.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.join);
            Delay (500);
            controlData.click(controlData.controls.lobby.button.create);
            Delay (500);
        }
      sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

      RunGC(); // run garbage collector between each game

      locationTimeout(5000, location);

      lastGameMade = GetTickCount();
      lastGameStatus = 1; // pending creation
      break;

   case 5: // Join Game
        if(!controlData.get(controlData.controls.lobby.join.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.create);
            Delay (1000);
            controlData.click(controlData.controls.lobby.button.join);
            Delay (1000);
        }
        if (game != '')
        {
            controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (100);
            //controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
            //Delay (100);
    controlData.click(controlData.controls.lobby.join.button.joinGame);
        }
check = 1;
    lastGameStatus = 1; // pending creation
      break;

   case 6: // Ladder
      break;

   case 7: // Channel List
      break;

   case 8: // Main Menu
      if(controlData.getCurrentRealmIndex() == me.gatewayid)
      {
         outputGameLength();
         controlData.click(controlData.gameTypes[me.playtype]);
      }
      else
         controlData.click(controlData.controls.mainMenu.button.gateway);
      break;

   case 9: // Login
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
      Delay(loginDelay);

      controlData.setText(controlData.controls.login.editBox.accountName, me.account);

      sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);

      locationTimeout(5000, location);
      break;

   case 10: // Login Error (this is a fatal error, so stop)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
      Delay(3500);
      break;

   case 11: // Unable To Connect
      timeoutDelay(unableToConnectRetry*60*1000, location)
      controlData.click(controlData.controls.login.unableToConnect.button.ok);
      break;

   case 12: // Character Select
      var _time, _control;

      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

      for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
      {
         _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
         if(_control && _control.GetText() != undefined)
            break;

         Delay(500);
      }

      if(_time < characterScreenTimeout)
      {
         Delay(characterSelectDelay);

         controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
         controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);

         // reset last game made, so it doesnt make a game immediately
         inGameAt = 0;
         setNextGameMake();
      }
      else
      {
         controlData.click(controlData.controls.characterSelect.button.exit);
         timeoutDelay(realmDownRetry*60*1000, location);
      }
      break;

   case 13: // Realm Down - Character Select screen
      controlData.click(controlData.controls.characterSelect.button.exit);
      timeoutDelay(realmDownRetry*60*1000, location);
      break;

   case 14: // Character Select - Disconnected
      timeoutDelay(disconnectedRetry*60*1000, location);
      controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
      break;

   case 15: // New Character
      break;   

   case 16: // Character Select - Please Wait popup
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
      break;

   case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
      controlData.click(controlData.controls.lobby.lostConnection.button.ok);
      break;

   case 18: // D2 Splash
      controlData.click(controlData.controls.d2Splash.textBox.copyright);
      break;

   case 19: // Login - Cdkey In Use
      timeoutDelay(cdkeyInUseRetry*60*1000, location);
      controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
      break;

   case 20: // Single Player - Select Difficulty
      RunGC(); // run garbage collector between each game

      controlData.click(controlData.singlePlayerDifficulties[me.diff]);
      break;

   case 21: // Main Menu - Connecting
      if(!locationTimeout(connectingToBnetTimeout, location))
         controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
      break;

   case 22: // Login - Invalid Cdkey (classic or xpac)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
      Delay(3500);
      break;   

   case 23: // Character Select - Connecting
      if(!locationTimeout(characterScreenTimeout, location))
         controlData.click(controlData.controls.characterSelect.button.exit);
      break;

   case 24: // Server Down - not much to do but wait..
      break;

   case 25: // Lobby - Please Wait
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
      break;

   case 26: // Lobby - Game Name Exists
      //sendEventToOOG(D2NT_MGR_PRINT_LOG, "Game already exists", 0);

      //inGameAt = 0;
      //lastGameStatus = 0;
      //setNextGameMake();
this.controls.lobby.button.quit
      locationTimeout(15000, location);
      break;

   case 27: // Gateway Select
      controlData.clickRealmEntry(me.gatewayid);
      controlData.click(controlData.controls.gateway.button.ok);
      break;

   case 28: // Lobby - Game Does Not Exist

Delay(160000); // 40 seconds longer then leader's min game time, edit yourself
controlData.click(controlData.controls.lobby.button.quit)
Delay(1000);
controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1)
check = 1;
oldgame = game;

      break;
   }
}

function sendEventToOOG(locationId, statusString, pendingTime)
{
   return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}

function setNextGameMake()
{
   lastGameMade = GetTickCount();
   nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
   inGameAt = 0;
   chatActionsDone = false;
}

function outputGameLength()
{
   if(inGameAt)
   {
      duration = GetTickCount() - inGameAt;

      inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
   }
}

function locationTimeout(time, location)
{
   endtime = GetTickCount() + time;

   while(controlData.getLocation().id == location.id && endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(500);
   }

   return (controlData.getLocation().id != location.id);
}

function timeoutDelay(time, location)
{
   endtime = GetTickCount() + time;

   while(endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(1000);
   }
}

function getRandomString(_length)
{
   _retString = "";
   _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";

   while(_length--)
   {
      _retString += _charSet.charAt(Random(0, _charSet.length-1));
      Delay(1);
   }

   return _retString;
}

(uses /f l command to find game, english, french, possibly german (german has to be added by you)  ''Killziky does not recommend this As it will cause more r/d's when spamming /f l''

Near the top of this code you will notice it says var leaderAccountName = "xxx";
Which ever account you are using that is the leader, put that account name exactly as it appears on the friends list in the quotes.

After you have these 2 files, the next step is to open up the file controlInfo.ntl
In this file locate the 2 lines that read this:
   this.controls.lobby.chat.textBox            = new Array();
   this.controls.lobby.chat.textBox.channelName         = [4,28,138,354,60];

Add this line under these:
   this.controls.lobby.chat.textBox.channelText              = [4,28,410,354,298];

This line makes the bot able to read the friends list.

I also editted the leader's baal script so the first tp it sends is fairly safe in the corner near baal (leechscript will take first tp from the leader)

There are 2 different if(ntconfig_publicmode) near the top of the baal script, what i did was i deleted the first if statement, and changed the 2nd one to look like this
   
Code: [Select]
if(NTConfig_PublicMode)
{
NTM_MoveTo(me.areaid, 15112, 5004, 1, true);
NTA_ClearPosition(20, true, 2);
NTM_MoveTo(me.areaid, 15116, 5004);

NTM_MakeTP();
//Say("TP is safe!");
NT_ClearThroneInt();
}


Places to edit in the NTBaalLeech.ntj file
   NTA_Initialize(); // 10

        var _leader = ""; // Name of leader's character in game, case sensitive
   
   if(!NTTM_CheckAct())


Places to edit in the NTBotLeech.ntj
var joinChannelInChat      = "";      // leave blank to not join a private channel

var leaderAccountName = "";   // Account name on friends list
var gamepassword = '';      // Game password if using one

Evram Has made some of this easier if you look a little further down :)

in case 28: // game does not exist
Delay(160000); Edit this number accordingly, 1000 = 1 second

just search this one :)

In the D2NT Manager on the bottom right you will see a drop down list of different .ntj files to load. Select NTBotLeech.ntj for the leech bot.

I may have missed a step in here, so any questions or if it is not working please feel free to post or PM me. I will try and help.[/quote]

This is all work from beo900 i just copied to here for you guys to have something to sticky :D


« Last Edit: August 05, 2010, 12:10:46 AM by cooptheking »

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Setup Leechbot Guide Beo900's Edition.
« on: July 30, 2010, 06:41:24 AM »

Offline killziky

  • Newbie
  • *
  • Join Date: Jun 2010
  • Posts: 46
  • Reputation 0
    • View Profile
Re: Beo900's Leechbot guide
« Reply #1 on: August 05, 2010, 12:05:03 AM »
Evrams input.. just for the ease of it :)

Code: [Select]
var gameMinLength = 90000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)

var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry = 300; // time in minutes to retry connecting on a realm down (default is 300 minutes)
var disconnectedRetry = 5; // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry = 5; // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout = 20000; // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout = 10000; // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout = 10000; // time in milliseconds to wait for a please wait popup
var createGameThreshold = 100; // time in milliseconds to wait between making games
var createGameThresholdRandom = 100; // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout = 10; // time in milliseconds to register a failed to create game
var waitInLineTimeout = 60000; // time in milliseconds to wait in lines for a create game (60 second default)
var characterSelectDelay = 1000; // time in milliseconds to wait before selecting a character on the char screen
var loginDelay = 1000; // time in milliseconds to wait before submitting login information
var clickDelay = 500; // wait X milliseconds before next action after a click event
var textDelay = 500; // wait X milliseconds before next action after inserting text into a textbox
var clickDelayRandom = 500; // random amount of time to add to a click
var textDelayRandom = 500; // random amount of time to add to a text set
var gameDoesNotExistDelayMin = 0; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax = 0; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout = 0; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterGame = true; // join chat after leaving a game
var joinRandomChannel = false; // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat = "345"; // leave blank to not join a private channel
var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat
var waitBeforeEnterChatMax = 3000; // max how long to wait before entering chat
var waitInChatBeforeActionsMin = 1000; // min how long to wait before joining channel
var waitInChatBeforeActionsMax = 1000; // max how long to wait before joining channel
var JoinFromChat = true;
var leaderAccountName ="beo70";

// DONT EDIT ANYTHING BELOW THIS

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: Beo900's Leechbot guide
« Reply #1 on: August 05, 2010, 12:05:03 AM »

Offline corgbigb

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 1
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #2 on: October 20, 2010, 08:10:09 AM »
first, i would like to say thanks for all you help and explanations!
second, i have followed all the instructions to a T and am getting an error!

my error is in the  ntbotgame.ntj
line 17
    NT_LoadConfig();

IS NOT DEFINED....wtf does this mean?
i have looked far and wide for a solution to this.
your explanations have got me so far...just not all the way YET

plz help me out guys!

Offline corgbigb

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 1
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #3 on: October 20, 2010, 09:26:49 AM »
ok.........

solved my problem!
figured that it was as simple as naming my char name in the char config file name.

NOW
i can get the leecher to find, join, party.......and that's it!
it will red error when i join the room telling me of an error in the nttownmove.ntl (323)
typeerror: _pos is undefinded

so i find line 323 in the nttownmove.ntl and it reads:
   if(_pos.x == 0 && _pos.y == 0)
   {
      NTTM_TownFindSpotInt(_act, spot);

      if(_pos.x == 0 && _pos.y == 0)
         return false;
   }



the section containing this string is:

function NTTM_TownMove(spot)
{
   var _act;
   var _pos;

   if(arguments.length < 1 || !spot)
      return false;

   _act = me.act - 1;

   if(_act == 0)
   {
      if(!NTTM_CreateAct1Int())
         return false;
   }

   _pos = _townpoints[_act][spot];

   if(_pos.x == 0 && _pos.y == 0)
   {
      NTTM_TownFindSpotInt(_act, spot);

      if(_pos.x == 0 && _pos.y == 0)
         return false;
   }

   if(_pos && _pos.x != 0 && _pos.y != 0)
   {
      var _path = NTTM_FindTownPathInt(_act, _pos.x, _pos.y, 15);

      if(!_path)
         return false;

      return NTTM_FollowTownPathInt(_path);
   }
   
   return false;
}




come on guys i know u can help out!
i feel like im sooooooo close to getting this script!
gimme some more faith in your site and you programming skills!

ty for your time

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: Setup Leechbot Guide Beo900's Edition.
« Reply #3 on: October 20, 2010, 09:26:49 AM »

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #4 on: October 20, 2010, 02:15:34 PM »
This might work to stop the erro (untested), but I don't think it would solve your problem.
Code: [Select]
function NTTM_TownMove(spot)
{
   var _act;
   var _pos;

   if(arguments.length < 1 || !spot)
      return false;

   _act = me.act - 1;

   if(_act == 0)
   {
      if(!NTTM_CreateAct1Int())
         return false;
   }

   if(_townpoints[_act][spot] == null)
         return false;

   _pos = _townpoints[_act][spot];

   if(_pos.x == 0 && _pos.y == 0)
   {
      NTTM_TownFindSpotInt(_act, spot);

      if(_pos.x == 0 && _pos.y == 0)
         return false;
   }

   if(_pos && _pos.x != 0 && _pos.y != 0)
   {
      var _path = NTTM_FindTownPathInt(_act, _pos.x, _pos.y, 15);

      if(!_path)
         return false;

      return NTTM_FollowTownPathInt(_path);
   }
   
   return false;
}




Heres a copy of the NTBotLeech.ntj included in pk release of d2nt:
Code: [Select]
// You downloaded this from PureKaoz.com; Enjoy!
// Make Sure to Tell your friends about PureKaoz.com and
// Please sign up, and post on our forum!



var gameMinLength      = 90000;   // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)

var unableToConnectRetry   = 5;      // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry      = 260;      // time in minutes to retry connecting on a realm down (default is 120 minutes)
var disconnectedRetry      = 5;      // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry      = 5;      // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout   = 20000;   // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout   = 5000;   // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout      = 2000;   // time in milliseconds to wait for a please wait popup
var createGameThreshold      = 5000;      // time in milliseconds to wait between making games
var createGameThresholdRandom   = 1000;      // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout      = 15000;   // time in milliseconds to register a failed to create game
var waitInLineTimeout      = 60000;   // time in milliseconds to wait in lines for a create game (60 second default)
var characterSelectDelay   = 1000;      // time in milliseconds to wait before selecting a character on the char screen
var loginDelay         = 1000;      // time in milliseconds to wait before submitting login information
var clickDelay         = 500;      // wait X milliseconds before next action after a click event
var textDelay         = 500;      // wait X milliseconds before next action after inserting text into a textbox
var clickDelayRandom      = 500;      // random amount of time to add to a click
var textDelayRandom      = 500;      // random amount of time to add to a text set
var gameDoesNotExistDelayMin   = 500;   // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax   = 500;   // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout   = 1000;   // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterGame      = true;   // join chat after leaving a game
var joinRandomChannel      = false;      // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat      = "clan nub";      // leave blank to not join a private channel
var waitBeforeEnterChatMin   = 1000;      // min how long to wait before entering chat
var waitBeforeEnterChatMax   = 2000;      // max how long to wait before entering chat
var waitInChatBeforeActionsMin   = 2000;      // min how long to wait before joining channel
var waitInChatBeforeActionsMax   = 3000;      // max how long to wait before joining channel
var JoinFromChat = true;
var leaderAccountName = "hustler2";
var gamepassword = '';
var samegame = '';
var oldgame = '';
var check = 1;

// DONT EDIT ANYTHING BELOW THIS

// D2NT Manager Command
const D2NT_MGR_LOADING = 1;
const D2NT_MGR_READY = 2;
const D2NT_MGR_LOGIN = 3;
const D2NT_MGR_CREATE_GAME = 4;
const D2NT_MGR_INGAME = 5;
const D2NT_MGR_RESTART = 6;
const D2NT_MGR_CHICKEN = 7;
const D2NT_MGR_PRINT_STATUS = 8;
const D2NT_MGR_PRINT_LOG = 9;

var lastGameMade = GetTickCount();
var lastGameStatus = 0;
var nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameFailed = false;

Include("libs/controlInfo.ntl");
//Include("joinBotSettings.ntl");

var controlData = new controlInfo();

var game = '';

function NTMain()
{
   Delay(1000);

   var _ingame = false;

   controlData.clickDelay = clickDelay;
   controlData.textDelay = textDelay;
   controlData.clickDelayRandom = clickDelayRandom;
   controlData.textDelayRandom = textDelayRandom;

   while(1)
   {
      if(me.ingame)
      {
         if(!inGameAt)
            inGameAt = GetTickCount();

         if(!_ingame)
         {
            if(Load("NTBot/NTBotGame.ntj"))
            {
               _ingame = true;

if(me.playtype > 0)
sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
else
sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);

               lastGameStatus = 2; // in game successful
            }
         }

         Delay(1000);
      }
      else
      {
         if(_ingame)
         {
            _ingame = false;

            sendEventToOOG(D2NT_MGR_READY, "", 0);
         }

         locationAction(controlData.getLocation());

         Delay(500);
      }
   }
}

function locationAction(location)
{
   switch(location.id)
   {
 
   case 3: // Lobby Chat
      if(!chatActionsDone)
      {
         chatActionsDone = true;
         Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
 
         if(joinRandomChannel || joinChannelInChat != "")
         {
            Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
            Delay(1000);
         }
      }
 
      if(JoinFromChat){

    if(check == 1)
{
    sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
    outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
    check = check + 1;
}
         game = '';
         if (joinChannelInChat)
Delay (1000);
//Say('Locating the leader : '+leaderAccountName);
 
         Say('/f l');
         Delay(1000);
         if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
         {
            var errors = '';
            var found_leader = false;
            lines = chat.GetText();
            for (var friend = 0; friend < lines.length; friend++)
            {
               if (lines[friend].lastIndexOf(': '+leaderAccountName+',') > -1)
               {
                  game = '';
                  found_leader = true;
                  var regOfflineEnglish=/^\d\s?:\s?(\w*)\s?,\s?offline\s*$/gi;
                  var regGameNameEnglish=/^\s*(the\s)?(game\s)?([\w\s-]*\w)\s\(private\)\.\s*$/gi;
                  var regGameNameFrench=/^\s*(la\s)?(partie\s)?([\w\s-]*\w)\s\(priv[^\)]*\)\.\s*$/gi;

                  if (lines[friend].match(regOfflineEnglish))
                  {
                     errors += (errors == '' ? '' : ' ') + 'leader is offline';
                  }
                  if (lines[friend + 1].match(regGameNameEnglish) && lines[friend+1].substr(1, 1) != ':')
                  {
                     game = lines[friend + 1].replace(regGameNameEnglish, "$3");
                  }
                  if (!game && lines[friend + 1].match(regGameNameFrench) && lines[friend+1].substr(1, 1) != ':')
                  {
                     game = lines[friend + 1].replace(regGameNameFrench, "$3");
                  }

                  if (game != '' && game != samegame && game != oldgame)
                  {
                     controlData.click(controlData.controls.lobby.button.join);
Delay(200);
                 controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (200);
controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
Delay (200);
         controlData.click(controlData.controls.lobby.join.button.joinGame);
check = 1;
                  }
                  else
                  {
                     if(!errors)
                     {
                        errors = 'leader is not in game.';
                     }
                  }
               }
            }
            if (!found_leader && joinChannelInChat)
            {
               if (errors)
                  Say('Errors : ' + errors);
               else
                  Say('I couldn\'t find the leader in my friend list.');
               Delay(1500);
            }
         }
         else
         {
            if (joinChannelInChat)
               Say('I can\'t read the chat!'); 
         }
         
      }


errors = '';

if(game != '')
samegame = game;

      break;
 
     
   case 1:   // Lobby
      if(location.id == 1 && joinChatAfterGame)
      {
         Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
         controlData.click(controlData.controls.lobby.button.enterChat);
         break;
      }

      if(GetTickCount() >= nextGameMake)
      {
         lastGameFailed = false;

         switch(lastGameStatus)
         {
         case 0:
            controlData.click(controlData.controls.lobby.button.create);
            nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         case 1: // game failed, rollover to reset timer
            inGameAt = GetTickCount(); // reset inGameAt, to wait how long we should have waited..
            lastGameFailed = true;
         case 2:
            outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         }
      }
      else
         timeoutDelay(nextGameMake-GetTickCount(), location);
      break;

   case 2: // Waiting In Line
      if(GetTickCount()-lastGameMade > waitInLineTimeout)
         controlData.click(controlData.controls.lobby.inLine.button.cancel);
      break;

   case 4: // Create Game
        if(!controlData.get(controlData.controls.lobby.create.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.join);
            Delay (500);
            controlData.click(controlData.controls.lobby.button.create);
            Delay (500);
        }
      sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

      RunGC(); // run garbage collector between each game

      locationTimeout(5000, location);

      lastGameMade = GetTickCount();
      lastGameStatus = 1; // pending creation
      break;

   case 5: // Join Game
        if(!controlData.get(controlData.controls.lobby.join.editBox.gameName))
        {
            controlData.click(controlData.controls.lobby.button.create);
            Delay (1000);
            controlData.click(controlData.controls.lobby.button.join);
            Delay (1000);
        }
        if (game != '')
        {
            controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
            Delay (100);
            //controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
            //Delay (100);
    controlData.click(controlData.controls.lobby.join.button.joinGame);
        }
check = 1;
    lastGameStatus = 1; // pending creation
      break;

   case 6: // Ladder
      break;

   case 7: // Channel List
      break;

   case 8: // Main Menu
      if(controlData.getCurrentRealmIndex() == me.gatewayid)
      {
         outputGameLength();
         controlData.click(controlData.gameTypes[me.playtype]);
      }
      else
         controlData.click(controlData.controls.mainMenu.button.gateway);
      break;

   case 9: // Login
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
      Delay(loginDelay);

      controlData.setText(controlData.controls.login.editBox.accountName, me.account);

      sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);

      locationTimeout(5000, location);
      break;

   case 10: // Login Error (this is a fatal error, so stop)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
      Delay(3500);
      break;

   case 11: // Unable To Connect
      timeoutDelay(unableToConnectRetry*60*1000, location)
      controlData.click(controlData.controls.login.unableToConnect.button.ok);
      break;

   case 12: // Character Select
      var _time, _control;

      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

      for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
      {
         _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
         if(_control && _control.GetText() != undefined)
            break;

         Delay(500);
      }

      if(_time < characterScreenTimeout)
      {
         Delay(characterSelectDelay);

         controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
         controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);

         // reset last game made, so it doesnt make a game immediately
         inGameAt = 0;
         setNextGameMake();
      }
      else
      {
         controlData.click(controlData.controls.characterSelect.button.exit);
         timeoutDelay(realmDownRetry*60*1000, location);
      }
      break;

   case 13: // Realm Down - Character Select screen
      controlData.click(controlData.controls.characterSelect.button.exit);
      timeoutDelay(realmDownRetry*60*1000, location);
      break;

   case 14: // Character Select - Disconnected
      timeoutDelay(disconnectedRetry*60*1000, location);
      controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
      break;

   case 15: // New Character
      break;   

   case 16: // Character Select - Please Wait popup
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
      break;

   case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
      controlData.click(controlData.controls.lobby.lostConnection.button.ok);
      break;

   case 18: // D2 Splash
      controlData.click(controlData.controls.d2Splash.textBox.copyright);
      break;

   case 19: // Login - Cdkey In Use
      timeoutDelay(cdkeyInUseRetry*60*1000, location);
      controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
      break;

   case 20: // Single Player - Select Difficulty
      RunGC(); // run garbage collector between each game

      controlData.click(controlData.singlePlayerDifficulties[me.diff]);
      break;

   case 21: // Main Menu - Connecting
      if(!locationTimeout(connectingToBnetTimeout, location))
         controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
      break;

   case 22: // Login - Invalid Cdkey (classic or xpac)
      sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
      Delay(3500);
      break;   

   case 23: // Character Select - Connecting
      if(!locationTimeout(characterScreenTimeout, location))
         controlData.click(controlData.controls.characterSelect.button.exit);
      break;

   case 24: // Server Down - not much to do but wait..
      break;

   case 25: // Lobby - Please Wait
      if(!locationTimeout(pleaseWaitTimeout, location))
         controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
      break;

   case 26: // Lobby - Game Name Exists
      //sendEventToOOG(D2NT_MGR_PRINT_LOG, "Game already exists", 0);

      //inGameAt = 0;
      //lastGameStatus = 0;
      //setNextGameMake();
this.controls.lobby.button.quit
      locationTimeout(15000, location);
      break;

   case 27: // Gateway Select
      controlData.clickRealmEntry(me.gatewayid);
      controlData.click(controlData.controls.gateway.button.ok);
      break;

   case 28: // Lobby - Game Does Not Exist

Delay(160000); // 40 seconds longer then leader's min game time, edit yourself
controlData.click(controlData.controls.lobby.button.quit)
Delay(1000);
controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1)
check = 1;
oldgame = game;

      break;
   }
}

function sendEventToOOG(locationId, statusString, pendingTime)
{
   return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}

function setNextGameMake()
{
   lastGameMade = GetTickCount();
   nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
   inGameAt = 0;
   chatActionsDone = false;
}

function outputGameLength()
{
   if(inGameAt)
   {
      duration = GetTickCount() - inGameAt;

      inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
   }
}

function locationTimeout(time, location)
{
   endtime = GetTickCount() + time;

   while(controlData.getLocation().id == location.id && endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(500);
   }

   return (controlData.getLocation().id != location.id);
}

function timeoutDelay(time, location)
{
   endtime = GetTickCount() + time;

   while(endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      Delay(1000);
   }
}

function getRandomString(_length)
{
   _retString = "";
   _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";

   while(_length--)
   {
      _retString += _charSet.charAt(Random(0, _charSet.length-1));
      Delay(1);
   }

   return _retString;
}



If neither of those help, post your leech script (using codebox, "#" button)

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: Setup Leechbot Guide Beo900's Edition.
« Reply #4 on: October 20, 2010, 02:15:34 PM »

Offline corgbigb

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 1
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #5 on: October 20, 2010, 11:08:52 PM »
is there any way to copy and paste the script w/o it trying to write the whole thing in one line? i have tried numerous times to copy and paste from your text boxes but it errors every time when i start the login process.

ALSO

what do you think about this new release of D2NT 1.7.2 and NTBot 3.6????

http://www.blizzhackers.cc/viewtopic.php?t=410779

i haven't found anything newer than release of 3.1 on your site.

they warn that its not safe against the warden. is this an older version of yours?

i am running d2nt 3.1 is what it says in top of window when i run.

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #6 on: October 24, 2010, 04:26:58 AM »
Click "Quote" then select the code from the quote and just never hit reply (or do and give props). I think firefox will allow formatted auto select, but I haven't tried even though I have it. lol


Quote
This is a Bot system for Diablo II 1.12
This is a version designed for an older diablo update.

Quote
* D2NT use no longer D2Loader
* D2NT use no longer hook or patch of D2's functions
* D2NT IS NOT safe from warden
It's not safe from warden. Why would I care what it does?

Offline Feral_Wolve

  • Newbie
  • *
  • Join Date: Nov 2010
  • Posts: 7
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #7 on: November 12, 2010, 09:47:03 AM »
Well i thought i had followed this to the T. Having issues though. In the Manager you set it to leechbot but when i try to leave game name empty it say..."room name empty" or w/e and wont let me leave it that way so not sure what to do there. I used the NTBotLeech script that said it doesnt use the /f l. I wasnt sure you YOU need to be on THERE f list...probably a silly question. let me know, thanks.

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: Setup Leechbot Guide Beo900's Edition.
« Reply #7 on: November 12, 2010, 09:47:03 AM »

Offline adC

  • Newbie
  • *
  • Join Date: Nov 2010
  • Posts: 4
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #8 on: November 12, 2010, 12:54:42 PM »
Well i thought i had followed this to the T. Having issues though. In the Manager you set it to leechbot but when i try to leave game name empty it say..."room name empty" or w/e and wont let me leave it that way so not sure what to do there. I used the NTBotLeech script that said it doesnt use the /f l. I wasnt sure you YOU need to be on THERE f list...probably a silly question. let me know, thanks.

Hello there, i can help you if you want. pm me.
Play Hard & Go Pro! c,' )

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #9 on: November 12, 2010, 03:39:46 PM »
Quote
I wasnt sure you YOU need to be on THERE f list...probably a silly question. let me know, thanks.

If you are not (mutual), it doesn't show the game they are in, and wont work.

Offline marreco167

  • Newbie
  • *
  • Join Date: Jun 2010
  • Posts: 3
  • Reputation 0
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #10 on: November 16, 2010, 09:42:10 PM »
I got it, it is joining the game partying. Them it goes to the tp and stays there the whole time it doesnt move, what should i do?

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #11 on: November 19, 2010, 12:34:17 AM »
I know I answered this recently, but where? o.O
Busy busy busy. I would try searching "D2 Bot Support" forum for it mr...
I got it, it is joining the game partying. Them it goes to the tp and stays there the whole time it doesnt move, what should i do?
Post your Leader Character Name exactly as it appears.
Post your character file for followers.
Post your baal/chaos scripts (whichever you use).

Offline needhelpomg

  • Newbie
  • *
  • Join Date: Nov 2010
  • Posts: 0
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #12 on: November 23, 2010, 07:51:20 PM »
i have some problems with the leech bot..
i followed everystep and still
when i run my bots the follower will go to the channel and wont join the leaders game.. if i do it manually everything is ok then..
any suggestions plz?

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #13 on: November 23, 2010, 08:40:11 PM »
For starters...

Some common misses for leech running....

All character files (or at least the followers)
add or edit:
Code: [Select]
NTConfig_Leader = "YourLeader_Name" // Your Leader name - CaSe sensitive

NTConfig_Script.push("NTBaalLeech.ntj");
NTConfig_Script.push("NTBaalLeechFight.ntj");
Comment out 1 of these lines with //
 example--->   //NTConfig_Script.push("NTBaalLeechFight.ntj");
Its up to you to know which of these scripts you have in your bots folder.

Leader character file
Edit:
Code: [Select]
NTConfig_PublicMode = true;
Follower character file
Edit:
Code: [Select]
NTConfig_Leader = "YourLeader_Name"This must be your leader CHARACTER NAME.

NTConfig
Add (if not exist):
Code: [Select]
var NTConfig_Leader;
NTBotLeech
Edit:
Code: [Select]
var leaderAccountName = "AccoUNt_Nam3";
var gamepassword = "GamePassWord";

NTBot
Edit:
Code: [Select]
channelUsers.push("AccountName");
channelUsers.push("CharacterName");
Replace with your info. You may add more lines if needed.


Leader Entree Point (in manager) :: NTBot
Follower Entree Point (in manager) :: NTBotLeech

More uh... FAQ solutions coming... Going to build (and sticky) a FAQ post. You inspired me.
« Last Edit: November 24, 2010, 11:01:53 PM by mythosis »

Offline jewbanger

  • Newbie
  • *
  • Join Date: Dec 2010
  • Posts: 4
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: Setup Leechbot Guide Beo900's Edition.
« Reply #14 on: December 18, 2010, 01:59:59 AM »
Just wanted to say, that you do not need the first .ntj that you stick in your bot folder, im assuming this is only
a script to like lvl a char or something, but if you have 2 gfg chars then you dont need it.. im going to create a
small little guide today to let people know that just want to run 2 gfg bots to leech off one another!! there is
basicly only one problem that i see happening on my test runs and usally only happens when the leader creates
the game and then the follow bot creates it also, and if the leader isnt in the game at the exact time the follower
types in the game info and hits join, then the game will say does not exsist. so if you can direct me to the delazs
for the leecher only. Or maybe somehow delay the /f l for every 10 secs or so.. that would work to then there would
be not one problem.. my bots run perfectly together, have not seen one error as of yet, this trying to join the game
as soon as leader types it is only problem. so anyways thanks in advanced!!

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: Setup Leechbot Guide Beo900's Edition.
« Reply #14 on: December 18, 2010, 01:59:59 AM »