[Release] Muddy's D2NT

06/15/2013 11:52 Ghost dragon#6991
ja ist auf true bei den anderen monstern macht er es meist auch nur im kuh lvl ist
06/16/2013 00:32 Muddy Waters#6992
Habe es mir eben nochmal angeschaut, da scheint tatsächlich ein Fehler in der Angriffsfunktion zu sein.

So sieht das ganze standardmäßig aus:

Scheint ein Fehler aus Schlampigkeit zu sein, der nicht unbedingt sofort ins Auge fällt.

Allerdings muss man auch kein JS-Guru sein, um zu erkennen, dass in der Switch-Anweisung am Anfang irgendwie die Zahl 2 fehlt - das ist dummerweise gerade die Anzahl an Argumenten, mit der die Funktion standardmäßig in dem Script aufgerufen wird. Durch die fehlende Sprungmarke werden die Standardwerte nicht initialisiert, sodass usefinditem letztlich den Wert undefined hat und die zugehörige if-Anweisung nicht ausgeführt wird.

Du kannst das einfach beheben, indem du diesen Fehler korrigierst:

Dann klappt es auch mit dem Plündern. :)
06/16/2013 00:43 Ghost dragon#6993
danke dir für die mühe

und ich frag lieber immer vorher bevor an nem script irgendwas änder außer ich kenn mich da besser aus und weiß wat ick da mache hehe

lieben dank
06/16/2013 14:44 web835#6994
Hi Muddy, wonder if is possible to add Bot Global Mesage before AutoMule starts..

Usefull for public games, to let people know that u will gona mule for next 10min
Quote:
MWConfig_GlobalSettings..

MWConfig_Announcements.AutoMuleMSG = Mule Message Here;
something like that

can u do that?

thx
06/18/2013 20:18 Muddy Waters#6995
It is possible. However, considering I have discontinued this project long ago and haven't played D2 for almost as long, I'm not gonna add any new features. Sorry.

You might be able to do it yourself, what you need to change should be located in MWBotGame.ntj.
06/19/2013 17:08 Senserim#6996
Ich weis das euch das warscheinlich schon zum Halse raushängt aber ich bekomme es nicht gebacken seit Monaten durchforste ich nun alles mögliche an Foren aber ich bekomme bestimmte sachen einfach nicht glat gebügelt. Wäre lieb wenn ihr euch meiner auch noch annehmen könnten.

Problem:

1) Klare Sache die Gräfin jedesmall wenn ich mit meiner Sorc vor ich rumschimmel, KillMonster faild
2) Selbes Spiel beim Frostfluss

3) Wenn ich nen magischen Ring finde mit ressis druf dann will der den mit iwelchen Juwlen craften Problem an der Sache er kommt nicht dazu, das Spiel crasht

4) die Leechscripte... Ich meine ja ich bin nicht bewandert was das Scripten angeht, jaaa ich geb mir Mühe das zu lernen jaaa ich hab alles schon 100 mal angeguckt im Forum nachgelesen und editiert und was weis ich sonst noch

Es will einfach nicht ... egal was ich mache egal wie egal wo ich find den Fehler nicht.
Leader is eingetragen ist in meiner Fl ist in meim channel schreibt wat schönes und dann... /f l /f l /f l .
Die Scripte sind nur soweit angepasst wie mans wirklich musste und ansonsten läuft es ja auch zb hat der Bot generel keine Probleme mit Imunen nurrrr bei der Gräfin und im Frostfluss wird der garstig.

Ich weis nicht weiter und würd mich wahnsinnig freun wenn man da mal was machen könnte.

Und wenn man vom Teufel spricht .. der wollte grade wieder was craften und is abgeschmiert..
06/19/2013 18:38 mirkoregge#6997
Quote:
Originally Posted by Senserim View Post
Ich weis das euch das warscheinlich schon zum Halse raushängt aber ich bekomme es nicht gebacken seit Monaten durchforste ich nun alles mögliche an Foren aber ich bekomme bestimmte sachen einfach nicht glat gebügelt. Wäre lieb wenn ihr euch meiner auch noch annehmen könnten.

Problem:

1) Klare Sache die Gräfin jedesmall wenn ich mit meiner Sorc vor ich rumschimmel, KillMonster faild
2) Selbes Spiel beim Frostfluss

3) Wenn ich nen magischen Ring finde mit ressis druf dann will der den mit iwelchen Juwlen craften Problem an der Sache er kommt nicht dazu, das Spiel crasht

4) die Leechscripte... Ich meine ja ich bin nicht bewandert was das Scripten angeht, jaaa ich geb mir Mühe das zu lernen jaaa ich hab alles schon 100 mal angeguckt im Forum nachgelesen und editiert und was weis ich sonst noch

Es will einfach nicht ... egal was ich mache egal wie egal wo ich find den Fehler nicht.
Leader is eingetragen ist in meiner Fl ist in meim channel schreibt wat schönes und dann... /f l /f l /f l .
Die Scripte sind nur soweit angepasst wie mans wirklich musste und ansonsten läuft es ja auch zb hat der Bot generel keine Probleme mit Imunen nurrrr bei der Gräfin und im Frostfluss wird der garstig.

Ich weis nicht weiter und würd mich wahnsinnig freun wenn man da mal was machen könnte.

Und wenn man vom Teufel spricht .. der wollte grade wieder was craften und is abgeschmiert..
Mach den Würfel vorher leer
06/19/2013 18:53 Senserim#6998
Die Idee ist nicht verkehrt aber leider leider packt er das Zeug ja wieder rein und selbst wenn ichs verkaufe .. irgendwann findet er einen neuen Ring oder so und macht den selben Mist wieder .... hab jetz seine Sammeleigenschaften abgeändert damit er einfach keine Ringe mehr sammelt, ist zwar schade aber naja .... xD er versuchte ja auch die Regenbogenfacette zu vercraften :D

denoch danke :) war schonmal nen Anfang
06/19/2013 19:03 mirkoregge#6999
mal blöd gefragt, wo liegt der würfel in der truhe? ich hatte anfangs immer das Problem, wenn ich den Würfel nicht oben links liegen hatte crashte es immer

bei deinem leecherscript scheinst du den leaderacc/char nicht richtig eingetragen zu haben

btw nimmt er alle juwele, die nicht in der pickit stehen, egal ob magic, rare oder unique
06/19/2013 19:14 Senserim#7000
Das mit dem Cube is ne gute Sache, werd ich testen danke dafür.

Das mit dem leechscript is sone Sache. Eingetragen ist definitiv alles richtig mit groß und klein und alles drum und drann kann es vieleicht einfach sein das nicht das richtige Kommentar vom "Leiter" kommt ? Das er zb statt ng : Diabaals-12 ... Folge uns in unserem Clanchannel hier und da und was weis ich noch Hammer+Sorc diabaals-12 ist das nächste game. Wäre das ne Option ?

Zu den Juwelen. Er nimmt nur die eldelsten vom edelen :D also grundlegend alles was er soll und ist es schwer mit einem Unique zu craften wenn mich nicht alles täuscht und eben das hat er versucht ich denke der Fehler muss aus diesen Gründen nicht in der pick sondern der Craft Datei liegen

Korrektur zu den juwelen das nicht ganz richtig er nimmt Tatsache alle aber alles was nicht unbedingt die Werte aus dem Pickkit haben tradet er bei den npc weg und das ohne Probleme

Huch wo ist den mein Kommi hin Oo

Also nochmal :P das mit dem Cube gute Idee wird getestet danke dafür

aufsammeln der juwelen ja jedes aber er behält nur die eldelste Ware ;)

und das leechscript ansich ist alles richtig eingestellt kann es sein ads einfach das RICHTIGE kommentar vom "Leiterbot" fehlt ? das statt ng- diabaal-20 sowas wie unser nächstes game bla bla bal bla *ewig langer text* diabaal-20 schreibt ?

PS : Gutes timing der crasht schonwieder um wieviel wollen wir auf den cube wetten ?

Lag am cube aber der Tipp mit dem Cube in der Ecke war leider nichts crasht immer noch.
Was ich jetz aber sicher weis ist das es am craften und nicht an den Juwelen oder Ringen alleine liegt.

