Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 19.78 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // added a line that sends whisper game name for leechers when in game revised by stairbuilder on 1-2-11 //
  3. // added fix for white screen of death credit to korean modders revised by stairbuilder on 2-17-11       //
  4. // added fix for creation button sticking revised by stairbuilder on 2-17-11                             //
  5. //////////// for use with NTLeechStarter2.ntj /////////////////////////////////////////////////////////////
  6. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  7.  
  8. ///////////////////////////////////////////////////
  9. //        characters in your game setting:       //    
  10. ///////////////////////////////////////////////////
  11. var characterdiff        =  "86";   //use this to keep those pesky spam bots out of the f'ing game
  12.                                     //note you must manually hit the check box the first time for this to work
  13. var maxNumberOfPlayersss = "8";     //use this to set the maximum number of players allowed in your game
  14.  
  15. ///////////////////////////////////////
  16. //        Channel Settings:          //     / /These controll what if any channel you join
  17. ///////////////////////////////////////
  18. var joinChatAfterGame           = true;          // join chat after leaving a game
  19. var joinRandomChannel           = false;         // if this is true, will join a random channel, otherwise it will use the channel below..
  20. var joinChannelInChat           = "op ibm";      // Channel you want your bot to join, leave blank to not join a private channel
  21.  
  22. ///////////////////////////////////////
  23. //        Message Settings:          //     // These controll what your bot sais to the leechers will also send a log incommand to a channel bot
  24. ///////////////////////////////////////
  25. var chatMessageOnJoin           = "here we go"; // Chat Message to say Login command for channel bot will only be sent once
  26. var chatMessageAfterGame1       = "";   // Optional chat message Line #1 to say after each game on Channel
  27. var chatMessageAfterGame2       = "";       // Optional chat message Line #2 to say after each game on Channel
  28. var chatMessageAfterGame3       = "";       // Optional chat message Line #3 to say after each game on Channel
  29. var chatMessageAfterGame4       = "";       // Optional chat message Line #4 to say after each game on Channel
  30. var chatMessageAfterGame5       = "";   // Optional chat message Line #5 to say after each game on Channel
  31.  
  32. ///////////////////////////////////////     // These will let you send a message with a game name password and time to your leechers
  33. //      Game Message Settings:       //     // var saygamename must be true for any of these to work
  34. ///////////////////////////////////////     // You cant NOT have a - in you game name it will bug it out
  35. var saygamename             = false;                        // Must be true for any of the game message settings to work
  36. var nextgamemessage         = "next game should be";    // This will come befor your next game name eg "New game is"
  37. var saypassword             = false;                        // This will togle if the bot says your game pw
  38. var saytime                 = false;                        // This will togle if the bot says how much time till creation
  39. var timemessage             = "in about";               // This will come after your pw and befor the time eg. "in about" xx seconds say time MUST be true for this to be used
  40.  
  41. //////////////////////////////////////
  42. //       Minimum Game Length:       //
  43. //////////////////////////////////////
  44.  
  45. var gameMinLength       = 40000;    // time in milliseconds, minimum game length, 180 seconds default (1 game/3 minutes)
  46.  
  47. ////////////////////////////////////////
  48. //        Connection Settings:        //
  49. ////////////////////////////////////////
  50.  
  51. var unableToConnectRetry    = 15;       // time in minutes to retry connecting on connection fail (real value is +/- 1 min)
  52. var realmDownRetry      = 900;      // time in minutes to retry connecting on a realm down (default is 300 minutes)
  53. var disconnectedRetry       = 5;        // time in minutes to retry on a disconnection (usually ip ban related)
  54. var cdkeyInUseRetry     = 5;        // time in minutes to retry on a cdkey in use error message (set to 0 to stop)
  55. var connectingToBnetTimeout = 20000;    // time in milliseconds to wait for a login to time out and click cancel and retry
  56. var characterScreenTimeout  = 10000;    // time in milliseconds to wait for character screen to appear
  57. var pleaseWaitTimeout       = 10000;    // time in milliseconds to wait for a please wait popup
  58. var createGameThreshold     = 5000;     // time in milliseconds to wait between making games
  59. var createGameThresholdRandom   = 1000;     // time in milliseconds to randomly add +/- to the game create time
  60. var createGameTimeout       = 44000;    // time in milliseconds to register a failed to create game
  61. var waitInLineTimeout       = 60000;    // time in milliseconds to wait in lines for a create game (60 second default)
  62. var characterSelectDelay    = 1000;     // time in milliseconds to wait before selecting a character on the char screen
  63. var loginDelay          = 1000;     // time in milliseconds to wait before submitting login information
  64. var clickDelay          = 500;      // wait X milliseconds before next action after a click event
  65. var textDelay           = 500;      // wait X milliseconds before next action after inserting text into a textbox
  66. var clickDelayRandom        = 500;      // random amount of time to add to a click
  67. var textDelayRandom     = 500;      // random amount of time to add to a text set
  68. var gameDoesNotExistDelayMin    = 600000;   // how long to wait when a Game Does Not Exist occurs - minimum - default 10 minutes
  69. var gameDoesNotExistDelayMax    = 900000;   // how long to wait when a Game Does Not Exist occurs - maximum - default 15 minutes
  70. var gameDoesNotExistTimeout = 30000;    // how long to wait for the dialog to disappear (default 30 seconds, don't change this)
  71. var waitBeforeEnterChatMin  = 1000;     // min how long to wait before entering chat
  72. var waitBeforeEnterChatMax  = 2000;     // max how long to wait before entering chat
  73. var waitInChatBeforeActionsMin  = 2000;     // min how long to wait before joining channel
  74. var waitInChatBeforeActionsMax  = 3000;     // max how long to wait before joining channel
  75. var waitBeforeNextLineChatMin   = 500;      // Minimum ammount of time to add after each text line 
  76. var waitBeforeNextLineChatMax   = 1500;     // Maximum ammount of time to add after each text line
  77.  
  78. // DONT EDIT ANYTHING BELOW THIS
  79.  
  80. // D2NT Manager Command
  81. const D2NT_MGR_LOADING = 1;
  82. const D2NT_MGR_READY = 2;
  83. const D2NT_MGR_LOGIN = 3;
  84. const D2NT_MGR_CREATE_GAME = 4;
  85. const D2NT_MGR_INGAME = 5;
  86. const D2NT_MGR_RESTART = 6;
  87. const D2NT_MGR_CHICKEN = 7;
  88. const D2NT_MGR_PRINT_STATUS = 8;
  89. const D2NT_MGR_PRINT_LOG = 9;
  90. var alreadyLoggedIn = false; // will only send the login command once leave as unless you want to login everytime you join a channel
  91. var lastGameMade = GetTickCount();
  92. var lastGameStatus = 0;
  93. var nextGameMake = 0;
  94. var inGameAt = 0;
  95. var chatActionsDone = false;
  96. var lastGameFailed = false;
  97. var tempDelay = Random(waitBeforeNextLineChatMin, waitBeforeNextLineChatMax);
  98. var gameInfo = "";
  99. var bugignor = true;
  100. Include("libs/controlInfo.ntl");
  101.  
  102. var controlData = new controlInfo();
  103.  
  104. function NTMain()
  105. {
  106.     Delay(1000);
  107.  
  108.     var _ingame = false;
  109.  
  110.     controlData.clickDelay = clickDelay;
  111.     controlData.textDelay = textDelay;
  112.     controlData.clickDelayRandom = clickDelayRandom;
  113.     controlData.textDelayRandom = textDelayRandom;
  114.     while(1)
  115.     {
  116.         if(me.ingame)
  117.         {
  118.             if(!inGameAt)
  119.                 inGameAt = GetTickCount();
  120.  
  121.             if(!_ingame)
  122.             {
  123.                 RunGC(); // run garbage collector between each game
  124.  
  125.                 if(Load("NTBot/NTBotGame.ntj"))
  126.                 {
  127.                     _ingame = true;
  128.  
  129.                     if(me.playtype > 0)
  130.                         sendEventToOOG(D2NT_MGR_INGAME, "In Game[IP:" + me.gameserverip.split(".")[3] + "]", 0);
  131.                        
  132.                     else
  133.                         sendEventToOOG(D2NT_MGR_INGAME, "In Game", 0);
  134.                         Say("/f m in_new_game " + me.gamename);  // this is for leechers to join only after leader is in game
  135.                     lastGameStatus = 2; // in game successful
  136.                 }
  137.             }
  138.  
  139.             Delay(1000);
  140.         }
  141.         else
  142.         {
  143.            
  144.             if(_ingame)
  145.             {
  146.                 My_ExitGame_Check(); // out of korean modded d2nt fixes white screen of death
  147.  
  148.                 _ingame = false;
  149.  
  150.                 sendEventToOOG(D2NT_MGR_READY, "", 0);
  151.             }
  152.  
  153.             locationAction(controlData.getLocation());
  154.  
  155.             Delay(500);
  156.         }
  157.     }
  158. }
  159.  
  160. function locationAction(location)
  161. {
  162.     switch(location.id)
  163.     {
  164.     case 3: // Lobby Chat
  165.         if(!chatActionsDone)
  166.         {
  167.             chatActionsDone = true;
  168.             Delay(Random(waitInChatBeforeActionsMin, waitInChatBeforeActionsMax));
  169.  
  170.             if(joinRandomChannel || joinChannelInChat != "")
  171.             {
  172.                 Say("/join " + (joinRandomChannel ? getRandomString(Random(3,10)) : joinChannelInChat));
  173.                 Delay(1000);
  174.                     if(!alreadyLoggedIn){
  175.                     alreadyLoggedIn = true;
  176.                     if (chatMessageOnJoin.length > 0){
  177.                         Say(chatMessageOnJoin);
  178.                     }
  179.                     }
  180.                 Delay(500);
  181.                 chatActionsDone = true;
  182.             }
  183.         }
  184.     case 1: // Lobby
  185.         if(location.id == 1 && joinChatAfterGame)
  186.         {
  187.             Delay(Random(waitBeforeEnterChatMin, waitBeforeEnterChatMax));
  188.             controlData.click(controlData.controls.lobby.button.enterChat);
  189.             break;
  190.         }
  191.         LogPrintSimple(me.account + "MyAccountTest.txt", me.account + " / " + me.charname) // this is to check for 2nd account login
  192.  
  193.         if(GetTickCount() > nextGameMake)
  194.         {
  195.             lastGameFailed = false;
  196.  
  197.             switch(lastGameStatus)
  198.             {
  199.             case 0:
  200.                 password = (me.gamepassword);
  201.                 game = (getGameName(me.gamename));
  202.                 counter = (getGameCounter(me.gamename, false));
  203.                 time = (parseInt((nextGameMake - GetTickCount() - tempDelay)/1000+3.0));
  204.                 if (saygamename){{
  205.                     gameInfo += nextgamemessage + " " + game + counter;
  206.                 }
  207.                     if (saypassword){
  208.                     gameInfo += "//" + password
  209.                     }
  210.                         if (saytime){
  211.                         gameInfo += " " + timemessage + " " + time + " seconds"
  212.                         }
  213.                 }
  214.                 if(joinChatAfterGame){
  215.                     if(chatMessageAfterGame1.length > 0){
  216.                         Say(chatMessageAfterGame1);
  217.                         if(chatMessageAfterGame1.length > 0){
  218.                             Delay(tempDelay);
  219.                         }
  220.                     }
  221.                     if(chatMessageAfterGame2.length > 0){
  222.                         Say(chatMessageAfterGame2);
  223.                             if(chatMessageAfterGame2.length > 0){
  224.                                 Delay(tempDelay);
  225.                             }
  226.                     }
  227.                     if(chatMessageAfterGame3.length > 0){
  228.                         Say(chatMessageAfterGame3);
  229.                         if(chatMessageAfterGame3.length > 0){
  230.                             Delay(tempDelay);
  231.                         }
  232.                     }
  233.                     if(chatMessageAfterGame4.length > 0){
  234.                         Say(chatMessageAfterGame4);
  235.                         if(chatMessageAfterGame4.length > 0){
  236.                             Delay(tempDelay);
  237.                         }
  238.                     }
  239.                     if(chatMessageAfterGame5.length > 0){
  240.                         Say(chatMessageAfterGame5);
  241.                         if(chatMessageAfterGame5.length > 0){
  242.                             Delay(tempDelay);
  243.                         }
  244.                     }
  245.                     if(saygamename) {
  246.                         if(bugignor){
  247.                             bugignor = false;
  248.                             gameInfo = "";
  249.                         }
  250.                     else{
  251.                         Say(gameInfo)
  252.                         Delay(tempDelay)
  253.                         gameInfo = "";
  254.                     }
  255.                     }
  256.                 }
  257.                 _control = controlData.get(controlData.controls.lobby.button.create); // fixes creation stuck button bug out of unmodded d2nt
  258.                 if(_control && _control.pressed)
  259.                 {
  260.                     controlData.click(controlData.controls.lobby.button.join);
  261.                     Delay(500);
  262.                 }
  263.  
  264.                 controlData.click(controlData.controls.lobby.button.create);
  265.                 //controlData.click(controlData.controls.lobby.create.button.useCharacterDifference);//checks the use character diff box...does this every time so no go
  266.                 controlData.setText(controlData.controls.lobby.create.editBox.characterDifference,(characterdiff)); //level restriction
  267.                 controlData.setText(controlData.controls.lobby.create.editBox.maxNumberOfPlayers, (maxNumberOfPlayersss)); //max players
  268.                 nextGameMake = GetTickCount() + createGameTimeout; // set our timeout
  269.                 sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  270.                 break;
  271.             case 1: // game failed, rollover to reset timer
  272.                 inGameAt = GetTickCount(); // reset inGameAt, to wait how long we should have waited..
  273.                 lastGameFailed = true;
  274.             case 2:
  275.                 outputGameLength();
  276.                 lastGameStatus = 0;
  277.                 setNextGameMake();
  278.                 sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  279.                 break;
  280.             }
  281.         }
  282.         else
  283.             timeoutDelay(nextGameMake-GetTickCount(), location, true);
  284.         break;
  285.  
  286.     case 2: // Waiting In Line
  287.         if(GetTickCount()-lastGameMade > waitInLineTimeout)
  288.             controlData.click(controlData.controls.lobby.inLine.button.cancel);
  289.         break;
  290.  
  291.     case 4: // Create Game
  292.         sendEventToOOG(D2NT_MGR_CREATE_GAME, location.name, 0);
  293.  
  294.         locationTimeout(5000, location);
  295.  
  296.         lastGameMade = GetTickCount();
  297.         lastGameStatus = 1; // pending creation
  298.         break;
  299.  
  300.     case 5: // Join Game
  301.         break;
  302.  
  303.     case 6: // Ladder
  304.         break;
  305.  
  306.     case 7: // Channel List
  307.         break;
  308.  
  309.     case 8: // Main Menu
  310.         if(controlData.getCurrentRealmIndex() == me.gatewayid)
  311.         {
  312.             outputGameLength();
  313.             controlData.click(controlData.gameTypes[me.playtype]);
  314.         }
  315.         else
  316.             controlData.click(controlData.controls.mainMenu.button.gateway);
  317.         break;
  318.  
  319.     case 9: // Login
  320.         sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  321.         Delay(loginDelay);
  322.  
  323.         controlData.setText(controlData.controls.login.editBox.accountName, me.account);
  324.  
  325.         sendEventToOOG(D2NT_MGR_LOGIN, location.name, 0);
  326.  
  327.         locationTimeout(5000, location);
  328.         break;
  329.  
  330.     case 10: // Login Error (this is a fatal error, so stop)
  331.         sendEventToOOG(D2NT_MGR_RESTART, location.name, 10);
  332.         Delay(3500);
  333.         break;
  334.  
  335.     case 11: // Unable To Connect
  336.         timeoutDelay(unableToConnectRetry*60*1000, location)
  337.         controlData.click(controlData.controls.login.unableToConnect.button.ok);
  338.         break;
  339.  
  340.     case 12: // Character Select
  341.         var _time, _control;
  342.  
  343.         sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name, 0);
  344.  
  345.         for(_time = 0 ; _time < characterScreenTimeout ; _time += 500)
  346.         {
  347.             _control = controlData.get(controlData.controls.characterSelect.textBox.characterInfo[me.charloc]);
  348.             if(_control && _control.GetText() != undefined)
  349.                 break;
  350.  
  351.             Delay(500);
  352.         }
  353.  
  354.         if(_time < characterScreenTimeout)
  355.         {
  356.             Delay(characterSelectDelay);
  357.  
  358.             controlData.click(controlData.controls.characterSelect.textBox.characters[me.charloc], 0, 0, 1);
  359.             controlData.click(controlData.controls.characterSelect.textBox.characterInfo[me.charloc], 0, 0, 1);
  360.  
  361.             // reset last game made, so it doesnt make a game immediately
  362.             inGameAt = 0;
  363.             setNextGameMake();
  364.         }
  365.         else
  366.         {
  367.             controlData.click(controlData.controls.characterSelect.button.exit);
  368.             timeoutDelay(realmDownRetry*60*1000, location);
  369.         }
  370.         break;
  371.  
  372.     case 13: // Realm Down - Character Select screen
  373.         controlData.click(controlData.controls.characterSelect.button.exit);
  374.         timeoutDelay(realmDownRetry*60*1000, location);
  375.         break;
  376.  
  377.     case 14: // Character Select - Disconnected
  378.         timeoutDelay(disconnectedRetry*60*1000, location);
  379.         controlData.click(controlData.controls.characterSelect.disconnected.button.ok);
  380.         break;
  381.  
  382.     case 15: // New Character
  383.         break; 
  384.  
  385.     case 16: // Character Select - Please Wait popup
  386.         if(!locationTimeout(pleaseWaitTimeout, location))
  387.             controlData.click(controlData.controls.characterSelect.pleaseWait.button.cancel);
  388.         break;
  389.  
  390.     case 17: // Lobby - Lost Connection - just click okay, since we're toast anyway
  391.         controlData.click(controlData.controls.lobby.lostConnection.button.ok);
  392.         break;
  393.  
  394.     case 18: // D2 Splash
  395.         controlData.click(controlData.controls.d2Splash.textBox.copyright);
  396.         break;
  397.  
  398.     case 19: // Login - Cdkey In Use
  399.         timeoutDelay(cdkeyInUseRetry*60*1000, location);
  400.         controlData.click(controlData.controls.login.cdkeyInUse.button.ok);
  401.         break;
  402.  
  403.     case 20: // Single Player - Select Difficulty
  404.         controlData.click(controlData.singlePlayerDifficulties[me.diff]);
  405.         break;
  406.  
  407.     case 21: // Main Menu - Connecting
  408.         if(!locationTimeout(connectingToBnetTimeout, location))
  409.             controlData.click(controlData.controls.mainMenu.connecting.button.cancel);
  410.         break;
  411.  
  412.     case 22: // Login - Invalid Cdkey (classic or xpac)
  413.         sendEventToOOG(D2NT_MGR_RESTART, location.name, 3600);
  414.         Delay(3500);
  415.         break; 
  416.  
  417.     case 23: // Character Select - Connecting
  418.         if(!locationTimeout(characterScreenTimeout, location))
  419.             controlData.click(controlData.controls.characterSelect.button.exit);
  420.         break;
  421.  
  422.     case 24: // Server Down - not much to do but wait..
  423.         break;
  424.  
  425.     case 25: // Lobby - Please Wait
  426.         if(!locationTimeout(pleaseWaitTimeout, location))
  427.             controlData.click(controlData.controls.lobby.pleaseWait.button.cancel);
  428.         break;
  429.  
  430.     case 26: // Lobby - Game Name Exists
  431.         sendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿE00000Game already exists", 0);
  432.  
  433.         inGameAt = 0;
  434.         lastGameStatus = 0;
  435.         setNextGameMake();
  436.  
  437.         locationTimeout(15000, location);
  438.         break;
  439.  
  440.     case 27: // Gateway Select
  441.         controlData.clickRealmEntry(me.gatewayid);
  442.         controlData.click(controlData.controls.gateway.button.ok);
  443.         break;
  444.  
  445.     case 28: // Lobby - Game Does Not Exist
  446.         inGameAt = Random(gameDoesNotExistDelayMin, gameDoesNotExistDelayMax);
  447.         //Delay(inGameAt);
  448.         lastGameStatus = 0;
  449.         setNextGameMake();
  450.  
  451.         locationTimeout(gameDoesNotExistTimeout, location);
  452.         break;
  453.     }
  454. }
  455.  
  456. function sendEventToOOG(locationId, statusString, pendingTime)
  457. {
  458.     return SendCopyData("D2NT Manager", null, (locationId<<16)|pendingTime, statusString);
  459. }
  460.  
  461. function setNextGameMake()
  462. {
  463.     lastGameMade = GetTickCount();
  464.     nextGameMake = lastGameMade + createGameThreshold + Random(0-createGameThresholdRandom, createGameThresholdRandom) + inGameAt;
  465.     inGameAt = 0;
  466.     chatActionsDone = false;
  467. }
  468.  
  469. function outputGameLength()
  470. {
  471.     if(inGameAt)
  472.     {
  473.         duration = GetTickCount() - inGameAt;
  474.  
  475.         inGameAt = (duration < gameMinLength ? gameMinLength - duration : 0);
  476.     }
  477. }
  478.  
  479. function locationTimeout(time, location)
  480. {
  481.     endtime = GetTickCount() + time;
  482.  
  483.     while(controlData.getLocation().id == location.id && endtime > GetTickCount())
  484.     {
  485.         sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  486.         Delay(500);
  487.     }
  488.  
  489.     return (controlData.getLocation().id != location.id);
  490. }
  491.  
  492. function timeoutDelay(time, location)
  493. {
  494.     endtime = GetTickCount() + time;
  495.  
  496.     while(endtime > GetTickCount())
  497.     {
  498.         sendEventToOOG(D2NT_MGR_PRINT_STATUS, location.name + " (" + parseInt((endtime-GetTickCount())/1000) + "s)", 0);
  499.         Delay(1000);
  500.     }
  501. }
  502.  
  503. function getRandomString(_length)
  504. {
  505.     _retString = "";
  506.     _charSet = "0123456789abcdefghijklmnopqrstuvwxyz";
  507.  
  508.     while(_length--)
  509.     {
  510.         _retString += _charSet.charAt(Random(0, _charSet.length-1));
  511.         Delay(1);
  512.     }
  513.  
  514.     return _retString;
  515. }
  516. function getGameName(lastGameString)
  517. {
  518.    if(!lastGameString)
  519.       return "";
  520.    else
  521.       return (lastGameString.split("-")[0] + "-");
  522. }
  523.  
  524. function getGameCounter(lastGameString, simple)
  525. {
  526.    var myCount;
  527.    if(!lastGameString)
  528.       return "-1";
  529.    else
  530.    {
  531.       switch(lastGameString.split("-")[1])
  532.       {
  533.          case "08":
  534.             myCount = 9;
  535.             break;
  536.          case "09":
  537.             myCount = 10;
  538.             break;
  539.         case "99":
  540.             myCount = 00;
  541.             break;
  542.          default:
  543.             myCount = parseInt(lastGameString.split("-")[1]) + 1;
  544.             break;
  545.       }
  546.       if(!simple)
  547.       {
  548.          if(myCount <= 9)
  549.             return ('0' + myCount);
  550.       }
  551.       return myCount;
  552.    }
  553. }
  554.  
  555. function My_ExitGame_Check()
  556. {
  557.     for (var i = 0; i < 40; i++)
  558.     {
  559.         if (controlData.getLocation().id != undefined)
  560.             break;
  561.  
  562.         if (i > 38)
  563.         {
  564.             LogPrintSimple(me.account + " StarterTest.txt", "White Screen of Death: Restarting")
  565.             sendEventToOOG(D2NT_MGR_PRINT_LOG, "ÿc1White Screen of Death: Restarting", 0);
  566.             sendEventToOOG(D2NT_MGR_RESTART, "", 5);
  567.             My_Delay(); // make sure and add this also
  568.         }
  569.  
  570.         Delay(500);
  571.     }
  572. }
  573.  
  574. function My_Delay(retry)
  575. {
  576.     if (arguments.length < 1)
  577.         retry = 20;
  578.  
  579.     while (retry-- > 0)
  580.         Delay(1000);
  581. }
  582.  
  583. function LogPrintSimple(filepath, mesg){
  584.  
  585.     var _filepath = filepath;
  586.     var _mesg = mesg;
  587.    
  588.     var date = new Date().toLocaleFormat("<%a, %b %d, %H:%M>");
  589.     var logfile = FileOpen(_filepath, 2); // opens file
  590.     if(!logfile)
  591.         var logfile = FileOpen(_filepath, 1); // if file not there then creates it
  592.  
  593.     logfile.WriteLine(date + " " + _mesg );
  594.     logfile.Close();
  595. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement