Author Topic: D2NT Announce Next Game in Channel!  (Read 5665 times)

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
D2NT Announce Next Game in Channel!
« on: May 19, 2010, 04:06:32 PM »
Okay, so i found this script finally on google, and some guy wrote all about it in a different lanuage... So i decided to write a how-to in ENGLISH! and i also wanted to edit some delays, because it made me temp ban.


Okay, go into your D2NT folder, and open the scripts folder.

Create a new text document, and name it NTPublicBaal.ntj, then copy/paste this to it.
Code: [Select]
/****************************************************************************
*               This file was modified by Muddy_Waters@epvp.de 
* Re-Modified by http://PureKaoz.com                  *                         *
*                        Last Update: 05/19/2010                            *
****************************************************************************/
var gameMinLength = 120000; // 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 = 15000; // time in milliseconds to wait between making games
var createGameThresholdRandom = 5000; // 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 = 1000; // wait X milliseconds before next action after a click event
var textDelay = 1000; // 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 = 600000; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax = 900000; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout = 30000; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterLogin = true; // join chat after login
var joinRandomChannel = false; // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat = "OP RandomChannel"; // leave blank not to join a private channel
var channelLogin = false; // type ".login" once after joining the channel
var channelUsers = new Array(); // dynamic array that holds channel users
//---------------------------------------------------------------------------------------------------------------------------------------------------------
// add any char/account here that is supposed to perform chat actions/game announcements or join a private channel
channelUsers.push("AccountName");
channelUsers.push("CharacterName");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//These key expressions are replaced that way: %game --> "gamename-",%counter --> number of the next game, %time --> time in seconds till game creation, %password --> game password
//Note that the announcement will start after the first run, so there won't be any anncouncement right after login
var gameAnnouncement = "Next Game! Join %game%counter//%password in %time seconds."; // leave blank not to post a channel announcement
var gameAnnouncementDelay = 5000; // wait X milliseconds before posting the announcement message (don't set this too low!)
var gameAnnouncementDelayRandom = 500; // random amount of time to add to a to the announcement delay
//----------------------------------------------------------------------------------------------------------------------------------------------------------
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

// 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;
var joinedChannel = false;
var justJoined = true;

Include("libs/controlInfo.ntl");

var controlData = new controlInfo();

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)
{
RunGC(); // run garbage collector between each game

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(justJoined)
{
justJoined = false;
if(isChannelUser(me.account, me.charname))
{
for(var i = 0; i < 3; i++)
{
SetStatusText("?c2Chat actions enabled!");
Delay(750);
SetStatusText("");
Delay(750);
}
}
else
{
for(var i = 0; i < 3; i++)
{
SetStatusText("?c1Chat actions disabled!");
Delay(750);
SetStatusText("");
Delay(750);
}
}
}
if(!chatActionsDone && isChannelUser(me.account, me.charname))
{
chatActionsDone = true;
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
if(!joinedChannel && (joinRandomChannel || joinChannelInChat != ""))
{
var rndChannel = getRandomString(Random(3,10));
SetStatusText("?c8Joining Channel " + (joinRandomChannel ? rndChannel : joinChannelInChat) );
Say("/join " + (joinRandomChannel ? rndChannel : joinChannelInChat));
joinedChannel = true;
Delay(1000);
if(channelLogin)
{
SetStatusText("?c8Channel Login...");
Say(".login");
Delay(2000);
}
}
}
case 1: // Lobby
if(location.id == 1 && joinChatAfterLogin)
{
Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
controlData.click(controlData.controls.lobby.button.enterChat);
break;
}
if(GetTickCount() > nextGameMake)
{
var _control;

lastGameFailed = false;

switch(lastGameStatus)
{
case 0:
_control = controlData.get(controlData.controls.lobby.button.create);
if(_control && _control.pressed)
{
controlData.click(controlData.controls.lobby.button.join);
Delay(500);
}

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();
lastGameFailed = true;
Delay(5000);

case 2:
outputGameLength();
lastGameStatus = 0;
setNextGameMake();
if(lastGameFailed)
{
SetStatusText("?c1Failed to join!");
sendEventToOOG(D2NT_MGR_PRINT_LOG, "?E00000Game " + ((getGameCounter(me.gamename, true)) ? ("(" + getGameCounter(me.gamename, false) + ")") : "") + " creation failed!", 0)
Delay(2500);
}
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
break;
}
}
else
{
if(joinChannelInChat && gameAnnouncement && me.gamename && isChannelUser(me.account, me.charname))
{
var tempDelay = (gameAnnouncementDelay > 5500) ? gameAnnouncementDelay : 5500 +
(gameAnnouncementDelayRandom > 700) ? Random(0, gameAnnouncementDelayRandom) : 500;
var gameText = gameAnnouncement;
gameText = gameText.replace("%password", me.gamepassword);
gameText = gameText.replace("%game", getGameName(me.gamename));
gameText = gameText.replace("%counter", getGameCounter(me.gamename, false));
gameText = gameText.replace("%time", parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0));
if(parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0) > 5)
{
Delay(tempDelay);
Say(gameText);
}
}
timeoutDelay(nextGameMake-GetTickCount(), location, true);
}
break;

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