Ich werd mich doch an die Craftdatei ranwagen und gucken was ich mit meinen angelesenen Skills so ausrichten kann :P
06/19/2013 20:35 mirkoregge#7001
post doch mal die charconfigs und leader/leecher-configs in einer code-box; ich schau morgen früh mal drüber, ansonsten erst wieder nach der Arbeit
06/19/2013 20:50 Senserim#7002
ja schön und gut und wie zauber ich das schöne böxchen ?

Srr ich stell mich grad wieder orginal blöde an.... viel spaß damit
Code:
/**
*	This file was modified by [Only registered and activated users can see links. Click Here To Register...] and [Only registered and activated users can see links. Click Here To Register...]			
*	Check the programming section for updates and further scripts
*	Last Update: 15:34 20.08.2011
*/

var DelayedJoinChars               = new Array();
//###################################################################
//##############################Settings#############################
//###################################################################
	
var LeaderAccountName          = "MoxnBrox";
var LeaderName                 = "Ololadin";
var GamePassword               = "1";
var JoinGameAgain              = false; // Set to true to re-enter the same game after chicken or disconnect.

var UseCDKeyChangeTrick        = false; // Set to true to use multiple CD Keys

var JoinRandomChannel          = false;
var JoinChannelInChat          = "OP SoT";
var FirstJoinMessage           = ""; // Message to post right after joining chat. Set to "" not to post any message.
var ChatMessageAfterGame       = ""; // Message to post when joining chta after a game. Set to "" not to post any message.

// If multiple leechers are to join the same game, they should do it slightly time shifted in order to avoid join bugs.
// Enter the names of your accounts OR chars below:
DelayedJoinChars.push("LeecherOne", "LeecherTwo", "LeecherThree");

//###################################################################
//##############################Delays###############################
//###################################################################

var GameMinLength              = 180000;

// realm delays (minutes)
var UnableToConnectRetry       = 2;
var RealmDownRetry             = 60;
var DisconnectedRetry          = 2;
var CdKeyInUseRetry            = 2;

// interface delays (milliseconds)
var MultipleLeecherJoinDelay   = 1000;
var JoinDelay                  = 100;
var ConnectingToBnetTimeout    = 20000;
var CharacterScreenTimeout     = 10000;
var PleaseWaitTimeout          = 10000;
var CreateGameThreshold        = 10000;
var CreateGameThresholdRandom  = 1000;
var CreateGameTimeout          = 15000;
var WaitInLineTimeout          = 15000;
var CharacterSelectDelay       = 5000
var LoginDelay                 = 1000;
var ClickDelay                 = 500;
var TextDelay                  = 500;
var ClickDelayRandom           = 500;
var TextDelayRandom            = 500;
var GameDoesNotExistDelayMin   = 600000;
var GameDoesNotExistDelayMax   = 900000;
var GameDoesNotExistTimeout    = 30000;
var WaitBeforeEnterChatMin     = 1000;
var WaitBeforeEnterChatMax     = 2000;
var WaitInChatBeforeActionsMin = 2000;
var WaitInChatBeforeActionsMax = 3000;

//###################################################################
//###################################################################
//###############DO NOT CHANGE 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 SayChatMsgAfterGame = true;

Include("libs/controlInfo.ntl");

var ControlData = new controlInfo();

var SameGame = "";
var OldGame = "Also noch mal";
var Game = "";
var Debug = false;
var JoinChatAfterGame    = true;

