Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.41 KB | None | 0 0
  1. // credit for this goes to D2od who knows way more than I do
  2. // revised on 1-2-11 by stairbuilder Credit for mod goes to Justin.Killen and I was pointed to it by fellgar
  3. // will now join game only when leader sends message from game. must use NTLeaderStarter2 with this or will not join game
  4. // commented out the /f l line, but can be uncommented if you wich
  5. // added white screen of death fix and also some print txt for testing 2-17-11 stairbuilder
  6.  
  7. // =============================================================================
  8. // Leader Account settings
  9. // =============================================================================
  10. var leaderAccountName = "smoketreez";
  11. var leaderName = "SmokeSack";
  12.  
  13. // =============================================================================
  14. // Game password (leave blank if none)
  15. // =============================================================================
  16. var gamepassword = "";
  17.  
  18. // =============================================================================
  19. // UseCDKeyChangeTrick :
  20. // if true, the follow bot will say his gamename/gamepwd (set in the OOG) in chat before each game
  21. // in order to increment his number of runs (to switch CDKeys after xx runs)
  22. // if false, the follow bot will never change his CDKey
  23. // =============================================================================
  24. var UseCDKeyChangeTrick = false;
  25.  
  26. // =============================================================================
  27. // Debug : set to true if you are experiencing problems with your JoinBot
  28. // it will log in your OOG the lobby chat actions
  29. // =============================================================================
  30. var Debug = false;
  31.  
  32. ////////////////////////////////////////////////////////////////////////////////
  33. // Lobby chat settings :
  34. ////////////////////////////////////////////////////////////////////////////////
  35.  
  36. // Set to true to join the chat after each game (needed for JoinBot)
  37. var joinChatAfterGame = true;
  38.  
  39. // Message said when you first enter the chat
  40. var firstJoinMessage = "";
  41.  
  42. // Message said after each game
  43. var chatMessageAfterGame = "";
  44.  
  45. // if this is true, will join a random channel, otherwise it will use the channel below..
  46. var joinRandomChannel = false;
  47. // Name of the channel you want to join (leave blank if you want to stay in the default channel)
  48. var joinChannelInChat = "iBi";
  49.  
  50.  
  51. ////////////////////////////////////////////////////////////////////////////////
  52. // Delays:
  53. ////////////////////////////////////////////////////////////////////////////////
  54.  
  55. // Minimum game length, waits in the lobby if last game was too short
  56. // I recommend to keep a value > 300000 (milliseconds) to avoid bnet temporary ban
  57. var gameMinLength = 420000;
  58.  
  59. // realm delays (minutes)
  60. var unableToConnectRetry = 20;
  61. var realmDownRetry = 480;
  62. var disconnectedRetry = 5;
  63. var cdkeyInUseRetry = 5;
  64.  
  65. // interface delays (milliseconds)
  66. var connectingToBnetTimeout = 20000;
  67. var characterScreenTimeout = 10000;
  68. var pleaseWaitTimeout = 10000;
  69. var createGameThreshold = 10000;
  70. var createGameThresholdRandom = 1000;
  71. var createGameTimeout = 15000;
  72. var waitInLineTimeout = 15000;
  73. var characterSelectDelay = 1000;
  74. var loginDelay = 1000;
  75. var clickDelay = 500;
  76. var textDelay = 500;
  77. var clickDelayRandom = 500;
  78. var textDelayRandom = 500;
  79. var gameDoesNotExistDelayMin = 600000;
  80. var gameDoesNotExistDelayMax = 900000;
  81. var gameDoesNotExistTimeout = 30000;
  82. var waitBeforeEnterChatMin = 1000;
  83. var waitBeforeEnterChatMax = 2000;
  84. var waitInChatBeforeActionsMin = 2000;
  85. var waitInChatBeforeActionsMax = 3000;
  86.  
  87. // Only for JoinBot (friend list delay, milliseconds)
  88. var LeaderOfflineDelay = 30000;
  89. var LeaderInChatDelay = 10000;
  90. var GameIsFullDelay = 30000;
  91.  
  92. ////////////////////////////////////////////////////////////////////////////////
  93. ////////////////////////////////////////////////////////////////////////////////
  94. // DO NOT EDIT ANYTHING BELOW THIS
  95. ////////////////////////////////////////////////////////////////////////////////
  96. ////////////////////////////////////////////////////////////////////////////////
  97.  
  98. //D2NT Manager Command
  99.  
  100. const D2NT_MGR_LOADING = 1;
  101. const D2NT_MGR_READY = 2;
  102. const D2NT_MGR_LOGIN = 3;
  103. const D2NT_MGR_CREATE_GAME = 4;
  104. const D2NT_MGR_INGAME = 5;
  105. const D2NT_MGR_RESTART = 6;
  106. const D2NT_MGR_CHICKEN = 7;
  107. const D2NT_MGR_PRINT_STATUS = 8;
  108. const D2NT_MGR_PRINT_LOG = 9;
  109.  
  110. var lastGameMade = GetTickCount();
  111. var lastGameStatus = 0;
  112. var nextGameMake = 0;
  113. var inGameAt = 0;
  114. var chatActionsDone = false;
  115. var lastGameFailed = false;
  116. var sayChatMsgAfterGame = false;
  117.  
  118. Include("libs/controlInfo.ntl");
  119. Include("libs/common/NTColorConverter.ntl");
  120.  
  121. var controlData = new controlInfo();
  122.  
  123. var game = '';
  124. var _gamename = "";
  125. var _gamepassword = "";
  126. var _leaderOfflineTick = -LeaderOfflineDelay;
  127. var _leaderInChatTick = -LeaderInChatDelay;
  128. var _GameIsFullTick = -GameIsFullDelay;
  129.  
  130. function NTMain()
  131. {
  132. Delay(1000);
  133.  
  134. var _ingame = false;
  135.  
  136. controlData.clickDelay = clickDelay;
  137. controlData.textDelay = textDelay;
  138. controlData.clickDelayRandom = clickDelayRandom;
  139. controlData.textDelayRandom = textDelayRandom;
  140.  
  141. while(1)
  142. {
  143. if(me.ingame)
  144. {
  145. _gamename = me.gamename;
  146. _gamepassword = me.gamepassword;
  147.  
  148. if(!inGameAt)
  149. inGameAt = GetTickCount();
  150.  
  151. if(!_ingame)
  152. {
  153. RunGC(); // run garbage collector between each game
  154.  
  155. if(Load("NTBot/NTBotGame.ntj"))
  156. {
  157. _ingame = true;
  158.  
  159. if(me.playtype > 0)
  160. sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
  161. else
  162. sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);
  163.  
  164. lastGameStatus = 2; // in game successful
  165.  
  166. // To exit game as soon as the leader quits
  167. //Load("NTBot/NTCheckLeader.ntj");
  168. // to party only the leader
  169. //Load("NTBot/tools/NTTools_AutoPartyJoinFriendGames.ntj");
  170. }
  171. }
  172.  
  173. Delay(1000);
  174. }
  175. else
  176. {
  177. if(_ingame)
  178. {
  179. My_ExitGame_Check(); // out of korean modded d2nt fixes white screen of death
  180. _ingame = false;
  181. sayChatMsgAfterGame = true;
  182.  
  183. sendEventToOOG(D2NT_MGR_READY, "", 0);
  184. }
  185.  
  186. locationAction(controlData.getLocation());
  187.  
  188. Delay(500);
  189. }
  190. }
  191. }
  192.  
  193. function locationAction(location)
  194. {
  195. switch(location.id)
  196. {
  197. case 3: // Lobby Chat
  198. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  199.  
  200. //LogPrintSimple(me.account + "MyAccountTest.txt", me.account + " / " + me.charname) // this is to check for 2nd account login
  201.  
  202. if(!chatActionsDone)
  203. {
  204. Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
  205.  
  206. if(joinRandomChannel || joinChannelInChat != "")
  207. {
  208. Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
  209. Delay(1000);
  210. }
  211.  
  212. if(firstJoinMessage)
  213. {
  214. Say(firstJoinMessage);
  215. Delay(200);
  216. }
  217.  
  218. chatActionsDone = true;
  219. }
  220.  
  221. if (chatMessageAfterGame && _gamename != "" && sayChatMsgAfterGame == true)
  222. {
  223. Say(chatMessageAfterGame);
  224. sayChatMsgAfterGame = false;
  225. Delay(200);
  226. }
  227.  
  228. game = '';
  229.  
  230. var _tick = GetTickCount();
  231. if ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick) // maybe play with this so it skips it for 30 seconds
  232. && (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
  233. && (_GameIsFullTick < 0 || (_GameIsFullTick + GameIsFullDelay) < _tick))
  234. {
  235. Delay(500);
  236. DebugInOOG('Locating the leader : '+leaderAccountName);
  237. //Say('/f l');
  238. }
  239.  
  240. if(chat = controlData.get(controlData.controls.lobby.chat.textBox.channelText))
  241. {
  242. var found_leader = false;
  243. lines = chat.GetText();
  244. for (var line_id = lines.length - 1; line_id > -1; line_id--)
  245. {
  246. if (found_leader) // useless... :/
  247. break;
  248.  
  249. if (lines[line_id].substring(0,1) == " ")
  250. continue;
  251.  
  252. // retrieving the whole message
  253. var msg = lines[line_id].replace(/^\s+|\s+$/, "");
  254. var msglines = 1;
  255. while (lines[line_id+msglines] != undefined && lines[line_id+msglines].substring(0,2) == " ")
  256. {
  257. msg += " " + lines[line_id+msglines].replace(/^\s+|\s+$/, "");
  258. msglines++;
  259. }
  260. if (msg.lastIndexOf(leaderName) >= 0)
  261. DebugInOOG("yc8found him :;"+msg);
  262.  
  263. // checking if the msg is a friendly whisper
  264. if (msg.lastIndexOf(leaderName + ' (*' +leaderAccountName+')') > -1) // need to modify this and then add another to handle the "@USWest
  265. { // should be just a matter of leaderName + '@' and then register the 2nd line as game name
  266. var regGameNameWhispered=/^.*in_new_game\s+(.*)$/gi; // replaced below with this to join on mesage upon entering game
  267. //var regGameNameWhispered=/^.*(game|partie|spiel|partita|partida).*(nomm[^\s]*|called|chiamata)\s*([\w\s-]*\w)\s*\.\s*$/gi;
  268. if (msg.match(regGameNameWhispered))
  269. game = msg.replace(regGameNameWhispered, "$1"); // replaced below with this to join on mesage upon entering game
  270. //game = msg.replace(regGameNameWhispered, "$3");
  271.  
  272. if (game != '')
  273. {
  274. found_leader = true;
  275. break;
  276. }
  277. }
  278.  
  279. // checking if the msg is from the friend list
  280. if (msg.lastIndexOf(': '+leaderAccountName+',') > -1)
  281. {
  282. found_leader = true;
  283. var regOffline=/^.*(offline|desconectado).*$/gi;
  284. var regInChat=/^.*(channel|canale?)\s*([\w\s-]*\w)\.?\s*$/gi;
  285. var regGameName=/^.*(game|partie|spiel|partita|partida)\s*([\w\s-]*\w)\s*\(priv[^\)]*\)\.\s*$/gi;
  286.  
  287. if (msg.match(regOffline)
  288. && (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
  289. {
  290. DebugInOOG('Leader is offline, delay '+Math.round(LeaderOfflineDelay/1000)+' sec for next /f l.');
  291. _leaderOfflineTick = GetTickCount();
  292. }
  293. else if (msg.match(regInChat)
  294. && (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick))
  295. {
  296. DebugInOOG('Leader is in the chat "'+msg.replace(regInChat, "$2")+'", delay '+Math.round(LeaderInChatDelay/1000)+' sec for next /f l.');
  297. _leaderInChatTick = GetTickCount();
  298. }
  299. else if (msg.match(regGameName)
  300. && ((_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick)
  301. && (_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)))
  302. {
  303. game = msg.replace(regGameName, "$2");
  304. }
  305. else if ((_leaderInChatTick < 0 || (_leaderInChatTick + LeaderInChatDelay) < _tick)
  306. && (_leaderOfflineTick < 0 || (_leaderOfflineTick + LeaderOfflineDelay) < _tick))
  307. {
  308. // unhandled line, supposelly "In Realm"
  309. DebugInOOG('The leader was in the the lobby but not in chat, delay '+Math.round(LeaderInChatDelay/1000)+' sec for next /f l.');
  310. _leaderInChatTick = GetTickCount();
  311. }
  312.  
  313. break;
  314. }
  315. }
  316.  
  317. if (found_leader == false)
  318. DebugInOOG('I couldn\'t find the leader in my friend list!');
  319.  
  320. if (game!="")
  321. {
  322. if (UseCDKeyChangeTrick)
  323. {
  324. // increasing the number of runs in the OOG (for CDKey switch)
  325. // Problem : the gamename/gamepassword set in your OOG will be typed in the lobbyChat
  326. // this may output a red message in the lobby chat if you have a password set (not a real problem)
  327. // 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
  328. sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
  329. Delay(1000);
  330. }
  331.  
  332. DebugInOOG('Leader is in the game "' + game + '"');
  333. controlData.click(controlData.controls.lobby.button.join);
  334. Delay(100);
  335. }
  336.  
  337. }
  338. else
  339. {
  340. DebugInOOG('I can\'t read the chat!');
  341. //DebugInOOG('You probably haven\'t added the lobby chat controlinfo coordinates!');
  342. Delay(30000);
  343. }
  344. break;
  345.  
  346. case 1: // Lobby
  347. if(location.id == 1 && joinChatAfterGame)
  348. {
  349. LogPrintSimple(me.account + "MyAccountTest.txt", me.account + " / " + me.charname) // this is to check for 2nd account login
  350. Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
  351. controlData.click(controlData.controls.lobby.button.enterChat);
  352. break;
  353. }
  354. break;
  355.  
  356. case 2: // Waiting In Line
  357. if(GetTickCount()-lastGameMade > waitInLineTimeout)
  358. controlData.click(controlData.controls.lobby.inLine.button.cancel);
  359. break;
  360.  
  361. case 4: // Create Game
  362. if(!controlData.get(controlData.controls.lobby.create.editBox.gameName))
  363. {
  364. controlData.click(controlData.controls.lobby.button.join);
  365. Delay (500);
  366. controlData.click(controlData.controls.lobby.button.create);
  367. Delay (500);
  368. break;
  369. }
  370.  
  371. sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
  372.  
  373. locationTimeout(5000, location);
  374.  
  375. lastGameMade = GetTickCount();
  376. lastGameStatus = 1; // pending creation
  377. break;
  378.  
  379. case 5: // Join Game
  380. if (game)
  381. {
  382. controlData.setText( controlData.controls.lobby.join.editBox.gameName, game);
  383. Delay (100);
  384. controlData.setText( controlData.controls.lobby.join.editBox.password, gamepassword);
  385. Delay (100);
  386. controlData.click(controlData.controls.lobby.join.button.joinGame);
  387. RunGC(); // run garbage collector between each game
  388. locationTimeout(5000, location);
  389. lastGameStatus = 1; // pending join
  390. }
  391. else
  392. {
  393. DebugInOOG('No game to join : cancelling');
  394. me.Cancel(1);
  395. Delay(1000);
  396. }
  397. break;
  398.  
  399. case 6: // Ladder
  400. break;
  401.  
  402. case 7: // Channel List
  403. break;
  404.  
  405. case 8: // Main Menu
  406. if(controlData.getCurrentRealmIndex() == me.gatewayid)
  407. {
  408. outputGameLength();
  409. controlData.click(controlData.gameTypes[me.playtype]);
  410. }
  411. else
  412. controlData.click(controlData.controls.mainMenu.button.gateway);
  413. break;
  414.  
  415. case 9: // Login
  416. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  417. Delay(loginDelay);
  418.  
  419. controlData.setText(controlData.controls.login.editBox.accountName, me.account);
  420.  
  421. sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);
  422.  
  423. locationTimeout(5000, location);
  424. break;
  425.  
  426. case 10: // Login Error (this is a fatal error, so stop)
  427. sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
  428. Delay(3500);
  429. break;
  430.  
  431. case 11: // Unable To Connect
  432. timeoutDelay(unableToConnectRetry*60*1000, location)
  433. controlData.click(controlData.controls.login.unableToConnect.button.ok);
  434. break;
  435.  
  436. case 12: // Character Select
  437. var _time, _control;
  438.  
  439. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  440.  
  441. for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
  442. {
  443. _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
  444. if(_control && _control.GetText() != undefined)
  445. break;
  446.  
  447. Delay(500);
  448. }
  449.  
  450. if(_time < characterScreenTimeout)
  451. {
  452. Delay(characterSelectDelay);
  453.  
  454. controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
  455. controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);
  456.  
  457. // reset last game made, so it doesnt make a game immediately
  458. inGameAt = 0;
  459. setNextGameMake();
  460. }
  461. else
  462. {
  463. controlData.click(controlData.controls.characterSelect.button.exit);
  464. timeoutDelay(realmDownRetry*60*1000, location);
  465. }
  466. break;
  467.  
  468. case 13: // Realm Down - Character Select screen
  469. controlData.click(controlData.controls.characterSelect.button.exit);
  470. timeoutDelay(realmDownRetry*60*1000, location);
  471. break;
  472.  
  473. case 14: // Character Select - Disconnected
  474. timeoutDelay(disconnectedRetry*60*1000, location);
  475. controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
  476. break;
  477.  
  478. case 15: // New Character
  479. break;
  480.  
  481. case 16: // Character Select - Please Wait popup
  482. if(!locationTimeout(pleaseWaitTimeout, location))
  483. controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
  484. break;
  485.  
  486. case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
  487. controlData.click(controlData.controls.lobby.lostConnection.button.ok);
  488. break;
  489.  
  490. case 18: // D2 Splash
  491. controlData.click(controlData.controls.d2Splash.textBox.copyright);
  492. break;
  493.  
  494. case 19: // Login - Cdkey In Use
  495. timeoutDelay(cdkeyInUseRetry*60*1000, location);
  496. controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
  497. break;
  498.  
  499. case 20: // Single Player - Select Difficulty
  500. controlData.click(controlData.singlePlayerDifficulties[me.diff]);
  501. break;
  502.  
  503. case 21: // Main Menu - Connecting
  504. if(!locationTimeout(connectingToBnetTimeout, location))
  505. controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
  506. break;
  507.  
  508. case 22: // Login - Invalid Cdkey (classic or xpac)
  509. sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
  510. Delay(3500);
  511. break;
  512.  
  513. case 23: // Character Select - Connecting
  514. if(!locationTimeout(characterScreenTimeout, location))
  515. controlData.click(controlData.controls.characterSelect.button.exit);
  516. break;
  517.  
  518. case 24: // Server Down - not much to do but wait..
  519. break;
  520.  
  521. case 25: // Lobby - Please Wait
  522. if(!locationTimeout(pleaseWaitTimeout, location))
  523. controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
  524. break;
  525.  
  526. case 26: // Lobby - Game Name Exists
  527. sendEventToOOG(D2NT_MGR_PRINT_LOG, "yE00000Game already exists", 0);
  528.  
  529. inGameAt = 0;
  530. lastGameStatus = 0;
  531. setNextGameMake();
  532.  
  533. locationTimeout(15000, location);
  534. break;
  535.  
  536. case 27: // Gateway Select
  537. controlData.clickRealmEntry(me.gatewayid);
  538. controlData.click(controlData.controls.gateway.button.ok);
  539. break;
  540.  
  541. case 28: // Lobby - Game Does Not Exist
  542. inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
  543. lastGameStatus = 0;
  544. setNextGameMake();
  545.  
  546. locationTimeout(gameDoesNotExistTimeout, location);
  547. break;
  548. default:
  549. DebugInOOG("Unhandled location : "+location.id);
  550. break;
  551. }
  552. DebugInOOG("Location : "+location.id);
  553. }
  554.  
  555. function sendEventToOOG(locationId, statusString, pendingTime)
  556. {
  557. return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
  558. }
  559.  
  560. function setNextGameMake()
  561. {
  562. lastGameMade = GetTickCount();
  563. nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
  564. inGameAt = 0;
  565. chatActionsDone = false;
  566. }
  567.  
  568. function outputGameLength()
  569. {
  570. if(inGameAt)
  571. {
  572. duration = GetTickCount() - inGameAt;
  573.  
  574. inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
  575. }
  576. }
  577.  
  578. function locationTimeout(time, location)
  579. {
  580. endtime = GetTickCount() + time;
  581.  
  582. while(controlData.getLocation().id == location.id && endtime > GetTickCount())
  583. {
  584. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  585. Delay(500);
  586. }
  587.  
  588. return (controlData.getLocation().id != location.id);
  589. }
  590.  
  591. function timeoutDelay(time, location)
  592. {
  593. endtime = GetTickCount() + time;
  594.  
  595. while(endtime > GetTickCount())
  596. {
  597. sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  598. Delay(1000);
  599. }
  600. }
  601.  
  602. function getRandomString(_length)
  603. {
  604. _retString = "";
  605. _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
  606.  
  607. while(_length--)
  608. {
  609. _retString += _charSet.charAt(Random(0, _charSet.length-1));
  610. Delay(1);
  611. }
  612.  
  613. return _retString;
  614. }
  615. function DebugInOOG(logString)
  616. {
  617. if (Debug)
  618. return SendCopyData("D2NT Manager", null, 9<<16, "-- Debug : " + logString);
  619. else
  620. return false;
  621. }
  622.  
  623. function My_ExitGame_Check()
  624. {
  625. for (var i = 0; i < 40; i++)
  626. {
  627. if (controlData.getLocation().id != undefined)
  628. break;
  629.  
  630. if (i > 38)
  631. {
  632. LogPrintSimple(me.account + " StarterTest.txt", "White Screen of Death: Restarting")
  633. sendEventToOOG(D2NT_MGR_PRINT_LOG, "yc1White Screen of Death: Restarting", 0);
  634. sendEventToOOG(D2NT_MGR_RESTART, "", 5);
  635. My_Delay(); // make sure and add this also
  636. }
  637.  
  638. Delay(500);
  639. }
  640. }
  641.  
  642. function My_Delay(retry)
  643. {
  644. if (arguments.length < 1)
  645. retry = 20;
  646.  
  647. while (retry-- > 0)
  648. Delay(1000);
  649. }
  650.  
  651. function LogPrintSimple(filepath, mesg){
  652.  
  653. var _filepath = filepath;
  654. var _mesg = mesg;
  655.  
  656. var date = new Date().toLocaleFormat("<%a, %b %d, %H:%M>");
  657. var logfile = FileOpen(_filepath, 2); // opens file
  658. if(!logfile)
  659. var logfile = FileOpen(_filepath, 1); // if file not there then creates it
  660.  
  661. logfile.WriteLine(date + " " + _mesg );
  662. logfile.Close();
  663. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement