|
You last visited: Today at 07:39
Advertisement
[Release] Muddy's D2NT
Discussion on [Release] Muddy's D2NT within the Diablo 2 Programming forum part of the Diablo 2 category.
07/17/2011, 21:58
|
#2536
|
elite*gold: 0
Join Date: Feb 2011
Posts: 4
Received Thanks: 0
|
hey leute mal ne frage-->
spiel schon lange zeit mit d2nt bluebird, aber der is in manchen gebieten überarbeitungswürdig sag ich mal so.
deshalb wollte ich mal muddys ausprobieren wegen der guten rezessionen, aber jedes mal wenn der einen magic ring aufnimmt oder gambled, dann kommt ein shutdown des systems.
HALT
Location: line#2245
Expression: Unrecoverable internal error6fb422e5
kann mir wer sagen was das is ?
und wie bekomm ich die blöden ansagen weg, was er grade macht xD
danke schon mal fürs helfen
|
|
|
07/17/2011, 22:06
|
#2537
|
elite*gold: 0
Join Date: Jun 2008
Posts: 209
Received Thanks: 30
|
Quote:
Originally Posted by Thomas Gürtler
hey leute mal ne frage-->
spiel schon lange zeit mit d2nt bluebird, aber der is in manchen gebieten überarbeitungswürdig sag ich mal so.
deshalb wollte ich mal muddys ausprobieren wegen der guten rezessionen, aber jedes mal wenn der einen magic ring aufnimmt oder gambled, dann kommt ein shutdown des systems.
HALT
Location: line#2245
Expression: Unrecoverable internal error6fb422e5
kann mir wer sagen was das is ?
und wie bekomm ich die blöden ansagen weg, was er grade macht xD
danke schon mal fürs helfen
|
Na haben wir d2 nicht auf Englisch ?
und zum status:MWConfig_ShowOverheadStatus = false; in der MWConfig_GlobalSettings.ntl
mfg AmonRa
|
|
|
07/17/2011, 22:13
|
#2538
|
elite*gold: 0
Join Date: Feb 2011
Posts: 4
Received Thanks: 0
|
könnte sein xD muss ich dann alle versionen meiner d2 ordner in eglish ausführen?
hab 3 mal diablo am rennen. und will wenn ich manuell bzw. mit bluebird spiele ned immer umschreiben müssen, aber da gibts wohl keine alternative lösung dafür oder?
danke schon mal
mfg ToM
|
|
|
07/17/2011, 22:19
|
#2539
|
elite*gold: 0
Join Date: Jun 2008
Posts: 209
Received Thanks: 30
|
Quote:
Originally Posted by Thomas Gürtler
könnte sein xD muss ich dann alle versionen meiner d2 ordner in eglish ausführen?
hab 3 mal diablo am rennen. und will wenn ich manuell bzw. mit bluebird spiele ned immer umschreiben müssen, aber da gibts wohl keine alternative lösung dafür oder?
danke schon mal
mfg ToM
|