function NTMain()
{
	Delay(1000);

	var _ingame = false;

	ControlData.ClickDelay = ClickDelay;
	ControlData.TextDelay = TextDelay;
	ControlData.ClickDelayRandom = ClickDelayRandom;
	ControlData.TextDelayRandom = TextDelayRandom;

	while(1)
	{
		if(me.ingame)
		{
			OldGame = me.gamename;

			if(!InGameAt)
				InGameAt = GetTickCount();

			if(!_ingame)
			{
				RunGC(); // run garbage collector between each game

				if(Load("NTBot/MWBotGame.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;
				SayChatMsgAfterGame = true;

				sendEventToOOG(D2NT_MGR_READY, "", 0);
			}

			locationAction(ControlData.getLocation());

			Delay(500);
		}
	}
}

function locationAction(location)
{
	var _randomChannel, _leaderFound, _lines, _msg, _msgLines, _lineIndex, _chat, _regGameNameWhispered, _regOffline, _regInChat, _regGameName;
	
	switch(location.id)
	{
		case 3: // Lobby Chat
			sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

			if(!ChatActionsDone)
			{  
				ChatActionsDone = true;

				Delay(Random(WaitInChatBeforeActionsMin, WaitInChatBeforeActionsMax));

				if(JoinRandomChannel || JoinChannelInChat != "")
				{
					SetStatusText("ÿc8Joining channel...");
					Say("/join " + (JoinRandomChannel ? getRandomString(Random(3,10)) : JoinChannelInChat));
					Delay(2000);
				}

				if(FirstJoinMessage)
				{
					Say(FirstJoinMessage);
					Delay(1000);
				}
			}

			if(SayChatMsgAfterGame)
			{
				if(ChatMessageAfterGame && OldGame != "")
					Say(ChatMessageAfterGame);
					
				SetStatusText("ÿc8Checking friendlist...");
				Say("/f l");
				SayChatMsgAfterGame = false;
				Delay(1500);
			}

			Game = "";

			if(_chat = ControlData.get(ControlData.controls.lobby.chat.textBox.channelText))
			{
				_leaderFound = false;
				_lines = _chat.GetText();
				for(_lineIndex = _lines.length - 1; _lineIndex > -1; _lineIndex--)
				{
					if(_leaderFound) // useless... :/
						break;

					if(_lines[_lineIndex].substring(0,1) == " ")
						continue;

					// retrieving the whole message
					_msg = _lines[_lineIndex].replace(/^\s+|\s+$/, "");
					_msgLines = 1;
					while(_lines[_lineIndex + _msgLines] != undefined && _lines[_lineIndex+_msgLines].substring(0,2) == "  ")
					{
						_msg += " " + _lines[_lineIndex + _msgLines].replace(/^\s+|\s+$/, "");
						_msgLines++;
					}
					
					// checking if the _msg is a friendly whisper
					if(_msg.toLowerCase().lastIndexOf(LeaderName.toLowerCase() + " (*" + LeaderAccountName.toLowerCase() + ")") > -1)
					{
						_regGameNameWhispered = /^.*(game|partie|spiel|partita|partida).*(nomm[^\s]*|called|chiamata)\s*([\w\s-]*\w)\s*\.\s*$/gi;
						if(_msg.match(_regGameNameWhispered))
							Game = _msg.replace(_regGameNameWhispered, "$3");

						if(Game != "")
						{
							_leaderFound = true;
							break;
						}
					}

					// checking if the _msg is from the friend list
					if(_msg.toLowerCase().lastIndexOf(": " + LeaderAccountName.toLowerCase() + ",") > -1)
					{
						_leaderFound = true;
						
						_regOffline = /^.*(offline|desconectado).*$/gi;
						_regInChat = /^.*(channel|canale?)\s*([\w\s-]*\w)\.?\s*$/gi;
						_regGameName = /^.*(game|partie|spiel|partita|partida)\s*([\w\s-]*\w)\s*\(priv[^\)]*\)\.\s*$/gi;

						if(_msg.match(_regOffline))
							SetStatusText("ÿc8Leader is currently offline.");
						else if(_msg.match(_regInChat))
							SetStatusText("ÿc8Waiting for leader to create a game.");
						else if(_msg.match(_regGameName))
							Game = _msg.replace(_regGameName, "$2");

						break;
					}
				}

				if(!_leaderFound)
				{
					DebugInOOG("I couldn't find the leader in my friend list!");
					SetStatusText("ÿc8Leader not found.");
				}
				
				if(Game != "")
				{
					DebugInOOG("Leader is in the game \"" + Game + "\"");
					//ControlData.click(ControlData.controls.lobby.button.join);
					//Delay(100);
					
					if(!JoinGameAgain)
					{
						if(Game != SameGame)
						{
							SetStatusText("ÿc8Joining Game: " + Game);
							
							if(UseCDKeyChangeTrick)
							{
								sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
								Delay(1000);
							}

							ControlData.click(ControlData.controls.lobby.button.join);
							Delay (200);
						}
						else
							SetStatusText("ÿc8Waiting for next game...");
					}
					else
					{
						SetStatusText("ÿc8Joining Game: " + Game);
						
						if (UseCDKeyChangeTrick)
						{
							sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
							Delay(1000);
						}

						ControlData.click(ControlData.controls.lobby.button.join);
						Delay (200);
					}

				}
			}
			else
				DebugInOOG("I can\'t read the chat!");

			if(Game != "")
				SameGame = Game;

			break;

		case 1:    // Lobby
			if(location.id == 1 && JoinChatAfterGame)
			{
				Delay(Random(WaitBeforeEnterChatMin, WaitBeforeEnterChatMax));
				ControlData.click(ControlData.controls.lobby.button.enterChat);
				break;
			}
			break;

		case 2: // Waiting In Line
			if(GetTickCount()-LastGameMade > WaitInLineTimeout)
				ControlData.click(ControlData.controls.lobby.inLine.button.cancel);
			break;

		case 4: // Create Game
			if(!ControlData.get(ControlData.controls.lobby.create.editBox.gameName))
			{
				ControlData.click(ControlData.controls.lobby.button.join);
				Delay (500);
				ControlData.click(ControlData.controls.lobby.button.create);
				Delay (500);
				break;
			}

			sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

			locationTimeout(5000, location);

			LastGameMade = GetTickCount();
			LastGameStatus = 1; // pending creation
			break;

	  case 5: // Join Game
		if (Game)
		{
			ControlData.setText( ControlData.controls.lobby.join.editBox.gameName, Game);
			Delay(100);
			ControlData.setText( ControlData.controls.lobby.join.editBox.password, GamePassword);
			for(var i = 0; i < DelayedJoinChars.length; i++)
			{
				if(me.charname.toLowerCase() == DelayedJoinChars[i].toLowerCase() || me.account.toLowerCase() == DelayedJoinChars[i].toLowerCase())
				{
					Delay(MultipleLeecherJoinDelay * i);
					break;
				}
			}
			Delay(JoinDelay);
			ControlData.click(ControlData.controls.lobby.join.button.joinGame);
			RunGC(); // run garbage collector between each game
			locationTimeout(5000, location);
			LastGameStatus = 1; // pending join
		}
		else
		{
			DebugInOOG("No game to join : cancelling");
			me.Cancel(1);
			Delay(1000);
		}
		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, "yE00000Game already exists", 0);

			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;
		default:
			DebugInOOG("Unhandled location : "+location.id);
			break;
	}
	//DebugInOOG("Location : "+location.id);
}

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

