SRL Archive - OSR Help

How can I...?


SimbaGod

2013-10-06 21:02:40

Edited thread! Got help for something else but now im asking…

IMPORTANT* Is it possible to add a code so the bot can stay logged in? Like for example, each 30 seconds, it moves the camera? I would like a simple code with anything that can let the bot stay logged in. :D

less IMPORTANT* Is it possible to change the link in of 2007 for eoc? Basically I want to get both so if you are able to put them both in one script(like when you say !07 its pc 2007 and if !eoc its pc eoc), would be great. If not, can you guys help make this into RS3? I think its only the link but i dont know what link for eoc and if its really that.


program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

Type T07Item = record
Name : String;
ID,Average,RecentLow,
RecentHigh,AlchPrice : Integer;
end;

var
LastT : string;

// By Flight
function getItem(Item: String): T07ITem;
var
fullS,s1,s2: String;
begin
Result.ID := 0;
fullS := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (Pos('"error"', fullS) > 0) then
Exit;

Result.Name := capitalize(Item);
Result.ID := Round(StrToInt(between('"id":"', '"', fullS)));
Result.Average := Round(StrToFloat(between('average":"', '"', fullS)));
Result.RecentHigh := Round(StrToFloat(between('t_high":"', '"', fullS)));
Result.RecentLow := Round(StrToFloat(between('t_low":"', '"', fullS)));
Result.AlchPrice := Round(StrToFloat(between('lch":"', '"', fullS)));
end;

procedure start();
var
T,S : String;
I : Integer;
item: T07Item;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
TypeSend('/'+item.Name+' is '+intToStr(item.Average))
else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end else if (Expl[I] = '!full') then
begin
T := replace(T, '!full ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
begin
S := toStr(item);
TypeSend('/'+S);
end else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Flight

2013-10-06 21:16:22

Give me a second and I'll edit this post.

Edit:
Untested but this should work:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
var
LastT : string;

function getPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
var
s1,s2: String;
begin
s1 := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (s1 = '{"error":"No results found."}') then
Exit;

s2 := Between('"average":"', '"', s1);
Result := Round(StrToFloat(s2));
end;

procedure start();
var
T : String;
I,P : Integer;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '+');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
P := getPrice(T);
if (P > 0) then
TypeSend(capitalize(T)+' pricechecked at ' + IntTostr(P) + ' GP')
else
begin
writeln('Incorrect item');
Exit;
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Let me know how that works for ya.

SimbaGod

2013-10-06 21:18:06

From: Flight
Give me a second and I'll edit this post.


OK! thanksss

SimbaGod

2013-10-06 21:44:46

From: Flight
Give me a second and I'll edit this post.

Edit:
Untested but this should work:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
var
LastT : string;

function getPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
var
s1,s2: String;
begin
s1 := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (s1 = '{"error":"No results found."}') then
Exit;

s2 := Between('"average":"', '"', s1);
Result := Round(StrToFloat(s2));
end;

procedure start();
var
T : String;
I,P : Integer;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '+');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
P := getPrice(T);
if (P > 0) then
TypeSend(capitalize(T)+' pricechecked at ' + IntTostr(P) + ' GP')
else
begin
writeln('Incorrect item');
Exit;
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Let me know how that works for ya.


Theres a + meaning the space for the item before the pricechecked. Can it be a space beside of a + (see screenshot)? Also,the "incorrect item" doesnt work. It says the pc of the item before.

Screenshot:

Flight

2013-10-06 22:55:23

Try this:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
var
LastT : string;

function getPrice(Item: String): Integer; // Made by Shatterhand, you're awesome! :)
var
s1,s2: String;
begin
Result := 0;
s1 := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (s1 = '{"error":"No results found."}') then
Exit;

s2 := Between('"average":"', '"', s1);
Result := Round(StrToFloat(s2));
end;

procedure start();
var
T : String;
I,P : Integer;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
P := getPrice(T);
if (P > 0) then
TypeSend(capitalize(T)+' pricechecked at ' + IntTostr(P) + ' GP')
else
begin
writeln('Incorrect item');
Exit;
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

SimbaGod

