SRL Archive - SRL Snippets

EoC Action Bar, with verification


DrChill

2012-11-29 09:58:50

This is my first public script Snippet, it checks if chat is open, and enables the action bar if it isn't. I'm not sure how kosher it is to use functions from someone's script, I'm from the OpenSource community, and there it is normal to borrow bits and pieces from others' script (also anti-leech would be widely condemned there ;) ).

I started out modifying Laimonas's function, then I kinda re-wrote it all. I observed a problem, PressKey is apparently made for typing so they make sure the chat is open, we need the opposite. Also, every time you go to the bank the action bar gets closed out, making this necessary. And finally slots are re-arrangeable so you have to be able to choose different keys for different slots.

// Borrowed from Flight's Barbarian Fly Fisher
function EnableActionBar: Boolean;
var
X,Y,i: Integer;
begin
Result := False;

for i:=1 to 5 do
if (FindText(x,y,ToStr(i),UpChars,490,300,505,315) and (not Result)) then
Result := True;

if not Result then
begin
MMouse(507,332, 2, 2);
if WaitUptext('Expand', 400) then
ClickMouse2(mouse_left);

for i:=1 to 5 do
if FindText(x,y,ToStr(i),UpChars,490,300,505,315) then
Result := True;

Wait(RandomRange(750, 1200));
end;
end;

(*
UseActionKey
-------------
function UseActionKey(keyString:string);

Example: UseActionKey('1'); // Use slot 1

by DrChill
*)

procedure UseActionKey(keyString : Char);
begin
if PlayerChatActive then
TypeByte(VK_ENTER);
if EnableActionBar then
begin
SendKeys(keyString, 50+Random(51), 30+Random(30));
end
end;

Enjoy, and feel free to criticize, I'm new to Pascal, Botting, and the SRL community in general :).

Noob King

2012-11-30 18:51:31

FYI, Use
 tags instead of [CODE] tags for Simba code. Makes it easier to read.

Ian

2012-11-30 18:58:45

Looks good, and also thank you for crediting people. I'm reading through now :)

zyrell

2012-12-01 13:03:56

Nicely done. And giving credit isn't common these days on the internet so thanks for doing that.

t4q

2012-12-02 03:18:54

Nice, but why it presses enter if chat is active? It should be VK_ESCAPE.
Action bar is automatically reopened after closing bank.
Otherwise very nice ;)

DrChill

2012-12-02 16:37:24

@Noob King
Thank you, changed.

I'm trying to keep track of where functions come from, but sometimes it's hard when you borrow code from all sorts of scripts :)

I made it do checks because when you close the bank the EoC bar isn't instantly re-opened, it takes a second. This ended up making my bot type '0' repeatedly, and in other circumstances it's useful to make sure the EoC bar is open.