SRL Archive - The Bashing Club / BBQ Pit

Someone Fix Smart


YoHoJo

2012-05-25 16:52:12

I don't know anything about anything, I know the fix is easy as shit, so someone fucking do it.

procedure SmartSetupEx(Server: integer; members, signed, superdetail: boolean);
var
prefix: string;
begin
prefix := ReadINI('World' + IntToStr(Server), 'Prefix', IncludePath + 'SRL/SRL/misc/worlds.ini');
if(prefix = '')then
begin
writeln('Invalid world number or corrupted world list. Please review your settings');
TerminateScript;
end;
SmartSetup('http://'+prefix+'.runescape.com/', 'plugin.js?param=o0,a' + IntToStr((Integer(not(Signed)) + 1) * Integer(not((SuperDetail and Signed)))) + ',m' + IntToStr(Integer(Members)), 765, 503, 's');
//SmartSaveSettings([Server, Members, Signed, SuperDetail, SmartGetDC]);
end;

You go there in smart.simba.

Now all the params are dynamic or someshit so you need to fix the
SmartSetup('http://'+prefix+'.runescape.com/', 'plugin.js?param=o0,a' + IntToStr((Integer(not(Signed)) + 1) * Integer(not((SuperDetail and Signed)))) + ',m' + IntToStr(Integer(Members)), 765, 503, 's');

Line.

Then you load rs in browser, view page source and look at this,
http://world13.runescape.com/,j0,f15234001444106085

Then you do some fucking magic and parse the string or use getpage or someshit to read the proper parameters every time even though they are dynamic to fix it.

Before params were static, now they are dynamic/different for everyone.

I don't know shit about how SMART works or how to fix this or anything, but I know it's easy to do.

Someone do it so SMART will load properly, RS can read our pings, and we don't all get banned for loading bad parameters and being obvious.

It takes 5 minutes, I just don't know how and everyone is an asshole, sorry I don't know basic programing just fix the damn thing if it's so easy then, or explain it like you would to someone with 0 experience instead of repeating the same shit over and over when I obviously don't understand what you are saying.

InB4 I already explained it to you, you are a dumbass, I made it as simple as possible , etc

Just fix the one line so everyone can be happy and stop complaining.

I don't even bot/care/have loading problems. I just want it fixed cuz it's broke.

i luffs yeww

2012-05-25 17:12:41

After minimal snooping around, I just wanted to add some information..


http://world34.runescape.com/,f7605086047154497636,iDBXPZaBPotHnzeZldoHBTxIiS7EULKORwMIJCmU
http://world34.runescape.com/,f7605086047154497636,iDBXPZaBPotHnzeZldoHBTxIiS7EULKORwMIJCmU

^ From loading (in browser) from already being cached.


http://world29.runescape.com/,f7605086047154497636,iDBXPZaBPotHnzeZldoHBTxIiS7EULKORwMIJCmU

^ From refreshing (in browser). Same request as before (so, as far as I can tell, once you have the initial request string, it should stay constant).


http://world20.runescape.com/,f2931045511151916005

^ After clearing cache and restarting browser.


http://world21.runescape.com/,f2931045511151916005,iDBXPZaBPotHnzeZldoHBT8eS8gzg6x1fAA4BA4Y

^ After refreshing page. Initial string (f[0-9]*,) stayed the same, and then the first 22 characters (iDBXPZaBPotHnzeZldoHBT) stayed the same from the "already-cached" request. Not sure if that's a unique ID for me based on something that they generate or if it's universal. Only have one machine to test it on.

Hope that maybe helps. Probably not, but meh.

mormonman

2012-05-25 17:47:36

h ttp://world8.runescape.com/,f3020447088152540772
h ttp://world96.runescape.com/,f3020447088152540772,iDBXPZaBPotHnzeZldoHBT0HAH9khdVk9AA8BA4Y

Kyle Undefined

2012-05-25 20:10:43

Send a pull request, then it's fixed.

Kyle Undefined

2012-05-25 20:27:20

The main param always seems to be the same, and start with f. Now, I'm not sure if they're tracking numbers, or just randomly generated and don't mean anything.