Da unter Guides/Tutorials findest du drei Anleitungen.
|
|
|
07/18/2011, 00:13
|
#2540
|
elite*gold: 0
Join Date: May 2010
Posts: 212
Received Thanks: 40
|
Quote:
Originally Posted by DeathFromHeaven
Code:
// This is the minimum time in seconds for your char to remain in a single game. Your char will not exit the game before this time elapsed.
me.mingametime = 270;
diese falls du nicht willst dass er im Game stehen bleibt, und diese, falls er dir in der Lobby zu lange wartet:
Code:
var GameMinLength = 180000; // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
erstere befindet sich in der Charconfig und zweitere in der NTBot.ntj
|
Ja danke DeathFromHeaven, aber das hilft ja nix, da in Classic das Game bei Dia automatisch nach ~90 sec.beendet wir. Und wenn dann die mingametime nicht vor Ablauf erreicht wird, crashed es. Und die Mingamtime braucht man, damit nicht mehr als 20 game p.h. erstellt werden.
|
|
|
07/18/2011, 08:31
|
#2541
|
elite*gold: 0
Join Date: Aug 2009
Posts: 435
Received Thanks: 159
|
Quote:
Originally Posted by modw89
kann mir wer sagen welchen delay ich runterschrauben muss wenn der bot das game vorzeitig verlässt?[z.b. bei skip wenn puppets im tron sind]
|
hatte mich auch eigentlich auf ihn bezogen, da gehe ich von aus, dass er nicht classic spielt :P
|
|
|
07/18/2011, 12:48
|
#2542
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Quote:
Originally Posted by fred9x9
Genau so ist es Muddy.
Meist nicht nur ein Restart, sondern ein Hänger beim Ausloggen,
bis der Server dich rausschmeißt.
Aber man weiß ja, ich kann deinen Vorschlag leider nicht umsetzen. 
Zumal der Timer noch an der "richtigen" Stelle, mit den richtigen Informationen sitzen müsste, damit Lod Player nicht davon betroffen werden.
LG
Fred
|
So furchtbar groß ist der Aufwand nicht, zwei neue Variablen, einen case im Script Message Handler und eine if-Anweisung innerhalb der Endlosschleife.
Kannst mir ja mal deine derzeitige MWBotgGame.ntj zukommen lassen, dann passe ich es dir schnell an.
Quote:
Originally Posted by mirkoregge
Hallo,
ich habe immer noch das Problem wie in diesem  beschrieben. Sobald der Bot Chicken, Waypointbug oder Joinbug hat, hängt sich die Game.exe auf. Der Fehler tritt auch auf, wenn man das Game manuell beendet (Ende-Taste). Es ist ein kurer Fehlerton seitens Windows 7 zu hören. Das Bild friert ein und nix passiert mehr. Im Manager erfolgt zwar ein Neustart, aber auch der bleibt in einer Endlosschleife. Hatte die letzte Version hier gedownloaded. Hoffe mir kann jemand helfen. Danke. Bis Freitag 
|
Um das zu beheben, müsste ich erstmal wissen, wodurch es genau ausgelöst wird. Da ich absolut keinen Anhaltspunkt habe, lässt sich das leider schwer umsetzen...
LG
Muddy
|
|
|
07/18/2011, 13:50
|
#2543
|
elite*gold: 0
Join Date: May 2010
Posts: 212
Received Thanks: 40
|
Quote:
Originally Posted by Muddy_Waters
So furchtbar groß ist der Aufwand nicht, zwei neue Variablen, einen case im Script Message Handler und eine if-Anweisung innerhalb der Endlosschleife.
Kannst mir ja mal deine derzeitige MWBotgGame.ntj zukommen lassen, dann passe ich es dir schnell an.
Um das zu beheben, müsste ich erstmal wissen, wodurch es genau ausgelöst wird. Da ich absolut keinen Anhaltspunkt habe, lässt sich das leider schwer umsetzen...
LG
Muddy
|
Im Voraus schon mal ein kleines DANKE.
Solte eigentlich die von dir zuletzt veröffentlichte sein.
Code:
/**
* This file was modified by
* Check the programming section for updates and further scripts
* Last Update: 02/26/2011
*/
// Global constants
const _MWBG_CHAT_COMMAND_TRIGGER = '.';
// Global variables
var _MWBG_ExperienceThresholds = new Array(
500, 1500, 3750, 7875, 14175, 22680, 32886, 44396, // Level 2 - 9
57715, 72144, 90180, 112725, 140906, 176132, 220165, 275207, 344008, 430010, // Level 10 - 19
537513, 671891, 839864, 1049830, 1312287, 1640359, 2050449, 2563061, 3203826, 3902260, // Level 20 - 29
4663553, 5493363, 6397855, 7383752, 8458379, 9629723, 10906488, 12298162, 13815086, 15468534, // Level 30 - 39
17270791, 19235252, 21376515, 23710491, 26254525, 29027522, 32050088, 35344686, 38935798, 42850109, // Level 40 - 49
47116709, 51767302, 56836449, 62361819, 68384473, 74949165, 82104680, 89904191, 98405658, 107672256, // Level 50 - 59
117772849, 128782495, 140783010, 153863570, 168121381, 183662396, 200602101, 219066380, 239192444, 261129853, // Level 60 - 69
285041630, 311105466, 339515048, 370481492, 404234916, 441026148, 481128591, 524840254, 572485967, 624419793, // Level 70 - 79
681027665, 742730244, 809986056, 883294891, 963201521, 1050299747, 1145236814, 1248718217, 1361512946, 1484459201, // Level 80 - 89
1618470619, 1764543065, 1923762030, 2097310703, 2286478756, 2492671933, 2717422497, 2962400612, 3229426756, 3520485254);// Level 90 - 99
var _MWBG_CurScriptIndex = 0;
var _MWBG_CurScriptEndTick = GetTickCount();
var _MWBG_CurScriptStartTick = GetTickCount();
var _MWBG_LastScript = false;
var _MWBG_UserExit = false;
var _MWBG_Statistics;
var _MWBG_WorldEventData;
var _MWBG_ShowStatusText = true;
var _MWBG_ShowCurrentPing = false;
var _MWBG_PositionsPrinted = new Array();
function MW_GameStatistics()
{
this.Potions = new Array();
this.Potions.Hp = 0;
this.Potions.Mp = 0;
this.Potions.Rv = 0;
this.Init = new Array();
this.Init.Ticks = GetTickCount();
this.Init.Exp = me.GetStat(13);
this.Init.CharLevel = me.GetStat(12);
this.Init.Gold = me.GetStat(14) + me.GetStat(15);
this.CommonLog = new Array();
this.CorpsesLooted = 0;
this.ChestsOpened = 0;
this.ShrinesUsed = 0;
this.ItemsPicked = 0;
this.ScriptGold = 0;
this.Errors = 0;
}
function MW_WorldEventData()
{
this.SojSoldString = GetLocaleString(11004).replace("%d ", "");
this.DiabloWalkString = GetLocaleString(11005);
this.Count = new Array();
this.Count.Message = 0;
this.Count.Recent = 0;
this.Count.Last = 0;
this.Count.Init = 0;
this.Loop = new Array();
this.Loop.Runtime = 0;
this.Loop.Mode = 0;
this.Loop.Running = false;
this.InitTicks = 0;
}
function NTMain()
{
SetStatusText("˙c8Initializing...");
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
var _script, _loops;
_MWBG_Statistics = new MW_GameStatistics();
_MWBG_WorldEventData = new MW_WorldEventData();
NTC_Delay(NTConfig_StartDelay);
if(!_MWBG_Statistics || !_MWBG_WorldEventData)
ExitGame();
if(MWConfig_UseXMLItemlog)
{
if(MWI_WriteTempLogToXML())
MWI_ClearTempLog();
}
MWI_ClearLoc();
SetUIState(0x0A, true);
NTT_GetCorpses();
if(MWConfig_ExitGameOnMissingPassword && !me.gamepassword)
{
SetStatusText("˙c1Exiting game...");
ExitGame();
}
if(MWConfig_Script.length > 0)
{
NTCU_InitCubing();
Load("NTBot/tools/NTToolsThread.ntj");
RegisterEvent(EVENT_GAMEMSG, NT_GameMsgEvents);
RegisterEvent(EVENT_KEYDOWN, NT_KeyEvents);
RegisterEvent(EVENT_SCRIPTMSG, NT_ScriptMsgEvents);
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
_loops = 0;
while(!_MWBG_LastScript && me.ingame)
{
MW_SetStatusText();
if(GetTickCount() >= _MWBG_CurScriptEndTick && MWConfig_Script[_MWBG_CurScriptIndex][1] != 0 && !isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]) && !NTC_InTown() && !_MWBG_WorldEventData.Loop.Running)
{
_script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
if(_script && _script.running)
{
Print("˙c;" + MWConfig_Script[_MWBG_CurScriptIndex][0] + "˙c8 is skipped due to exceeding the maximum runtime of ˙c;" + MWConfig_Script[_MWBG_CurScriptIndex][1] + "˙c8 minutes!");
NT_ScriptMsgEvents("SCRIPT_END");
}
}
NTC_Delay(500);
if(!_MWBG_LastScript && _MWBG_Statistics.Errors > MWConfig_GameErrorLimit)
{
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
_MWBG_LastScript = true;
}
if(_loops++ % 40 == 0)
MW_UpdateCommonLog();
}
}
UnregisterEvent(EVENT_GAMEMSG);
UnregisterEvent(EVENT_KEYDOWN);
UnregisterEvent(EVENT_SCRIPTMSG);
MW_UpdateCommonLog();
MW_CheckMinGametime();
SetStatusText("˙c1Exiting game...");
if(me.ingame)
MW_PrintOutputString(_MWBG_UserExit);
me.revealautomap = false;
me.showmissileonautomap = false;
me.showenemyonautomap = false;
if(!NTC_InTown() && !_MWBG_UserExit)
NTSI_PickItems(true);
ExitGame();
}
function NT_GameMsgEvents(msg, type)
{
var _message, _messenger, _output, _date;
var i;
if(type == 0)
{
_message = msg.split("˙c0: ")[1]; // Extract the message
if(_message.substr(0, _MWBG_CHAT_COMMAND_TRIGGER.length) != _MWBG_CHAT_COMMAND_TRIGGER)
return;
_message = _message.substr(_MWBG_CHAT_COMMAND_TRIGGER.length, _message.length); // Remove the trigger
_messenger = msg.split("˙c0: ")[0].replace("˙c4", ""); // Extract the name of the char that wrote the message
if(_messenger == me.charname && _message.toLowerCase().indexOf("run") == 0)
{
for(i = 0; i < MWConfig_Script.length; i++)
{
if(MWConfig_Script[i][0].toLowerCase().indexOf(_message.toLowerCase().split(" ")[1]) > -1)
break;
}
if(i < MWConfig_Script.length)
{
Print("˙c8Switching to ˙c;" + MWConfig_Script[i][0] + "˙c8...");
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(250);
_MWBG_CurScriptIndex = i - 1;
NT_ScriptMsgEvents("SCRIPT_END");
}
else
Print("˙c1There is no script activated matching the term '" + _message + "'!");
return;
}
NTC_SendMsgToScript("MWRush.ntj", _messenger + " " + _message.toUpperCase());
}
if(type == 4)
{
if(MWConfig_CheckSojSales && msg.indexOf(_MWBG_WorldEventData.SojSoldString) > -1)
{
me.maxgametime = 0;
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(200);
_MWBG_WorldEventData.Count.Last = _MWBG_WorldEventData.Count.Recent;
_MWBG_WorldEventData.Count.Recent = parseInt(msg.split(" ")[0]);
_MWBG_WorldEventData.Count.Message++;
if(_MWBG_WorldEventData.Count.Init == 0)
{
_MWBG_WorldEventData.Count.Init = _MWBG_WorldEventData.Count.Recent;
_MWBG_WorldEventData.InitTicks = GetTickCount();
}
if(!_MWBG_WorldEventData.Loop.Running)
{
_MWBG_WorldEventData.Loop.Runtime = _MWBG_WorldEventData.Count.Message*10*60E3;
_MWBG_WorldEventData.Loop.Mode = 1;
}
else if(_MWBG_WorldEventData.Loop.Mode == 1)
_MWBG_WorldEventData.Loop.Runtime = _MWBG_WorldEventData.Count.Message*5*60E3;
_output = "˙c4" + msg;
_output += ";˙c0Game:˙c8 " + me.gamename + "//" + me.gamepassword;
_output += "\n˙c0Server IP:˙c8 " + me.gameserverip.split(".")[3];
_output += "\n˙c0Message Count:˙c8 " + _MWBG_WorldEventData.Count.Message;
_output += "\n˙c0Sojs Total:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + " [+" + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Last) + "]";
_date = new Date(_MWBG_WorldEventData.InitTicks);
if(_date)
{
_output += "\n˙c0First Message:˙c8 " + _date.toLocaleFormat("%H:%M:%S");
_output += " [-" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks) + "]";
}
_output += "\n˙c0Waiting˙c8 " + (_MWBG_WorldEventData.Loop.Runtime / 60E3) + " ˙c0minutes";
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
if(!_MWBG_WorldEventData.Loop.Running)
{
MW_AntiIdle();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
}
else if(NTConfig_CheckCloneDiablo && msg.indexOf(_MWBG_WorldEventData.DiabloWalkString) > -1)
{
me.maxgametime = 0;
_output = "˙c4" + msg;
_output += ";˙c0Game:˙c8 " + me.gamename + "//" + me.gamepassword;
_output += "\n˙c0Server IP:˙c8 " + me.gameserverip.split(".")[3];
_output += "\n˙c0Message Count:˙c8 " + _MWBG_WorldEventData.Count.Message;
_output += "\n˙c0Sojs Total:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + " [+" + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Last) + "]";
_date = new Date(_MWBG_WorldEventData.InitTicks);
if(_date)
{
_output += "\n˙c0First Message:˙c8 " + _date.toLocaleFormat("%H:%M:%S");
_output += " [-" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks) + "]";
}
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(200);
_MWBG_WorldEventData.Loop.Runtime = 0;
_MWBG_WorldEventData.Loop.Mode = 0;
if(!_MWBG_WorldEventData.Loop.Running)
MW_AntiIdle();
}
}
}
function NT_KeyEvents(keycode)
{
//Print("Keycode: " + keycode);
var _script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
switch(keycode)
{
case 19: // Pause (PAUSE)
if(_script)
{
if(_script.running)
{
_MWBG_ShowStatusText = false;
_script.Stop();
me.maxgametime = 0;
NTC_Delay(250);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
SetStatusText("˙c1Stopped ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(500);
}
else
{
if(_MWBG_WorldEventData.Loop.Running)
{
_MWBG_WorldEventData.Loop.Running = false;
NTC_Delay(500);
}
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
NT_ScriptMsgEvents("SET_DEFAULT_STATUS");
}
break;
case 33: // Skip (PGUP)
_MWBG_ShowStatusText = false;
SetStatusText("˙c1Skipping current script...");
_MWBG_WorldEventData.Loop.Running = false
if(!_script)
break;
if(_script.running)
_script.Stop();
NTC_PingDelay(250);
NT_ScriptMsgEvents("SCRIPT_END");
break;
case 34: // Repeat (PGDN)
_MWBG_ShowStatusText = false;
SetStatusText("˙c1Repeating previous script...");
_MWBG_WorldEventData.Loop.Running = false
if(!_script)
break;
if(_script.running)
_script.Stop();
NTC_PingDelay(250);
NT_ScriptMsgEvents("SCRIPT_REPEAT");
break;
case 35: // Clear current XML logfile (END)
_MWBG_ShowCurrentPing = !_MWBG_ShowCurrentPing;
break;
case 36: // Show coordinates (POS1/HOME)
MW_PrintPosition();
break;
case 46: // Exit (DEL)
if(_MWBG_LastScript)
return;
SetStatusText("˙c1Exiting game...");
_MWBG_WorldEventData.Loop.Running = false
_MWBG_ShowStatusText = false;
_MWBG_UserExit = true;
_MWBG_LastScript = true;
if(NTConfig_PublicMode)
Say("Next game!");
break;
case 45: // Log stashed items (INS)
_MWBG_ShowStatusText = false;
SetStatusText("˙c8Logging current stash to " + ((MWConfig_LogStashToTxt) ? "TXT" : "XML") + "...");
if(MWI_LogStashedItems())
SetStatusText("˙c8Done!");
else
SetStatusText("˙c1Logging failed!");
NT_ScriptMsgEvents("SET_DEFAULT_STATUS");
break;
default:
MWUC_HandleUserCommand(keycode, _MWBG_Statistics, _MWBG_CurScriptIndex);
break;
}
}
function MW_PrintPosition()
{
var _color;
_MWBG_PositionsPrinted.push([me.x, me.y, me.areaid]);
if(_MWBG_PositionsPrinted.length > 2)
_MWBG_PositionsPrinted.splice(0, 1);
_color = MWC_GetRandomColor();
Print(_color + "Current Position: ˙c0(˙c2" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][0] + "˙c0|˙c1" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][1] + "˙c0) [˙c7" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][2] + "˙c0]");
if(_MWBG_PositionsPrinted.length > 1)
Print(_color + "Last Position: ˙c0(˙c2" + _MWBG_PositionsPrinted[0][0] + "˙c0|˙c1" + _MWBG_PositionsPrinted[0][1] + "˙c0) [˙c7" + _MWBG_PositionsPrinted[0][2] + "˙c0] (˙c7Distance: " + GetDistance(_MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][0], _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][1], _MWBG_PositionsPrinted[0][0], _MWBG_PositionsPrinted[0][1]).toFixed(2) + "˙c0)");
}
function NT_ScriptMsgEvents(msg)
{
var _area, _msg, _fhandle, _buffer, _script;
if(!msg)
return;
if(msg.split("_")[0] == "SET" && msg.indexOf("SET_DEFAULT_STATUS") == -1)
{
MW_EvaluateInputData(msg);
return;
}
switch(msg)
{
case "SCRIPT_END":
_MWBG_ShowStatusText = false;
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
if(++_MWBG_CurScriptIndex < MWConfig_Script.length)
{
if(MWConfig_ShowGoldPickupsPerScript)
{
if(_MWBG_Statistics.ScriptGold > 0)
Print("˙c8Picked up ˙c;" + MWC_InsertDigitSeperator(_MWBG_Statistics.ScriptGold) + "˙c8 gold running ˙c;" + MWConfig_Script[_MWBG_CurScriptIndex - 1][0]);
_MWBG_Statistics.ScriptGold = 0;
}
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
_MWBG_ShowStatusText = true;
}
else
_MWBG_LastScript = true;
break;
case "SCRIPT_REPEAT":
_MWBG_ShowStatusText = false;
if(_MWBG_CurScriptIndex - 1 >= 0)
{
_MWBG_CurScriptIndex--;
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
else
{
SetStatusText("˙c1Cannot repeat - Invalid Index!");
NTC_PingDelay(250);
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
_MWBG_ShowStatusText = true;
break;
case "SET_DEFAULT_STATUS":
NTC_Delay(2500);
_MWBG_ShowStatusText = true;
break;
case "STOP_STATUS_TEXT_UPDATE":
_MWBG_ShowStatusText = false;
break;
case "RESET_TICKS":
MW_ResetTicks();
break;
case "EXIT_GAME":
SetStatusText("˙c1Exiting game...");
_MWBG_WorldEventData.Loop.Running = false
_MWBG_ShowStatusText = false;
_MWBG_UserExit = true;
_MWBG_LastScript = true;
break;
default:
_msg = new Array();
_msg.push(msg);
_msg.push("");
_fhandle = FileOpen("Logs/Temporary Data/"+ me.charname + ".errdata", 2);
if(_fhandle)
{
while(!_fhandle.eof)
{
_buffer = _fhandle.ReadLine();
if(_buffer != "" && _buffer.indexOf("//") == -1)
{
if(_msg[1] != "")
_msg[1] += "\n";
_msg[1] += _buffer;
}
}
_fhandle.Close();
_fhandle = FileOpen("Logs/Temporary Data/"+ me.charname + ".errdata", 1);
if(_fhandle)
{
_fhandle.WriteLine("// This file holds aditional error information");
_fhandle.Close();
}
}
if(_msg[1] == "")
_msg[1] = "˙BE0000No additional error description available!";
else
_msg[1] = _msg[1].replace("%script", MWConfig_Script[_MWBG_CurScriptIndex][0]);
Print("˙c1" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " failed: " + _msg[0]);
_area = MWC_FindArea();
if(_area)
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙BE0000" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " : " + _msg[0] + " failed (" + _area.name + ");" + _msg[1]);
else
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙BE0000" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " : " + _msg[0] + " failed (unknown area);" + _msg[1]);
_MWBG_Statistics.Errors++;
NT_ScriptMsgEvents("SCRIPT_END");
break;
}
}
function MW_ResetTicks()
{
_MWBG_CurScriptStartTick = GetTickCount();
if(MWConfig_Script[_MWBG_CurScriptIndex].length == 2 && !isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]))
_MWBG_CurScriptEndTick = _MWBG_CurScriptStartTick + 6E4 * MWConfig_Script[_MWBG_CurScriptIndex][1];
}
function MW_AntiIdle()
{
var _endtime, _starttick, _loops, _timeString, _time;
_loops = 0;
_MWBG_WorldEventData.Loop.Running = true;
_MWBG_ShowStatusText = false;
_starttick = GetTickCount();
if(_MWBG_WorldEventData.Loop.Mode == 0)
_MWBG_WorldEventData.Loop.Runtime = MWConfig_WorldEventWaitTime;
if(GetUIState(0x01) || GetUIState(0x0C))
me.Cancel(1);
while((_MWBG_WorldEventData.Loop.Runtime == 0 || _MWBG_WorldEventData.Loop.Runtime + _starttick > GetTickCount()) && _MWBG_WorldEventData.Loop.Running && me.ingame)
{
if(_loops % 2 == 0)
{
if(MWConfig_WorldEventAccount)
{
if(_MWBG_WorldEventData.Loop.Mode == 0)
Say("/w *" + MWConfig_WorldEventAccount + " World Event in " + me.gamename + "//" + me.gamepassword + "!");
else
Say("/w *" + MWConfig_WorldEventAccount + " Soj Count in " + me.gamename + "//" + me.gamepassword + " (" + _MWBG_SojCount + ((_MWBG_SojCount - _MWBG_InitialSojCount) ? " [+" + (_MWBG_SojCount - _MWBG_InitialSojCount)+ "]" : "") + " sold)!");
}
}
SetStatusText("˙c8Switching to Act " + (1 +_loops % 5) + "...");
NTTM_CheckAct(1 + _loops % 5);
SetStatusText("˙c8Moving to Portal Spot...");
NTTM_TownMove("portalspot");
_endtime = GetTickCount() + 300E3; // Wait 300 seconds in each act
while(_endtime > GetTickCount() && (_MWBG_WorldEventData.Loop.Runtime == 0 || _MWBG_WorldEventData.Loop.Runtime + _starttick > GetTickCount()) && _MWBG_WorldEventData.Loop.Running && me.ingame)
{
if(_MWBG_WorldEventData.Loop.Mode == 0)
{
_timeString = "˙c8Diablo Walks the Earth! [";
_time = GetTickCount() - _starttick;
}
else
{
_timeString = "˙c8Awaiting Soj Sale... [";
_time = _MWBG_WorldEventData.Loop.Runtime + _starttick - GetTickCount();
}
_timeString += MWC_ConvertTicksToTimeString(_time) + "]";
SetStatusText(_timeString);
NTC_Delay(250);
}
_loops++;
}
_MWBG_WorldEventData.Loop.Running = false;
if(_MWBG_WorldEventData.Loop.Mode != 0)
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙c4Proceeding...;˙c0Total Sojs sold:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + "\n˙c0Waited˙c8 " + (parseInt((GetTickCount() - _starttick) / 6E4) % 60) + ":" + (parseInt((GetTickCount() - _starttick) / 1E3) % 60) + "");
MW_ResetTicks();
_MWBG_ShowStatusText = true;
}
function MW_EvaluateInputData(msg)
{
switch(msg.split("_")[1])
{
case "SHRINEACTIVATED":
_MWBG_Statistics.ShrinesUsed++;
break;
case "CHESTOPENEND":
_MWBG_Statistics.ChestsOpened++;
break;
case "LOOTED":
_MWBG_Statistics.CorpsesLooted++;
break;
case "PICKED":
_MWBG_Statistics.ItemsPicked++;
break;
case "SCRIPTGOLD":
_MWBG_Statistics.ScriptGold += parseInt(msg.split("_")[2]);
break;
case "HPDRANK":
_MWBG_Statistics.Potions.Hp++;
break;
case "MPDRANK":
_MWBG_Statistics.Potions.Mp++;
break;
case "RVDRANK":
_MWBG_Statistics.Potions.Rv++;
break;
case "COMMONITEM":
_MWBG_Statistics.CommonLog.push(parseInt(msg.split("_")[2]));
break;
}
}
function MW_PrintOutputString(byUser)
{
var _output, _room, _gold, _expString, _tempString, _dateDiff;
if(arguments.length < 1)
byUser = false;
_room = MWI_GetStashRoom();
if(byUser)
{
_output = MW_GetInterpolationColor(_room[0] / _room[1]) + "Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " (" + me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished by User!;";
}
else
{
if(_MWBG_Statistics.Errors > 1)
_output = "˙F66F21Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " ("+ me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished!;";
else
_output = MW_GetInterpolationColor(_room[0] / _room[1]) + "Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " ("+ me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished successfully!;";
}
// Level up info
if(_MWBG_Statistics.Init.CharLevel != me.GetStat(12))
_output += "˙00FF40!!! Level up (" + me.GetStat(12) + ") !!!\n";
// Gametime info
_output += "˙c0Duration:˙c8 " + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks);
// Add the relation between maximum and actual gametime
if(me.maxgametime > 0)
_output += " [" + ((GetTickCount() - _MWBG_Statistics.Init.Ticks) / 10 / me.maxgametime).toFixed(1) + "%]";
// Exp info
if(_MWBG_Statistics.Init.CharLevel == me.GetStat(12) && me.GetStat(13) - _MWBG_Statistics.Init.Exp > 0)
{
_output += "\n˙c0Experience:˙c8 " + MWC_InsertDigitSeperator(me.GetStat(13) - _MWBG_Statistics.Init.Exp);
if(MW_GetRequiredExp(me.GetStat(12) + 1) - MW_GetRequiredExp(me.GetStat(12)) > 0)
_output += " [" + ((me.GetStat(13) - _MWBG_Statistics.Init.Exp) / (MW_GetRequiredExp(me.GetStat(12) + 1) - MW_GetRequiredExp(me.GetStat(12))) * 100).toFixed(4) + "%]";
}
// Potion Info
if(_MWBG_Statistics.Potions.Hp > 0 || _MWBG_Statistics.Potions.Mp > 0 || _MWBG_Statistics.Potions.Rv > 0)
_output += "\n˙c0Potions:˙BE0000 (" + _MWBG_Statistics.Potions.Hp + ")˙c3 (" + _MWBG_Statistics.Potions.Mp + ")˙9F008C (" + _MWBG_Statistics.Potions.Rv + ")";
// Gold pickup
_gold = NTC_MyGold() - _MWBG_Statistics.Init.Gold;
if(_gold != 0)
_output += "\n˙c0Gold:˙c8 " + MWC_InsertDigitSeperator(_gold);
// Picked items
if(_MWBG_Statistics.ItemsPicked > 0)
_output += "\n˙c0Items:˙c8 " + _MWBG_Statistics.ItemsPicked;
// Looted corpses
if(_MWBG_Statistics.CorpsesLooted > 0)
_output += "\n˙c0Looted:˙c8 " + _MWBG_Statistics.CorpsesLooted;
// Chest info
if(_MWBG_Statistics.ChestsOpened > 0)
_output += "\n˙c0Chests:˙c8 " + _MWBG_Statistics.ChestsOpened;
// Shrine info
if(_MWBG_Statistics.ShrinesUsed > 0)
_output += "\n˙c0Shrines:˙c8 " + _MWBG_Statistics.ShrinesUsed;
// Stash info
_output += "\n˙c0Stash: " + MW_GetInterpolationColor(_room[0] / _room[1]) + _room[0] + "/" + _room[1];
// Inventory info
_room = MWI_GetStashRoom(false, true);
_output += "\n˙c0Inventory: " + MW_GetInterpolationColor(_room[0] / _room[1]) + _room[0] + "/" + _room[1];
// _output += "\n˙c0Color Check: " + MW_GetInterpolationColor(0.0) + "0% " + MW_GetInterpolationColor(0.25) + "25% " + MW_GetInterpolationColor(0.5) + "50% " + MW_GetInterpolationColor(0.75) + "75% " + MW_GetInterpolationColor(1.0) + "100% ";
// Error info
if(_MWBG_Statistics.Errors > 0)
_output += "\n˙BE0000Errors: " + _MWBG_Statistics.Errors;
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
}
function MW_GetRequiredExp(level)
{
// Returns the experience which is required for the level specified
if(!level || level < 2 || level > 99)
return -1;
return _MWBG_ExperienceThresholds[level - 2];
}
function MW_GetScriptRuntimeMinutes(addZeros)
{
return parseInt((GetTickCount() - _MWBG_CurScriptStartTick) / 6E4) % 60;
}
function MW_GetScriptRuntimeSeconds(addZeros)
{
return parseInt((GetTickCount() - _MWBG_CurScriptStartTick) / 1E3) % 60;
}
function MW_SetStatusText()
{
var _seconds, _minutes, _script, _timeString, _textString, _color;
if(!_MWBG_ShowStatusText)
return;
_script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
_seconds = MW_GetScriptRuntimeSeconds();
_minutes = MW_GetScriptRuntimeMinutes();
_timeString = "";
if(_script && _script.running)
{
_textString = "˙c2Running ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0];
if(_minutes == 0 && _seconds <= 5)
{
if(_seconds % 2 == 1)
_color = "˙c8";
else
_color = "˙c4";
if(isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]) || MWConfig_Script[_MWBG_CurScriptIndex][1] <= 0)
_timeString = _color + " [+Inf]";
else
{
_timeString = _color + " [";
if(MWConfig_Script[_MWBG_CurScriptIndex][1] < 10)
_timeString += "0";
_timeString += MWConfig_Script[_MWBG_CurScriptIndex][1] + ":00]";
}
}
else
{
if(MWConfig_Script[_MWBG_CurScriptIndex][1] != 0)
{
if(_minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] || _minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] - 1 && _seconds >= 50)
_timeString = "˙c1";
else if(_minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] - 1)
_timeString = "˙c8";
}
_timeString += " [" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_CurScriptStartTick) + "]"
if(_MWBG_ShowCurrentPing)
_timeString = " (" + me.ping + ")" + _timeString;
}
}
else
{
_textString = "˙c1Stopped ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0];
if(_MWBG_ShowCurrentPing)
_timeString = " (" + me.ping + ")";
}
MWC_SetStatusText(_textString, _timeString);
}
function MW_GetInterpolationColor(percentage)
{
var _colors, _colorIndex, _deltaColor, _colorPercentage, _component, _colorHexString;
if(arguments.length < 1 || percentage < 0.0 || percentage > 1.0)
return "˙FFFFFF";
// Define RGB colors - Note: red values between 191 and 208 are invalid as they would lead to a 'C' at the very beginning of the HEX string which would cause the HEX color to be misinterpreted as a D2 color code (˙c)
_colors = new Array(3);
_colors[0] = [0, 255, 50];
_colors[1] = [0, 120, 255];
_colors[2] = [190, 0, 0];
_colorHexString = "";
// Transform the given percentage in order to match the color scale
if(percentage < 0.5)
{
_colorIndex = 0;
_colorPercentage = percentage / 0.4999;
}
else
{
_colorIndex = 1;
_colorPercentage = (percentage - 0.5) / 0.5;
}
// Calculate the actual difference of each red, green and blue
_deltaColor = new Array(3);
_deltaColor[0] = _colors[_colorIndex + 1][0] - _colors[_colorIndex][0];
_deltaColor[1] = _colors[_colorIndex + 1][1] - _colors[_colorIndex][1];
_deltaColor[2] = _colors[_colorIndex + 1][2] - _colors[_colorIndex][2];
for(var i = 0; i < _colors.length; i++)
{
// Calculate the color component
_component = parseInt(_colors[_colorIndex][i] + _colorPercentage * _deltaColor[i]);
if(_component >= 0 && _component < 256 && !(_component > 191 && _component < 208 && i == 0))
_colorHexString += ((_component.toString(16).length == 1) ? "0" : "") + _component.toString(16);
else
return "˙FFFFFF";
}
return "˙" + _colorHexString;
}
function MW_UpdateCommonLog(charlog)
{
var _filepath, _fhandle, _newfile, _buffer, _lines, _itemData, _data, _date, _addedString;
if(_MWBG_Statistics.CommonLog.length < 1)
return true;
if(arguments.length < 1)
charlog = false;
_lines = new Array();
if(charlog)
_filepath = "Logs/" + me.charname + "/MyCommonLog.txt";
else
_filepath = "Logs/CommonLog.txt";
_fhandle = FileOpen(_filepath, 2);
if(_fhandle)
{
while(!_fhandle.eof)
{
_buffer = _fhandle.ReadLine();
if(_buffer != "" && _buffer.indexOf("//") == -1 || _buffer.indexOf("File") > -1)
_lines.push(_buffer);
}
_fhandle.Close();
}
else if(!charlog)
return false;
if(_lines.length < 1 || _lines[0].indexOf("INVALID_DATE") > -1)
_newfile = true;
else
_newfile = false;
_itemData = new Array([610], [611], [612], [613], [614], [615], [616], [617], [618], [619], [620], [621], [622], [623], [624], [625], [626], [627], [628], [629], [630], [631], [632], [633], [634], [635], [636], [637], [638], [639], [640], [641], [642], // Runes
[557], [558], [559], [560], [561], [562], [563], [564], [565], [566], [567], [568], [569], [570], [571], [572], [573], [574], [575], [576], [577], [578], [579], [580], [581], [582], [583], [584], [585], [586], [597], [598], [599], [600], [601], // Gems
[647], [648], [649], // Keys
[650], [651], [652], // Organs
[654], [655], [656], [657]); // Essences
for(var i = 0; i < _itemData.length; i++)
_itemData[i].push(_NTIPIDToName[_itemData[i][0]], 0); // Add the item's name and an integer to save the quantity of this item type
for(var i = 1; i < _lines.length; i++)
{
_data = _lines[i].split(": ");
for(var j = 0; j < _itemData.length; j++)
{
if(_data[0] == _itemData[j][1])
{
if(_data.length == 2)
_itemData[j][2] = parseInt(_data[1].replace(",", ""));
break;
}
}
}
for(var i = 0; i < _MWBG_Statistics.CommonLog.length; i++)
{
for(var j = 0; j < _itemData.length; j++)
{
if(_MWBG_Statistics.CommonLog[i] == _itemData[j][0])
{
_itemData[j][2]++;
break;
}
}
}
_fhandle = FileOpen(_filepath, 1);
if(_fhandle)
{
_date = new Date();
_addedString = "";
for(var i = 0; i < _MWBG_Statistics.CommonLog.length; i++)
{
_addedString += _NTIPIDToName[_MWBG_Statistics.CommonLog[i]];
if(i + 1 < _MWBG_Statistics.CommonLog.length)
_addedString += ", ";
}
if(_date)
{
if(_newfile)
_fhandle.WriteLine("// File Created: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " <> Last Update: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " by " + me.charname + " (" + _addedString + ")");
else
_fhandle.WriteLine(_lines[0].split(" <>")[0] + " <> Last Update: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " (" + me.charname + ": " + _addedString + ")");
}
else
{
if(_newfile)
_fhandle.WriteLine("// File Created: INVALID_DATE <> Last Update: INVALID_DATE" + " (" + me.charname + ": " + _addedString + ")");
else
_fhandle.WriteLine(_lines[0].split(" <>")[0] + " <> Last Update: INVALID_DATE" + " (" + me.charname + ": " + _addedString + ")");
}
_fhandle.WriteLine("// ###### Runes ######");
for(var i = 0; i < _itemData.length; i++)
{
_fhandle.WriteLine(_itemData[i][1] + ": " + MWC_InsertDigitSeperator(_itemData[i][2]));
if(_itemData[i][0] == 642)
_fhandle.WriteLine("\n// ###### Gems ######");
else if(_itemData[i][0] == 601)
_fhandle.WriteLine("\n// ###### Keys ######");
else if(_itemData[i][0] == 649)
_fhandle.WriteLine("\n// ###### Organs ######");
else if(_itemData[i][0] == 652)
_fhandle.WriteLine("\n// ###### Essences ######");
else if(_itemData[i][0] == 561 || _itemData[i][0] == 566 || _itemData[i][0] == 571 || _itemData[i][0] == 576 || _itemData[i][0] == 581 || _itemData[i][0] == 586)
_fhandle.WriteLine("");
}
_fhandle.Close();
}
else if(!charlog)
return false;
if(!charlog)
return MW_UpdateCommonLog(true);
_MWBG_Statistics.CommonLog = new Array();
return true;
}
function MW_CheckMinGametime()
{
var _deltaTime;
do
{
if(_deltaTime)
{
if(!NTC_InTown())
NTTM_CheckAct();
MWC_SetStatusText("˙c8Awaiting minimum gametime... [" + MWC_ConvertTicksToTimeString(_deltaTime) + "]");
NTC_Delay(500);
}
_deltaTime = me.mingametime * 1E3 - GetTickCount() + _MWBG_Statistics.Init.Ticks;
} while(_deltaTime > 0 && !_MWBG_UserExit);
}
Der von Mirkoregge beschriebene "Abgang" deckt sich mit dem meines Fehlers. Vlt. hilft das dort weiter.
Achja solltest du die neue Routine nicht allgemein einbinden? Das Prob. haben ja alle User, die in Classic nur CS runs machen.
LG
|
|
|
07/18/2011, 14:28
|
#2544
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Ich weiss aber gerade nicht genau, inwieweit ich das bei mir von der aktuellen Version abgeändert habe, insofern ändere ich es besser direkt. Abgesehen davon, ist es eine Arbeit von unter 5 Minuten.
So, versuch es mal so:
Code:
/**
* This file was modified by
* Check the programming section for updates and further scripts
* Last Update: 14:27 18.07.2011
*/
// Global constants
const _MWBG_CHAT_COMMAND_TRIGGER = '.';
const _MWBG_SEC_AFTER_DIA_KILL = 100;
// Global variables
var _MWBG_ExperienceThresholds = new Array(
500, 1500, 3750, 7875, 14175, 22680, 32886, 44396, // Level 2 - 9
57715, 72144, 90180, 112725, 140906, 176132, 220165, 275207, 344008, 430010, // Level 10 - 19
537513, 671891, 839864, 1049830, 1312287, 1640359, 2050449, 2563061, 3203826, 3902260, // Level 20 - 29
4663553, 5493363, 6397855, 7383752, 8458379, 9629723, 10906488, 12298162, 13815086, 15468534, // Level 30 - 39
17270791, 19235252, 21376515, 23710491, 26254525, 29027522, 32050088, 35344686, 38935798, 42850109, // Level 40 - 49
47116709, 51767302, 56836449, 62361819, 68384473, 74949165, 82104680, 89904191, 98405658, 107672256, // Level 50 - 59
117772849, 128782495, 140783010, 153863570, 168121381, 183662396, 200602101, 219066380, 239192444, 261129853, // Level 60 - 69
285041630, 311105466, 339515048, 370481492, 404234916, 441026148, 481128591, 524840254, 572485967, 624419793, // Level 70 - 79
681027665, 742730244, 809986056, 883294891, 963201521, 1050299747, 1145236814, 1248718217, 1361512946, 1484459201, // Level 80 - 89
1618470619, 1764543065, 1923762030, 2097310703, 2286478756, 2492671933, 2717422497, 2962400612, 3229426756, 3520485254);// Level 90 - 99
var _MWBG_CurScriptIndex = 0;
var _MWBG_CurScriptEndTick = GetTickCount();
var _MWBG_CurScriptStartTick = GetTickCount();
var _MWBG_DiaKillTicks = 0;
var _MWBG_LastScript = false;
var _MWBG_UserExit = false;
var _MWBG_Statistics;
var _MWBG_WorldEventData;
var _MWBG_ShowStatusText = true;
var _MWBG_ShowCurrentPing = false;
var _MWBG_PositionsPrinted = new Array();
function MW_GameStatistics()
{
this.Potions = new Array();
this.Potions.Hp = 0;
this.Potions.Mp = 0;
this.Potions.Rv = 0;
this.Init = new Array();
this.Init.Ticks = GetTickCount();
this.Init.Exp = me.GetStat(13);
this.Init.CharLevel = me.GetStat(12);
this.Init.Gold = me.GetStat(14) + me.GetStat(15);
this.CommonLog = new Array();
this.CorpsesLooted = 0;
this.ChestsOpened = 0;
this.ShrinesUsed = 0;
this.ItemsPicked = 0;
this.ScriptGold = 0;
this.Errors = 0;
}
function MW_WorldEventData()
{
this.SojSoldString = GetLocaleString(11004).replace("%d ", "");
this.DiabloWalkString = GetLocaleString(11005);
this.Count = new Array();
this.Count.Message = 0;
this.Count.Recent = 0;
this.Count.Last = 0;
this.Count.Init = 0;
this.Loop = new Array();
this.Loop.Runtime = 0;
this.Loop.Mode = 0;
this.Loop.Running = false;
this.InitTicks = 0;
}
function NTMain()
{
SetStatusText("˙c8Initializing...");
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
var _script, _loops;
_MWBG_Statistics = new MW_GameStatistics();
_MWBG_WorldEventData = new MW_WorldEventData();
NTC_Delay(NTConfig_StartDelay);
if(!_MWBG_Statistics || !_MWBG_WorldEventData)
ExitGame();
if(MWConfig_UseXMLItemlog)
{
if(MWI_WriteTempLogToXML())
MWI_ClearTempLog();
}
MWI_ClearLoc();
SetUIState(0x0A, true);
NTT_GetCorpses();
if(MWConfig_ExitGameOnMissingPassword && !me.gamepassword)
{
SetStatusText("˙c1Exiting game...");
ExitGame();
}
if(MWConfig_Script.length > 0)
{
NTCU_InitCubing();
Load("NTBot/tools/NTToolsThread.ntj");
RegisterEvent(EVENT_GAMEMSG, NT_GameMsgEvents);
RegisterEvent(EVENT_KEYDOWN, NT_KeyEvents);
RegisterEvent(EVENT_SCRIPTMSG, NT_ScriptMsgEvents);
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
_loops = 0;
while(!_MWBG_LastScript && me.ingame)
{
MW_SetStatusText();
if(GetTickCount() >= _MWBG_CurScriptEndTick && MWConfig_Script[_MWBG_CurScriptIndex][1] != 0 && !isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]) && !NTC_InTown() && !_MWBG_WorldEventData.Loop.Running)
{
_script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
if(_script && _script.running)
{
Print("˙c;" + MWConfig_Script[_MWBG_CurScriptIndex][0] + "˙c8 is skipped due to exceeding the maximum runtime of ˙c;" + MWConfig_Script[_MWBG_CurScriptIndex][1] + "˙c8 minutes!");
NT_ScriptMsgEvents("SCRIPT_END");
}
}
NTC_Delay(500);
if(!_MWBG_LastScript && _MWBG_Statistics.Errors > MWConfig_GameErrorLimit || _MWBG_DiaKillTicks > 0 && _MWBG_DiaKillTicks + _MWBG_SEC_AFTER_DIA_KILL * 1000 < GetTickCount())
{
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
_MWBG_LastScript = true;
}
if(_loops++ % 40 == 0)
MW_UpdateCommonLog();
}
}
UnregisterEvent(EVENT_GAMEMSG);
UnregisterEvent(EVENT_KEYDOWN);
UnregisterEvent(EVENT_SCRIPTMSG);
MW_UpdateCommonLog();
MW_CheckMinGametime();
SetStatusText("˙c1Exiting game...");
if(me.ingame)
MW_PrintOutputString(_MWBG_UserExit);
me.revealautomap = false;
me.showmissileonautomap = false;
me.showenemyonautomap = false;
if(!NTC_InTown() && !_MWBG_UserExit)
NTSI_PickItems(true);
ExitGame();
}
function NT_GameMsgEvents(msg, type)
{
var _message, _messenger, _output, _date;
var i;
if(type == 0)
{
_message = msg.split("˙c0: ")[1]; // Extract the message
if(_message.substr(0, _MWBG_CHAT_COMMAND_TRIGGER.length) != _MWBG_CHAT_COMMAND_TRIGGER)
return;
_message = _message.substr(_MWBG_CHAT_COMMAND_TRIGGER.length, _message.length); // Remove the trigger
_messenger = msg.split("˙c0: ")[0].replace("˙c4", ""); // Extract the name of the char that wrote the message
if(_messenger == me.charname && _message.toLowerCase().indexOf("run") == 0)
{
for(i = 0; i < MWConfig_Script.length; i++)
{
if(MWConfig_Script[i][0].toLowerCase().indexOf(_message.toLowerCase().split(" ")[1]) > -1)
break;
}
if(i < MWConfig_Script.length)
{
Print("˙c8Switching to ˙c;" + MWConfig_Script[i][0] + "˙c8...");
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(250);
_MWBG_CurScriptIndex = i - 1;
NT_ScriptMsgEvents("SCRIPT_END");
}
else
Print("˙c1There is no script activated matching the term '" + _message + "'!");
return;
}
NTC_SendMsgToScript("MWRush.ntj", _messenger + " " + _message.toUpperCase());
}
if(type == 4)
{
if(MWConfig_CheckSojSales && msg.indexOf(_MWBG_WorldEventData.SojSoldString) > -1)
{
me.maxgametime = 0;
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(200);
_MWBG_WorldEventData.Count.Last = _MWBG_WorldEventData.Count.Recent;
_MWBG_WorldEventData.Count.Recent = parseInt(msg.split(" ")[0]);
_MWBG_WorldEventData.Count.Message++;
if(_MWBG_WorldEventData.Count.Init == 0)
{
_MWBG_WorldEventData.Count.Init = _MWBG_WorldEventData.Count.Recent;
_MWBG_WorldEventData.InitTicks = GetTickCount();
}
if(!_MWBG_WorldEventData.Loop.Running)
{
_MWBG_WorldEventData.Loop.Runtime = _MWBG_WorldEventData.Count.Message*10*60E3;
_MWBG_WorldEventData.Loop.Mode = 1;
}
else if(_MWBG_WorldEventData.Loop.Mode == 1)
_MWBG_WorldEventData.Loop.Runtime = _MWBG_WorldEventData.Count.Message*5*60E3;
_output = "˙c4" + msg;
_output += ";˙c0Game:˙c8 " + me.gamename + "//" + me.gamepassword;
_output += "\n˙c0Server IP:˙c8 " + me.gameserverip.split(".")[3];
_output += "\n˙c0Message Count:˙c8 " + _MWBG_WorldEventData.Count.Message;
_output += "\n˙c0Sojs Total:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + " [+" + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Last) + "]";
_date = new Date(_MWBG_WorldEventData.InitTicks);
if(_date)
{
_output += "\n˙c0First Message:˙c8 " + _date.toLocaleFormat("%H:%M:%S");
_output += " [-" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks) + "]";
}
_output += "\n˙c0Waiting˙c8 " + (_MWBG_WorldEventData.Loop.Runtime / 60E3) + " ˙c0minutes";
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
if(!_MWBG_WorldEventData.Loop.Running)
{
MW_AntiIdle();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
}
else if(NTConfig_CheckCloneDiablo && msg.indexOf(_MWBG_WorldEventData.DiabloWalkString) > -1)
{
me.maxgametime = 0;
_output = "˙c4" + msg;
_output += ";˙c0Game:˙c8 " + me.gamename + "//" + me.gamepassword;
_output += "\n˙c0Server IP:˙c8 " + me.gameserverip.split(".")[3];
_output += "\n˙c0Message Count:˙c8 " + _MWBG_WorldEventData.Count.Message;
_output += "\n˙c0Sojs Total:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + " [+" + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Last) + "]";
_date = new Date(_MWBG_WorldEventData.InitTicks);
if(_date)
{
_output += "\n˙c0First Message:˙c8 " + _date.toLocaleFormat("%H:%M:%S");
_output += " [-" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks) + "]";
}
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(200);
_MWBG_WorldEventData.Loop.Runtime = 0;
_MWBG_WorldEventData.Loop.Mode = 0;
if(!_MWBG_WorldEventData.Loop.Running)
MW_AntiIdle();
}
}
}
function NT_KeyEvents(keycode)
{
//Print("Keycode: " + keycode);
var _script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
switch(keycode)
{
case 19: // Pause (PAUSE)
if(_script)
{
if(_script.running)
{
_MWBG_ShowStatusText = false;
_script.Stop();
me.maxgametime = 0;
NTC_Delay(250);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
SetStatusText("˙c1Stopped ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
NTC_Delay(500);
}
else
{
if(_MWBG_WorldEventData.Loop.Running)
{
_MWBG_WorldEventData.Loop.Running = false;
NTC_Delay(500);
}
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
NT_ScriptMsgEvents("SET_DEFAULT_STATUS");
}
break;
case 33: // Skip (PGUP)
_MWBG_ShowStatusText = false;
SetStatusText("˙c1Skipping current script...");
_MWBG_WorldEventData.Loop.Running = false
if(!_script)
break;
if(_script.running)
_script.Stop();
NTC_PingDelay(250);
NT_ScriptMsgEvents("SCRIPT_END");
break;
case 34: // Repeat (PGDN)
_MWBG_ShowStatusText = false;
SetStatusText("˙c1Repeating previous script...");
_MWBG_WorldEventData.Loop.Running = false
if(!_script)
break;
if(_script.running)
_script.Stop();
NTC_PingDelay(250);
NT_ScriptMsgEvents("SCRIPT_REPEAT");
break;
case 35: // Clear current XML logfile (END)
_MWBG_ShowCurrentPing = !_MWBG_ShowCurrentPing;
break;
case 36: // Show coordinates (POS1/HOME)
MW_PrintPosition();
break;
case 46: // Exit (DEL)
if(_MWBG_LastScript)
return;
SetStatusText("˙c1Exiting game...");
_MWBG_WorldEventData.Loop.Running = false
_MWBG_ShowStatusText = false;
_MWBG_UserExit = true;
_MWBG_LastScript = true;
if(NTConfig_PublicMode)
Say("Next game!");
break;
case 45: // Log stashed items (INS)
_MWBG_ShowStatusText = false;
SetStatusText("˙c8Logging current stash to " + ((MWConfig_LogStashToTxt) ? "TXT" : "XML") + "...");
if(MWI_LogStashedItems())
SetStatusText("˙c8Done!");
else
SetStatusText("˙c1Logging failed!");
NT_ScriptMsgEvents("SET_DEFAULT_STATUS");
break;
default:
MWUC_HandleUserCommand(keycode, _MWBG_Statistics, _MWBG_CurScriptIndex);
break;
}
}
function MW_PrintPosition()
{
var _color;
_MWBG_PositionsPrinted.push([me.x, me.y, me.areaid]);
if(_MWBG_PositionsPrinted.length > 2)
_MWBG_PositionsPrinted.splice(0, 1);
_color = MWC_GetRandomColor();
Print(_color + "Current Position: ˙c0(˙c2" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][0] + "˙c0|˙c1" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][1] + "˙c0) [˙c7" + _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][2] + "˙c0]");
if(_MWBG_PositionsPrinted.length > 1)
Print(_color + "Last Position: ˙c0(˙c2" + _MWBG_PositionsPrinted[0][0] + "˙c0|˙c1" + _MWBG_PositionsPrinted[0][1] + "˙c0) [˙c7" + _MWBG_PositionsPrinted[0][2] + "˙c0] (˙c7Distance: " + GetDistance(_MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][0], _MWBG_PositionsPrinted[_MWBG_PositionsPrinted.length - 1][1], _MWBG_PositionsPrinted[0][0], _MWBG_PositionsPrinted[0][1]).toFixed(2) + "˙c0)");
}
function NT_ScriptMsgEvents(msg)
{
var _area, _msg, _fhandle, _buffer, _script;
if(!msg)
return;
if(msg.split("_")[0] == "SET" && msg.indexOf("SET_DEFAULT_STATUS") == -1)
{
MW_EvaluateInputData(msg);
return;
}
switch(msg)
{
case "SCRIPT_END":
_MWBG_ShowStatusText = false;
NTC_StopScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
if(++_MWBG_CurScriptIndex < MWConfig_Script.length)
{
if(MWConfig_ShowGoldPickupsPerScript)
{
if(_MWBG_Statistics.ScriptGold > 0)
Print("˙c8Picked up ˙c;" + MWC_InsertDigitSeperator(_MWBG_Statistics.ScriptGold) + "˙c8 gold running ˙c;" + MWConfig_Script[_MWBG_CurScriptIndex - 1][0]);
_MWBG_Statistics.ScriptGold = 0;
}
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
_MWBG_ShowStatusText = true;
}
else
_MWBG_LastScript = true;
break;
case "SCRIPT_REPEAT":
_MWBG_ShowStatusText = false;
if(_MWBG_CurScriptIndex - 1 >= 0)
{
_MWBG_CurScriptIndex--;
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
else
{
SetStatusText("˙c1Cannot repeat - Invalid Index!");
NTC_PingDelay(250);
MW_ResetTicks();
Load("NTBot/bots/" + MWConfig_Script[_MWBG_CurScriptIndex][0]);
}
_MWBG_ShowStatusText = true;
break;
case "SET_DEFAULT_STATUS":
NTC_Delay(2500);
_MWBG_ShowStatusText = true;
break;
case "STOP_STATUS_TEXT_UPDATE":
_MWBG_ShowStatusText = false;
break;
case "RESET_TICKS":
MW_ResetTicks();
break;
case "EXIT_GAME":
SetStatusText("˙c1Exiting game...");
_MWBG_WorldEventData.Loop.Running = false
_MWBG_ShowStatusText = false;
_MWBG_UserExit = true;
_MWBG_LastScript = true;
break;
case "DIA_KILL":
if(me.gametype == 0)
{
_MWBG_DiaKillTicks = GetTickCount();
Print("˙c<Exiting game in ˙c1" + _MWBG_SEC_AFTER_DIA_KILL + "˙c< seconds...");
}
break;
default:
_msg = new Array();
_msg.push(msg);
_msg.push("");
_fhandle = FileOpen("Logs/Temporary Data/"+ me.charname + ".errdata", 2);
if(_fhandle)
{
while(!_fhandle.eof)
{
_buffer = _fhandle.ReadLine();
if(_buffer != "" && _buffer.indexOf("//") == -1)
{
if(_msg[1] != "")
_msg[1] += "\n";
_msg[1] += _buffer;
}
}
_fhandle.Close();
_fhandle = FileOpen("Logs/Temporary Data/"+ me.charname + ".errdata", 1);
if(_fhandle)
{
_fhandle.WriteLine("// This file holds aditional error information");
_fhandle.Close();
}
}
if(_msg[1] == "")
_msg[1] = "˙BE0000No additional error description available!";
else
_msg[1] = _msg[1].replace("%script", MWConfig_Script[_MWBG_CurScriptIndex][0]);
Print("˙c1" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " failed: " + _msg[0]);
_area = MWC_FindArea();
if(_area)
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙BE0000" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " : " + _msg[0] + " failed (" + _area.name + ");" + _msg[1]);
else
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙BE0000" + MWConfig_Script[_MWBG_CurScriptIndex][0] + " : " + _msg[0] + " failed (unknown area);" + _msg[1]);
_MWBG_Statistics.Errors++;
NT_ScriptMsgEvents("SCRIPT_END");
break;
}
}
function MW_ResetTicks()
{
_MWBG_CurScriptStartTick = GetTickCount();
if(MWConfig_Script[_MWBG_CurScriptIndex].length == 2 && !isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]))
_MWBG_CurScriptEndTick = _MWBG_CurScriptStartTick + 6E4 * MWConfig_Script[_MWBG_CurScriptIndex][1];
}
function MW_AntiIdle()
{
var _endtime, _starttick, _loops, _timeString, _time;
_loops = 0;
_MWBG_WorldEventData.Loop.Running = true;
_MWBG_ShowStatusText = false;
_starttick = GetTickCount();
if(_MWBG_WorldEventData.Loop.Mode == 0)
_MWBG_WorldEventData.Loop.Runtime = MWConfig_WorldEventWaitTime;
if(GetUIState(0x01) || GetUIState(0x0C))
me.Cancel(1);
while((_MWBG_WorldEventData.Loop.Runtime == 0 || _MWBG_WorldEventData.Loop.Runtime + _starttick > GetTickCount()) && _MWBG_WorldEventData.Loop.Running && me.ingame)
{
if(_loops % 2 == 0)
{
if(MWConfig_WorldEventAccount)
{
if(_MWBG_WorldEventData.Loop.Mode == 0)
Say("/w *" + MWConfig_WorldEventAccount + " World Event in " + me.gamename + "//" + me.gamepassword + "!");
else
Say("/w *" + MWConfig_WorldEventAccount + " Soj Count in " + me.gamename + "//" + me.gamepassword + " (" + _MWBG_SojCount + ((_MWBG_SojCount - _MWBG_InitialSojCount) ? " [+" + (_MWBG_SojCount - _MWBG_InitialSojCount)+ "]" : "") + " sold)!");
}
}
SetStatusText("˙c8Switching to Act " + (1 +_loops % 5) + "...");
NTTM_CheckAct(1 + _loops % 5);
SetStatusText("˙c8Moving to Portal Spot...");
NTTM_TownMove("portalspot");
_endtime = GetTickCount() + 300E3; // Wait 300 seconds in each act
while(_endtime > GetTickCount() && (_MWBG_WorldEventData.Loop.Runtime == 0 || _MWBG_WorldEventData.Loop.Runtime + _starttick > GetTickCount()) && _MWBG_WorldEventData.Loop.Running && me.ingame)
{
if(_MWBG_WorldEventData.Loop.Mode == 0)
{
_timeString = "˙c8Diablo Walks the Earth! [";
_time = GetTickCount() - _starttick;
}
else
{
_timeString = "˙c8Awaiting Soj Sale... [";
_time = _MWBG_WorldEventData.Loop.Runtime + _starttick - GetTickCount();
}
_timeString += MWC_ConvertTicksToTimeString(_time) + "]";
SetStatusText(_timeString);
NTC_Delay(250);
}
_loops++;
}
_MWBG_WorldEventData.Loop.Running = false;
if(_MWBG_WorldEventData.Loop.Mode != 0)
NTC_SendLogToOOG(NTC_LOG_COMMON, "˙c4Proceeding...;˙c0Total Sojs sold:˙c8 " + (_MWBG_WorldEventData.Count.Recent - _MWBG_WorldEventData.Count.Init) + "\n˙c0Waited˙c8 " + (parseInt((GetTickCount() - _starttick) / 6E4) % 60) + ":" + (parseInt((GetTickCount() - _starttick) / 1E3) % 60) + "");
MW_ResetTicks();
_MWBG_ShowStatusText = true;
}
function MW_EvaluateInputData(msg)
{
switch(msg.split("_")[1])
{
case "SHRINEACTIVATED":
_MWBG_Statistics.ShrinesUsed++;
break;
case "CHESTOPENEND":
_MWBG_Statistics.ChestsOpened++;
break;
case "LOOTED":
_MWBG_Statistics.CorpsesLooted++;
break;
case "PICKED":
_MWBG_Statistics.ItemsPicked++;
break;
case "SCRIPTGOLD":
_MWBG_Statistics.ScriptGold += parseInt(msg.split("_")[2]);
break;
case "HPDRANK":
_MWBG_Statistics.Potions.Hp++;
break;
case "MPDRANK":
_MWBG_Statistics.Potions.Mp++;
break;
case "RVDRANK":
_MWBG_Statistics.Potions.Rv++;
break;
case "COMMONITEM":
_MWBG_Statistics.CommonLog.push(parseInt(msg.split("_")[2]));
break;
}
}
function MW_PrintOutputString(byUser)
{
var _output, _room, _gold, _expString, _tempString, _dateDiff;
if(arguments.length < 1)
byUser = false;
_room = MWI_GetStashRoom();
if(byUser)
{
_output = MW_GetInterpolationColor(_room[0] / _room[1]) + "Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " (" + me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished by User!;";
}
else
{
if(_MWBG_Statistics.Errors > 1)
_output = "˙F66F21Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " ("+ me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished!;";
else
_output = MW_GetInterpolationColor(_room[0] / _room[1]) + "Game" + ((me.gamename.slice(me.gamename.lastIndexOf('-') + 1)) ? " ("+ me.gamename.slice(me.gamename.lastIndexOf('-') + 1) + ") " : " ") + "was finished successfully!;";
}
// Level up info
if(_MWBG_Statistics.Init.CharLevel != me.GetStat(12))
_output += "˙00FF40!!! Level up (" + me.GetStat(12) + ") !!!\n";
// Gametime info
_output += "˙c0Duration:˙c8 " + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_Statistics.Init.Ticks);
// Add the relation between maximum and actual gametime
if(me.maxgametime > 0)
_output += " [" + ((GetTickCount() - _MWBG_Statistics.Init.Ticks) / 10 / me.maxgametime).toFixed(1) + "%]";
// Exp info
if(_MWBG_Statistics.Init.CharLevel == me.GetStat(12) && me.GetStat(13) - _MWBG_Statistics.Init.Exp > 0)
{
_output += "\n˙c0Experience:˙c8 " + MWC_InsertDigitSeperator(me.GetStat(13) - _MWBG_Statistics.Init.Exp);
if(MW_GetRequiredExp(me.GetStat(12) + 1) - MW_GetRequiredExp(me.GetStat(12)) > 0)
_output += " [" + ((me.GetStat(13) - _MWBG_Statistics.Init.Exp) / (MW_GetRequiredExp(me.GetStat(12) + 1) - MW_GetRequiredExp(me.GetStat(12))) * 100).toFixed(4) + "%]";
}
// Potion Info
if(_MWBG_Statistics.Potions.Hp > 0 || _MWBG_Statistics.Potions.Mp > 0 || _MWBG_Statistics.Potions.Rv > 0)
_output += "\n˙c0Potions:˙BE0000 (" + _MWBG_Statistics.Potions.Hp + ")˙c3 (" + _MWBG_Statistics.Potions.Mp + ")˙9F008C (" + _MWBG_Statistics.Potions.Rv + ")";
// Gold pickup
_gold = NTC_MyGold() - _MWBG_Statistics.Init.Gold;
if(_gold != 0)
_output += "\n˙c0Gold:˙c8 " + MWC_InsertDigitSeperator(_gold);
// Picked items
if(_MWBG_Statistics.ItemsPicked > 0)
_output += "\n˙c0Items:˙c8 " + _MWBG_Statistics.ItemsPicked;
// Looted corpses
if(_MWBG_Statistics.CorpsesLooted > 0)
_output += "\n˙c0Looted:˙c8 " + _MWBG_Statistics.CorpsesLooted;
// Chest info
if(_MWBG_Statistics.ChestsOpened > 0)
_output += "\n˙c0Chests:˙c8 " + _MWBG_Statistics.ChestsOpened;
// Shrine info
if(_MWBG_Statistics.ShrinesUsed > 0)
_output += "\n˙c0Shrines:˙c8 " + _MWBG_Statistics.ShrinesUsed;
// Stash info
_output += "\n˙c0Stash: " + MW_GetInterpolationColor(_room[0] / _room[1]) + _room[0] + "/" + _room[1];
// Inventory info
_room = MWI_GetStashRoom(false, true);
_output += "\n˙c0Inventory: " + MW_GetInterpolationColor(_room[0] / _room[1]) + _room[0] + "/" + _room[1];
// _output += "\n˙c0Color Check: " + MW_GetInterpolationColor(0.0) + "0% " + MW_GetInterpolationColor(0.25) + "25% " + MW_GetInterpolationColor(0.5) + "50% " + MW_GetInterpolationColor(0.75) + "75% " + MW_GetInterpolationColor(1.0) + "100% ";
// Error info
if(_MWBG_Statistics.Errors > 0)
_output += "\n˙BE0000Errors: " + _MWBG_Statistics.Errors;
NTC_SendLogToOOG(NTC_LOG_COMMON, _output);
}
function MW_GetRequiredExp(level)
{
// Returns the experience which is required for the level specified
if(!level || level < 2 || level > 99)
return -1;
return _MWBG_ExperienceThresholds[level - 2];
}
function MW_GetScriptRuntimeMinutes(addZeros)
{
return parseInt((GetTickCount() - _MWBG_CurScriptStartTick) / 6E4) % 60;
}
function MW_GetScriptRuntimeSeconds(addZeros)
{
return parseInt((GetTickCount() - _MWBG_CurScriptStartTick) / 1E3) % 60;
}
function MW_SetStatusText()
{
var _seconds, _minutes, _script, _timeString, _textString, _color;
if(!_MWBG_ShowStatusText)
return;
_script = NTC_FindScript(MWConfig_Script[_MWBG_CurScriptIndex][0]);
_seconds = MW_GetScriptRuntimeSeconds();
_minutes = MW_GetScriptRuntimeMinutes();
_timeString = "";
if(_script && _script.running)
{
_textString = "˙c2Running ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0];
if(_minutes == 0 && _seconds <= 5)
{
if(_seconds % 2 == 1)
_color = "˙c8";
else
_color = "˙c4";
if(isNaN(MWConfig_Script[_MWBG_CurScriptIndex][1]) || MWConfig_Script[_MWBG_CurScriptIndex][1] <= 0)
_timeString = _color + " [+Inf]";
else
{
_timeString = _color + " [";
if(MWConfig_Script[_MWBG_CurScriptIndex][1] < 10)
_timeString += "0";
_timeString += MWConfig_Script[_MWBG_CurScriptIndex][1] + ":00]";
}
}
else
{
if(MWConfig_Script[_MWBG_CurScriptIndex][1] != 0)
{
if(_minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] || _minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] - 1 && _seconds >= 50)
_timeString = "˙c1";
else if(_minutes >= MWConfig_Script[_MWBG_CurScriptIndex][1] - 1)
_timeString = "˙c8";
}
_timeString += " [" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWBG_CurScriptStartTick) + "]"
if(_MWBG_ShowCurrentPing)
_timeString = " (" + me.ping + ")" + _timeString;
}
}
else
{
_textString = "˙c1Stopped ˙c4" + MWConfig_Script[_MWBG_CurScriptIndex][0];
if(_MWBG_ShowCurrentPing)
_timeString = " (" + me.ping + ")";
}
MWC_SetStatusText(_textString, _timeString);
}
function MW_GetInterpolationColor(percentage)
{
var _colors, _colorIndex, _deltaColor, _colorPercentage, _component, _colorHexString;
if(arguments.length < 1 || percentage < 0.0 || percentage > 1.0)
return "˙FFFFFF";
// Define RGB colors - Note: red values between 191 and 208 are invalid as they would lead to a 'C' at the very beginning of the HEX string which would cause the HEX color to be misinterpreted as a D2 color code (˙c)
_colors = new Array(3);
_colors[0] = [0, 255, 50];
_colors[1] = [0, 120, 255];
_colors[2] = [190, 0, 0];
_colorHexString = "";
// Transform the given percentage in order to match the color scale
if(percentage < 0.5)
{
_colorIndex = 0;
_colorPercentage = percentage / 0.4999;
}
else
{
_colorIndex = 1;
_colorPercentage = (percentage - 0.5) / 0.5;
}
// Calculate the actual difference of each red, green and blue
_deltaColor = new Array(3);
_deltaColor[0] = _colors[_colorIndex + 1][0] - _colors[_colorIndex][0];
_deltaColor[1] = _colors[_colorIndex + 1][1] - _colors[_colorIndex][1];
_deltaColor[2] = _colors[_colorIndex + 1][2] - _colors[_colorIndex][2];
for(var i = 0; i < _colors.length; i++)
{
// Calculate the color component
_component = parseInt(_colors[_colorIndex][i] + _colorPercentage * _deltaColor[i]);
if(_component >= 0 && _component < 256 && !(_component > 191 && _component < 208 && i == 0))
_colorHexString += ((_component.toString(16).length == 1) ? "0" : "") + _component.toString(16);
else
return "˙FFFFFF";
}
return "˙" + _colorHexString;
}
function MW_UpdateCommonLog(charlog)
{
var _filepath, _fhandle, _newfile, _buffer, _lines, _itemData, _data, _date, _addedString;
if(_MWBG_Statistics.CommonLog.length < 1)
return true;
if(arguments.length < 1)
charlog = false;
_lines = new Array();
if(charlog)
_filepath = "Logs/" + me.charname + "/MyCommonLog.txt";
else
_filepath = "Logs/CommonLog.txt";
_fhandle = FileOpen(_filepath, 2);
if(_fhandle)
{
while(!_fhandle.eof)
{
_buffer = _fhandle.ReadLine();
if(_buffer != "" && _buffer.indexOf("//") == -1 || _buffer.indexOf("File") > -1)
_lines.push(_buffer);
}
_fhandle.Close();
}
else if(!charlog)
return false;
if(_lines.length < 1 || _lines[0].indexOf("INVALID_DATE") > -1)
_newfile = true;
else
_newfile = false;
_itemData = new Array([610], [611], [612], [613], [614], [615], [616], [617], [618], [619], [620], [621], [622], [623], [624], [625], [626], [627], [628], [629], [630], [631], [632], [633], [634], [635], [636], [637], [638], [639], [640], [641], [642], // Runes
[557], [558], [559], [560], [561], [562], [563], [564], [565], [566], [567], [568], [569], [570], [571], [572], [573], [574], [575], [576], [577], [578], [579], [580], [581], [582], [583], [584], [585], [586], [597], [598], [599], [600], [601], // Gems
[647], [648], [649], // Keys
[650], [651], [652], // Organs
[654], [655], [656], [657]); // Essences
for(var i = 0; i < _itemData.length; i++)
_itemData[i].push(_NTIPIDToName[_itemData[i][0]], 0); // Add the item's name and an integer to save the quantity of this item type
for(var i = 1; i < _lines.length; i++)
{
_data = _lines[i].split(": ");
for(var j = 0; j < _itemData.length; j++)
{
if(_data[0] == _itemData[j][1])
{
if(_data.length == 2)
_itemData[j][2] = parseInt(_data[1].replace(",", ""));
break;
}
}
}
for(var i = 0; i < _MWBG_Statistics.CommonLog.length; i++)
{
for(var j = 0; j < _itemData.length; j++)
{
if(_MWBG_Statistics.CommonLog[i] == _itemData[j][0])
{
_itemData[j][2]++;
break;
}
}
}
_fhandle = FileOpen(_filepath, 1);
if(_fhandle)
{
_date = new Date();
_addedString = "";
for(var i = 0; i < _MWBG_Statistics.CommonLog.length; i++)
{
_addedString += _NTIPIDToName[_MWBG_Statistics.CommonLog[i]];
if(i + 1 < _MWBG_Statistics.CommonLog.length)
_addedString += ", ";
}
if(_date)
{
if(_newfile)
_fhandle.WriteLine("// File Created: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " <> Last Update: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " by " + me.charname + " (" + _addedString + ")");
else
_fhandle.WriteLine(_lines[0].split(" <>")[0] + " <> Last Update: " + _date.toLocaleFormat("%a %m/%d/%y %H:%M:%S") + " (" + me.charname + ": " + _addedString + ")");
}
else
{
if(_newfile)
_fhandle.WriteLine("// File Created: INVALID_DATE <> Last Update: INVALID_DATE" + " (" + me.charname + ": " + _addedString + ")");
else
_fhandle.WriteLine(_lines[0].split(" <>")[0] + " <> Last Update: INVALID_DATE" + " (" + me.charname + ": " + _addedString + ")");
}
_fhandle.WriteLine("// ###### Runes ######");
for(var i = 0; i < _itemData.length; i++)
{
_fhandle.WriteLine(_itemData[i][1] + ": " + MWC_InsertDigitSeperator(_itemData[i][2]));
if(_itemData[i][0] == 642)
_fhandle.WriteLine("\n// ###### Gems ######");
else if(_itemData[i][0] == 601)
_fhandle.WriteLine("\n// ###### Keys ######");
else if(_itemData[i][0] == 649)
_fhandle.WriteLine("\n// ###### Organs ######");
else if(_itemData[i][0] == 652)
_fhandle.WriteLine("\n// ###### Essences ######");
else if(_itemData[i][0] == 561 || _itemData[i][0] == 566 || _itemData[i][0] == 571 || _itemData[i][0] == 576 || _itemData[i][0] == 581 || _itemData[i][0] == 586)
_fhandle.WriteLine("");
}
_fhandle.Close();
}
else if(!charlog)
return false;
if(!charlog)
return MW_UpdateCommonLog(true);
_MWBG_Statistics.CommonLog = new Array();
return true;
}
function MW_CheckMinGametime()
{
var _deltaTime;
do
{
if(_deltaTime)
{
if(!NTC_InTown())
NTTM_CheckAct();
MWC_SetStatusText("˙c8Awaiting minimum gametime... [" + MWC_ConvertTicksToTimeString(_deltaTime) + "]");
NTC_Delay(500);
}
_deltaTime = me.mingametime * 1E3 - GetTickCount() + _MWBG_Statistics.Init.Ticks;
} while(_deltaTime > 0 && !_MWBG_UserExit);
}
Du müsstest in deinem Diablo Script noch folgendes einfügen:
Code:
NTC_SendMsgToScript("MWBotGame.ntj", "DIA_KILLED");
Ausserdem die Konstante für die Wartezeit auf einen sinnvollen Wert setzen.
Bedenke, dass es eine Abtastrate von gut 500ms gibt, du solltest also definitiv ein paar Sekunden Luft einplanen.
Probier es mal aus.
LG
Muddy
|
|
|
07/18/2011, 14:58
|
#2545
|
elite*gold: 0
Join Date: Mar 2010
Posts: 539
Received Thanks: 418
|
Quote:
Originally Posted by Muddy_Waters
Du müsstest in deinem Diablo Script noch folgendes einfügen:
Code:
NTC_SendMsgToScript("MWBotGame.ntj", "DIA_KILLED");
|
Mit den Übergabewerten ein bisschen aufpassen, Muddy!
Code:
NTC_SendMsgToScript("MWBotGame.ntj", "[COLOR="Red"]DIA_KILL[/COLOR]");
PS: Habe gerade Gott zurechtgewiesen, wo bleibt mein Keks?
|
|
|
07/18/2011, 15:12
|
#2546
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Das kommt davon, wenn man schon mit dem Schreiben des Beitrags beginnt, während man noch an dem Script rumwerkelt.
Aber wenn du wüsstest, wie schleppend ich mit meinem Einstiegsprojekt, einem Maphack auf D2BS Basis, voran komme, würdest du die Aussage mit dem Gott nochmal überdenken. 
Gut, das mag zum Teil auch daran liegen, dass ich meine verfügbare Zeit derzeit eher mit dem Daddeln einer D2 Mod im SP verschwende, aber es macht eben einfach irgendwie Spaß.
@fred
Wie du es machst ist eigentlich egal, hauptsache konsistent.
LG
Muddy
|
|
|
07/18/2011, 15:34
|
#2547
|
elite*gold: 139
Join Date: Oct 2006
Posts: 12,058
Received Thanks: 24,256
|
Quote:
Originally Posted by Muddy_Waters
Aber wenn du wüsstest, wie schleppend ich mit meinem Einstiegsprojekt, einem Maphack auf D2BS Basis, voran komme, würdest du die Aussage mit dem Gott nochmal überdenken. 
|
Was haste denn schon wieder vor? :P
Quote:
Originally Posted by Muddy_Waters
Gut, das mag zum Teil auch daran liegen, dass ich meine verfügbare Zeit derzeit eher mit dem Daddeln einer D2 Mod im SP verschwende, aber es macht eben einfach irgendwie Spaß. 
|
Du auch, welchen spielste denn?  Hänge im Moment (mal wieder) an MedianXL. :|
|
|
|
07/18/2011, 15:45
|
#2548
|
elite*gold: 0
Join Date: May 2010
Posts: 212
Received Thanks: 40
|
Quote:
Originally Posted by TheCrazy11
Mit den Übergabewerten ein bisschen aufpassen, Muddy!
Code:
NTC_SendMsgToScript("MWBotGame.ntj", "[COLOR="Red"]DIA_KILL[/COLOR]");
PS: Habe gerade Gott zurechtgewiesen, wo bleibt mein Keks? 
|
Dorthin?
Code:
NTP_DoPrecast(true);
if(me.classid == NTC_CHAR_CLASS_PALADIN && !MWC_CheckForExpShrineUsers())
NTC_PutSkill(109, NTC_HAND_RIGHT);
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("MWBotGame.ntj", "NTTMGR_CheckSafe()");
return;
}
NTC_FindUnit(NTC_UNIT_MONSTER, 243, 100);
if(!NTA_KillMonster(243))
{
NTC_SendMsgToScript("MWBotGame.ntj", "NTA_KillMonster()");
return;
}
NTSI_PickItems();
?? NTC_SendMsgToScript("MWBotGame.ntj", "DIA_KILL"); ??
if(NTConfig_PublicMode)
Say(""); //ff Say("Next game");
|
|
|
07/18/2011, 15:48
|
#2549
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Ja genau. Und bitte entferne auch direkt die nachfolgende if-Anweisung mit dem Say() Aufruf mit dem leeren String als Parameter, das Gebilde sieht einfach fürchterlich aus.
LG
Muddy
|
|
|
07/18/2011, 16:52
|
#2550
|
elite*gold: 0
Join Date: Jul 2011
Posts: 8
Received Thanks: 1
|
Vorschlag: Der Bot sollte kein chicken machen wenn das clone diablo event läuft... Ich hab gestern nen Anni deswegen verkackt  Dia war auf 1% gibt mir ne kelle ich droppe unter chickenlife und der bot leaved instant das game... game closed... ^^ Bitte unbedingt ändern!!! Danke
Auch wenn man im Pause Modus ist sollte kein chicken gemacht werden oder man sollte es zumindest einstellen können ob er es auf Pause machen soll. Aber beim clone diablo event sollte er auf keinenfall chicken machen!
|
|
|
 |