function setNextGameMake()
{
	LastGameMade = GetTickCount();
	NextGameMake = LastGameMade + CreateGameThreshold + Random(0-CreateGameThresholdRandom, CreateGameThresholdRandom) + InGameAt;
	InGameAt = 0;
	ChatActionsDone = false;
}

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

		InGameAt = (duration < GameMinLength ? GameMinLength - duration : 0);
	}
}

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

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

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

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

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

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

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

	return _retString;
}
function DebugInOOG(logString)
{
	if (Debug)
		return SendCopyData("D2NT Manager", null, 9<<16, "-- Debug : " + logString);
	else
		return false;
}
Ich wette der Fehler ist so offensichtlich das ich eigentlich gegen eine Wand laufen sollte aber danke schonmal fürs rüber glubschen.
06/19/2013 21:02 ttfu#7003
Habe folgendes problem, hab 4 leecher in einem game, und die verlassen das game auch alle "gleichzeitig" wo sich immer einer aufhängt, wie baue ich da ein delay von 2-3 secunden, also z.b der erste char verlässt das game nach 2 secunden nach den"next game"
der zweite char nach 4 secunden......

danke für eure hilfe
06/19/2013 21:13 mirkoregge#7004
Quote:
Originally Posted by Senserim View Post
ja schön und gut und wie zauber ich das schöne böxchen ?

