Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Diablo 2 > Diablo 2 Programming
You last visited: Today at 00:42

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[D2NT Release] Game Announcements im Channel

Discussion on [D2NT Release] Game Announcements im Channel within the Diablo 2 Programming forum part of the Diablo 2 category.

Reply
 
Old 05/10/2010, 07:05   #31
 
elite*gold: 0
Join Date: Apr 2010
Posts: 58
Received Thanks: 1
Dabash is offline  
Old 05/10/2010, 08:58   #32
Administrator
 
Muddy Waters's Avatar
 
elite*gold: 41364
Join Date: Jan 2010
Posts: 22,729
Received Thanks: 12,625
Quote:
Originally Posted by Dabash View Post
ok dann mal drauf achten danke ^^

so habe mal drauf geachtet
und joa tut sich garnix kein blincken kein text nix auhc nach den ersten bal run tippselt auch nicht .login im chat also rein garnix
In dem Fall scheint die Sache ziemlich eindeutig. Was bei dir läuft ist nicht mein modifiziertes Script, sondern die standard NTBot.ntj! Stell sicher, dass du die original NTBot.ntj mit meinem Anhang oder dem Inhalt der [Code] Box überschreibst, eventuell vorher sichern.

Ansonsten kann sich da gar nichts tun.

Lg
Muddy
Muddy Waters is offline  
Thanks
1 User
Old 05/10/2010, 09:24   #33
 
elite*gold: 0
Join Date: Apr 2010
Posts: 58
Received Thanks: 1
ok dan versuche ch mal copy deis raus und dann mal sehn^^
Dabash is offline  
Old 05/10/2010, 10:18   #34
 
elite*gold: 0
Join Date: Apr 2010
Posts: 58
Received Thanks: 1
so er läuft soweit danke^^

aber eins noch :ab und an läuft er ab und an ned das komisch^^

woran könnts noch liegen das es ned immer geht ?

Quote:
var gameMinLength = 60000; // 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 = 5; // 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 = 14000; // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout = 8000; // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout = 8000; // time in milliseconds to wait for a please wait popup
var createGameThreshold = 5500; // time in milliseconds to wait between making games
var createGameThresholdRandom = 3000; // time in milliseconds to randomly add +/- to the game create time
var createGameTimeout = 8000; // time in milliseconds to register a failed to create game
var waitInLineTimeout = 5000; // 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 = 2000; // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
var gameDoesNotExistDelayMax = 2000; // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
var gameDoesNotExistTimeout = 3000; // 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 lastbaal"; // 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("vivalabash-l");
channelUsers.push("DaBashii");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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 = ": 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
Dabash is offline  
Old 05/10/2010, 17:54   #35
 
elite*gold: 0
Join Date: May 2010
Posts: 9
Received Thanks: 0
Das hier ist meine

Code:
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 lastbaal";		// 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("ponz_iv");
channelUsers.push("ponz_Adam");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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		= "Test Announcement: 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 = true;
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 > 5000) ? gameAnnouncementDelay : 5000 + 
							(gameAnnouncementDelayRandom > 500) ? 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;
}

Mein Problem:

Er geht zwar auf "join Channel" aber geht nicht in, zb bei mir, op lastbaal
brain_91 is offline  
Old 05/10/2010, 18:34   #36
 
elite*gold: 0
Join Date: Apr 2010
Posts: 58
Received Thanks: 1
Quote:
Originally Posted by brain_91 View Post
Das hier ist meine

Code:
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 lastbaal";		// 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("ponz_iv");
channelUsers.push("ponz_Adam");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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		= "Test Announcement: 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 = true;
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 > 5000) ? gameAnnouncementDelay : 5000 + 
							(gameAnnouncementDelayRandom > 500) ? 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;
}

Mein Problem:

Er geht zwar auf "join Channel" aber geht nicht in, zb bei mir, op lastbaal
hmm sollte er aber tun sehe da grade bei dir kein fehler drinne
Dabash is offline  
Old 05/10/2010, 21:19   #37
Administrator
 
Muddy Waters's Avatar
 
elite*gold: 41364
Join Date: Jan 2010
Posts: 22,729
Received Thanks: 12,625
Quote:
Originally Posted by Dabash View Post
so er läuft soweit danke^^

aber eins noch :ab und an läuft er ab und an ned das komisch^^

woran könnts noch liegen das es ned immer geht ?
Sofern währenddessen oben im Statustext "Game Creation pending..." statt deinem game namen steht, dann liegt das daran, dass der Spielname oder auch der counter nicht definiert sind. Du brauchst eben mindestens ein Spiel mit gültigem Namen damit das rund läuft. Nach nem Crash beispielsweise fehlt das.
Mal schaun, wenn ich mal wieder Zeit habe, baue ich vielleicht ein Datei backup ein, sodass das auch nach einem Crash korrekt initialisiert wird.