|
Similar Threads
|
[Release] D2NT 3.1 1.13c
07/17/2016 - Diablo 2 - 91 Replies
hi,
hab eben den d2nt3.1 gefunden. ein neues baba script is dabei.
release thread eon
D2NT3.1
|
[Realease] Muddy's Waypoint Catcher
08/21/2013 - Diablo 2 Programming - 46 Replies
Moin zusammen,
hier mal die erste Release Version eines kleinen Scripts genannt Waypoint Catcher. Das ganze ist jetzt nichtmal 24h alt, dementsprechend sind vermutlich noch einige Bugs vorhanden. Hinweise dazu nehme ich gerne entgegen. ;)
Features:
- Suchen sämtlicher Wegpunkte mit Ausnahme, wobei in Akt ein durch Probleme im Jail Bereich nach dem Wegpunkt Outer Cloister abgebrochen wird
- Wahlweise auch mit TP an jedem gefundenen Wp, sodass man damit auch anderen (nicht-Bots) die...
|
[D2NT] Long Dia Release
05/10/2011 - Diablo 2 Programming - 28 Replies
Ein kleines Script für diablo, es startet beim eingang macht ein tp cleart den weg zum star macht am star noch ein tp dann läufts wie das normale nur cleart es schöner :)
hoffe euch gefällts ich habs noch nicht wirklich getestet (2-3 runs) bugs können gerne hier gepostet werden verbesserungs vorschläge auch :D
installation:
1.)Script in den Bot ordner kopieren
2.)Script im editor oder vergleichbaren öffnen
3.) Msg´s anpassen (ist nicht schwer)
4.) in der char config die zeile...
|
D2NT 3.0 Pickit release
10/22/2010 - Diablo 2 - 77 Replies
edit
|
Muddy's D2NT Help
07/29/2010 - Diablo 2 - 3 Replies
hi i just started to use the bot it work's great.
how do i set up the skill's i use on my Sorc and pick up itme's?
.....
if you reply to this post please use english
|
All times are GMT +1. The time now is 07:41.
|
|