SRL Archive - Outdated / Broken

Player to player autoseller!


m0u53m4t

2007-03-26 17:24:34

Used for about 2 hours non stop, this will auto buy all the coal you can afford, then sell it again for whatever higher price you specify.

Edit the script as little to make it run all day buying and selling. You makes tonnes of cash :f:

As its normally run Fally East, you don't really need antirandoms, I've never had a random in a bank:

{.include srl\srl.scar}
{.include srl\srl\Misc\trade.scar}
{.include srl\srl\skill\fighting.scar}

Const BuyOrSell = 'buy';
Const BuyGpEach = 150;
Const SellGpEach = 180;
Const SellBatch = 150; //How many coal to sell at a time? 150 Recommended

Const StartPlayer = 0; // Determines who will play first

Procedure DeclarePlayers;
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=StartPlayer; // CurrentPlayer = Array Index

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Loc :='Loc1';
Players[0].Skill:='Mining';
Players[0].Active:=True;

writeln('You have currently ' +inttostr(HowManyPlayers)+' Players set to run. The starting player is '+ players[currentplayer].name);
End;

Var
NotedCoalBmp,UnNotedCoalBmp,CoalOffer,Sales,Bought,Spent,GpEach:Integer;
SellerName,LastChat,TheWord:String;
Correct:Boolean;

Procedure Proggy;
Begin
ClearDebug
Writeln('Completed ' + inttostr(sales) + ' trades.')
Writeln('Bought ' + inttostr(bought) + ' coal.')
Writeln('Spent ' + inttostr(spent) + 'gp.')
end;

Procedure SayThanks;
Begin
Wait(1000+Random(200))
LastChat := GetNewChatMsg
Writeln(LastChat)
If LastChat = 'accepted trade.' then
Begin
Case Random(10) of
0: TypeSend('ty ' + SellerName)
1: TypeSend('ty')
2: TypeSend('Thx')
3: TypeSend('Thanks')
End;
Sales := Sales + 1
Bought := Bought + CoalOffer
Spent := Spent + (CoalOffer *BuyGpEach)
Proggy
End;
End;

Function RightAmount2: Boolean;
Begin
If (CheckItem(True,'Coal')= CoalOffer) then Result := True
End;

Function RightAmount1: Boolean;
Begin
If (CoinAmount('your trade') = (BuyGpEach * CoalOffer)) then Result := True;
End;

Function RightAmount3: Boolean;
Begin
If (CoinAmount('trade') = (SellGpEach * 150)) then Result := True;
End;

Function RightAmount4: Boolean;
Begin
If (CheckItem(True,'Coins') = (SellGpEach * 150)) then Result := True;
End;

Procedure OfferGp(GpCount :integer);
Begin
If ((Not (CoinAmount('your trade') = (BuyGpEach * CoalOffer))) and (TradeScreen or TradeScreen2)) Then
Begin
If Not (CoinAmount('your trade') = 0) then
Begin
Mouse(50,90,13,13,False)
If not ClickOption('Remove All',1) then Popup('Remove All')
Wait(500+random(500))
End;
ClickAllItemsColorTolWait('Offer X',1424108,5,1000+random(500))
Wait(1000+random(500))
TypeSend(IntToStr(GpCount))
Wait(1300+random(500))
End;
End;

Procedure OfferCoal(CoalCount :integer);
Begin
If Not (AmountBmp('your trade',NotedCoalBmp,10)=CoalCount) then
Begin
If (AmountBmp('your trade',NotedCoalBmp,10)>0) then
Begin
Mouse(50,90,13,13,False)
If not ClickOption('Remove All',1) then Popup('Remove All')
Wait(500+random(500))
End;
ClickAllItemsColorTolWait('Offer X',1583144,5,1000+random(500))
Wait(1000+random(500))
TypeSend(IntToStr(CoalCount))
Wait(1000+random(500))
End;
End;

Function WaitForOffer: Integer;
Begin
While AmountBmp('trade',NotedCoalBmp,10) < 1 do
begin;
If AmountBmp('trade',UnNotedCoalBmp,10) > 0 then Begin; Decline; TypeSend('Notes only soz'); End;
If not TradeScreen then exit;
Wait(200+Random(100))
end;
Result := AmountBmp('trade',NotedCoalBmp,10)
End;

