|
You last visited: Today at 11:02
Advertisement
[Script] Leechfriendless
Discussion on [Script] Leechfriendless within the Diablo 2 Programming forum part of the Diablo 2 category.
06/17/2011, 11:23
|
#1
|
elite*gold: 10
Join Date: Dec 2008
Posts: 328
Received Thanks: 42
|
[Script] Leechfriendless
Lieber Muddy
Also ich use eig. Publich Botten for dummies/Muddy!
Nun versuch ich in deinen Bot , das Script (was auch in GVetal enthalten)
Einzubauen ... ich hab es mir um ehrlich zu sein viel leichter vorgestellt!
Da ich eig. nicht wirklich viel Erfahrung habe , bitte ich nun um deine Hilfe (muss dazu sagen das du wahrscheinlich der einzige hier im Forum bist , der wirklich die Geflechte dieses Bot verstehst!
Meine Fragen: - warum schaff ich es nicht, das er aus dem Script die games herausließt ( als Bsp: Audibaal-)?
- lässt es sich überhaupt in deinen Bot einfügen?
- is er nur zum leechen oder wäre es möglich das er Co-fightet?
Ein anliegen wäre mir auch zu wissen ob ich dich damit überfodere und zu viel verlange!?
Hier das Script: (mir ist bewusst das du es kennst  )
PHP Code:
// ====================================================================================================
// v THIS IS THE JUNK YOU'LL WANT TO EDIT v
// Frendless leech starter setting (set to run with op gotv channel bot by default there will be no help on changing this)
// ====================================================================================================
var gamenames = ["EamPleGameWithouTTHENumbers-"]; // Game name to search for (CASE-SENSITIVE)
var gamepasswords = ["ExAmPlePassword"]; // Password for that game.
var maxRetriesPerGame = 3; // The # of times to try rejoining a *unique* game
var maxRetries = 3; // The # of *different* games to try joining, if all attempts fail, bot will exit to character selection screen and rejoin lobby
// ====================================================================================================
var gameMinLength = 180000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry = 260; // time in minutes to retry connecting on a realm down (default is 120 minutes)
var disconnectedRetry = 5; // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry = 1; // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout = 20000; // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout = 5000; // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout = 2000; // time in milliseconds to wait for a please wait popup
var createGameThreshold = 2000; // time in milliseconds to wait between making games
var createGameThresholdRandom = 500; // 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 = 1000; // 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 = 50; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat
var waitBeforeEnterChatMax = 2000; // max how long to wait before entering chat
var waitInChatBeforeActionsMin = 1000; // min how long to wait before joining channel
var waitInChatBeforeActionsMax = 2000; // max how long to wait before joining channel
// DONT EDIT ANYTHING BELOW THIS
var extrafilters = ["New game ", " started by"]; // The 2nd filter should be whatever the bot manager says right after the game name
// If the 2nd filter is empty, the rest of the line is used as the game name
var joinChannelInChat = "op gotv"; // leave blank to not join a private channel
// 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 nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameStatus = 0; // 0 = OK, 1 = Processing, 2 = Ready for retry
var game = "";
var gamepassword = "";
var retry = 0;
var fullretry = maxRetries;
var samegame = new Array(gamenames.length); // Empty array for however many runs you might be following (default 6)
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);
fullretry = maxRetries;
lastGameStatus = 0;
game = "";
}
}
Delay(1000);
}
else
{
Delay(500);
if (_ingame)
{
_ingame = false;
// --------------------------
// Prevent NT from closing D2
// --------------------------
// Wait for lobby or lobby chat
var _location;
do
{
_location = controlData.getLocation();
Delay(50);
}
while (_location.id != 3 && _location.id != 1);
if (_location.id == 3) // Lobby Chat
{
// We need to go somewhere besides the lobby chat so NT can type crap and think its creating a game
Delay(100);
Say("/join " + getRandomString(Random(3,10)));
Delay(1000);
}
sendEventToOOG(D2NT_MGR_CREATE_GAME, _location.name, 0);
outputGameLength();
setNextGameMake();
// --------------------------
sendEventToOOG(D2NT_MGR_READY, "", 0);
}
locationAction(controlData.getLocation());
Delay(500);
}
}
}
function locationAction(location)
{
switch (location.id)
{
case 3: // Lobby Chat
// Not retrying anymore, clear the game name so that if user tries to do it themself, bot won't fill in with old game
if (lastGameStatus == 0 || retry == 0)
{
// Clear these flags just in case
retry = 0;
game = "";
}
// Handle non-existent or full games:
// When the join button is hit, lastGameStatus = 1.
// When in-game, lastGameStatus = 0.
// So this gets executed when NTMain() doesn't reset the flag to 0.
if (lastGameStatus == 1)
{
if (fullretry == 0) // If we have tried [maxRetries] different games ([maxRetriesPerGame] retries for each game)
{
lastGameStatus = 0;
fullretry = maxRetries;
// We need to close out of chat and come back
sendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿE00000Game doesn't exist or its full. Rejoining chat.", 0);
controlData.click(controlData.controls.lobby.button.quit);
}
else
{
lastGameStatus = 2; // Ready for retry
if (retry == 0) // If we just failed [maxRetriesPerGame] times for joining this game
fullretry--; // Update flag
sendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿE00000Game doesn't exist or its full. " + retry + " retries left.", 0);
inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
setNextGameMake();
chatActionsDone = true; // Undo the flag set by setNextGameMake()
locationTimeout(gameDoesNotExistTimeout, location);
}
break;
}
if (!chatActionsDone || GetTickCount() > nextGameMake + 180000) // Need to join channel or its been 3 minutes and no action, possibly kicked from channel, rejoin
{
if (GetTickCount() > nextGameMake + 180000) // Reset this so that we don't keep joining channel over and over
nextGameMake = GetTickCount();
chatActionsDone = true;
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
Say("/join " + joinChannelInChat);
Delay(1000);
sendEventToOOG(D2NT_MGR_PRINT_LOG, "Looking for games..", 0);
}
// Time for action?
if (GetTickCount() >= nextGameMake)
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
// If we can retry and there is a game to retry
if (retry > 0 && game != "" && lastGameStatus == 2)
{
controlData.click(controlData.controls.lobby.button.join);
retry--;
break;
}
var chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText);
if (chat)
{
var linewithname = "";
lines = chat.GetText();
if (lines)
{
for (var line = 0; line < lines.length; line++)
{
linewithname = lines[line];
for (var _filterindex = 0; _filterindex < extrafilters.length; _filterindex += 2)
{
// Check filters
if (linewithname.lastIndexOf(extrafilters[_filterindex]) != -1 && linewithname.lastIndexOf(extrafilters[_filterindex+1]) != -1)
{
for (var _gameindex = 0; _gameindex < gamenames.length; _gameindex++)
{
// Check for game name
var index = linewithname.lastIndexOf(gamenames[_gameindex]);
if (index > -1)
{
game = linewithname.substring(index, linewithname.lastIndexOf(extrafilters[_filterindex+1]));
gamepassword = gamepasswords[_gameindex];
if (game != "" && game != samegame[_gameindex])
{
sendEventToOOG(D2NT_MGR_PRINT_LOG, "Joining " + game + "..", 0);
samegame[_gameindex] = game;
controlData.click(controlData.controls.lobby.button.join);
retry = maxRetriesPerGame;
break;
}
}
}
}
}
}
}
}
}
else
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((nextGameMake-GetTickCount())/1000) + "s)", 0);
break;
case 1: // Lobby
// Enter chat
Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
controlData.click(controlData.controls.lobby.button.enterChat);
break;
case 2: // Waiting In Line
if (GetTickCount()-lastGameMade > waitInLineTimeout)
controlData.click(controlData.controls.lobby.inLine.button.cancel);
break;
case 4: // Create Game
break;
case 5: // Join Game
if (game != "")
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
Delay (1250);
controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
Delay (1250);
controlData.click(controlData.controls.lobby.join.button.joinGame);
}
lastGameMade = GetTickCount();
lastGameStatus = 1;
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);
inGameAt = 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
// This is handled in the lobby chat
// Get rid of the message (DNE/Full game) so the lobby chat can handle
controlData.click(controlData.controls.lobby.button.create);
Delay(200);
controlData.click(controlData.controls.lobby.create.button.cancel);
break;
default:
break;
}
}
function sendEventToOOG(locationId, statusString, pendingTime)
{
return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}
function setNextGameMake()
{
lastGameMade = GetTickCount();
nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
inGameAt = 0;
chatActionsDone = false;
}
function outputGameLength()
{
if (inGameAt)
{
duration = GetTickCount() - inGameAt;
inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
}
}
function locationTimeout(time, location)
{
endtime = GetTickCount() + time;
while (controlData.getLocation().id == location.id && endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(500);
}
return (controlData.getLocation().id != location.id);
}
function timeoutDelay(time, location)
{
endtime = GetTickCount() + time;
while (endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(1000);
}
}
function getRandomString(_length)
{
_retString = "";
_charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
while (_length--)
{
_retString += _charSet.charAt(Random(0, _charSet.length-1));
Delay(1);
}
return _retString;
}
|
|
|
06/17/2011, 14:05
|
#2
|
elite*gold: 0
Join Date: Mar 2010
Posts: 539
Received Thanks: 418
|
Das ist der Teil, der den Gamename aus dem Chat liest:
Code:
var chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText);
if (chat)
{
var linewithname = "";
lines = chat.GetText();
if (lines)
{
for (var line = 0; line < lines.length; line++)
{
linewithname = lines[line];
for (var _filterindex = 0; _filterindex < extrafilters.length; _filterindex += 2)
{
// Check filters
if (linewithname.lastIndexOf(extrafilters[_filterindex]) != -1 && linewithname.lastIndexOf(extrafilters[_filterindex+1]) != -1)
{
for (var _gameindex = 0; _gameindex < gamenames.length; _gameindex++)
{
// Check for game name
var index = linewithname.lastIndexOf(gamenames[_gameindex]);
if (index > -1)
{
game = linewithname.substring(index, linewithname.lastIndexOf(extrafilters[_filterindex+1]));
gamepassword = gamepasswords[_gameindex];
if (game != "" && game != samegame[_gameindex])
{
sendEventToOOG(D2NT_MGR_PRINT_LOG, "Joining " + game + "..", 0);
samegame[_gameindex] = game;
controlData.click(controlData.controls.lobby.button.join);
retry = maxRetriesPerGame;
break;
}
}
}
}
}
}
}
}
Es müssen jedoch noch einige Variablen dafür definiert und an bestimmten Stellen neu gesetzt werden, dafür habe ich leider momentan keine Zeit.
Hier sind die Variablen, deren Einbindungen und Auswirkungen im ganzen Script (vermutlich nur in den Funktionen NTMain() und locationAction(location)) kontrolliert werden müssen:
Code:
var gamenames = ["EamPleGameWithouTTHENumbers-"]; // Game name to search for (CASE-SENSITIVE)
var gamepasswords = ["ExAmPlePassword"]; // Password for that game.
var maxRetriesPerGame = 3; // The # of times to try rejoining a *unique* game
var maxRetries = 3; // The # of *different* games to try joining, if all attempts fail, bot will exit to character selection screen and rejoin lobby
Code:
// DONT EDIT ANYTHING BELOW THIS
var extrafilters = ["New game ", " started by"]; // The 2nd filter should be whatever the bot manager says right after the game name
// If the 2nd filter is empty, the rest of the line is used as the game name
Code:
var game = "";
var gamepassword = "";
var retry = 0;
var fullretry = maxRetries;
var samegame = new Array(gamenames.length); // Empty array for however many runs you might be following (default 6)
Der Gamename MUSS zwischen extrafilters[0] (im Bsp: "New game ") und extrafilters[1] (im Bsp: " started by") stehen!
Im Chat muss also folgendes stehen:
Code:
<beliebiger Text>[COLOR="green"]New game [/COLOR]<Hier steht das Game>[COLOR="Green"] started by[/COLOR]<beliebiger Text>
EDIT:
zu 2.: Jo, lässt sich in Muddy's einfügen.
zu 3.: Ob er nur leecht oder cofightet liegt daran, welches Script du in der Charconfig einstellst! 
Der Entrypoint ist standardmäßig nur zuständig für Einloggen, Charauswahl und das Createn/Joinen des Games.
|
|
|
06/17/2011, 18:12
|
#3
|
elite*gold: 10
Join Date: Dec 2008
Posts: 328
Received Thanks: 42
|
Gut ist soweit verständlich ... jetzt fehlt halt nur noch der Teil der ergänzed werden soll ... ist mir halt nicht klar, wie ich den definieren/coden muss...
wäre sehr dankbar wenn das hier erklärt werden würde , wie ich das nun zB in den von Laranas einbaue
bzw..wo ich es genau definieren sollte...
Edit : aja ...vielen vielen dank für die mühen bis jetzt
|
|
|
06/17/2011, 20:18
|
#4
|
elite*gold: 0
Join Date: Mar 2010
Posts: 539
Received Thanks: 418
|
Wenn du diesen Entrypoint mit lanara's verwenden willst, musst du gar nichts verändern!
Einfach als beliebigen Entrypoint (z.B. FriendlessLeech.ntj) abspeichern und kannst ihn schon verwenden.
Quick&Dirty kannst du ihn auch bei Muddy's verwenden, sofern du nicht die Extras, die Muddy eingebaut hat (v.a. dateigestütztes Gameerstellen zur Vermeidung von RDs, erweiterte Anzeige in der Kopfzeile), verwenden willst. Dafür musst du lediglich folgendes in der erstellten FriendlessLeech.ntj ändern:
Code:
if (Load("NTBot/NTBotGame.ntj"))
ersetzen durch:
Code:
if (Load("NTBot/[COLOR="Red"]MW[/COLOR]BotGame.ntj"))
Dann sollte alles laufen!
|
|
|
06/17/2011, 23:42
|
#5
|
Administrator
elite*gold: 41755
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,658
|
Tja, wozu noch groß dazu äußern, wenn Crazy mich hier perfekt vertritt?
Das Script war mir übrigens nicht bekannt, ich finde aber die Art und Weise wie das mit der Ersetzung der Ansage abläuft relativ unübersichtlich und wenig intuitiv, da gefällt mir meine Lösung irgendwie besser.
Und ja, da das nur ein Entry Point ist funktioniert das grundsätzlich mit meiner Version, aber auch das hatte Crazy ja schon erwähnt.
LG
Muddy
|
|
|
06/18/2011, 06:22
|
#6
|
elite*gold: 10
Join Date: Dec 2008
Posts: 328
Received Thanks: 42
|
Ja, nur funktioniert es nicht ....
er macht im channel nichts...
steht nur im D2nt Manager : looking for games
hier mein Code
PHP Code:
// ====================================================================================================
// v THIS IS THE JUNK YOU'LL WANT TO EDIT v
// Frendless leech starter setting (set to run with op gotv channel bot by default there will be no help on changing this)
// ====================================================================================================
var gamenames = ["Hornybaal-"];["Cebaal-"];["Pornobaal-"];[""] // Game name to search for (CASE-SENSITIVE)
var gamepasswords = [""]; // Password for that game.
var maxRetriesPerGame = 3; // The # of times to try rejoining a *unique* game
var maxRetries = 3; // The # of *different* games to try joining, if all attempts fail, bot will exit to character selection screen and rejoin lobby
// ====================================================================================================
var gameMinLength = 180000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
var unableToConnectRetry = 5; // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
var realmDownRetry = 260; // time in minutes to retry connecting on a realm down (default is 120 minutes)
var disconnectedRetry = 5; // time in minutes to retry on a disconnection (usually ip ban related)
var cdkeyInUseRetry = 1; // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
var connectingToBnetTimeout = 20000; // time in milliseconds to wait for a login to time out and click cancel and retry
var characterScreenTimeout = 5000; // time in milliseconds to wait for character screen to appear
var pleaseWaitTimeout = 2000; // time in milliseconds to wait for a please wait popup
var createGameThreshold = 2000; // time in milliseconds to wait between making games
var createGameThresholdRandom = 500; // 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 = 1000; // 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 = 50; // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
var waitBeforeEnterChatMin = 1000; // min how long to wait before entering chat
var waitBeforeEnterChatMax = 2000; // max how long to wait before entering chat
var waitInChatBeforeActionsMin = 1000; // min how long to wait before joining channel
var waitInChatBeforeActionsMax = 2000; // max how long to wait before joining channel
// DONT EDIT ANYTHING BELOW THIS
var extrafilters = ["next game ", "seconds"]; // The 2nd filter should be whatever the bot manager says right after the game name
// If the 2nd filter is empty, the rest of the line is used as the game name
var joinChannelInChat = "op pornobaal"; // leave blank to not join a private channel
// 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 nextGameMake = 0;
var inGameAt = 0;
var chatActionsDone = false;
var lastGameStatus = 0; // 0 = OK, 1 = Processing, 2 = Ready for retry
var game = "";
var gamepassword = "";
var retry = 0;
var fullretry = maxRetries;
var samegame = new Array(gamenames.length); // Empty array for however many runs you might be following (default 6)
Include("libs/controlInfo.ntl");
Include("libs/common/NTColorConverter.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);
fullretry = maxRetries;
lastGameStatus = 0;
game = "";
}
}
Delay(1000);
}
else
{
Delay(500);
if (_ingame)
{
_ingame = false;
// --------------------------
// Prevent NT from closing D2
// --------------------------
// Wait for lobby or lobby chat
var _location;
do
{
_location = controlData.getLocation();
Delay(50);
}
while (_location.id != 3 && _location.id != 1);
if (_location.id == 3) // Lobby Chat
{
// We need to go somewhere besides the lobby chat so NT can type crap and think its creating a game
Delay(100);
Say("/join " + getRandomString(Random(3,10)));
Delay(1000);
}
sendEventToOOG(D2NT_MGR_CREATE_GAME, _location.name, 0);
outputGameLength();
setNextGameMake();
// --------------------------
sendEventToOOG(D2NT_MGR_READY, "", 0);
}
locationAction(controlData.getLocation());
Delay(500);
}
}
}
function locationAction(location)
{
switch (location.id)
{
case 3: // Lobby Chat
// Not retrying anymore, clear the game name so that if user tries to do it themself, bot won't fill in with old game
if (lastGameStatus == 0 || retry == 0)
{
// Clear these flags just in case
retry = 0;
game = "";
}
// Handle non-existent or full games:
// When the join button is hit, lastGameStatus = 1.
// When in-game, lastGameStatus = 0.
// So this gets executed when NTMain() doesn't reset the flag to 0.
if (lastGameStatus == 1)
{
if (fullretry == 0) // If we have tried [maxRetries] different games ([maxRetriesPerGame] retries for each game)
{
lastGameStatus = 0;
fullretry = maxRetries;
// We need to close out of chat and come back
sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Game doesn't exist or its full. Rejoining chat.", 0);
controlData.click(controlData.controls.lobby.button.quit);
}
else
{
lastGameStatus = 2; // Ready for retry
if (retry == 0) // If we just failed [maxRetriesPerGame] times for joining this game
fullretry--; // Update flag
sendEventToOOG(D2NT_MGR_PRINT_LOG, COLOR_1 + "Game doesn't exist or its full. " + retry + " retries left.", 0);
inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
setNextGameMake();
chatActionsDone = true; // Undo the flag set by setNextGameMake()
locationTimeout(gameDoesNotExistTimeout, location);
}
break;
}
if (!chatActionsDone || GetTickCount() > nextGameMake + 180000) // Need to join channel or its been 3 minutes and no action, possibly kicked from channel, rejoin
{
if (GetTickCount() > nextGameMake + 180000) // Reset this so that we don't keep joining channel over and over
nextGameMake = GetTickCount();
chatActionsDone = true;
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
Say("/join " + joinChannelInChat);
Delay(1000);
sendEventToOOG(D2NT_MGR_PRINT_LOG, "Looking for games..", 0);
}
// Time for action?
if (GetTickCount() >= nextGameMake)
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
// If we can retry and there is a game to retry
if (retry > 0 && game != "" && lastGameStatus == 2)
{
controlData.click(controlData.controls.lobby.button.join);
retry--;
break;
}
var chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText);
if (chat)
{
var linewithname = "";
lines = chat.GetText();
if (lines)
{
for (var line = 0; line < lines.length; line++)
{
linewithname = lines[line];
for (var _filterindex = 0; _filterindex < extrafilters.length; _filterindex += 2)
{
// Check filters
if (linewithname.lastIndexOf(extrafilters[_filterindex]) != -1 && linewithname.lastIndexOf(extrafilters[_filterindex+1]) != -1)
{
for (var _gameindex = 0; _gameindex < gamenames.length; _gameindex++)
{
// Check for game name
var index = linewithname.lastIndexOf(gamenames[_gameindex]);
if (index > -1)
{
game = linewithname.substring(index, linewithname.lastIndexOf(extrafilters[_filterindex+1]));
gamepassword = gamepasswords[_gameindex];
if (game != "" && game != samegame[_gameindex])
{
sendEventToOOG(D2NT_MGR_PRINT_LOG, "Joining " + game + "..", 0);
samegame[_gameindex] = game;
controlData.click(controlData.controls.lobby.button.join);
retry = maxRetriesPerGame;
break;
}
}
}
}
}
}
}
}
}
else
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((nextGameMake-GetTickCount())/1000) + "s)", 0);
break;
case 1: // Lobby
// Enter chat
Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
controlData.click(controlData.controls.lobby.button.enterChat);
break;
case 2: // Waiting In Line
if (GetTickCount()-lastGameMade > waitInLineTimeout)
controlData.click(controlData.controls.lobby.inLine.button.cancel);
break;
case 4: // Create Game
break;
case 5: // Join Game
if (game != "")
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
Delay (1250);
controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
Delay (1250);
controlData.click(controlData.controls.lobby.join.button.joinGame);
}
lastGameMade = GetTickCount();
lastGameStatus = 1;
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, COLOR_1 + "Game already exists.", 0);
inGameAt = 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
// This is handled in the lobby chat
// Get rid of the message (DNE/Full game) so the lobby chat can handle
controlData.click(controlData.controls.lobby.button.create);
Delay(200);
controlData.click(controlData.controls.lobby.create.button.cancel);
break;
default:
break;
}
}
function sendEventToOOG(locationId, statusString, pendingTime)
{
return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
}
function setNextGameMake()
{
lastGameMade = GetTickCount();
nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
inGameAt = 0;
chatActionsDone = false;
}
function outputGameLength()
{
if (inGameAt)
{
duration = GetTickCount() - inGameAt;
inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
}
}
function locationTimeout(time, location)
{
endtime = GetTickCount() + time;
while (controlData.getLocation().id == location.id && endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(500);
}
return (controlData.getLocation().id != location.id);
}
function timeoutDelay(time, location)
{
endtime = GetTickCount() + time;
while (endtime > GetTickCount())
{
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
Delay(1000);
}
}
function getRandomString(_length)
{
_retString = "";
_charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
while (_length--)
{
_retString += _charSet.charAt(Random(0, _charSet.length-1));
Delay(1);
}
return _retString;
}
|
|
|
06/18/2011, 14:16
|
#7
|
elite*gold: 0
Join Date: Mar 2010
Posts: 539
Received Thanks: 418
|
Ok, da hast du Fehler in der Config gemacht.
1. Das Array mit den Gamenamen muss so aussehen:
Code:
var gamenames = ["Hornybaal-", "Cebaal-", "Pornobaal-"];
Ansonsten wird nur nach "Hornybaal-" gesucht.
2. Für jedes Game muss ein Passwort angegeben werden:
Code:
var gamepasswords = ["", "", ""];
3. extrafilters muss richtig angegeben werden.
Wir nehmen mal an, dass alle Gamenamen in den folgenden erwähnten Games in der Variable gamenames richtig eingetragen sind.
Wir sehen uns den Aufbau der Auslesefunktion an, somit kommen wir auf folgenden Aufbau, der im Chat vorkommen muss:
Code:
<Text>[COLOR="Red"]<extrafilters 1. Teil>[/COLOR]<Text>[COLOR="Blue"]<Gamename>[/COLOR][COLOR="Green"]<extrafilters 2.Teil>[/COLOR]<Text>
Somit sehen wir, dass der 2. Teil von extrafilters wirklich direkt nach dem Gamenamen kommt.
WICHTIG: Es müssen auch die Leerzeichen angegeben werden!
Hier ein paar Beispiele dazu:
Code:
[COLOR="Red"]next game[/COLOR] should be [COLOR="Blue"]Pornobaal-98[/COLOR][COLOR="Green"]// in about[/COLOR] 2 seconds
--> var extrafilters = [[COLOR="Red"]"next game"[/COLOR], [COLOR="Green"]"// in about"[/COLOR]];
next [COLOR="Red"]game: join[/COLOR] [COLOR="Blue"]O_obaal-17[/COLOR][COLOR="Green"]// in[/COLOR] 16 seconds.
--> var extrafilters = [[COLOR="Red"]"game: join"[/COLOR], [COLOR="Green"]"// in"[/COLOR]];
## [COLOR="Red"]Hammer+Lightsorc[/COLOR]. Next game should be: [COLOR="Blue"]Tybaal-14[/COLOR][COLOR="Green"] in[/COLOR] 10 seconds ##
--> var extrafilters = [[COLOR="Red"]"Hammer+Lightsorc"[/COLOR], [COLOR="Green"]" in"[/COLOR]];
Light-sorc an Hammerdin at funbaals. [COLOR="Red"]Join us[/COLOR] for fun. Next game [COLOR="Blue"]Funbaal-35[/COLOR]
--> var extrafilters = [[COLOR="Red"]"Join us"[/COLOR], [COLOR="Green"]""[/COLOR]]; [COLOR="DarkOrange"]// Es steht nichts mehr hinter dem Gamename, deswegen ist der 2. Teil von extrafilters leer ("")[/COLOR]
[COLOR="Red"]Join[/COLOR] [COLOR="Blue"]Fxbaal-64[/COLOR] [COLOR="Green"]level 80+[/COLOR] in 1 seconds
--> var extrafilters = [[COLOR="Red"]"Join"[/COLOR], [COLOR="Green"]" level 80+"[/COLOR]];
Ich habe eher ungewöhliche Werte für den 1. Teil von extrafilters genommen, dass du es einfacher für dich ableiten kannst.
Jetzt wollen wir aber nicht nur eines der 5 Games joinen, für das wir extrafilters angepasst haben, also legen wir alle zusammen, dass wir jedes der 5 Games joinen können, wenn sie angekündigt werden:
Code:
var extrafilters = [[COLOR="Red"]"next game"[/COLOR], [COLOR="Green"]"// in about"[/COLOR],
[COLOR="Red"]"game: join"[/COLOR], [COLOR="Green"]"// in"[/COLOR],
[COLOR="Red"]"Hammer+Lightsorc"[/COLOR], [COLOR="Green"]" in"[/COLOR],
[COLOR="Red"]"Join us"[/COLOR], [COLOR="Green"]""[/COLOR],
[COLOR="Red"]"Join"[/COLOR], [COLOR="Green"]" level 80+"[/COLOR]];
Ich habe es aufgrund er Übersicht in verschiedene Zeilen geschrieben, man kann es natürlich auch in einer Zeile angeben, macht programmtechnisch keinen Unterschied:
Code:
var extrafilters = [[COLOR="Red"]"next game"[/COLOR], [COLOR="Green"]"// in about"[/COLOR], [COLOR="Red"]"game: join"[/COLOR], [COLOR="Green"]"// in"[/COLOR], [COLOR="Red"]"Hammer+Lightsorc"[/COLOR], [COLOR="Green"]" in"[/COLOR], [COLOR="Red"]"Join us"[/COLOR], [COLOR="Green"]""[/COLOR], [COLOR="Red"]"Join"[/COLOR], [COLOR="Green"]" level 80+"[/COLOR]];
Die komplette Config für meine Beispiele wäre dann:
Code:
var gamenames = ["Pornobaal-", "O_obaal-", "Tybaal-", "Funbaal-", "Fxbaal-"];
var gamepasswords = ["", "", "", "", ""];
var extrafilters = ["next game", "// in about",
"game: join", "// in",
"Hammer+Lightsorc", " in",
"Join us", "",
"Join", " level 80+"];
|
|
|
06/18/2011, 20:12
|
#8
|
elite*gold: 10
Join Date: Dec 2008
Posts: 328
Received Thanks: 42
|
Muss sagen ich bedanke mich recht herzlich & und verbeuge mich !!!
 
Sehr gut erklärt und nun funktioniert es auch !
lg lg und danke nochmal
PS: habe gerade gesehen das Etal es auch über SVN erneuert hat, da wie ich im Forum gesehen habe , viele damit nicht klar kammen!!
|
|
|
06/19/2011, 22:35
|
#9
|
elite*gold: 70
Join Date: Sep 2009
Posts: 453
Received Thanks: 116
|
Quote:
Originally Posted by TheCrazy11
Wenn du diesen Entrypoint mit lanara's verwenden willst, musst du gar nichts verändern!
Einfach als beliebigen Entrypoint (z.B. FriendlessLeech.ntj) abspeichern und kannst ihn schon verwenden.
Quick&Dirty kannst du ihn auch bei Muddy's verwenden, sofern du nicht die Extras, die Muddy eingebaut hat (v.a. dateigestütztes Gameerstellen zur Vermeidung von RDs, erweiterte Anzeige in der Kopfzeile), verwenden willst. Dafür musst du lediglich folgendes in der erstellten FriendlessLeech.ntj ändern:
Code:
if (Load("NTBot/NTBotGame.ntj"))
ersetzen durch:
Code:
if (Load("NTBot/[COLOR="Red"]MW[/COLOR]BotGame.ntj"))
Dann sollte alles laufen! 
|
soweit klappt es ja, dass er games sucht und joint, habe nun das problem, das in der neuen muddys version kein leechscript vorhanden ist. welches kann man denn verwenden? Wenn man eins hat, gibt es da eine möglichkeit, dass er die tps selber benutzt, ohne das man leader acc und name weiß??
edit: habs mit dem getestet:
ntbotleech.ntj
Code:
//################################################## #################
//###########################Einstellungen########## #################
//################################################## #################
var leaderAccountName = "";
var leaderName = "";
var gamepassword = "";
var JoinGameAgain = false; // wenn der Bot nach chicken oder disconnect ins selbe Spiel nochmal gehen soll, auf true stellen
var UseCDKeyChangeTrick = true; // Wenn der LeechBot mehrere CD Keys nutzen soll, dann auf true stellen.
var joinRandomChannel = false;
var joinChannelInChat = "";
var firstJoinMessage = "/o igw"; // Soll der leechbot etwas sagen, wenn er in den Chat kommt, dann hier eintragen
var chatMessageAfterGame = ""; // Soll der leechbot etwas sagen, wenn er aus dem Spiel kommt, dann hier eintragen
//################################################## #################
//##############################Delays############## #################
//################################################## #################
var gameMinLength = 0;
// realm delays (minutes)
var unableToConnectRetry = 2;
var realmDownRetry = 2;
var disconnectedRetry = 2;
var cdkeyInUseRetry = 2;
// interface delays (milliseconds)
var connectingToBnetTimeout = 20000;
var characterScreenTimeout = 10000;
var pleaseWaitTimeout = 10000;
var createGameThreshold = 10000;
var createGameThresholdRandom = 1000;
var createGameTimeout = 15000;
var waitInLineTimeout = 15000;
var characterSelectDelay = 1000;
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;
// Only for JoinBot (friend list delay, milliseconds)
var LeaderOfflineDelay = 30000;
var LeaderInChatDelay = 10000;
var GameIsFullDelay = 30000;
//################################################## #################
//################################################## #################
//###############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 = false;
Include("libs/controlInfo.ntl");
var controlData = new controlInfo();
var samegame = '';
var oldgame = '';
var game = '';
var _gamename = "";
var _gamepassword = "";
var _leaderOfflineTick = -LeaderOfflineDelay;
var _leaderInChatTick = -LeaderInChatDelay;
var _GameIsFullTick = -GameIsFullDelay;
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)
{
_gamename = me.gamename;
_gamepassword = me.gamepassword;
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
// To exit game as soon as the leader quits
//Load("NTBot/NTCheckLeader.ntj");
// to party only the leader
//Load("NTBot/tools/NTTools_AutoPartyJoinFriendGames.ntj");
}
}
Delay(1000);
}
else
{
if(_ingame)
{
_ingame = false;
sayChatMsgAfterGame = true;
sendEventToOOG(D2NT_MGR_READY, "", 0);
}
locationAction(controlData.getLocation());
Delay(500);
}
}
}
function locationAction(location)
{
switch(location.id)
{
case 3: // Lobby Chat
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
if(!chatActionsDone)
{
Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
if(joinRandomChannel || joinChannelInChat != "")
{
Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
Delay(1000);
}
if(firstJoinMessage)
{
Say(firstJoinMessage);
Delay(200);
}
chatActionsDone = true;
}
if (chatMessageAfterGame && _gamename != "" && sayChatMsgAfterGame == true)
{
Say(chatMessageAfterGame);
sayChatMsgAfterGame = false;
Delay(200);
}
game = '';
var _tick = GetTickCount();
if ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
&& (_GameIsFullTick < 0 || (_GameIsFullTick + GameIsFullDelay) < _tick))
{
DebugInOOG('Locating the leader : '+leaderAccountName);
Say('/f l');
Delay(500);
}
if(chat = controlData.get(controlData.controls.lobby.chat.te xtBox.channelText))
{
var found_leader = false;
lines = chat.GetText();
for (var line_id = lines.length - 1; line_id > -1; line_id--)
{
if (found_leader) // useless... :/
break;
if (lines[line_id].substring(0,1) == " ")
continue;
// retrieving the whole message
var msg = lines[line_id].replace(/^\s+|\s+$/, "");
var msglines = 1;
while (lines[line_id+msglines] != undefined && lines[line_id+msglines].substring(0,2) == " ")
{
msg += " " + lines[line_id+msglines].replace(/^\s+|\s+$/, "");
msglines++;
}
if (msg.lastIndexOf(leaderName) >= 0)
DebugInOOG("yc8found him :;"+msg);
// checking if the msg is a friendly whisper
if (msg.lastIndexOf(leaderName + ' (*' +leaderAccountName+')') > -1)
{
var 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 != '')
{
found_leader = true;
break;
}
}
// checking if the msg is from the friend list
if (msg.lastIndexOf(': '+leaderAccountName+',') > -1)
{
found_leader = true;
var regOffline=/^.*(offline|desconectado).*$/gi;
var regInChat=/^.*(channel|canale?)\s*([\w\s-]*\w)\.?\s*$/gi;
var regGameName=/^.*(game|partie|spiel|partita|partida)\s*([\w\s-]*\w)\s*\(priv[^\)]*\)\.\s*$/gi;
if (msg.match(regOffline)
&& (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
{
DebugInOOG('Leader is offline, delay '+Math.round(LeaderOfflineDelay/1000)+' sec for next /f l.');
_leaderOfflineTick = GetTickCount();
}
else if (msg.match(regInChat)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick))
{
DebugInOOG('Leader is in the chat "'+msg.replace(regInChat, "$2")+'", delay '+Math.round(LeaderInChatDelay/500)+' sec for next /f l.');
_leaderInChatTick = GetTickCount();
}
else if (msg.match(regGameName)
&& ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick)
&& (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)))
{
game = msg.replace(regGameName, "$2");
}
else if ((_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
&& (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
{
// unhandled line, supposelly "In Realm"
DebugInOOG('The leader was in the the lobby but not in chat, delay '+Math.round(LeaderInChatDelay/500)+' sec for next /f l.');
_leaderInChatTick = GetTickCount();
}
break;
}
}
if (found_leader == false)
DebugInOOG('I couldn\'t find the leader in my friend list!');
if (game!="")
{
DebugInOOG('Leader is in the game "' + game + '"');
//controlData.click(controlData.controls.lobby.butto n.join);
//Delay(100);
if(!JoinGameAgain)
{
if (game != samegame)
{
if (UseCDKeyChangeTrick)
{
// increasing the number of runs in the OOG (for CDKey switch)
// Problem : the gamename/gamepassword set in your OOG will be typed in the lobbyChat
// this may output a red message in the lobby chat if you have a password set (not a real problem)
// I recommend to set a gamename like "Run" and no gamepassword in your OOG. -> this will output "Run-01", "Run-02", etc in lobby chat before joining games
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
Delay(1000);
}
controlData.click(controlData.controls.lobby.butto n.join);
Delay (200);
}
else
Delay(30000);
}
else
{
if (UseCDKeyChangeTrick)
{
// increasing the number of runs in the OOG (for CDKey switch)
// Problem : the gamename/gamepassword set in your OOG will be typed in the lobbyChat
// this may output a red message in the lobby chat if you have a password set (not a real problem)
// I recommend to set a gamename like "Run" and no gamepassword in your OOG. -> this will output "Run-01", "Run-02", etc in lobby chat before joining games
sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
Delay(1000);
}
controlData.click(controlData.controls.lobby.butto n.join);
Delay (200);
}
}
}
else
{
DebugInOOG('I can\'t read the chat!');
//DebugInOOG('You probably haven\'t added the lobby chat controlinfo coordinates!');
Delay(30000);
}
if(game != '')
samegame = game;
break;
case 1: // Lobby
if(location.id == 1 && joinChatAfterGame)
{
Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
controlData.click(controlData.controls.lobby.butto n.enterChat);
break;
}
break;
case 2: // Waiting In Line
if(GetTickCount()-lastGameMade > waitInLineTimeout)
controlData.click(controlData.controls.lobby.inLin e.button.cancel);
break;
case 4: // Create Game
if(!controlData.get(controlData.controls.lobby.cre ate.editBox.gameName))
{
controlData.click(controlData.controls.lobby.butto n.join);
Delay (500);
controlData.click(controlData.controls.lobby.butto n.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);
Delay (100);
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.bu tton.gateway);
break;
case 9: // Login
sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
Delay(loginDelay);
controlData.setText(controlData.controls.login.edi tBox.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.unabl eToConnect.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.characterSele ct.textBox.characterInfo[me.charloc]);
if(_control && _control.GetText() != undefined)
break;
Delay(500);
}
if(_time < characterScreenTimeout)
{
Delay(characterSelectDelay);
controlData.click(controlData.controls.characterSe lect.textBox.characters[me.charloc], 0, 0, 1);
controlData.click(controlData.controls.characterSe lect.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.characterSe lect.button.exit);
timeoutDelay(realmDownRetry*60*1000, location);
}
break;
case 13: // Realm Down - Character Select screen
controlData.click(controlData.controls.characterSe lect.button.exit);
timeoutDelay(realmDownRetry*60*1000, location);
break;
case 14: // Character Select - Disconnected
timeoutDelay(disconnectedRetry*60*1000, location);
controlData.click(controlData.controls.characterSe lect.disconnected.button.ok);
break;
case 15: // New Character
break;
case 16: // Character Select - Please Wait popup
if(!locationTimeout(pleaseWaitTimeout, location))
controlData.click(controlData.controls.characterSe lect.pleaseWait.button.cancel);
break;
case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
controlData.click(controlData.controls.lobby.lostC onnection.button.ok);
break;
case 18: // D2 Splash
controlData.click(controlData.controls.d2Splash.te xtBox.copyright);
break;
case 19: // Login - Cdkey In Use
timeoutDelay(cdkeyInUseRetry*60*1000, location);
controlData.click(controlData.controls.login.cdkey InUse.button.ok);
break;
case 20: // Single Player - Select Difficulty
controlData.click(controlData.singlePlayerDifficul ties[me.diff]);
break;
case 21: // Main Menu - Connecting
if(!locationTimeout(connectingToBnetTimeout, location))
controlData.click(controlData.controls.mainMenu.co nnecting.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.characterSe lect.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.pleas eWait.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.but ton.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;
}
charconfig script ergänzung
Code:
MWConfig_Script.push(["", 5]); NTConfig_KillBaal = true; NTConfig_precast = false;
NTConfig_Leader = "" // Name vom Leader-Char, Groß- und Kleinschreibung beachten!
NTConfig_CoLeechTPMsg = ""; // Bei dieser Message vom Leader geht der Bot ins TP. Wenn er jederzeit rein gehen soll, leer lassen.
der script ist aus muddys-bot-topic.
die frage nun, muss man ernsthaftig jeden leader von jedem run eintragen? oder gibt es eine einfachere lösung?
|
|
|
06/20/2011, 13:50
|
#10
|
elite*gold: 0
Join Date: Mar 2010
Posts: 539
Received Thanks: 418
|
Ganz ohne Namen wird es nicht gehen, dafür ist die Funktion NTM_UsePortal() nicht ausgelegt, die braucht immer nen Namen, da sie sonst ein eigenes Portal benützen will.
Man kann die MultiLeech.ntj von Kolton verwenden (die hier ist aus dem EtalBot kopiert):
Code:
//Universal baal leecher by Kolton
var _leadernames = [[COLOR="red"]"Esp_Elite", "Dunedin"[/COLOR]]; //casing matters
var _safemessages = [[COLOR="red"]"safe", "clear"[/COLOR]]; //casing doesn't matter
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
RegisterEvent(EVENT_GAMEMSG, Chat);
if(!NTTM_CheckAct(5))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
NTTMGR_TownManager();
NTTM_TownMove("portalspot");
while(me.areaid == 109)
NTC_Delay(200);
NTC_Delay(500);
NTM_MoveTo(me.areaid, 15113, 5050);
NTP_DoPrecast(true);
while(1)
Delay(500);
NTC_SendMsgToScript("[COLOR="Red"]MW[/COLOR]BotGame.ntj", "SCRIPT_END");
}
function Chat(msg, type)
{
if(type == 4)
{
for(var i = 0 ; i < _leadernames.length ; i++)
{
if(msg.indexOf(_leadernames[i]) != -1)
{
NTC_Delay(500);
ExitGame();
}
}
}
else for(var i = 0 ; i < _safemessages.length ; i++)
{
if(msg.toLowerCase().indexOf(_safemessages[i]) != -1)
{
for(var i = 0 ; i < _leadernames.length ; i++)
{
if(NTM_UsePortal("BluePortal", 131, _leadernames[i]))
break;
}
}
}
}
Die roten Markierungen müssen angepasst werden, sollte sich fast selbst erklären.
Damit wird jedoch nur im Thron geleecht, für Baal oder auch CoFight müsste man das Script etwas ändern.
Wenn ich Zeit finde, werde ich das noch machen, schaut momentan jedoch eher schlecht aus...
|
|
|
06/21/2011, 11:08
|
#11
|
elite*gold: 70
Join Date: Sep 2009
Posts: 453
Received Thanks: 116
|
Quote:
Originally Posted by TheCrazy11
Ganz ohne Namen wird es nicht gehen, dafür ist die Funktion NTM_UsePortal() nicht ausgelegt, die braucht immer nen Namen, da sie sonst ein eigenes Portal benützen will.
Man kann die MultiLeech.ntj von Kolton verwenden (die hier ist aus dem EtalBot kopiert):
Code:
//Universal baal leecher by Kolton
var _leadernames = [[COLOR="red"]"Esp_Elite", "Dunedin"[/COLOR]]; //casing matters
var _safemessages = [[COLOR="red"]"safe", "clear"[/COLOR]]; //casing doesn't matter
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
NTA_Initialize();
RegisterEvent(EVENT_GAMEMSG, Chat);
if(!NTTM_CheckAct(5))
{
NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
return;
}
NTTMGR_TownManager();
NTTM_TownMove("portalspot");
while(me.areaid == 109)
NTC_Delay(200);
NTC_Delay(500);
NTM_MoveTo(me.areaid, 15113, 5050);
NTP_DoPrecast(true);
while(1)
Delay(500);
NTC_SendMsgToScript("[COLOR="Red"]MW[/COLOR]BotGame.ntj", "SCRIPT_END");
}
function Chat(msg, type)
{
if(type == 4)
{
for(var i = 0 ; i < _leadernames.length ; i++)
{
if(msg.indexOf(_leadernames[i]) != -1)
{
NTC_Delay(500);
ExitGame();
}
}
}
else for(var i = 0 ; i < _safemessages.length ; i++)
{
if(msg.toLowerCase().indexOf(_safemessages[i]) != -1)
{
for(var i = 0 ; i < _leadernames.length ; i++)
{
if(NTM_UsePortal("BluePortal", 131, _leadernames[i]))
break;
}
}
}
}
Die roten Markierungen müssen angepasst werden, sollte sich fast selbst erklären.
Damit wird jedoch nur im Thron geleecht, für Baal oder auch CoFight müsste man das Script etwas ändern.
Wenn ich Zeit finde, werde ich das noch machen, schaut momentan jedoch eher schlecht aus... 
|
danke werde es mal testen sobald ich heute dazu komme =) falls wer eine public-baal liste mit leadername sowie channelmsg hat kann er die gerne posten^^
|
|
|
06/23/2011, 15:02
|
#12
|
elite*gold: 6
Join Date: Jul 2008
Posts: 37
Received Thanks: 6
|
Servus, bei mir wills nicht klappen  Wie muss ich den Filter einstellen, wenn die Ansagenachricht wie folgt lautet:
Code:
next game should be Bestdiabaal-99//Myrun1 in about 2 seconds
Dann müsste der doch wie folgt aussehen:
Code:
var extrafilters = ["next game", "//Myrun1 in about"];
Oder so müsste es doch eigentlich auch gehen?
Code:
var extrafilters = ["next game should be ", "//Myrun1 in about 2 seconds"];
Oder wo ist mein Denkfehler?  Ich könnte mir ja vorstellen, dass ich die beiden Slash irgendwie Escapen muss... doch wie mache ich das?
|
|
|
07/20/2011, 22:39
|
#13
|
elite*gold: 18
Join Date: Aug 2008
Posts: 599
Received Thanks: 54
|
Was kann man denn jetzt mit Muddys D2NT manager benutzen kann mir hier jemand den vollen script senden bitte?
|
|
|
 |
