Jump to content
shadowrecon

Shadows Fix For RS has been updated - Check it out =) 100% working

Recommended Posts

So after some time thinking on how this could be done i went into github looking around, noticed how the functions were calling/setting themselfs up and came up with this solution, i did some testing and everything works great checked memory to make sure smart wasnt dueplicating its self and leaving residue and as far as i can tell its 100% a working solution, this is only a reload smart function so you will need to also add a dection system for detecting the 'RS had been' Updated but that shouldnt be to hard, or put your main loop on a timer and call this function after 5 hours or so.. well take a look and tell me what you think..

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function ReloadSMART: Boolean;
Contributors: ShadowRecon.
Description: Shutsdown SMART, and then reopens it, returns true if player logged in, false if not.
Date Created: 1/10/2012  By ShadowRecon.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
Function ReloadSMART:boolean;
Begin
Writeln('Reloading Smart');
wait(1000);
SmartSetupEx(10,True);
writeln('SMART has been Reloaded');
Writeln('Waiting on login screen');
SmartSetTarget; // Makes Sure the new SMART window is declared as active
repeat  // waits until login screen is dectected
 begin
  Wait(1000); 
 end;
until (LoginScreen = True);
 if not(LoginScreen = true) then
  exit;
   if (not (LoggedIn)) then
    begin
      if (Login = true) then
       begin
        result := True;
        WaitRR(500, 750);
       end;
    end;
   if (not (LoggedIn)) then
    begin
      Writeln('No Players Active..');
      TerminateScript; // this can be edited out...
      result := False;
      Exit;
    end;
end;

Edited by shadowrecon
Link to comment
Share on other sites

The example posted may not work. If you call smart setup with a different world number smart will reload. Does this free the previous smart? dunno.

 

And to check if you need to (not tested but should do ya):

if (not LoggedIn) and (Players[CurrentPlayer].Loc = 'RS updated') then
begin
 Players[CurrentPlayer].Active := True;
 ReloadSmart;
 Login;
end;

Link to comment
Share on other sites

Setting the players back to active is a good point, i have been running my scripts on timers and just calling the reloadsmart at a 5 hour interval.

 

I did notice that after called 6 or 7 times it does kinda lag up scar and smart, found this out in initial testing when i was restarting smart over and over in a row, but if you do it once and watch memory its not crazy, my bots run around 400k ram constantly and im at about 450k which could be because of reload or ect. but 50mb isnt nothing out of 8g so why worry but i guess for people with old computers this could be an issue.

 

I figure if i get 10-12 hours of botting and i have to restart scar after that oh well, the best fix would to have a command within the smart JVM instance instead of using scar to manipulate it. But for now i think this is a viable solution that could be easily implemented into any script.

Edited by shadowrecon
Link to comment
Share on other sites

I dont know if anyone else has been trying this function or not, but ive had pretty good results, if the script runs over about 20 hours there is a major spike in memory usage, but it keeps running with out crashing, so aslong as your computer can take the beatin it seems to be a fix for now. heres how i have set up in my script: All im doing id putting the reloadsmart function on a timer and when the script run time = 5 hours it reloads. while keeping up with previous hours so when it reloads it just doesnt reload again as there is no way to reset script timer? asfar as i know.

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function ReloadSMART: Boolean;
Contributors: ShadowRecon.
Description: Shutsdown SMART, and then reopens it, returns true if player logged in, false if not.
Date Created: 1/10/2012  By ShadowRecon.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
Function ReloadSMART:boolean;
Begin
Writeln('Reloading Smart');
wait(1000);
SmartSetupEx(10,True);
writeln('SMART has been Reloaded');
Writeln('Waiting on login screen');
SmartSetTarget; // Makes Sure the new SMART window is declared as active
repeat  // waits until login screen is dectected
 begin
  Wait(1000);
 end;
until (LoginScreen = True);
 if not(LoginScreen = true) then
  exit;
   if (not (LoggedIn)) then
    begin
      if (Login = true) then
       begin
        result := True;
        WaitRR(500, 750);
       end;
    end;
   if (not (LoggedIn)) then
    begin
      Writeln('No Players Active..');
      TerminateScript; // this can be edited out...
      result := False;
      Exit;
    end;
end;

Procedure CheckTimeRunning;
var
H,M,S,PreviousH: integer;
begin
ConvertTime(GetTimeRunning,H,M,S);
if ( (H - PreviousH) > 5) then
 begin
   PreviousH := H;
    if ReloadSMART = true then
      exit;
 end
  else
   exit;
end;

Link to comment
Share on other sites