f2931045511151916005
f7605086047154497636
f2931045511151916005
f7686785832139986021

YoHoJo

2012-05-25 20:29:59

Luffs also had f2931045511151916005 and f2931045511151916005 like you did, so they can't be (too) random?

Brandon

2012-05-25 20:59:51

Not finished loading: f62101020448972612 (That's the entire thing)..

Finished loading:
world87.runescape.com/,f62101020448972612,iDBXPZaBPotHnzeZldoHBT93ASanfOOt5AA8BA4Y
archive=gamepackVq+5mmrrCTCBIg0gxM36cg8nQL7D40Jl_5679745.jar
Also this part is static:
iDBXPZaBPotHnzeZldoHBT

After that looks random or something :S

Also I got an idea of a fix.

Something like this:

Function GetSmartParameters: String;
var
P1, P2: Integer;
Page: String;
Pieces: TStringList;
begin
Page:= GetPage('http://www.runescape.com/game.ws?j=1');
Pieces:= TStringList.Create;
P1:= Pos('http://world', Page);
P2:= PosEx('" ', Page, P1 + 1);
Result:= Copy(Page, P1, P2 - P1);
Pieces.Free;
end;

But it doesn't fully work.. See the page doesn't get loaded :S Wonder how RSBot does it..
One option would be to use LibCurl with Smart.. If Smart can Use LibCurl or Boost then I wouldn't mind writing it..

Kyle Undefined

2012-05-25 21:10:35

Doing some testing, I can make it load crazy fast for about 3 times, and then it slows back down to a crawl after that.

Still going to work on this.

Here's some data, top part is first param, second part is the numbers after the HBT string.


f2931045511151916005
f7605086047154497636
f2931045511151916005
f7686785832139986021
f0237504546202071077

93ASanfOOt5AA8BA4Y
0HAH9khdVk9AA8BA4Y
8eS8gzg6x1fAA4BA4Y
xIiS7EULKORwMIJCmU

Kyle Undefined

2012-05-25 22:07:03

Double post I know, but I believe I've made some headway. This loads wicked fast, and it's using the "clear cache" method. Which means it just passes in the "f" param with a randomly generated string of numbers behind it. I don't know if Jagex is tracking these numbers or not, but this matches the new structure.

Here it is if you want to test. I can't be certain if it will flag your account or not, since I have no clue what the numbers are for or what they mean. I've left the old structure in there as well, for reference.

Also, I don't know what's the best route of action is. By that I mean do we switch to the new structure, and hope that the param is just randomly generated and has no meaning? Or do we keep using the old structure? This fixes the old structure as well.


procedure SmartSetupEx(Server: integer; members, signed, superdetail: boolean);
var
prefix, param : string;
r : Integer;
begin
prefix := ReadINI('World' + IntToStr(Server), 'Prefix', IncludePath + 'SRL/SRL/misc/worlds.ini');
if(prefix = '')then
begin
writeln('Invalid world number or corrupted world list. Please review your settings');
TerminateScript;
end;

param := 'f';
while(not(Length(param) = 20))do
param := param + IntToStr(RandomRange(0, 9));

SmartSetup('http://'+prefix+'.runescape.com/', ',' + param, 765, 503, 's');
//SmartSetup('http://'+prefix+'.runescape.com/', 'plugin.js?param=o0,a' + IntToStr((Integer(not(Signed)) + 1) * Integer(not((SuperDetail and Signed)))) + ',m' + IntToStr(Integer(Members)), 765, 503, 's');
//SmartSaveSettings([Server, Members, Signed, SuperDetail, SmartGetDC]);

r := SmartGetRefresh;
wait(2000);
SmartSetRefresh(75);
SmartSetRefresh(r);
end;

i luffs yeww

2012-05-26 03:05:09

I can almost 100% assure you that the numbers can't be randomly generated on the client side to be safe. I like where ggzz was going with GetPage. Make a request just like a browser, store the string, and that's what you use for requests later.

I could see how this would be a very effective way to catch all bots, like they did with AR.. Keeping track of all of these strings (requests, could be a value that's hashed or something, I dunno, quite hard to say without leaked information..) and flagging anyone who has a request string that isn't in their servers would give a clear map to anyone using a non-browser client (and of course their client would be fine).

Could be a cunning trick by Jagex. Or them trying to make us think it's a cunning trick.

i'm not sober.

Kyle Undefined

2012-05-26 03:38:39

I do like the GetPage approach, however, it will ping Jagex twice in a row. That could be VERY detectable. Two hits from the same IP, just seconds apart every time SMART is ran? I'd rather wait and see if any more information can be brought up about this though.

Side note, what do you think about adding


r := SmartGetRefresh;
wait(2000);
SmartSetRefresh(75);
SmartSetRefresh(r);

To the current SmartSetupEx? I've tested that with the current version, and the loading is sped up hugely.

Brandon

2012-05-26 04:30:15

From: Kyle Undefined
I do like the GetPage approach, however, it will ping Jagex twice in a row. That could be VERY detectable. Two hits from the same IP, just seconds apart every time SMART is ran? I'd rather wait and see if any more information can be brought up about this though.

To the current SmartSetupEx? I've tested that with the current version, and the loading is sped up hugely.


I think Benland may have solved this already :S In his latest smart, in the CPP file, it shows:


setup((char*)"http://world55.runescape.com/", (char*)"l=2/,f2492772472491484653", 765, 503 (char*)"");

Notice the parameters he used? It's those weird numbers and stuff, I don't recall ever seeing those in previous releases.. I usually saw stuff like "f7" or "f5" but not those numbers :S

A: He's secretly working on this..
B: He's already completed it..

Now where did he get those values :S Someone should ask him.


Anyway you could actually make that pinging into one hit to the page by grabbing the page and the jar in one swoop then loading it with the right parameters.. This would probably require an external library though.. Unless java can grab webpages with some sorta API. Lets assume that we need an external library then smart would be recompiled with the code internally and grab everything for us.. Simba would then just have to call smartsetup with the world and stuff and smart could do the rest.. if a library is needed then curl would be well suited (Bit overkill though, really not necessary.. it can't be this hard).

i luffs yeww

2012-05-26 15:17:16

From: Brandon
I think Benland may have solved this already :S In his latest smart, in the CPP file, it shows:


setup((char*)"http://world55.runescape.com/", (char*)"l=2/,f2492772472491484653", 765, 503 (char*)"");

Notice the parameters he used? It's those weird numbers and stuff, I don't recall ever seeing those in previous releases.. I usually saw stuff like "f7" or "f5" but not those numbers :S

A: He's secretly working on this..
B: He's already completed it..

Now where did he get those values :S Someone should ask him.


Several people have shown similar values. They don't seem to be constant, but if YoHoJo had the same string, that's a little odd..

So where Ben got this is probably just by looking at page requests. If you read the thread you'll see similar answers.

And about the multiple requests.. When you request runescape.com/game.ws?j=1 you send out multiple requests anyway. 22 requests to runescape.com, as of now. So I don't see how requesting the page is too suspicious.

EDIT:

I thought you already posted here, ggzz.. So I'm not sure why you're asking where Ben got his f[0-9]* string.

Sirenia

2012-05-27 16:20:38

Is it safe to bot in Smart or should we bot in a browser until the fix is pushed?

i luffs yeww

2012-05-27 18:26:37

From: Sirenia
Is it safe to bot in Smart or should we bot in a browser until the fix is pushed?


My personal opinion: a browser may be safer for now. I don't know how SMART is dealing with this now, but I would be surprised if Jagex didn't keep track of this specifically to stop botting.

But I could be wrong.

BenLand100

2012-05-28 20:22:25

From: Brandon
I think Benland may have solved this already :S In his latest smart, in the CPP file, it shows:


setup((char*)"http://world55.runescape.com/", (char*)"l=2/,f2492772472491484653", 765, 503 (char*)"");

Notice the parameters he used? It's those weird numbers and stuff, I don't recall ever seeing those in previous releases.. I usually saw stuff like "f7" or "f5" but not those numbers :S

A: He's secretly working on this..
B: He's already completed it..

Now where did he get those values :S Someone should ask him.


Anyway you could actually make that pinging into one hit to the page by grabbing the page and the jar in one swoop then loading it with the right parameters.. This would probably require an external library though.. Unless java can grab webpages with some sorta API. Lets assume that we need an external library then smart would be recompiled with the code internally and grab everything for us.. Simba would then just have to call smartsetup with the world and stuff and smart could do the rest.. if a library is needed then curl would be well suited (Bit overkill though, really not necessary.. it can't be this hard).


You must have pulled that out of one of the test files, not actually from SMART. All of the loading path is SRL side for a reason: so I don't have to release a new version of smart when the loading procedure changes. You just have to pass SMART the page with the applet definition. Whenever I test I just check that page and copy the address, which is what I've been trying to tell you all to do for some time now. I explained it to YoHoJo but I guess he didn't know how and posted here.

If you're interested, my understanding is that Jagex has a few versions/compilations of the client in use at any given time (possibly even on a per-user basis) and that argument string has something to do with that. You should just treat it as dynamic and load that page, parse it, and pass it to SMART. Clearly it's not critical, since it works without it, but it's obvious to Jagex that you're up to no good otherwise.

x[Warrior]x3500

2012-05-28 22:33:54

random notes: i looked into the official rs clients source the other day and found that they parse data from a link located in the .prm file on each of our machines. so i went to that link (mine was http://www.runescape.com/k=3/l=$(Language:0)/jav_config.ws).

< all info after this point was done without looking into the code to see what exactly they parse from the webpage. this is because i am on a different computer>

i looked through the params, and two stuck out to me: 17 and -1. 17 is the same number as the in the url's "userFlow" (possibly shortened to f? for flow). and -1 just seemed similar to the second param that was talked about.
just some thoughts. i personally dont believe any of these numbers are random. i am gunna get into the official clients source again asap. hopefully that will shed a little more light on what exactly they do.

Kyle Undefined

2012-05-28 22:57:24

Doing something like this, does nothing to fix the speed of the loading.


procedure SmartSetupEx(Server: integer; members, signed, superdetail: boolean);
var
prefix, pageData, params: string;
TSA : TStringArray;
i : Integer;
begin
prefix := ReadINI('World' + IntToStr(Server), 'Prefix', IncludePath + 'SRL/SRL/misc/worlds.ini');
if(prefix = '')then
begin
writeln('Invalid world number or corrupted world list. Please review your settings');
TerminateScript;
end;

PageData := GetPage('http://www.runescape.com/game.ws?j=1');
PageData := Between('<iframe', '</iframe>', PageData);
PageData := Between('src="', '"', PageData);
ExplodeWrap(',', PageData, TSA);

for I := 1 to High(TSA) do
params := params + ',' + TSA[i];

SmartSetup('http://'+prefix+'.runescape.com/', params, 765, 503, 's');
//SmartSaveSettings([Server, Members, Signed, SuperDetail, SmartGetDC]);
end;

It grabs the correct parameters and passes them in, but loads even slower.

shstiger2009

2012-05-28 23:06:13

Way off topic, but I just love the pissed off-ness in YoHoJo's OP. :D

Brandon

2012-05-28 23:48:16

Correct Params are loaded though.. I just tested it 11 times in a row:

http://world87.runescape.com/,f684599936022389348

That's the link Simba grabbed for me.. I visited that in a browser and viewed the page info, looked a the param names and they are the exact same as the ones in the smart console. ONLY difference that I saw was the GamePackXXXXXXXXXX.Jar where XXXXXXXXXXXXX was different from that displayed in the browser; Otherwise everything else was perfect..

The code I used:


Function GetSmartParameters: String;
var
P1, P2: Integer;
Page: String;
begin
Page:= GetPage('http://www.runescape.com/game.ws?j=1');
P1:= Pos('http://world', Page);
P2:= PosEx('" ', Page, P1 + 1);
Result:= Copy(Page, P1, P2 - P1);
end;

Procedure SetupSmartX(Server: Integer);
var
Params: TStringArray;
begin
Params:= Explode(',', GetSmartParameters);
writeln(Params);
//Params[0]:= 'http://world87.runescape.com/';
//Params[1]:= 'f684599936022389348'; //Was just testing the params to see if its the same..
SmartSetup(Params[0], 'l=2/,' + Params[1], 765, 503, 's');
end;

var
T: Integer;

begin
{$IFDEF SMART}
SMART_SERVER:= 72;
{$ENDIF}

MarkTime(T);
SetupSmartX(SMART_Server); //27179
//SmartSetupEx(72, True, True, False); //51262
While (Not RSReady) Do
Wait(1);
writeln(TimeFromMark(T));

//DeclarePlayers;
end.

Screeny of the actual source:
http://i.imgur.com/hq8EF.png

Image is large and I don't want my post hanging off to the right side of the screen..

Kyle Undefined

2012-05-29 08:53:58

How fast was the actual loading of the RS client in SMART? Mine grabs the exact same params, yet after SMART loaded, the RS client took even longer to load.

BenLand100

2012-05-29 15:03:25

I think you're missing the point. It would be nice if this fixed the loading speed, BUT the problem is that SRL is loading the client in a BLATANTLY WRONG way. This needs to be fixed without any caveats.

Kyle Undefined

2012-05-29 15:11:07

From: BenLand100
I think you're missing the point. It would be nice if this fixed the loading speed, BUT the problem is that SRL is loading the client in a BLATANTLY WRONG way. This needs to be fixed without any caveats.


From the tests I've done, fixing the way SRL loads the client drastically slows down the load time.

Brandon

2012-05-29 15:19:13

How exactly does SRL load the client :S And Kyle the thing above only speeds it up by a tiny bit.. Getparams > Banhammer though even though smart still loads slow :P

Kyle Undefined

2012-05-29 15:28:20

From: Brandon
How exactly does SRL load the client :S And Kyle the thing above only speeds it up by a tiny bit.. Getparams > Banhammer though even though smart still loads slow :P


I agree, but slow loading is another issue people are having. Switching it to the new way really slows down the client even more.

Ashaman88

2012-05-29 20:21:45

{*******************************************************************************
procedure SetupSRL;
by: SRL Dev Team
Last Edit: 22 June 2010 -- Nava2
Description: Sets up all variables needed to run SRL.
*******************************************************************************}
Function GetSmartParameters: String;
var
P1, P2: Integer;
Page: String;
begin
Page:= GetPage('http://www.runescape.com/game.ws?j=1');
P1:= Pos('http://world', Page);
P2:= PosEx('" ', Page, P1 + 1);
Result:= Copy(Page, P1, P2 - P1);
end;

Procedure SetupSmartX(Server: Integer);
var
Params: TStringArray;
begin
Params:= Explode(',', GetSmartParameters);
SmartSetup(Params[0], 'l=2/,' + Params[1], 765, 503, 's');
end;

procedure SetupSRL;
var
t: Integer;
begin
{$IFNDEF SMART}
{$IFDEF SIMBA}
if (not IsTargetValid) then
srl_Warn('SetUpSRL', 'Target client is not valid! ' +
'Drag the crosshairs over the target client.', warn_Terminate);
{$ENDIF}
{$ENDIF}
SetupBoxes; //Sets up box variables in globals.simba
t := GetTimeRunning;
MouseSpeed := 15;
{$IFDEF UseLaptopMouse}LMouse_MissChance := 75;{$ENDIF}
CheckHPFirst := True;
Reincarnate := False;
TalkAfterRandoms := False;
RoadColor := 0;
WaterColor := 0;
BankColor := 0;

// these need to be removed eventually (no longer used)
SRL_OnFindRandomCall := nil;
LampSkill := 'mining';

//SetUpSRLReport;
LoadCosineArrays;
SymbolAccuracy:= 0.8;
LoadSRLBitMaps;
LoadSRLFonts;
{$IFNDEF SRL_RANDOMS_TEST}
_SetRandoms();
{$ENDIF}
SetupSRLAutoResponder;
SRL_RandomScreenShot := False;
UseFindMod := True;
LogoutOnMod := True;
UseFindTrade := True;
UseAutoResponder := True;
GraphicsSet := False;
AllowPVP := False;
SRL_DisableIPLog := false;
SRL_SavePath := includePath + 'SRL/logs/';
SRL_StartTime := theDate(DATE_MONTH)+' at '+theTime;
WarnSensitivity := -2;
SetupAutoColors;

{$IFDEF LoadExtraFonts}
srl_UpdateFonts(srl_FontsUp2date);
{$ENDIF}

AddOnTerminate('FreeSRL');
SetSupressExceptions(true);
Writeln ('SRL Compiled in '+ IntToStr(GetTimeRunning - t) + ' msec');

{$IFDEF SRL_SMART}
if (Smart_Server = 0) then
begin
Smart_Server := RandomWorld(Smart_Members, False);
Smart_Signed := True;
Smart_SuperDetail := False;
end;
Writeln('SMART Initialized.' + #10 + 'Loaded: Server ' + IntToStr(Smart_Server) + ', Members: ' + BoolToStr(Smart_Members)
+ ', Signed: ' + BoolToStr(Smart_Signed) + ', Super Detail: ' + BoolToStr(Smart_SuperDetail) + '.');
// SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
SetupSmartX(SMART_Server);
SetTargetArray(SmartImageArray, 765,503);
repeat
Wait(100);
if (GetTimeRunning - t) > 120000 then
Break;
smartsetrefresh(75);
until(RSReady);
{$ELSE}
Smart_Server := 0;
Smart_Members := false;
Smart_Signed := True;
Smart_SuperDetail := false;
{$ENDIF}

SetupGauss();
end;

replaced setupsrl in srl.simba with this and it loaded super fast

YoHoJo

2012-05-29 20:24:33

What exactly you change in SetupSRL?

Ashaman88

2012-05-29 20:35:05

From: YoHoJo
What exactly you change in SetupSRL?


All I did was add ggzz's idea and also repeat smartsetrefresh until rs is ready.

Only thing is that it is now reloading smart everytime you restart a script, even with the same smartserver set (at least the 2 times i started a script with it)

YoHoJo

2012-05-29 20:37:21

Oh you doing refreshes.

According to BenLand there is a 'real' way to fix it which is for Simba/SRL to load Runescape 'properly'.

But yeah adding the refresh lines is a great 'qufickfix' for the problem :D!

Rezozo

2012-05-29 20:51:17

Am I the only one who noticed Kyle's Multiple- Double posting…!

Caught in the act! (*No offense*)

Brandon

2012-05-29 22:17:05

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


mormonman

2012-05-30 00:08:40

Brandon send a pull request for srl :) I think that's a great implementation of dynamic loading.

Kyle Undefined

2012-05-30 00:53:34

It may get the correct params, but how fast is the actual RS client load inside of SMART?

Brandon

2012-05-30 01:16:08

From: mormonman
Brandon send a pull request for srl :) I think that's a great implementation of dynamic loading.


From: Kyle Undefined
It may get the correct params, but how fast is the actual RS client load inside of SMART?



I'll send one in a sec. I need to figure out what ben means by: "The Way SRL Loads Smart".. Params are correct but speed is the same unless I touch the refresh bar. Even moving it up by one makes it load extremely fast. Not moving it at all = same speed as before.

I was using:

SmartSetRefresh(SmartGetRefresh + 1); to make it load faster. The bar doesn't have to be maxed.. it just has to be either clicked or moved up or down by 1. So I'm going IRC to ask ben what he means since no one seems to know before I send a pull..

Kyle Undefined

2012-05-30 01:20:56

That's fine. I just don't want to introduce a new issue by fixing something else. I'll do some tests tomorrow to see how it works.

I believe Ben was referring to the URL that SmartSetup uses.

mormonman

2012-05-30 01:40:56

Ben said what you had looks good.

This is what I came up with for 7.1beta

There is no need to save the old params because if there is already a smart remote loaded then it will pair with it.
function GetSmartParams: TStringArray;
var
P1, P2: Integer;
Params: TStringArray;
Page: 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);
writeln(page);
Params := Explode(',', Page);
Result := Params;
end;

function InitSmart(force_new: boolean): integer;
var
i, count: Integer;
Params: TStringArray;
begin
if not force_new then
begin
count := SmartGetClients(True);
if count > 0 then
begin
for i:= 0 to count-1 do
begin
Result := SmartClientID(i);
if SmartPairClient(Result) then
begin
SetEIOSTarget('libsmartremote', ToStr(Result));
Exit;
end;
end;
end;
end;
Params := GetSmartParams;
if (Length(Params) < 2) then Exit;
writeln('url: ' + params[0] + 'l=0/,' + params[1]);
Result := SmartSpawnClient('./Plugins/', params[0], 'l=0/,' + params[1], 765, 503,
's', '', '', -1);
if (Result > 0) then SetEIOSTarget('libsmartremote', ToStr(Result));
end;

Brandon

2012-05-30 01:48:18

From: mormonman
Ben said what you had looks good.

This is what I came up with for 7.1beta

There is no need to save the old params because if there is already a smart remote loaded then it will pair with it.


Ahh Nice nice. That only works with Simba 0.99b5 and above right? and does that fix the load speed issue? I never got around to testing the Smart remote thing because it gave me some crash error report last time so I just loaded it normally. The remote thing works for me in CPP but not Simba :S but that was like at v7 not 7.1 so I guess things changed. But I like that we don't have to save it =]

Going to grab that smart and test that. :D

EDIT:

Loading it the way Mormonman does is a much much better solution as no matter what, the parameters are always fresh and you do not need to save it. Downside to this though is that we all need to use Simba 0.99b5 which is in beta/development stages, and Smart v7.1 which is also beta/development stages. Of course that's not really a "Downside" but meh..

The only problem left is convincing everyone to move to a new smart and simba.. otherwise the method I posted would be the only other solution. Thus we have two solutions, the one for the current simba and smart and the one for the future simba and smart. Someone make a decision lol..

YoHoJo

2012-05-30 06:19:50

Was working fine hours ago, but now I'm getting this every time

{$LoadLib LibSmartRemote}
{$DEFINE SRL5}
{$I SRL/SRL.Simba}

const
{---World Setup Constants---}
WORLD = 35;
MEMBERS = false;
{---------------------------}

Function GetSmartParams: TStringArray;
var
P1, P2: Integer;
Params: TStringArray;
Page: 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);
writeln(page);
Params := Explode(',', Page);
Result := Params;
end;

Function InitSmart(Force_New: Boolean): Integer;
var
I, Count: Integer;
Params: TStringArray;
begin
If (Not Force_New) then
begin
Count := SmartGetClients(True);
if (Count > 0) then
begin
For I:= 0 to Count - 1 Do
begin
Result := SmartClientID(I);
If SmartPairClient(Result) then
begin
SetEIOSTarget('libsmartremote', ToStr(Result));
Exit;
end;
end;
end;
end;
Params := GetSmartParams;
If (Length(Params) < 2) then
begin
Result:= -1;
Exit;
end;
writeln('Loading SMART: ' + Params[0] + ',' + Params[1]);

Result := SmartSpawnClient('./Plugins/', Params[0], ',' + Params[1], 765, 503, 's', '', '', -1);
if (Result > 0) then
SetEIOSTarget('libsmartremote', ToStr(Result));
end;

Procedure SetupSmart;
var
ID, T: Integer;
begin
T := GetTimeRunning;
ID := InitSmart(True);
If (ID <= 0) then
begin
Writeln('** SMART failed to load **');
TerminateScript;
end else
begin
Writeln('Paired With SMART[' + ToStr(ID) + ']');
// SmartSetRefresh(SmartGetRefresh + 1);
// MMouse(2, 2, 0, 0);
//SmartSetRefresh(SmartGetRefresh + 1);
end;

Repeat
Wait(100);
If ((GetTimeRunning - T) > 120000) then
Break;
Until(RSReady);
Writeln('SMART loaded in ' + ToStr(GetTimeRunning - T) + 'ms');
end;

begin
SetupSmart;
SetupSRL;
end.

Edit:
Changed NOTHING, working for now…


Edit:

Tried implementing this into a script
Error: Exception: ActivateClient not available for this target at line 1292
^The script itself.

Removed the line.
Error: Exception: ActivateClient not available for this target at line 571
(again)
But this time in login.simba?!
     begin
Result := True;
Exit; //THIS IS THE LINE
end;
end;
end;
end;

WhatDaFuz?

mormonman

2012-05-30 08:51:33

YoHoJo, please don't try using that yet. Wait for official release along with Lape, Simba 0.99, and SMART v7.1(not beta).

More recent version of some functionality of Smart remote:
http://pastebin.com/BG1aqt22

Kyle Undefined

2012-05-30 09:34:27

So we have a fix for the future, awesome, but what about a fix for today? Are proposing ggzz's fix for the present, and mormons for the future?

Brandon

2012-05-30 11:59:14

From: Kyle Undefined
So we have a fix for the future, awesome, but what about a fix for today? Are proposing ggzz's fix for the present, and mormons for the future?



@Yohojo the reason Activate client works in the SRL include is because it "Probably" uses defines.

Something like:

{$IFNDEF SMART}
ActivateClient;
{ENDIF}
that says if Smart is not defined or included then activateclient.. Smart never needs activating so that line is useless to it. Just needs to be enabled.

Anyway I like Mormonman's code and yeah we need to wait until it's official; until then the only other way is saving them to the file unless someone has a better idea.

BenLand100

2012-05-30 20:42:08

I would like to note that as of v7.1 keeping track of the arguments you started SMART with becomes irrelevant since you will be able to pair to an already started client by its ID. And since you can switch worlds on the fly, there's no reason to track the init args. In that case, something as simple as the following will suffice.

procedure GetSmartParams(var root,params: string);
var
path: String;
loc: integer;
begin
path:= Between('<iframe id="game" src="', '" frameborder', GetPage('http://www.runescape.com/game.ws?j=1'));
loc:= pos('runescape.com/',path);
root:= Copy(path,0,loc+13);
params:= Copy(path,loc+14,length(path)-loc+14);
writeln(root)
writeln(params);
end;

Brandon

2012-05-30 20:57:06

From: BenLand100
I would like to note that as of v7.1..


Ben while your here.. Even with the right params, smart loads slowly still unless I do:

Procedure FixSmartSpeed;
var
T: Integer;
begin
T:= GetSystemTime + 2000;
While (Not SmartEnabled) Do
begin
if (GetSystemTime >= T) Then
Break;
Wait(500);
end;
SmartSetRefresh(SmartGetRefresh + 1);
MMouse(4, 4, 0, 0);
SmartSetRefresh(SmartGetRefresh - 1);
end;

Any reason why? Or at least a theory as to why? And is Smart 7.2 out of beta? SendKeys and ActivateClient does not work with it unless I do "SmartSendKeys('String');


EDIT: I just saw u fixed the SendKeys..

The_Dude

2012-05-31 03:22:08

Should we not be using SMART right now?

YoHoJo

2012-05-31 04:07:45

From: The_Dude
Should we not be using SMART right now?


If you are paranoid don't, but it's pretty highly unlikely that anything bad will happen, but it's possible.

BenLand100

2012-05-31 18:42:18

From: Brandon
Ben while your here.. Even with the right params, smart loads slowly still unless I do:

Any reason why? Or at least a theory as to why? And is Smart 7.2 out of beta? SendKeys and ActivateClient does not work with it unless I do "SmartSendKeys('String');


EDIT: I just saw u fixed the SendKeys..

Define slowly. SMART loads in < 40s for me always across multiple machines, hence I can't really test to see what's wrong. If you're running a version of Java SMART wasn't written for, that could be a problem, but again, that should prevent it from working at all, not cripple it. Since adjusting the refresh bar makes a difference, I suspect that something Jagex is doing calls getGraphics on the client a lot which triggers a lot of lag. However, I've heard reports that people internet speed affects the load time significantly, which could be why I have no problem, because uni nets are awesome. Basically I've been given no hard facts or test cases so I can't reproduce or fix that.

v7.1beta2 is the current test version, but no, not released as stable yet. Will be released as stable with Simba 0.99, which is the minimum version the new loading scheme works with.

If there is a bug with ActivateClient post a bug report (e.g. an actual bug report with code (not a script with SRL dependencies, a test case) to generate the error, not just "ActivateClient doesn't work") on SMART's github and I'll get to it. Can't really expect me to fix something without telling me it's a problem.