2013-10-07 07:38:07

From: Flight
Try this:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
var
LastT : string;

function getPrice(Item: String): Integer; // Made by Shatterhand, you're awesome! :)
var
s1,s2: String;
begin
Result := 0;
s1 := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (s1 = '{"error":"No results found."}') then
Exit;

s2 := Between('"average":"', '"', s1);
Result := Round(StrToFloat(s2));
end;

procedure start();
var
T : String;
I,P : Integer;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
P := getPrice(T);
if (P > 0) then
TypeSend(capitalize(T)+' pricechecked at ' + IntTostr(P) + ' GP')
else
begin
writeln('Incorrect item');
Exit;
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.


Hey! thanks for doing this :D I have a problem with the script tho. The item name is great but the mistake thing isnt workin. It stops the bot like before.


Daniel

2013-10-07 08:34:50

Try this one ;)


program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}
var
LastT : string;

function getPrice(Item: String): Integer; // Made by Shatterhand, you're awesome! :)
var
s1,s2: String;
begin
Result := 0;
s1 := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (s1 = '{"error":"No results found."}') then
Exit;

s2 := Between('"average":"', '"', s1);
try
Result := Round(StrToFloat(s2));
except
Writeln(Format('Invalid item ''%s''.', [Item]));
end;
end;

procedure start();
var
T : String;
I,P : Integer;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
P := getPrice(T);
if (P > 0) then
TypeSend(capitalize(T)+' pricechecked at ' + IntTostr(P) + ' GP')
else
begin
writeln('Incorrect item');
Exit;
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Or what Flight suggested below. That would be the better solution as it is more in line with the original code.

Flight

2013-10-07 08:37:02

Ok try this: replace these two lines:

if (s1 = '{"error":"No results found."}') then
Exit;
with these two lines:

if (Pos('"error"', s1) > 0) then
Exit;

SimbaGod

2013-10-07 16:19:48

From: Flight
Ok try this: replace these two lines:

if (s1 = '{"error":"No results found."}') then
Exit;
with these two lines:

if (Pos('"error"', s1) > 0) then
Exit;


didnt quite work but with all your help, i got my pc working! Thank you :)

SimbaGod

2013-10-07 18:36:57

Edited thread! Need help for that!

SimbaGod

2013-10-08 23:22:19

Need something else! Was thinking it was simple to do (im starting) but i cant see it! Help me :S

Flight

2013-10-08 23:29:31

Yeah that's possible if you create a new type in the script which will store the item data. Give me a few minutes and I'll see what I can come up with.

Try this on for size:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

Type T07Item = record
Name : String;
ID,Average,RecentLow,
RecentHigh,AlchPrice : Integer;
end;

var
LastT : string;

// By Flight
function getItem(Item: String): T07ITem;
var
fullS,s1,s2: String;
begin
Result.ID := 0;
fullS := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (Pos('"error"', fullS) > 0) then
Exit;

Result.Name := capitalize(Item);
Result.ID := Round(StrToInt(between('"id":"', '"', fullS)));
Result.Average := Round(StrToFloat(between('age":"', '"', fullS)));
Result.RecentHigh := Round(StrToFloat(between('t_high":"', '"', fullS)));
Result.RecentLow := Round(StrToFloat(between('t_low":"', '"', fullS)));
Result.AlchPrice := Round(StrToFloat(between('lch":"', '"', fullS)));
end;

