From: JoeyGupta
Am I the only one who noticed Kyle's Multiple- Double posting…!
Caught in the act! (*No offense*)
Ahh it's fine.. we all need to see this thread so he's pretty much excused lol..
Also Here I created myself a new way of loading smart.. This will use fresh params and save them to a file. Params will expire every 6 - 24 hrs. I don't know why I put 6-24 hrs but meh seeing as jagex has their crap limits, I thought I might as well make sure nothing fishy will catch us.
What the code below will do is that it will grab some parameters for us before loading smart. It will save these parameters to an INI file everytime it grabs some.
When smart loads, it will check that INI for some fresh params or some params that aren't expire. This will allow smart to not close/open everytime and it will allow us to have the correct params every time.
Problems: I cannot get the inifile to create in the C drive.. so instead I just created one on my desktop. Of course change your own file location. You can open the INI file with a text editor (Preferably notepad++) and see how it works.
I don't know if Ben will like this or if I'm doing it right or wrong or if anyone will like it at all but I'm going to use this myself instead of the default SmartSetup.
EDIT: Fixed it so that it only writes new params to the file if they are outdated or don't exist.. If they exist and aren't outdated, it will just use them without saving new ones.
{$DEFINE SMART}
{$I SRL/SRL.Simba}
const
SmartFileLocation = 'C:/Users/Brandon/Desktop/SmartWorlds.INI';
Function Convert24Hours(Time: TStringArray): TStringArray;
var
Value: Integer;
begin
If (Not ExecRegExpr('AM|am', Time[2])) then
begin
Value:= StrToInt(Time[0]);
IncEx(Value, 12);
Time[0]:= IntToStr(Value);
end;
Result:= Time;
end;
Function ParamsOutdated(World: String): Boolean;
var
CurrentTime, LastWritten: String;
DateTimeData, OldTime, NewTime: TStringArray;
begin
Result:= False;
LastWritten:= ReadINI('DateTime', 'Date' + World, SmartFileLocation);
if (Length(LastWritten) < 1) then
begin
Result:= True;
Exit;
end;
DateTimeData:= Explode('-', LastWritten);
if (DateTimeData[0] <> TheDate(Date_Month)) then
begin
CurrentTime:= TheTime;
OldTime:= Convert24Hours(Explode(':', DateTimeData[1]));
NewTime:= Convert24Hours(Explode(':', CurrentTime));
Result:= (Abs((StrToInt(NewTime[0]) - StrToInt(OldTime[0]))) >= 6);
Exit;
end else
Result:= False;
end;
Function SaveNewParams: TStringArray;
var
P1, P2: Integer;
Params: TStringArray;
Page, World: String;
begin
Page:= GetPage('http://www.runescape.com/game.ws?j=1');
P1:= Pos('http://world', Page);
P2:= PosEx('" ', Page, P1 + 1);
Page:= Copy(Page, P1, P2 - P1);
Params:= Explode(',', Page);
P1:= Pos('world.', Params[0]);
P2:= PosEx('.runescape', Params[0], P1 + 1);
World:= Copy(Params[0], P1 + 13, P2 - (P1 + 13));
writeln('Params Grabbed: ' + ToStr(Params));
If ParamsOutdated(World) Then
begin
WriteINI('World', 'Server' + World, Params[1], SmartFileLocation);
WriteINI('DateTime', 'Date' + World, TheDate(Date_Month) + '-' + TheTime, SmartFileLocation);
end;
Result:= Params;
end;
Function GetSmartParams(Server: Integer): TStringArray;
var
World: String;
begin
World:= IntToStr(Server);
If ParamsOutdated(World) then
begin
Result:= SaveNewParams;
Exit;
end;
World:= ReadINI('World', 'Server' + World, SmartFileLocation);
If (Length(World) > 0) then
begin
SetLength(Result, 2);
Result[0]:= 'http://world' + IntToStr(Server) + '.runescape.com/';
Result[1]:= World;
end;
end;
Function GetAnyValidParams(Server: String): TStringArray;
var
I: Integer;
begin
if (ParamsOutdated(Server)) then
begin
For I:= 1 To 138 Do
If (Not ParamsOutdated(IntToStr(I))) then
begin
SetLength(Result, 2);
Result[0]:= 'http://world' + IntToStr(I) + '.runescape.com/';
Result[1]:= ReadINI('World', 'Server' + IntToStr(I), SmartFileLocation);
Break;
end;
end else
begin
SetLength(Result, 2);
Result[0]:= 'http://world' + Server + '.runescape.com/';
Result[1]:= ReadINI('World', 'Server' + Server, SmartFileLocation);
end;
end;
Procedure SetupSmartX(Server: Integer; AnyParams: Boolean);
var
Params: TStringArray;
begin
Params:= GetSmartParams(Server);
If AnyParams then
Params:= GetAnyValidParams(IntToStr(Server));
writeln('Params Used: ' + ToStr(Params));
SmartSetup(Params[0], 'l=2/,' + Params[1], 765, 503, 's');
end;
begin
SetupSmartX(45, True); //False will use fresh params EVERY TIME.. causing an already open smart to close.
//True will use valid params from the Initialization file. If none, it will grab some and use it.
end.
EDIT 2: Here's a list of Params I currently grabbed from a BenchTest.. It also shows the Date and Time they were grabbed.. 6 -24 hrs from those times, they will expire.
[World]
Server4=f7021554535069661924
Server43=f2983055355466736997
Server45=f3019159466646543588
Server79=f7560684294762093157
Server63=f5202150241775371237
Server72=f599968784316158949
Server70=f2396722436159275748
Server20=f4673520882373456612
Server29=f7615657867666976484
Server36=f5191005845587647076
Server37=f4750830597745241957
Server48=f2940128478805105253
Server61=f99022513827243621
Server73=f678627178343178084
Server98=f599410208054881509
Server99=f2976860478645501924
Server100=f2952908182446271845
Server103=f7494822593996137189
Server104=f2411318761484424804
Server115=f2956497987159017573
Server7=f4753864458930901093
Server13=f38245823011953893
Server30=f2384313116172760421
Server34=f2320570671017729509
Server38=f686431144996101988
Server41=f7037398099342514276
Server88=f7540706490820936804
Server97=f7048728164985120612
Server114=f110411733410227173
Server8=f2974246258833774181
Server57=f2338205337060765284
Server27=f647151420288599268
Server35=f584645952853138917
Server96=f6970639507000110436
Server1=f2978599128559507172
Server3=f20972573502635108
Server17=f5326284420612029540
Server33=f4742341339838067173
Server62=f2928130416063817956
Server116=f2342388367414934884
Server14=f634232686603562981
Server22=f2344328120734627940
Server44=f3004358465883459940
Server39=f4742284557249399909
Server78=f4617701001096299493
Server11=f7020295432802789732
Server26=f7591439900118405988
Server16=f4711467534965535332
Server23=f5189870926931785189
Server24=f5197970299829295972
Server18=f60452355551605733
Server46=f2379904684904352101
Server21=f7019683890482012005
Server87=f631208949821163621
Server6=f7040548960809484261
Server77=f7003495690282780517
Server42=f7013211130511637092
Server89=f6964901523206349925
Server31=f2900228539297486309
Server76=f5201288906677409253
[DateTime]
Date4=05/29/12-10:24:40 PM
Date43=05/29/12-10:26:40 PM
Date45=05/29/12-10:09:00 PM
Date79=05/29/12-10:09:10 PM
Date63=05/29/12-10:24:57 PM
Date72=05/29/12-10:29:29 PM
Date70=05/29/12-10:47:31 PM
Date20=05/29/12-10:47:31 PM
Date29=05/29/12-10:47:31 PM
Date36=05/29/12-10:47:32 PM
Date37=05/29/12-10:47:32 PM
Date48=05/29/12-10:47:32 PM
Date61=05/29/12-10:47:33 PM
Date73=05/29/12-10:47:33 PM
Date98=05/29/12-10:47:33 PM
Date99=05/29/12-10:47:34 PM
Date100=05/29/12-10:47:34 PM
Date103=05/29/12-10:47:34 PM
Date104=05/29/12-10:47:34 PM
Date115=05/29/12-10:47:35 PM
Date7=05/29/12-10:47:35 PM
Date13=05/29/12-10:47:35 PM
Date30=05/29/12-10:47:36 PM
Date34=05/29/12-10:47:36 PM
Date38=05/29/12-10:47:36 PM
Date41=05/29/12-10:47:37 PM
Date88=05/29/12-10:47:37 PM
Date97=05/29/12-10:47:38 PM
Date114=05/29/12-10:47:38 PM
Date8=05/29/12-10:47:38 PM
Date57=05/29/12-10:47:39 PM
Date27=05/29/12-10:47:39 PM
Date35=05/29/12-10:47:39 PM
Date96=05/29/12-10:47:40 PM
Date1=05/29/12-10:47:40 PM
Date3=05/29/12-10:47:41 PM
Date17=05/29/12-10:47:41 PM
Date33=05/29/12-10:47:41 PM
Date62=05/29/12-10:47:42 PM
Date116=05/29/12-10:47:42 PM
Date14=05/29/12-10:47:42 PM
Date22=05/29/12-10:47:42 PM
Date44=05/29/12-10:47:43 PM
Date39=05/29/12-10:47:43 PM
Date78=05/29/12-10:47:43 PM
Date11=05/29/12-10:47:45 PM
Date26=05/29/12-10:47:45 PM
Date16=05/29/12-10:47:47 PM
Date23=05/29/12-10:47:47 PM
Date24=05/29/12-10:47:47 PM
Date18=05/29/12-10:47:53 PM
Date46=05/29/12-10:47:53 PM
Date21=05/29/12-10:47:56 PM
Date87=05/29/12-10:47:57 PM
Date6=05/29/12-10:47:58 PM
Date77=05/29/12-10:48:42 PM
Date42=05/29/12-10:49:32 PM
Date89=05/29/12-10:49:51 PM
Date31=05/29/12-10:50:01 PM
Date76=05/29/12-10:50:37 PM