Similar Threads
|
L2Walker script: Solo rebuff/restock/return script
08/08/2012 - Lin2 Exploits, Hacks, Bots, Tools & Macros - 63 Replies
Hello!
I've been reading alot and not really contributing so i'll start off here with a very well working script im using to bot my SK outside ivory tower in oren. I've tried to structure the code so it easily can be modified for another level of character, town, and hunting spot.
The script is made for CT2 Retail, mainly to get advantage of the newbie buffs (which now lasts all the way until level 62)
Change log:
Update 2008-09-01
Version 1.14 -Download
|
[suche] d2nt level rush script 1-25 / follow script
06/23/2010 - Diablo 2 Programming - 5 Replies
moin
erstmal sry falls es da doch schon was passendes zu gab - hab schonmal gesucht aber nur alte sachen gefunden oder eben antworten in richtung "geht so schnell dafür braucht man keinen bot" ^^
mein problem besteht darin dass ich für lvl 1 bis 20 immer x stunden brauche - trist geht ja noch halberwegs aber mit tombruns such ich mich immer dusselig ^^ - bzw cows sind noch schlimmer (dafür geht das cow-script für d2nt ausm bluebird zumindest halberwegs)
die frage ist jetz die - giebt...
|
All times are GMT +2. The time now is 11:02.
|
|