case 4: // Create Game
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

locationTimeout(5000, location);

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

case 5: // Join Game
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
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, "?E00000Game already exists", 0);
SetStatusText("?c1Game akready exists!");
inGameAt = 0;
lastGameStatus = 0;
setNextGameMake();

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
inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
lastGameStatus = 0;
setNextGameMake();

locationTimeout(gameDoesNotExistTimeout, location);
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, showNextGameStatus)
{
if(arguments.length < 3)
showNextGameStatus = false;

endtime = GetTickCount() + time;

while(endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
if(showNextGameStatus)
{
if(lastGameFailed && parseInt((endtime-GetTickCount())/1000) > 30)
{
if(parseInt((endtime-GetTickCount())/1000) % 30 == 0)
{
SetStatusText("?c1Last game failed!");
Delay(5000);
}
if(me.gamename && getGameCounter(me.gamename, false))
SetStatusText("?c8Next game: " + getGameName(me.gamename) + getGameCounter(me.gamename, false) + " (" + parseInt((endtime-GetTickCount())/1000) + "s)");
else
SetStatusText("?c8Game creation pending... (" + parseInt((endtime-GetTickCount())/1000) + "s)");
}
else if(parseInt((endtime-GetTickCount())/1000) >= 0)
{
if(me.gamename && getGameCounter(me.gamename, false))
SetStatusText("?c8Next game: " + getGameName(me.gamename) + getGameCounter(me.gamename, false) + " (" + parseInt((endtime-GetTickCount())/1000) + "s)");
else
SetStatusText("?c8Game creation pending... (" + parseInt((endtime-GetTickCount())/1000) + "s)");
}
}
Delay(1000);
if(me.ingame)
endtime = GetTickCount();
}
if(showNextGameStatus)
SetStatusText("?c8Creating game...");
}

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

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

return _retString;
}

function getGameName(lastGameString)
{
if(!lastGameString)
return "";
else
return (lastGameString.split("-")[0] + "-");
}

function getGameCounter(lastGameString, simple)
{
var myCount;
if(!lastGameString)
return "-1";
else
{
switch(lastGameString.split("-")[1])
{
case "08":
myCount = 9;
break;
case "09":
myCount = 10;
break;
default:
myCount = parseInt(lastGameString.split("-")[1]) + 1;
break;
}
if(!simple)
{
if(myCount <= 9)
return ('0' + myCount);
}
return myCount;
}
}

function isChannelUser(accountname, charname)
{
for(var i = 0; i < channelUsers.length; i++)
{
if(accountname.toLowerCase() == channelUsers[i].toLowerCase() || charname.toLowerCase() == channelUsers[i].toLowerCase())
return true;
}
return false;
}

After you have pasted the coding to your .ntj file... you have to edit a few things.