Procedure BuyCoal;
Begin
Correct := False
if TradeScreen then
Begin
SellerName := GetTraderName
Repeat
Repeat
If AmountBmp('trade',UnNotedCoalBmp,10) > 0 then Decline
Wait(100+random(100))
CoalOffer := WaitForOffer
OfferGp(CoalOffer*BuyGpEach)
If Not Waiting then Correct := RightAmount1
If Not(TradeScreen or TradeScreen2) then Exit;
Until Correct
Accept
Wait(100+random(100))
If Not(TradeScreen or TradeScreen2) then Exit;
Until TradeScreen2
If RightAmount2 then Accept
If Not RightAmount2 then Decline
While Waiting do Wait(100+Random(100))
SayThanks
End;
End;

Procedure SellCoal;
Begin
Correct := False
if TradeScreen then
Begin
SellerName := GetTraderName
Repeat
OfferCoal(SellBatch)
Repeat
If Not Waiting then Correct := RightAmount3
Wait(100+random(100))
If Not(TradeScreen or TradeScreen2) then Exit;
Until Correct
If Not Waiting then Accept
Wait(100+random(100))
If Not(TradeScreen or TradeScreen2) then Exit;
Until TradeScreen2
If RightAmount4 then Accept
If Not RightAmount4 then Decline
While Waiting do Wait(100+Random(100))
SayThanks
End;
End;

function AcceptTrade2: Boolean;
//only works with last line, turn public chat off
var
timeout: Integer;
fx, fy: Integer;
begin
if FindColor(Fx, Fy, 8388736, 23, 418, 182, 425) then
begin
Mouse(Fx + Random(140),Fy, 3, 10, True);
Flag
MarkTime(timeout);
repeat
Wait(500 + Random(100))
if (TimeFromMark(timeout) > 3000) then
Exit;
until (TradeScreen);
Result := True;
end;
end;

Procedure MyAntiBan;
begin
Status('Doing antiban')
Case Random(11) of
0: AntiBan
1: RandomRClick
2: PickUpMouse
3: IdleTime(1000,5000,1.0)
4: Mouse(MSCX, MSCY,25,25,True)
5: RandomMovement
6: BoredHuman
7: BoredHuman
8: BoredHuman
9: BoredHuman
10: Wait(Random(15000))
End;
end;


Procedure TalkSale;
Var
Phrase:String;
I:Integer;
Begin

If Random(30) = 0 then MyAntiBan
If TheWord = 'buy' then GpEach := BuyGpEach
If TheWord = 'sell' then GpEach := SellGpEach

If Random(3) = 0 then Phrase := 'flash2:'
If Random(3) = 0 then Phrase := Phrase + 'Wave:'
Phrase := Phrase + TheWord
If Random(2) = 0 then Phrase := Phrase + 'ing'
If Random(5) = 0 then Phrase := Phrase + ' noted'
Phrase := Phrase + ' coal'
If Random(2) = 0 then For i := 0 to Random(3) do Phrase := Phrase + '!'
Phrase := Phrase + ' ' + IntToStr(GpEach) + 'ea'
For i := 0 to Random(3) do Phrase := Phrase + '!'

typesend(Phrase)
Wait(1000+random(2500))
End;

Procedure FillMem;
begin
NotedCoalBmp:= BitmapFromString(21, 2, 'z78DA558D490E04310803BF14CC9A6' +
'3D6FF3FA9D3C31CD22021835CB8EE5826E52D2223942EC10191C5' +
'13A12A40D72E8EA5218299CEBF7F9F061C4E913AEF8D6A314B9DA' +
'C4D550E5F06A16033E1CF9F5F2ECAC1B60C6EF03BDDF46C72C8C1' +
'F4A1EAEB4747A37ECFDB9394B3566E77EEA0B67C3FFA4E349B');

UnnotedCoalBmp:= BitmapFromString(30, 1, '483E33000001100E084637234A3925' +
'4D3C28503F2A56442D5A462E56442D00000130202000000115150' +
'E202012232317232317000001302020302020483E334940340000' +
'01503F2A5A462E72593B7D6141826644826644000001');
LoadCoinBmp
End;

Procedure Setup;
Begin
TheWord := BuyOrSell
SetupSRL
FillMem
ActivateClient
DeclarePlayers
If Not LoggedIn then LoginPlayer
SetChat('Hide', 1);
SetChat('Hide', 1);
SetChat('Off', 2);
SetChat('Off', 2);
SetChat('On', 3);
SetChat('On', 3);

ClearDebug
Writeln('Welcome to m0u53m4ts coal buyer!')
End;