procedure start();
var
T,S : String;
I : Integer;
item: T07Item;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
TypeSend('/'+item.Name+': '+intToStr(item.Average))
else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end else if (Expl[I] = '!full') then
begin
T := replace(T, '!full ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
begin
S := toStr(item);
TypeSend('/'+S);
end else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Type "!pc (item name)" for getting the average price only. Type "!full (item name)" for getting all the data of an item (Name, ID, average price, recent high, recent low, high alch value). For example, if you did "!full raw monkfish" this is what you would get:

"{'Raw_monkfish', 3889, 415, 415, 414, 138}"

…assuming my code above is correct.

SimbaGod

2013-10-09 07:29:31

From: Flight
Yeah that's possible if you create a new type in the script which will store the item data. Give me a few minutes and I'll see what I can come up with.

Try this on for size:

program Pricechecker;
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

Type T07Item = record
Name : String;
ID,Average,RecentLow,
RecentHigh,AlchPrice : Integer;
end;

var
LastT : string;

// By Flight
function getItem(Item: String): T07ITem;
var
fullS,s1,s2: String;
begin
Result.ID := 0;
fullS := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (Pos('"error"', fullS) > 0) then
Exit;

Result.Name := capitalize(Item);
Result.ID := Round(StrToInt(between('"id":"', '"', fullS)));
Result.Average := Round(StrToFloat(between('age":"', '"', fullS)));
Result.RecentHigh := Round(StrToFloat(between('t_high":"', '"', fullS)));
Result.RecentLow := Round(StrToFloat(between('t_low":"', '"', fullS)));
Result.AlchPrice := Round(StrToFloat(between('lch":"', '"', fullS)));
end;

procedure start();
var
T,S : String;
I : Integer;
item: T07Item;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
TypeSend('/'+item.Name+': '+intToStr(item.Average))
else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end else if (Expl[I] = '!full') then
begin
T := replace(T, '!full ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
begin
S := toStr(item);
TypeSend('/'+S);
end else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end;
end;
until false;
end;

begin
setupSRL();
activateClient();

start();
end.

Type "!pc (item name)" for getting the average price only. Type "!full (item name)" for getting all the data of an item (Name, ID, average price, recent high, recent low, high alch value). For example, if you did "!full raw monkfish" this is what you would get:

"{'Raw_monkfish', 3889, 415, 415, 414, 138}"

…assuming my code above is correct.


Thanks flight! I got an error doing !pc rune and !full rune. Both came up with this :



Edit: All is ok! I replaced "age" with "average" and it works. THANKS FLIGHT! I know im annoying but is it possible that the bot stays loged in? like is it possible to code for the bot : each 30 seconds, the camera moves.

Because it logs out when inactive.

SimbaGod

2013-10-09 16:18:30

"
IMPORTANT* Is it possible to add a code so the bot can stay logged in? Like for example, each 30 seconds, it moves the camera? I would like a simple code with anything that can let the bot stay logged in. "

Or type a letter each 1 min to be active and stay logged in XD

SimbaGod

2013-10-10 07:04:33

Need this!

Hoodz

2013-10-10 08:14:01

From: SimbaGod
Need this!


you can make another procedure like this


procedure NoLog;
begin
case random(6969) of //you can change this. of you want this more frequent you lower the number.
0..10: randomtab(false);
11..20: makecompass(randomrange(0, 360));
end;
end;

this will click random tabs and move the camera randomly.

SimbaGod

2013-10-10 17:08:56

From: hoodz
you can make another procedure like this


procedure NoLog;
begin
case random(6969) of //you can change this. of you want this more frequent you lower the number.
0..10: randomtab(false);
11..20: makecompass(randomrange(0, 360));
end;
end;

this will click random tabs and move the camera randomly.


Does not work :( can u do copy the full link and insert it so m sure i did the right thing? Maybe its the code tho?

Hoodz

2013-10-10 17:13:40

From: SimbaGod
Does not work :( can u do copy the full link and insert it so m sure i did the right thing? Maybe its the code tho?

idk if this was the correct one, but this should work. if its never doing anything try to lower the amount (6966)

program pricechecker;

{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

Type T07Item = record
Name : String;
ID,Average,RecentLow,
RecentHigh,AlchPrice : Integer;
end;

var
LastT : string;

// By Flight
function getItem(Item: String): T07ITem;
var
fullS,s1,s2: String;
begin
Result.ID := 0;
fullS := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (Pos('"error"', fullS) > 0) then
Exit;

Result.Name := capitalize(Item);
Result.ID := Round(StrToInt(between('"id":"', '"', fullS)));
Result.Average := Round(StrToFloat(between('age":"', '"', fullS)));
Result.RecentHigh := Round(StrToFloat(between('t_high":"', '"', fullS)));
Result.RecentLow := Round(StrToFloat(between('t_low":"', '"', fullS)));
Result.AlchPrice := Round(StrToFloat(between('lch":"', '"', fullS)));
end;

procedure start();
var
T,S : String;
I : Integer;
item: T07Item;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
TypeSend('/'+item.Name+': '+intToStr(item.Average))
else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end else if (Expl[I] = '!full') then
begin
T := replace(T, '!full ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
begin
S := toStr(item);
TypeSend('/'+S);
end else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end;
end;
until false;
end;

procedure NoLog;
begin
case random(6969) of //you can change this. of you want this more frequent you lower the number.
0..10: randomtab(false);
11..20: makecompass(randomrange(0, 360));
end;
end;

begin
setupSRL();
activateClient();
repeat
start();
NoLog;
until(false)
end.

SimbaGod

2013-10-10 20:13:59

From: hoodz
idk if this was the correct one, but this should work. if its never doing anything try to lower the amount (6966)

program pricechecker;

{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

Type T07Item = record
Name : String;
ID,Average,RecentLow,
RecentHigh,AlchPrice : Integer;
end;

var
LastT : string;

// By Flight
function getItem(Item: String): T07ITem;
var
fullS,s1,s2: String;
begin
Result.ID := 0;
fullS := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
if (Pos('"error"', fullS) > 0) then
Exit;

Result.Name := capitalize(Item);
Result.ID := Round(StrToInt(between('"id":"', '"', fullS)));
Result.Average := Round(StrToFloat(between('age":"', '"', fullS)));
Result.RecentHigh := Round(StrToFloat(between('t_high":"', '"', fullS)));
Result.RecentLow := Round(StrToFloat(between('t_low":"', '"', fullS)));
Result.AlchPrice := Round(StrToFloat(between('lch":"', '"', fullS)));
end;

procedure start();
var
T,S : String;
I : Integer;
item: T07Item;
Expl: TStringArray;
begin
repeat
T := lowercase(getChatBoxText(8, 128));
Expl := explode(' ', T)

for I:=0 to high(Expl) do
begin
if (Expl[I] = '!pc') then
begin
T := replace(T, '!pc ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
TypeSend('/'+item.Name+': '+intToStr(item.Average))
else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end else if (Expl[I] = '!full') then
begin
T := replace(T, '!full ', '');
T := replace(T, ' ', '_');

if not (T = LastT) then
begin
LastT := T;
writeLn(T);
item := getItem(T);
if (item.ID > 0) then
begin
S := toStr(item);
TypeSend('/'+S);
end else
begin
writeln('Incorrect item');
TypeSend('/Incorrect Item');
end;
end;
end;
end;
until false;
end;

procedure NoLog;
begin
case random(6969) of //you can change this. of you want this more frequent you lower the number.
0..10: randomtab(false);
11..20: makecompass(randomrange(0, 360));
end;
end;

begin
setupSRL();
activateClient();
repeat
start();
NoLog;
until(false)
end.


sry but still not working :S even with that you said (the change) :(

Flight

2013-10-10 20:23:11

From: SimbaGod
sry but still not working :S even with that you said (the change) :(


Come on man, I already did the hard part for you. Surely you can make a loop that calls this (and random-finders) constantly and also does random anti-bans. Just read up on some tutorials about loops and adding anti-bans to your script. I'm positive you can come up with something nice on your own if you just give a little effort.

SimbaGod

2013-10-10 20:54:19

From: Flight
Come on man, I already did the hard part for you. Surely you can make a loop that calls this (and random-finders) constantly and also does random anti-bans. Just read up on some tutorials about loops and adding anti-bans to your script. I'm positive you can come up with something nice on your own if you just give a little effort.


I tried many things… I cant get it! I tried doing an auto typer with the pc bot so it wont log out. I tried doing the camera thing but didnt work. I got an answer on that so i tried it and didnt work so i had to edit the script and do some things… (That didnt work!) it doesnt seem im trying but i spend alot of time trying to know what you guys do.

I only need the code for it so it doesnt logged out after being inactive! :( Flight, thank you alot for your time on my script. I appeciate it :D

SimbaGod

2013-10-14 13:24:58

Need this!