file: C:\d2jsp\scripts\bots\YAMB.d2l
...
function YAM() {
// Load the includes, setup the log paths and start the run time chrono
YAM_LoadIncludes();
// Check if we have a body then get it if yes
DT_getCorpses();
if (DT_HaveCorpse) {
DL_Deaths+=1;
}
//added by me aabbcc
print("Moving outta the way");
if (me.act == 5) {
DM_MoveTo(5092, 5025);
}
//no more added by me
// Set the Title
YAM_SetTitle();
// Load Party up!
if (PublicMode) {
file = fileOpen("libs/YAMB/configs/YAM_TeamBotting.d2l", 0);
if (!file) {
try{
newTeamFile = fileOpen("libs/YAMB/configs/YAM_TeamBotting.d2l", 1);
if (!newTeamFile)
throw "Unable to create New YAM_TeamBotting File :: Error in YAM_TeamBotting file creation!";
newTeamFile.writeLine("// Define all your leader char names here. Make sure that they are spelled out");
newTeamFile.writeLine("// exactly and case sensitive. For Leader/Leecher and Team botting purposes");
(YAM_IsLeader == true) ? newTeamFile.writeLine("Leaders.push(\"" + me.name + "\");") : newTeamFile.writeLine("//Leaders.push(\"FirstLeaderName\");");
newTeamFile.writeLine("//Leaders.push(\"SecondLeaderName\");");
newTeamFile.writeLine("");
(YAM_IsLeader == false) ? newTeamFile.writeLine("Helpers.push(\"" + me.name + "\");") : newTeamFile.writeLine("//Helpers.push(\"FirstHelper\");");
newTeamFile.writeLine("//Helpers.push(\"SecondHelper\");");
newTeamFile.close();
print("New YAM_TeamBotting file created!");
print("You MUST edit this first for team botting to work.");
}
catch(fileException){
print("-------------------------------------------------------------");
print(fileException);
stop();
}
}
else
file.close();
DC_LoadInclude("YAMB/configs/YAM_TeamBotting.d2l");
load(YAM_PartyUpPath);
DC_ResetLeader();
}
var YAM_RunTimer = new Date().getTime();
// Register the key events watch
registerEvent(EVENT_KEYUP, YAM_KeyUpManager);
registerEvent(EVENT_SCRIPTMSG, YAM_CheckEvents);
registerEvent(EVENT_GAMEMSG, YAM_gamemsgHandler);
// Load and setup the cubing support if user wants it before loading main snagit
if (YAM_EnableCubing) {
DC_LoadInclude("YAMB/common/YAM-Cubing.d2l");
DCU_CubingEnabled = true;
DCU_countrycode = 1;
DCU_Snagfile = DIM_TempSnagFile;
DC_LoadInclude(YAM_CubeConfig); // Cube config must be loaded after d2jsp-cubing
// Prepare the temp snagit file before we load snagit.ini
DCU_UpdateCubeIniAtStartup();
if(YAM_UseNJIP)
njipOpenFile("settings/" + DCU_Snagfile);
}
// Load the snagit.ini file if not using NJIP, and load the .nip files in the njip array if we are using NJIP
(!YAM_UseNJIP) ? DIM_getINI("settings/" + DSN_SnagItINIFile, true) : DSN_LoadNIPFiles();
// Handle IP stuff before setting max game length
_IP = me.gameserverip.split(".")[3];
// if we wanna show the ip, do it now
if (YAM_DisplayIP) {
var IP_sh = getScreenHook();
IP_sh.x = 700;
IP_sh.y = 595;
IP_sh.font = 1;
IP_sh.color = 2;
IP_sh.text = "*IP: ." + _IP;
}
// If inventory is full, retry to stash and stop before setting max game length if still full
if (YAM_StopFullInv && DT_CountFreeSpaces() == 0) {
DC_Print("Inventory is full, going to try to clear it first !");
YAM_TownManager();
}
if (YAM_StartGameDelay > 0) {
DC_Print("Waiting " + (parseInt(YAM_StartGameDelay / 1000,10)) + " seconds before game initialization...");
delay(YAM_StartGameDelay);
}
// With all that taken care of, set max game length
me.gamelength = YAM_MaxGameLength*1000;
// Load the life watch script
load(YAM_LifeWatchPath);
delay(500);
// Show MF info
if(DC_Verbose)
DT_DisplayMF();
// Check for all the bosses user wants to run and load them in the correct order
for (xxp=0; xxp < YAMXXP.length; xxp++) {
if (YAM_madeConfigs == true){
print("Stopping bot to let you edit your new config files!");
break;
}
XP_ResetVars();
DL_LoadRun();
YAM_ShowCredits();
_curBoss = (YAM_MustIdle) ? "HOTIP" : YAMXXP[xxp];
///DC_SendMsgToScript( "scripts\\YAMBstarter.d2j", "running:" + _curBoss );
scriptBroadcast( "running:" + _curBoss );
(YAM_MustIdle) ? LoadModule("HOTIP") : LoadModule(YAMXXP[xxp]);
gameMsgExtendHandler = null; // Reset it
}
if (YAM_MustIdle) {
XP_ResetVars();
DL_LoadRun();
YAM_ShowCredits();
//DC_SendMsgToScript( "scripts\\YAMBstarter.d2j", "running:HOTIP" );
scriptBroadcast( "running:HOTIP" );
LoadModule("HOTIP");
}
// Check if min run time is reached, do a town run and/or stall if not
YAM_RunTime = new Date().getTime() - YAM_RunTimer;
if (YAM_RunTime < YAM_MinGameLength*1000) {
DC_Print("Run took "+ Math.round(YAM_RunTime/1000) +" seconds and was finished under minimum game length ("+YAM_MinGameLength+" seconds)");
_merc = DC_GetMerc();
if ((YAM_MinGameLength - YAM_RunTime/1000) > 9 || (_merc && _merc.getState(2))) {
YAM_TownManager();
YAM_RunTime=new Date().getTime() - YAM_RunTimer;
}
if (YAM_RunTime < YAM_MinGameLength*1000) {
YAM_MakeTP();
DC_Print("Stalling for "+ Math.round(YAM_MinGameLength - YAM_RunTime/1000) +" seconds");
delay(YAM_MinGameLength*1000 - YAM_RunTime);
}
}
quit();
}
...