Srr ich stell mich grad wieder orginal blöde an.... viel spaß damit
Code:
/**
*	This file was modified by [Only registered and activated users can see links. Click Here To Register...] and [Only registered and activated users can see links. Click Here To Register...]			
*	Check the programming section for updates and further scripts
*	Last Update: 15:34 20.08.2011
*/

var DelayedJoinChars               = new Array();
//###################################################################
//##############################Settings#############################
//###################################################################
	
var LeaderAccountName          = "MoxnBrox";
var LeaderName                 = "Ololadin";
var GamePassword               = "1";
var JoinGameAgain              = false; // Set to true to re-enter the same game after chicken or disconnect.

var UseCDKeyChangeTrick        = false; // Set to true to use multiple CD Keys

var JoinRandomChannel          = false;
var JoinChannelInChat          = "OP SoT";
var FirstJoinMessage           = ""; // Message to post right after joining chat. Set to "" not to post any message.
var ChatMessageAfterGame       = ""; // Message to post when joining chta after a game. Set to "" not to post any message.

// If multiple leechers are to join the same game, they should do it slightly time shifted in order to avoid join bugs.
// Enter the names of your accounts OR chars below:
DelayedJoinChars.push("LeecherOne", "LeecherTwo", "LeecherThree");

//###################################################################
//##############################Delays###############################
//###################################################################

var GameMinLength              = 180000;

// realm delays (minutes)
var UnableToConnectRetry       = 2;
var RealmDownRetry             = 60;
var DisconnectedRetry          = 2;
var CdKeyInUseRetry            = 2;

// interface delays (milliseconds)
var MultipleLeecherJoinDelay   = 1000;
var JoinDelay                  = 100;
var ConnectingToBnetTimeout    = 20000;
var CharacterScreenTimeout     = 10000;
var PleaseWaitTimeout          = 10000;
var CreateGameThreshold        = 10000;
var CreateGameThresholdRandom  = 1000;
var CreateGameTimeout          = 15000;
var WaitInLineTimeout          = 15000;
var CharacterSelectDelay       = 5000
var LoginDelay                 = 1000;
var ClickDelay                 = 500;
var TextDelay                  = 500;
var ClickDelayRandom           = 500;
var TextDelayRandom            = 500;
var GameDoesNotExistDelayMin   = 600000;
var GameDoesNotExistDelayMax   = 900000;
var GameDoesNotExistTimeout    = 30000;
var WaitBeforeEnterChatMin     = 1000;
var WaitBeforeEnterChatMax     = 2000;
var WaitInChatBeforeActionsMin = 2000;
var WaitInChatBeforeActionsMax = 3000;

//###################################################################
//###################################################################
//###############DO NOT CHANGE 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 SayChatMsgAfterGame = true;

Include("libs/controlInfo.ntl");

var ControlData = new controlInfo();

var SameGame = "";
var OldGame = "Also noch mal";
var Game = "";
var Debug = false;
var JoinChatAfterGame    = true;