Code: [Select]
[color=red]channelUsers.push("AccountName");
channelUsers.push("CharacterName");[/color]

Fill in your account name, and character name inside the quotes.....


Then you can edit this part of the config

Code: [Select]
[color=red]var gameAnnouncement = "Next Game! Join %game%counter//%password in %time seconds."; // leave blank not to post a channel announcement
var gameAnnouncementDelay = 5500; // wait X milliseconds before posting the announcement message (don't set this too low!)
var gameAnnouncementDelayRandom = 550; // random amount of time to add to a to the announcement delay[/color]

Game announcement is what you want to say... followed by the game, game number, // password, and how long till it's to be made.

If you have any problems with these delays, just keep bumping them up... i changed them to 5500 and 550


Enjoy!
USEast Channel: Clan Kaoz
HighLyfe@jsp

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

D2NT Announce Next Game in Channel!
« on: May 19, 2010, 04:06:32 PM »

Offline TheFreak

  • Just like an admin ;)
  • AFK Admins
  • PK Pro
  • *****
  • Join Date: May 2010
  • Posts: 372
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #1 on: May 24, 2010, 12:51:10 AM »
Works great, using it now.


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"

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

Re: D2NT Announce Next Game in Channel!
« Reply #1 on: May 24, 2010, 12:51:10 AM »

Offline ozone

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 2
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #2 on: May 26, 2010, 10:46:21 AM »

var gameAnnouncement = "Next Game! Join xxx-1//%password in %time seconds."; // leave blank not to post a channel announcement

if i put like this all the time i'm in channel it will say alwaise xxx-1. the ng is xxx-2 and so on  :o

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: D2NT Announce Next Game in Channel!
« Reply #3 on: May 26, 2010, 02:48:47 PM »

var gameAnnouncement = "Next Game! Join xxx-1//%password in %time seconds."; // leave blank not to post a channel announcement

if i put like this all the time i'm in channel it will say alwaise xxx-1. the ng is xxx-2 and so on  :o

yes you can take the //password out if you dont plan on using a password..
USEast Channel: Clan Kaoz
HighLyfe@jsp

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

Re: D2NT Announce Next Game in Channel!
« Reply #3 on: May 26, 2010, 02:48:47 PM »

Offline ozone

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 2
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #4 on: May 26, 2010, 05:20:53 PM »
the problem isnt the password! the problem is that it says only xxx-1 and doesnt edit the number when ng will be xxx-3

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

Re: D2NT Announce Next Game in Channel!
« Reply #4 on: May 26, 2010, 05:20:53 PM »

Offline TheFreak

  • Just like an admin ;)
  • AFK Admins
  • PK Pro
  • *****
  • Join Date: May 2010
  • Posts: 372
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #5 on: May 26, 2010, 09:54:06 PM »
the problem isnt the password! the problem is that it says only xxx-1 and doesnt edit the number when ng will be xxx-3

It should be like this:

Code: [Select]
[color=red]var gameAnnouncement = "Next Game! Join %game%counter//%password in %time seconds."; // leave blank not to post a [/color]
That will say xxx-1 then xxx-2. It gets tha game counter from yur d2nt manager.


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"

Offline RealColdFire

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 4
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #6 on: May 28, 2010, 04:13:15 PM »
I was wondering if there was a way for the bot to announce the game a second before creating the game rather then announcing the game and then sitting in the channel..

I have a 40 second delay between making games because I only use one cd key - I dont get a lot of runners because the bot announces the next game and then sits for the delay period..

I've tried to change the AnnounceGameDelay to about 3-5 seconds before making the game but it will wait that delay and then wait the actual delay of 40 seconds to create the game..

Any way I can set it so it announces the game seconds before game creation?

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: D2NT Announce Next Game in Channel!
« Reply #7 on: May 28, 2010, 07:31:19 PM »
When i use one cdkey, i still only keep the 5 second random delay, and it work's fine bud... Imo i would run it like that, with DEFAULT delays that i have supplied they are tested with one cdkey and ran over 250 runs succesfully. under 3 minute runs to.

