SRL Archive - Bugs

invfull is messing up


EtherFreak

2010-08-29 23:04:50

program New;
{.include SRL/SRL.scar}
begin
mousespeed:=7;
wait(200);
if invfull then
writeln('yes')else
writeln('no');
end.

invfull is messing up. when I run the above code, the mouse moves and selects the inventory icon, and then moves around on the inventory icon clicking a bunch. it never works beyond that. However, I also checked in the smart client, and invfull works fine. I am using the downloaded runescape client, and I am selecting it with the window target, and all my other coded stuff seems to run fine. upon searching, I kind of get the notion that it is a gametab.scar issue rather then a inventor.scar issue. forgive me if this has been posted elsewhere, for I could not find it in my searching.

Cstrike

2010-08-29 23:06:08

What about SetupSRL; ?
I'd say try that [add it in to be the first executed line] and see if you keep seeing problems.

Tniffoc

2010-08-29 23:08:58

From: cstrike
What about SetupSRL; ?
I'd say try that [add it in to be the first executed line] and see if you keep seeing problems.


Make sure to add the various needed SMART setup things if you are using SMART rather than the regular Runescape client (with the cross-hair dragging thing).

EtherFreak

2010-08-29 23:40:10

I added setupsrl, still no go. invfull is working in smart (the client within scar), but not the web browser, nor the rs client downloaded from rs.

Heavenguard

2010-08-29 23:47:36

:) lets go through this problem, maybe we can figure out whatsagoin on. :)

{*******************************************************************************
function InvFull: Boolean;
By: n3ss3s
Description: Returns True if inventory is full
*******************************************************************************}
function InvFull: Boolean;
begin
Result := (InvCount = 28); // <-- Hmm... invcount
end;

{*******************************************************************************
function InvCount: Integer;
By: RsN
Description: Returns amount of items in your inventory
*******************************************************************************}
function InvCount: Integer;
var
I: Integer;
begin
Result := 0;
GameTab(tab_inv); // <-- hmm.. gametab..
for I := 1 to 28 do
if (ExistsItem(I)) then
Inc(Result);
end;

{*******************************************************************************
function GameTab(Tab: Integer): Boolean;
By: ZephyrsFury
Description: Switches to a specific game tab.
const
tab_Combat = 21;
tab_Stats = 22;
tab_Quest = 23;
tab_Diary = 24;
tab_Inv = 25;
tab_Equip = 26;
tab_Prayer = 27;
tab_Magic = 28;
tab_Objectives = 29;
tab_Friends = 30;
tab_Ignore = 31;
tab_Clan = 32;
tab_Options = 33;
tab_Emotes = 34;
tab_Music = 35;
tab_Notes = 36;
tab_LogOut = 37;
*******************************************************************************}
function GameTab(Tab: Integer): Boolean;
var
tP: TPoint;
T, Tries: Integer;

