Advertisement
Guest User

Untitled

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