Quote:
Originally Posted by brain_91 View Post
Das hier ist meine

Code:
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 lastbaal";		// 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("ponz_iv");
channelUsers.push("ponz_Adam");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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		= "Test Announcement: 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 = true;
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) );
				[COLOR="Red"]Delay(1000);[/COLOR]
				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 > 5000) ? gameAnnouncementDelay : 5000 + 
							(gameAnnouncementDelayRandom > 500) ? 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;
}

Mein Problem:

Er geht zwar auf "join Channel" aber geht nicht in, zb bei mir, op lastbaal
Was macht er stattdessen? Nichts? das "join Channel" steht im Statustext nehme ich an?

Eventuell müsste da noch ein Delay rein, obwohl das mit dem Statustext eigentlich nicht sein müsste. Aber die Say() Funktion zickt gerne mal rum, wenn man zu flott ist. Ich habe dir mal ein Delay an der passenden Stelle eingefügt (siehe Quote), probier doch bitte mal ob das was bringt.

Lg
Muddy
Muddy Waters is offline  
Old 05/10/2010, 21:36   #38
 
elite*gold: 0
Join Date: May 2010
Posts: 9
Received Thanks: 0
nene er joint den public eu de-xx channel.. und postet da sein game ganz normal nur will er keinen "privaten" channel joinen wir op lastbaal
brain_91 is offline  
Old 05/12/2010, 13:10   #39
 
elite*gold: 0
Join Date: Apr 2010
Posts: 58
Received Thanks: 1
ok hast recht nach crash kommt es ned nur nach korregt beendeten game ^^ dann warte ich mal brav^^
Dabash is offline  
Old 05/12/2010, 17:25   #40
 
elite*gold: 0
Join Date: Apr 2010
Posts: 1
Received Thanks: 0
Code:
/****************************************************************************
*               This file was modified by [email][/email]              *																									
*                   Check the programming section for                       *
*                      updates and further scripts                          *
*                        Last Update: 05/07/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 lastbaal";		// 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("dmdpower");
channelUsers.push("dmd-hdin");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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		= "Join dmd-baal-21//%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 > 5000) ? gameAnnouncementDelay : 5000 + 
							(gameAnnouncementDelayRandom > 500) ? 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;
}
er geht in den channel rein schreibt hin join dmd-baal-21 aber dann macht er auch beim next game wieder dmd-baal-21 . Wie stell ich ein ds er beim ng dmd-baal-22 macht?

mfg miamiplayboy
miamiplayboy is offline  
Old 05/14/2010, 14:07   #41
 
elite*gold: 0
Join Date: Feb 2010
Posts: 189
Received Thanks: 14
Hmmm, hast du die gesamte Konfigurationsdatei kopiert? Klingt so, als würden gewisse Funktionen fehlen...

edit: Hab noch n anderes Problem und zwar kann ich mit dieser Konfiguration den Bot nicht mehr pausieren.

Und, vielleicht als kleiner input, wär's auch möglich, dass man Pausenfunktion im channel einbauen könnte?
deep_thought is offline  
Old 05/14/2010, 17:14   #42
Administrator
 
Muddy Waters's Avatar
 
elite*gold: 41364
Join Date: Jan 2010
Posts: 22,729
Received Thanks: 12,625
Quote:
Originally Posted by miamiplayboy View Post
Code:
/****************************************************************************
*               This file was modified by [EMAIL=""][/EMAIL]              *                                                                                                    
*                   Check the programming section for                       *
*                      updates and further scripts                          *
*                        Last Update: 05/07/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 lastbaal";        // 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("dmdpower");
channelUsers.push("dmd-hdin");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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        = "Join dmd-baal-21//%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 > 5000) ? gameAnnouncementDelay : 5000 + 
                            (gameAnnouncementDelayRandom > 500) ? 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;
}
er geht in den channel rein schreibt hin join dmd-baal-21 aber dann macht er auch beim next game wieder dmd-baal-21 . Wie stell ich ein ds er beim ng dmd-baal-22 macht?

mfg miamiplayboy
An sich sollte der Counter nach jedem Game inkrementiert werden. Wenn das nicht passiert, wäre es interessant zu wissen, in welcher Situation das genau passiert, denn wenn alles ganz normal läuft kann das eigentlich gar nicht passieren.

Quote:
Originally Posted by deep_thought View Post
Hmmm, hast du die gesamte Konfigurationsdatei kopiert? Klingt so, als würden gewisse Funktionen fehlen...

edit: Hab noch n anderes Problem und zwar kann ich mit dieser Konfiguration den Bot nicht mehr pausieren.

Und, vielleicht als kleiner input, wär's auch möglich, dass man Pausenfunktion im channel einbauen könnte?
Das mit der Pause Funktion ist nicht nachvollziehbar, da das alles in der NTBotGame.ntj stattfindet und nicht hier.

Und Input? Wohl eher add-on oder enhancement. Theoretisch möglich, allerdings sehe ich den Sinn nicht ganz.
Wozu soll das Ganze dienen?

Lg
Muddy
Muddy Waters is offline  
Old 05/14/2010, 18:15   #43
 
elite*gold: 0
Join Date: Feb 2010
Posts: 189
Received Thanks: 14
easy muling... der bot ist da ziemlich eigensinnig. vorallem jetzt, wo er noch in den channel geht usw, teilweise ziemlich schwierig in ein bestimmtes game zu joinen. Oder wie macht ihr das?

Oder auch, wenn man mal kurz chatten will, oder was auch immer^^ Also, wenn's zu aufwendig ist, kein Problem, aber wenn's leicht möglich ist, schadet's ja nicht
deep_thought is offline  
Old 05/14/2010, 20:28   #44

 
HK18's Avatar
 
elite*gold: 70
Join Date: Sep 2009
Posts: 453
Received Thanks: 116
Code:
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		= 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	= 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 Lastbaal";		// 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("Buzul123-mf");
channelUsers.push("Hammer-Buz");
//----------------------------------------------------------------------------------------------------------------------------------------------------------
//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: %game%counter in few seconds."; // leave blank not to post a channel announcement
var gameAnnouncementDelay	= 1000;		// 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


zu meinem problem seitdem ich "var createGameThreshold" geändert habe nachdem mir das erstellen zu unregelmässig war funktioniert die ansage leider nicht mehr tips für die parameter?^^
HK18 is offline  
Old 05/14/2010, 20:53   #45
 
elite*gold: 0
Join Date: Feb 2010
Posts: 189
Received Thanks: 14
Dein Gameannouncement ist wohl zu kurz, vermute ich mal. Obwohl, das sollte ja vom delay abhängig sein, nachdem du channel gejoined bist. Wobei. Mit deinem delay könnt die Ansage ja schon nach einer halben Sekunde kommen und beim channelwechsel kann's gerne mal laggen.

Aber die Zeiten sind eh nicht mit einander verknüpft, von dem her auch sonst aufpassen, dass es keine Überlagerungen gibt. Mir ist z.B. mal passiert, dass das announcement zu spät gekommen wär.

Ich hab createGameTreshhold auf ca 10000 und annoucement auf 5000, die delays auf 500. Läuft gut so.

edit: lol, ich komm in den thread um eigentlich eine Frage zu stellen, sehe eine andere, versuche zu antworten, und vergesse dabei meine eigene... -.-

Die Ingamepausenfunktion scheint irgendwie doch hiermit zusammen zu hängen, weil ich dieses script nur beim public running palabot benutze, wo ich jetzt nicht mehr pausieren kann, was hingegen bei der sorc immer noch geht. Woran könnt's liegen?
deep_thought is offline  
Reply

Tags
d2nt channel game ansage


Similar Threads Similar Threads
d2nt channel Problem
03/21/2012 - Diablo 2 - 4 Replies
Hi, Also mein bot geht in channel alles schön und gut aber wie kann man einstellen das er am anfang .login schreibt und immer gameansage macht z.b next game is ???-baal-xx ?? Mfg Wickedseek
D2nt Channel frage
08/09/2010 - Diablo 2 - 1 Replies
Huhu leute, ich wollte gerne meinen hammer nen OP xxx channel joinen + mich einloggen sprich .login. Habe schön öfters gesehen, das der bot auch das nächste game ansagen kann im channel.. Channel reingehen ist ja kein prob, nur den rest bekomme ich nicht hin.. schon einiges im inet gefunden aber ka wie was wo.. würde mich über schnelle und gute lösungen freuen ^^
Can Someone Help me with D2nt Channel Bott
07/09/2010 - Diablo 2 Programming - 2 Replies
I am trying to create a channel bot for my clan. However, I can not seem to get it to work. I was wondering if someone who has this could copy and paste their Bot. ntj file or help me. what i want 1) Bot to enter same private channel every time 2) Bot to announce my upcoming game here is what I am trying to use.... bot does enters channel but does not announce the game. The script I am using can be found below:
d2nt join channel only @ login
05/13/2010 - Diablo 2 - 2 Replies
ja der d2nt joined ja den channel immer wieder neu obwohl er schon drinne ist. finde das ein wenig lästig. kann man das umstellen dass er nur nachm login den channel joined?
d2nt bluebird channel frage
05/07/2010 - Diablo 2 - 6 Replies
hi leutz ne frage wie mache ich das, das er nach dem login in denn channel joint wo ich hin will und dann den game name schreibt was ich gemacht habe?? mfg toby ps: ja ich weis gehört ins topic von blue hab 2 mal rein gepostet aber niemand antwortet mir



All times are GMT +2. The time now is 00:42.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.