begin
Result := false;
if (not(InRange(Tab, Tab_Combat, Tab_LogOut))) then
begin
SRL_Warn('GameTab', 'Tab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_AllVersions);
Exit;
end;

Result := (GetCurrentTab = Tab);
if (Result) then exit;

if (TabExists(Tab)) then
begin
tP := Point((Tab - 21) mod 8 * 30 + RandomRange(527, 545),
(Tab - 21) div 8 * 298 + RandomRange(177, 197));
if (Tab = tab_LogOut) then
tP := Point(RandomRange(747, 760), RandomRange(3, 18));

Tries := 0;
while ((Tries < 3) and (not Result)) do
begin
Mouse(tP.X, tP.Y, 0, 0, True);

T := GetSystemTime;
while (not Result) and (GetSystemTime - T < 2000) do
begin
Result := (GetCurrentTab = Tab);
Wait(100 + Random(100));
end;

Inc(Tries);
end;

if (Result) then
Wait(250 + Random(300));

end else
SRL_Warn('GameTab', 'GameTab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_Notice);

So we tracked this down to 1 area where the problem -might- be, but since I know this is working fine, lets just go ahead anyway and see what its doing.


Result := (GetCurrentTab = Tab); // So pretty much: if (YourTab) = (TheTabYouWant) then the Result is True.
if (Result) then exit; // if the result is true then exit this function.

if (TabExists(Tab)) then // if the tab you want exists in SRL then...
begin
tP := Point((Tab - 21) mod 8 * 30 + RandomRange(527, 545),
(Tab - 21) div 8 * 298 + RandomRange(177, 197); // Gets the point(x, y) of the tab you want.
if (Tab = tab_LogOut) then // if the tab you want is the LogOut tab then...
tP := Point(RandomRange(747, 760), RandomRange(3, 18)); // gets the point of the log_out point.

hmm, so this is how it gets the tpoint (which is just an X and Y) to click on. Lets see what it does after that…

Tries := 0; // Tries is declared as 0.
while ((Tries < 3) and (not Result)) do // so while you have less then 3 tries, and its not on the tab you want ...
begin
Mouse(tP.X, tP.Y, 0, 0, True); // Click on the tab you want...

T := GetSystemTime; // Mark the system time..
while (not Result) and (GetSystemTime - T < 2000) do // While its not on the tab you want, and 2 seconds have not passed do..
begin
Result := (GetCurrentTab = Tab); // Re-check to see if your tab is set to the tab you want...
Wait(100 + Random(100)); // wait a bit..
Inc(Tries); // Increases Tries by 1.
end;

end;

so itll pretty much only click on this tab 3 times total [granted that its not on the inventory tab].

The problem you may be getting is that maybe runescape's Graphics settings aren't set right for the downloaded client. Try to re-check if its set to safe-mode, low-res, and all that good botting stuff :D Either way, i don't see how the script is constantly clicking the inventory tab, since your only calling it once, it should only click it a max (3) times, even if its not working :O After u make sure all the graphics settings are good for this client and the web-browser try this.

[Make sure your using simba xD] This should read through the things your using and see if things are working correctly. Don't forget to activate your client ^^.

program EtherFreaker;
{$i srl\srl.scar}

var
CGT: Integer; // Well use this to see our current game tab.
InvC: Integer; // Well use this to see how many items are in our inventory.

begin
SetupSRL; // Make sure you call this if your using any of SRL's Functions :D

Wait(RandomRange(400, 700)); // Waits a random range from 400 ms to 700 ms.
CGT := GetCurrentTab; // CGT is now assigned to the function GetCurrentTab.
InvC := InvCount; // InvC is now assigned the function InvCount.

if (CGT = 25) then // Tab 25 is the inventory tab.
Writeln('-> Our current game tab is the inventory.')
else
Writeln('[X] Our current game tab is not the inventory, its gametab('+ToStr(CGT)+').');

Writeln('-> We have ' + ToStr(InvC) + ' items in our inventory.');
if InvFull then
Writeln('--> Our inventory is full.')
else
Writeln('[X] Our inventory is not full.');
end.
If everything here works fine [if the debug prints out good], then theres no problem. If something didnt return right, then post the debug up here :D, hope we helped dude.

Heres a little of my testing. I just downloaded the runescape client from runescapes site. Logged in, activated the client, and ran this. Heres a couple.

|First Run|
// I had a Pickaxe in my inventory, inventory gametab pre-selected.
Compiled succesfully in 2684 ms.
-> Our current game tab is the inventory.
-> We have 1 items in our inventory.
[X] Our inventory is not full.
Successfully executed.

|Second Run|
// I had a Pickaxe and 2 ores in my inventory, i had the stats gametab pre-selected.
SRL Compiled in 47 msec
[X] Our current game tab is not the inventory, its gametab(22).
-> We have 3 items in our inventory.
[X] Our inventory is not full.
Successfully executed.
// It clicked the inventory tab :), and it said that the stats game_tab was pre-selected when it ran. Everything checks out.

|Third Run|
// I had a Pickaxe and 27 ores in my inventory(full inventory), i had the inventory gametab pre-selected.
SRL Compiled in 32 msec
-> Our current game tab is the inventory.
-> We have 28 items in our inventory.
--> Our inventory is full.
Successfully executed.

Everything should work out good for you bud :), i know my web-browser RS works 100% with SRL, and so does the client :), you should have no problems :D.

Tniffoc

2010-08-29 23:49:28

Are you dragging the crosshairs over the non-SMART clients before you're starting the script?

EDIT: Also, I know in SCAR calling "ActivateClient" before SetupSRL was needed.

EtherFreak

2010-08-30 02:20:39

to clairify, yes, it is clicking the inventory 3 times, but it is also moving around a little bit on the inventory. I am dragging the crosshairs to the nonsmart clients (browser window and downloaded client). I will fool with the color settings and see if this helps. I would use the srl smart cient if I was better at programing, but I find testing coding works better with the nonsmart client.

EtherFreak

2010-08-30 02:34:58

hmm, I reset it to safe mode, and it finaly is working right. I do not know how this changed off this setting, but that seemed to be the issue. the other issue I was having, is the compiled window was blocking the bank window, and causing issues (scar only seeing 25, instead of 28 items). guess I feel like a bit of a fool now. thank you for the help.

Heavenguard

2010-08-30 12:09:13

From: EtherFreak
hmm, I reset it to safe mode, and it finaly is working right. I do not know how this changed off this setting, but that seemed to be the issue. the other issue I was having, is the compiled window was blocking the bank window, and causing issues (scar only seeing 25, instead of 28 items). guess I feel like a bit of a fool now. thank you for the help.


Use simba my friend, this is the simba forums after all :P. Also, if you activated your client correctly, then it should not matter at all if anything was blocking the inventory at all, it should still read it as if everything was visible on your screen. Your not a fool at all :P errors are inevitable, and were all here to help each other ^^. (<3 in fact your very smart lol. thats just my personal opinion :) )