function NTMain()
{
	Delay(1000);

	var _ingame = false;

	ControlData.ClickDelay = ClickDelay;
	ControlData.TextDelay = TextDelay;
	ControlData.ClickDelayRandom = ClickDelayRandom;
	ControlData.TextDelayRandom = TextDelayRandom;

	while(1)
	{
		if(me.ingame)
		{
			OldGame = me.gamename;

			if(!InGameAt)
				InGameAt = GetTickCount();

			if(!_ingame)
			{
				RunGC(); // run garbage collector between each game

				if(Load("NTBot/MWBotGame.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;
				SayChatMsgAfterGame = true;

				sendEventToOOG(D2NT_MGR_READY, "", 0);
			}

			locationAction(ControlData.getLocation());

			Delay(500);
		}
	}
}

function locationAction(location)
{
	var _randomChannel, _leaderFound, _lines, _msg, _msgLines, _lineIndex, _chat, _regGameNameWhispered, _regOffline, _regInChat, _regGameName;
	
	switch(location.id)
	{
		case 3: // Lobby Chat
			sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);

			if(!ChatActionsDone)
			{  
				ChatActionsDone = true;

				Delay(Random(WaitInChatBeforeActionsMin, WaitInChatBeforeActionsMax));

				if(JoinRandomChannel || JoinChannelInChat != "")
				{
					SetStatusText("ÿc8Joining channel...");
					Say("/join " + (JoinRandomChannel ? getRandomString(Random(3,10)) : JoinChannelInChat));
					Delay(2000);
				}

				if(FirstJoinMessage)
				{
					Say(FirstJoinMessage);
					Delay(1000);
				}
			}

			if(SayChatMsgAfterGame)
			{
				if(ChatMessageAfterGame && OldGame != "")
					Say(ChatMessageAfterGame);
					
				SetStatusText("ÿc8Checking friendlist...");
				Say("/f l");
				SayChatMsgAfterGame = false;
				Delay(1500);
			}

			Game = "";

			if(_chat = ControlData.get(ControlData.controls.lobby.chat.textBox.channelText))
			{
				_leaderFound = false;
				_lines = _chat.GetText();
				for(_lineIndex = _lines.length - 1; _lineIndex > -1; _lineIndex--)
				{
					if(_leaderFound) // useless... :/
						break;

					if(_lines[_lineIndex].substring(0,1) == " ")
						continue;

					// retrieving the whole message
					_msg = _lines[_lineIndex].replace(/^\s+|\s+$/, "");
					_msgLines = 1;
					while(_lines[_lineIndex + _msgLines] != undefined && _lines[_lineIndex+_msgLines].substring(0,2) == "  ")
					{
						_msg += " " + _lines[_lineIndex + _msgLines].replace(/^\s+|\s+$/, "");
						_msgLines++;
					}
					
					// checking if the _msg is a friendly whisper
					if(_msg.toLowerCase().lastIndexOf(LeaderName.toLowerCase() + " (*" + LeaderAccountName.toLowerCase() + ")") > -1)
					{
						_regGameNameWhispered = /^.*(game|partie|spiel|partita|partida).*(nomm[^\s]*|called|chiamata)\s*([\w\s-]*\w)\s*\.\s*$/gi;
						if(_msg.match(_regGameNameWhispered))
							Game = _msg.replace(_regGameNameWhispered, "$3");

						if(Game != "")
						{
							_leaderFound = true;
							break;
						}
					}

					// checking if the _msg is from the friend list
					if(_msg.toLowerCase().lastIndexOf(": " + LeaderAccountName.toLowerCase() + ",") > -1)
					{
						_leaderFound = true;
						
						_regOffline = /^.*(offline|desconectado).*$/gi;
						_regInChat = /^.*(channel|canale?)\s*([\w\s-]*\w)\.?\s*$/gi;
						_regGameName = /^.*(game|partie|spiel|partita|partida)\s*([\w\s-]*\w)\s*\(priv[^\)]*\)\.\s*$/gi;

						if(_msg.match(_regOffline))
							SetStatusText("ÿc8Leader is currently offline.");
						else if(_msg.match(_regInChat))
							SetStatusText("ÿc8Waiting for leader to create a game.");
						else if(_msg.match(_regGameName))
							Game = _msg.replace(_regGameName, "$2");

						break;
					}
				}

				if(!_leaderFound)
				{
					DebugInOOG("I couldn't find the leader in my friend list!");
					SetStatusText("ÿc8Leader not found.");
				}
				
				if(Game != "")
				{
					DebugInOOG("Leader is in the game \"" + Game + "\"");
					//ControlData.click(ControlData.controls.lobby.button.join);
					//Delay(100);
					
					if(!JoinGameAgain)
					{
						if(Game != SameGame)
						{
							SetStatusText("ÿc8Joining Game: " + Game);
							
							if(UseCDKeyChangeTrick)
							{
								sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
								Delay(1000);
							}

							ControlData.click(ControlData.controls.lobby.button.join);
							Delay (200);
						}
						else
							SetStatusText("ÿc8Waiting for next game...");
					}
					else
					{
						SetStatusText("ÿc8Joining Game: " + Game);
						
						if (UseCDKeyChangeTrick)
						{
							sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
							Delay(1000);
						}

						ControlData.click(ControlData.controls.lobby.button.join);
						Delay (200);
					}

				}
			}
			else
				DebugInOOG("I can\'t read the chat!");

			if(Game != "")
				SameGame = Game;

			break;

		case 1:    // Lobby
			if(location.id == 1 && JoinChatAfterGame)
			{
				Delay(Random(WaitBeforeEnterChatMin, WaitBeforeEnterChatMax));
				ControlData.click(ControlData.controls.lobby.button.enterChat);
				break;
			}
			break;

		case 2: // Waiting In Line
			if(GetTickCount()-LastGameMade > WaitInLineTimeout)
				ControlData.click(ControlData.controls.lobby.inLine.button.cancel);
			break;

		case 4: // Create Game
			if(!ControlData.get(ControlData.controls.lobby.create.editBox.gameName))
			{
				ControlData.click(ControlData.controls.lobby.button.join);
				Delay (500);
				ControlData.click(ControlData.controls.lobby.button.create);
				Delay (500);
				break;
			}

			sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);

			locationTimeout(5000, location);

			LastGameMade = GetTickCount();
			LastGameStatus = 1; // pending creation
			break;

	  case 5: // Join Game
		if (Game)
		{
			ControlData.setText( ControlData.controls.lobby.join.editBox.gameName, Game);
			Delay(100);
			ControlData.setText( ControlData.controls.lobby.join.editBox.password, GamePassword);
			for(var i = 0; i < DelayedJoinChars.length; i++)
			{
				if(me.charname.toLowerCase() == DelayedJoinChars[i].toLowerCase() || me.account.toLowerCase() == DelayedJoinChars[i].toLowerCase())
				{
					Delay(MultipleLeecherJoinDelay * i);
					break;
				}
			}
			Delay(JoinDelay);
			ControlData.click(ControlData.controls.lobby.join.button.joinGame);
			RunGC(); // run garbage collector between each game
			locationTimeout(5000, location);
			LastGameStatus = 1; // pending join
		}
		else
		{
			DebugInOOG("No game to join : cancelling");
			me.Cancel(1);
			Delay(1000);
		}
		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, "yE00000Game already exists", 0);

			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;
		default:
			DebugInOOG("Unhandled location : "+location.id);
			break;
	}
	//DebugInOOG("Location : "+location.id);
}

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