But otherwise, just change the delay that it anounces to about 35 seconds and it should do it within 5 second before
(Remember its milliseconds, so set it to 35000 delay.)
Let me know if this helps you!
USEast Channel: Clan Kaoz
HighLyfe@jsp

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

Re: D2NT Announce Next Game in Channel!
« Reply #7 on: May 28, 2010, 07:31:19 PM »

Offline RealColdFire

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 4
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #8 on: May 28, 2010, 07:41:30 PM »
I've tried to change the AnnounceGameDelay to about 3-5 seconds before making the game but it will wait that delay and then wait the actual delay of 40 seconds to create the game..

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: D2NT Announce Next Game in Channel!
« Reply #9 on: May 29, 2010, 10:36:44 PM »
I've tried to change the AnnounceGameDelay to about 3-5 seconds before making the game but it will wait that delay and then wait the actual delay of 40 seconds to create the game..

Okay, i am trying to edit the code so that it will announce the game on the game create function.. i'll give you an update soon...
it's pretty much like making a special edition just for you...... AIM me @ DGAFJustin
USEast Channel: Clan Kaoz
HighLyfe@jsp

Offline RealColdFire

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 4
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #10 on: May 30, 2010, 02:39:08 AM »
I'm sorry I dont have AIM - maybe you can give me your email - this is what my script looks like

Code: [Select]
/****************************************************************************
*               This file was modified by Muddy_Waters@epvp.de
*         Re-Modified by http://PureKaoz.com                  *                                                                                                   *
*                        Last Update: 05/19/2010                            *
****************************************************************************/
var gameMinLength      = 180;   // 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      = 40000;      // time in milliseconds to wait between making games
var createGameThresholdRandom   = 40000;      // 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         = 500;      // time in milliseconds to wait before submitting login information
var clickDelay         = 1000;      // wait X milliseconds before next action after a click event
var textDelay         = 1000;      // 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   = 600000;   // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax   = 900000;   // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout   = 30000;   // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var joinChatAfterLogin      = true;      // join chat after login
var joinRandomChannel      = false;      // if this is true, will join a random channel, otherwise it will use the channel below..
var joinChannelInChat      = "OP Baalz";      // leave blank not to join a private channel
var channelLogin         = true;   // type ".login" once after joining the channel
var channelUsers          = new Array(); // dynamic array that holds channel users
//---------------------------------------------------------------------------------------------------------------------------------------------------------
// add any char/account here that is supposed to perform chat actions/game announcements or join a private channel
channelUsers.push("Darkminion");
channelUsers.push("Darkminion");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//These key expressions are replaced that way: %game --> "gamename-",%counter --> number of the next game, %time --> time in seconds till game creation, %password --> game password
//Note that the announcement will start after the first run, so there won't be any anncouncement right after login
var gameAnnouncement      = "Next Game! Join %game%counter in %time seconds."; // leave blank not to post a channel announcement
var gameAnnouncementDelay   = 35000; // wait X milliseconds before posting the announcement message (don't set this too low!)
var gameAnnouncementDelayRandom = 35000; // random amount of time to add to a to the announcement delay
//----------------------------------------------------------------------------------------------------------------------------------------------------------
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

// 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;
var   joinedChannel = false;
var justJoined = true;

Include("libs/controlInfo.ntl");