Freddy, your right. I have been kinda selfish with codes lately. Just the whole UnitedBots coming up and everything I just wanted a bit of a headstart before releasing the codes I use if you get what I mean? I really will be helping build this community with free bots and help as soon as possible. Trying to still help as much as possible. But I think I see what your saying.. if im not gonna give the code out yet then why the hell should I publicly even announce it... ego? Ya I understand but it has nothign to do with ego bro. Ill be giving out codes and new functions here soon bro. Still field testing too and getting some bots ready for public release.

Link to comment
Share on other sites

yeah its not a permanent fix, but like i said it runs for 15-20 hours np by that time tho my guys are stuck in randoms or lookin goofy. my other solution was to call a reload of the script by using getfile() and replacing the current script with a new one and having it reload scar and start over, but there would be no way to track how many time this has been done nor which players were inactive.. ect.

 

fail-safes are always nice =p i build all of my functions with atleast 2 sometimes alot more.. i think redundancy is the most important part to your script being successful. an extra 400 lines in failsafes is not going to effect your performance with the script but only make it more likely to succeed =)

Edited by shadowrecon
Link to comment
Share on other sites

yeah its not a permanent fix, but like i said it runs for 15-20 hours np by that time tho my guys are stuck in randoms or lookin goofy. my other solution was to call a reload of the script by using getfile() and replacing the current script with a new one and having it reload scar and start over, but there would be no way to track how many time this has been done nor which players were inactive.. ect.
What an awesome idea. Dump any relevant info out to a status file, reload SCAR, read in file and set things "back" and presto magic you could go forever. Okay it's a bit more complicated than that, but not by much.

 

fail-safes are always nice =p i build all of my functions with atleast 2 sometimes alot more.. i think redundancy is the most important part to your script being successful. an extra 400 lines in failsafes is not going to effect your performance with the script but only make it more likely to succeed =)
I couldn't agree with you more. I put an insane amount of checking in my scripts. Drives Wanted nuts reading my scripts: thinks it's overkill.
Link to comment
Share on other sites

What an awesome idea. Dump any relevant info out to a status file, reload SCAR, read in file and set things "back" and presto magic you could go forever. Okay it's a bit more complicated than that, but not by much.

 

I couldn't agree with you more. I put an insane amount of checking in my scripts. Drives Wanted nuts reading my scripts: thinks it's overkill.

 

yeah i was talking to freddy about reading files off the internet and he said u could save what you read to the script your using and it would cause scar to reload, so i was like hmm... lol.

 

if else if else if.. < i love if loops i wish i could get away from all of the 'over kill' with using those things but im always like well 'if' that happens then i would need to do this.. loll. so a simple script ends up being over 600+ lines, but ill tell you what they always work! =) lol. My wc bot posted in the script forms is done alot like that, but it works flawlessly, ive since updated it alot but the core is pretty much the same neither the less they both work and the colors havent been updated in ages!

Link to comment
Share on other sites

You would have to do more than simply reload the script. I recall BenLand saying because SMART runs in the same process thread (to allow communication between SCAR and SMART) the memory from SMART does not get freed entirely until you exit SCAR completely. He was talking about SIMBA but I believe the same applies to SCAR?

 

Which means you would need a "controller" of some sort to close/restart SCAR when prompted to, which means inter-process communication of some sort. Maybe something as simple as a 2nd scar that clicks the close button on the first SCAR then re-clicks on the SCAR icon, etc, etc.

Link to comment
Share on other sites

You would have to do more than simply reload the script. I recall BenLand saying because SMART runs in the same process thread (to allow communication between SCAR and SMART) the memory from SMART does not get freed entirely until you exit SCAR completely. He was talking about SIMBA but I believe the same applies to SCAR?

 

Which means you would need a "controller" of some sort to close/restart SCAR when prompted to, which means inter-process communication of some sort. Maybe something as simple as a 2nd scar that clicks the close button on the first SCAR then re-clicks on the SCAR icon, etc, etc.

 

oh wow, yeah why not just make it log-out your guy, close smart, then open new scar and have default script set to the one your using and hit play, then in the start of script have it check for another scar and if found then close it before loading osi... real pain in the butt but would work i think?

Link to comment
Share on other sites

Shadow I told you about that last week, dont sound surprised lol.

 

I think it comes still with an issue that it would be hard to make it universal, screen size, computer size, where is the application. Freddy said there is a shell plugin we could use. but then you have to make sure everyone is using it. Security risks that way. So there is 3 ways to go about this. The easiest is the hardest to make universal. The hardest is the easiest to have people not trust your scripts.

 

Now the original method is still the best which was posted. so until a fix comes through smart itself or freddy implements a reload then so be it,

 

Since freddy wont put in a (reload scar) function. :P ( do it do it )

Edited by rsutton
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...