function setNextGameMake()
{
	LastGameMade = GetTickCount();
	NextGameMake = LastGameMade + CreateGameThreshold + Random(0-CreateGameThresholdRandom, CreateGameThresholdRandom) + InGameAt;
	InGameAt = 0;
	ChatActionsDone = false;
}

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

		InGameAt = (duration < GameMinLength ? GameMinLength - duration : 0);
	}
}

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

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

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

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

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

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

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

	return _retString;
}
function DebugInOOG(logString)
{
	if (Debug)
		return SendCopyData("D2NT Manager", null, 9<<16, "-- Debug : " + logString);
	else
		return false;
}
Ich wette der Fehler ist so offensichtlich das ich eigentlich gegen eine Wand laufen sollte aber danke schonmal fürs rüber glubschen.
auf anhieb stört mich erstmal
Code:
var OldGame = "Also noch mal";
hast du das so geändert?

Quote:
Originally Posted by ttfu View Post
Habe folgendes problem, hab 4 leecher in einem game, und die verlassen das game auch alle "gleichzeitig" wo sich immer einer aufhängt, wie baue ich da ein delay von 2-3 secunden, also z.b der erste char verlässt das game nach 2 secunden nach den"next game"
der zweite char nach 4 secunden......

danke für eure hilfe
dazu musst du dein Leechscript kopieren und zum Schluss ein Delay einbauen
dann lösst du leecher 1 mit neuem leechscript1 arbeiten; leecher 2 mit leechscript2 etc
06/19/2013 21:20 Senserim#7005
wie zur hölle ist denn das da reingekommen Oo ?