var controlData = new controlInfo();

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)
         {
            RunGC(); // run garbage collector between each game

            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(justJoined)
      {
         justJoined = false;
         if(isChannelUser(me.account, me.charname))
         {
            for(var i = 0; i < 3; i++)
            {
               SetStatusText("?c2Chat actions enabled!");   
               Delay(750);
               SetStatusText("");   
               Delay(750);
            }
         }
         else
         {
            for(var i = 0; i < 3; i++)
            {
               SetStatusText("?c1Chat actions disabled!");   
               Delay(750);
               SetStatusText("");   
               Delay(750);
            }
         }
      }
      if(!chatActionsDone && isChannelUser(me.account, me.charname))
      {
         chatActionsDone = true;
         Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
         if(!joinedChannel && (joinRandomChannel || joinChannelInChat != ""))
         {
            var rndChannel = getRandomString(Random(3,10));
            SetStatusText("?c8Joining Channel " + (joinRandomChannel ? rndChannel : joinChannelInChat) );
            Say("/join " + (joinRandomChannel ? rndChannel : joinChannelInChat));
            joinedChannel = true;
            Delay(1000);
            if(channelLogin)
            {
               SetStatusText("?c8Channel Login...");
               Say(".login");
               Delay(2000);
            }
         }
      }
   case 1:   // Lobby
      if(location.id == 1 && joinChatAfterLogin)
      {
         Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
         controlData.click(controlData.controls.lobby.button.enterChat);
         break;
      }
      if(GetTickCount() > nextGameMake)
      {
         var _control;

         lastGameFailed = false;

         switch(lastGameStatus)
         {
         case 0:
            _control = controlData.get(controlData.controls.lobby.button.create);
            if(_control && _control.pressed)
            {
               controlData.click(controlData.controls.lobby.button.join);
               Delay(500);
            }

            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();
            lastGameFailed = true;
            Delay(5000);
           
         case 2:
            outputGameLength();
            lastGameStatus = 0;
            setNextGameMake();
            if(lastGameFailed)
            {
               SetStatusText("?c1Failed to join!");
               sendEventToOOG(D2NT_MGR_PRINT_LOG, "?E00000Game " + ((getGameCounter(me.gamename, true)) ? ("(" + getGameCounter(me.gamename, false) + ")") : "") + " creation failed!", 0)
               Delay(2500);
            }
            sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
            break;
         }
      }
      else
      {
         if(joinChannelInChat && gameAnnouncement && me.gamename && isChannelUser(me.account, me.charname))
         {
            var tempDelay = (gameAnnouncementDelay > 5500) ? gameAnnouncementDelay : 5500 +
                     (gameAnnouncementDelayRandom > 700) ? Random(0, gameAnnouncementDelayRandom) : 500;
            var gameText = gameAnnouncement;
            gameText = gameText.replace("%password", me.gamepassword);
            gameText = gameText.replace("%game", getGameName(me.gamename));
            gameText = gameText.replace("%counter", getGameCounter(me.gamename, false));
            gameText = gameText.replace("%time", parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0));
            if(parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0) > 5)
            {   
               Delay(tempDelay);
               Say(gameText);
            }
         }
         timeoutDelay(nextGameMake-GetTickCount(), location, true);
      }
      break;

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

   case 4: // Create Game
      sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

      locationTimeout(5000, location);

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

   case 5: // Join Game
      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
      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, "?E00000Game already exists", 0);
      SetStatusText("?c1Game akready exists!");
      inGameAt = 0;
      lastGameStatus = 0;
      setNextGameMake();

      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
      inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
      lastGameStatus = 0;
      setNextGameMake();

      locationTimeout(gameDoesNotExistTimeout, location);
      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, showNextGameStatus)
{
   if(arguments.length < 3)
      showNextGameStatus = false;
   
   endtime = GetTickCount() + time;

   while(endtime > GetTickCount())
   {
      sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
      if(showNextGameStatus)
      {
         if(lastGameFailed && parseInt((endtime-GetTickCount())/1000) > 30)
         {
            if(parseInt((endtime-GetTickCount())/1000) % 30 == 0)
            {
               SetStatusText("?c1Last game failed!");
               Delay(5000);
            }
            if(me.gamename && getGameCounter(me.gamename, false))
               SetStatusText("?c8Next game: " + getGameName(me.gamename) + getGameCounter(me.gamename, false) + " (" + parseInt((endtime-GetTickCount())/1000) + "s)");
            else
               SetStatusText("?c8Game creation pending... (" + parseInt((endtime-GetTickCount())/1000) + "s)");
         }
         else if(parseInt((endtime-GetTickCount())/1000) >= 0)
         {
            if(me.gamename && getGameCounter(me.gamename, false))
               SetStatusText("?c8Next game: " + getGameName(me.gamename) + getGameCounter(me.gamename, false) + " (" + parseInt((endtime-GetTickCount())/1000) + "s)");
            else
               SetStatusText("?c8Game creation pending... (" + parseInt((endtime-GetTickCount())/1000) + "s)");
         }
      }
      Delay(1000);
         if(me.ingame)
            endtime = GetTickCount();
   }
   if(showNextGameStatus)
      SetStatusText("?c8Creating game...");
}

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

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

   return _retString;
}