begin
Setup
Repeat
Repeat
TalkSale
If Not (BankScreen or TradeScreen or TradeScreen2) then FindNormalRandoms
FindTalk
If InFight then RunTo('E',True)
Until TradeScreen or TradeScreen2 or FindColorTolerance(x,y,8388736,21,420,228,430,3)
If AcceptTrade2 then
If Lowercase(TheWord) = 'buy' then BuyCoal
If Lowercase(TheWord) = 'sell' then SellCoal
If Not ((Lowercase(TheWord) = 'sell') or (Lowercase(TheWord) = 'buy')) Then Begin; Writeln('TheWord isnt set right'); TerminateScript; End;
Until CoinAmount('inv') < 10000
Writeln('Buying done!')
TheWord := 'sell';
Repeat
Repeat
TalkSale
Until TradeScreen or TradeScreen2 or FindColorTolerance(x,y,8388736,21,420,228,430,3)
If AcceptTrade2 then
If Lowercase(TheWord) = 'buy' then BuyCoal
If Lowercase(TheWord) = 'sell' then SellCoal
If Not ((Lowercase(TheWord) = 'sell') or (Lowercase(TheWord) = 'buy')) Then Begin; Writeln('TheWord isnt set right'); TerminateScript; End;
Until AmountBmp('inv',NotedCoalBmp,10) < 150
Writeln('Buying done!')
end.

Infantry001

2007-03-26 17:29:41

Hmm insteresting… ill check it out.

P.S. Maybe next update, you could do auto pricing!

m0u53m4t

2007-03-26 17:31:05

What do you mean auto pricing? I presumed it would be better to leave them as global things that the user can choose :p

Infantry001

2007-03-26 17:44:30

Well, yeah, i guess its always good to leave an option for users, but some of us (like me) dont play runescape, so we dont know the prices.

m0u53m4t

2007-03-26 17:47:18

That's why I've set in defaults :p

If you're not sure, leave it. If you want to change it, do :D

syberium

2007-03-26 18:45:32

wow very nice, couple of errors on compile though =/ one was on line 230 sometin u puny IntToStv instead of IntToStr so i fixed that.. also i got this one.. not sure if its my srl or the script so yea.. heres the error.
 Line 279: [Error] (19144:4): Unknown identifier 'InFight' in script


edit: for infight error just add the include {.include SRL\SRL\skill\Fighting.scar} also u set E as the direction to run if it finds a fight but u dident declare E as a direction so in ur Const just add Const E = 'East'; once i fixed those it compiles now

c0de

2007-03-26 19:49:39

Very nice :-)

By auto pricing he meant you should have script check what zybez.net says about that item. There is price checker on it…

syberium

2007-03-26 20:10:56

PROBLEM: inv interface not open

Weird..^ it like tryed to click on the inv bag DURING a trade but the inv bag dont show up during a trade.. then it went and typed selling coal 180 ea. during the trade screen so yea.. idk why

m0u53m4t

2007-03-27 11:54:41

Strange… It works fine for me.

I'll retest…

Hey321

2007-03-27 12:23:41

Also, for some odd reason, it walked out of the bank…

TOB

2007-03-27 12:27:36

Haven't tested but good job, reminds me of Stupid3000's old script.

Hey321

2007-03-27 12:41:53

Also, by the way, buying doesn't work. It opens the trade, then does nothing.


Edit: It doesn't accept trades either :O.

syberium

2007-03-28 01:09:07

ya that inv dont exist thing only happened once for me.. but when it does get the trade it wont offer anything it just declines..? maybe its not finding the dtm

m0u53m4t

2007-03-28 12:20:00

Bah. It works for me :p

I'll do some more debugging anyway…

Ransom

2007-03-29 10:00:22

hey nice to see another one. one thing to be warned about tho is i pretty much trashed mine because i've gotten increased amounts of randoms from just standing in the bank talking. I set mine up for lots of mass product items if you want to see the code for that. i pretty much skipped the bulk sale though because i usually would buy at 130 from nubs and sell in world one in sets of 5k coal all at once. i did however use single item selling for all those stupid mith long swords i would make. i'd set it up to sell each one for like 700 and stop when my invntory ran out and stuff.

the whole buy/sell turnaround is a good idea but i don't htink it maximizes your profits quickly. it's not really hard to get rid of 5k coal hehe.

anyway if you want some of my code i'll be happy to share it.

just watch out for those randoms tho. i kept getting swarms and pinball and quiz and all this stuff just from standing there typing. it was retarded. banned my super rich merchant.

m0u53m4t

2007-03-29 12:16:34

Shame. :(

Its stopped working now anyway and I can't be bothered to fix it :p

Anyone feel free to try :p

grindisbest

2007-05-31 22:15:02

I was thinking about making something like this but I never got round to it, might take a look at yours when I have some free time.

neG

2007-05-31 23:23:04

This is a nice idea and the code looks awesome.
Ill check it out tonite and see if I can get it to work.
Ill let you know how it goes :)