function getGameName(lastGameString)
{
   if(!lastGameString)
      return "";
   else
      return (lastGameString.split("-")[0] + "-");
}

function getGameCounter(lastGameString, simple)
{
   var myCount;
   if(!lastGameString)
      return "-1";
   else
   {
      switch(lastGameString.split("-")[1])
      {
         case "08":
            myCount = 9;
            break;
         case "09":
            myCount = 10;
            break;
         default:
            myCount = parseInt(lastGameString.split("-")[1]) + 1;
            break;
      }
      if(!simple)
      {
         if(myCount <= 9)
            return ('0' + myCount);
      }
      return myCount;
   }
}

function isChannelUser(accountname, charname)
{
   for(var i = 0; i < channelUsers.length; i++)
   {
      if(accountname.toLowerCase() == channelUsers[i].toLowerCase() || charname.toLowerCase() == channelUsers[i].toLowerCase())
         return true;
   }
   return false;
}

I noticed sometimes it dousnt even do the announcement - last night I changed my script to CreateGameDelay= 5000 and GameAnnounce= 3000 and it would work a couple games and then just stop announcing later on as the games progressed..

Since I got a r/d from using that (I figured I would try a low create game delay because I do baal and chaos) I went back to 40 second create game delay and although before it would wait the 35 second mark (as shown in my script) - announce the game AND THEN wait the actual create game delay period to create the game.. it dousnt seem to even be doing that anymore..

Not to complain but I'm just trying to help on improving script..

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: D2NT Announce Next Game in Channel!
« Reply #11 on: May 30, 2010, 06:48:01 AM »
Well, have you tried to get the 35 seconds out of the game announce, and a 5 second delay on creating game? If that doesn't work, ill finish editing the code.. lmk.
USEast Channel: Clan Kaoz
HighLyfe@jsp

Offline RealColdFire

  • Newbie
  • *
  • Join Date: May 2010
  • Posts: 4
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #12 on: May 30, 2010, 11:30:22 AM »
I've tried to set the creategamedelay to 0 and gameannounce to 40 seconds and the bot just creates games right away..

Also have tried to set the delay to around 5 seconds and bot just creates game - completely ignores any announcegame code..

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: D2NT Announce Next Game in Channel!
« Reply #13 on: May 30, 2010, 03:37:24 PM »
I've tried to set the creategamedelay to 0 and gameannounce to 40 seconds and the bot just creates games right away..

Also have tried to set the delay to around 5 seconds and bot just creates game - completely ignores any announcegame code..

If you search the gamedealy, and announce delay farther down into the coding, you will see how it is hardcoded that if your delay is low it changes it... you may want to try to manually edit these down in the code.
USEast Channel: Clan Kaoz
HighLyfe@jsp

Offline Helvinek

  • Newbie
  • *
  • Join Date: Jun 2010
  • Posts: 4
  • Reputation 0
    • View Profile
Re: D2NT Announce Next Game in Channel!
« Reply #14 on: June 08, 2010, 01:33:30 PM »
I cant get mine to work at all, its saved as a .ntj in my scripts folder, ive played with the numbers a bit and i get nothing. Its not even doing a .login for op pkbaal, i have to inbetween a run do it manually before it loads the next game. Im not really sure what the problem is, im usually able to troubleshoot these kind of things.

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

Re: D2NT Announce Next Game in Channel!
« Reply #14 on: June 08, 2010, 01:33:30 PM »