The thread title says it all, is there a way to check if a player has send you a trade request, or am i just going to have to search for the trade color?
Thanks
(this is in OSR)
The thread title says it all, is there a way to check if a player has send you a trade request, or am i just going to have to search for the trade color?
Thanks
(this is in OSR)
Blah := GetChatBoxText(lineofchat,Coloroftexthere);
There's a better way to do this but I'm not at computer ATM sorry
Reading the include will definitely help a lot, Ill look through and post what I find, never used trading :P
Simba Code:if HandleTrade then
blahblahblah // Handles the trade, last function in include
Simba Code:{*******************************************************************************
function HandleTrade: Boolean;
by: ZephyrsFury
Description: Handles a trade.
*******************************************************************************}
function HandleTrade: Boolean;
var
TheTrader: string;
Success: Boolean;
TradeTime, Tx, Ty, ii, c: Integer;
begin
if (SomeoneTrades) then
begin
if (TimeFromMark(TradeMark) < 30000) then Exit;
TheTrader := GetTradersName;
WriteLn(TheTrader + ' wishes to trade.');
if (InTradersArray(TheTrader, ii)) then
if (TimeFromMark(Traders[ii].Time) < 5 * 60 * 1000) and (Traders[ii].Attempts >= 2) then
begin
WriteLn('We have had unsuccessful trades with ' + TheTrader + ' in the last 5 minutes, Exiting...');
MarkTime(TradeMark);
Exit;
end;
c := 0;
while (TradeScreen <> 1) and (c < 3) do
begin
if (AcceptTrade) then Break;
Inc(c);
Wait(1000 + Random(1000));
end;
if (c >= 3) then
begin
Writeln('Could not open trade screen.');
Exit;
end;
if (TradeScreen = 1) then
begin
MarkTime(TradeTime);
WriteLn('Trading with ' + TheTrader);
while (TimeFromMark(TradeTime) < 30000) do
begin
if (TradeScreen = 1) then
begin
if (PlayerAccepted) then
begin
WriteLn('Player has accepted, checking for items...');
if (FindColor(Tx, Ty, srl_outline_black, 311, 76, 504, 292)) then
begin
Accept;
WriteLn('Found items, accepted first tradescreen.');
end else
begin
WriteLn('Trader did not offer any items, Declining');
Break;
end;
end;
end else
if (TradeScreen = 2) then
begin
if (PlayerAccepted) then
begin
WriteLn('Player has accepted second tradescreen.');
Accept;
WriteLn('Accepted second tradescreen');
Success := True;
end;
end else Break;
Wait(1000 + Random(1000));
end;
end;
if (not(Success)) then
begin
if (TimeFromMark(TradeTime) > 30000) then
WriteLn('Trade time limit passed, declining.');
while (TradeScreen <> 0) do
Decline;
WriteLn('Trade Failed');
UpdateTradersArray(TheTrader, False);
if (TalkAfterTrade) then
if (InTradersArray(TheTrader, ii)) then
if (Traders[ii].Attempts >= 2) then
case Random(6) of
0: TypeSend(AddMistakes('don''t trade if you''ve got nothing to give me', 20));
1: TypeSend(AddMistakes('stop bothering me', 20));
2: TypeSend(AddMistakes('please stop trading with me', 20));
3: TypeSend(AddMistakes('stop trading with me', 20));
4: TypeSend(AddMistakes('stop trading if your not giving me any thing', 20));
5: TypeSend(AddMistakes('lol you can stop trading now', 20));
end;
end else
begin
if (TalkAfterTrade) then
case Random(6) of
0: TypeSend(AddMistakes('thanks', 20));
1: TypeSend(AddMistakes('ty', 20));
2: TypeSend(AddMistakes('wow thanks...', 20));
3: TypeSend(AddMistakes('thanks a lot...', 20));
4: TypeSend(AddMistakes('cool thanks', 20));
5: TypeSend(AddMistakes('thanks very much', 20));
end;
WriteLn('Trade Successful!');
UpdateTradersArray(TheTrader, True);
Result := True;
end;
MarkTime(TradeMark);
if SRL_HasProc(srl_OnFindTrade) then
SRL_Procs[srl_OnFindTrade]();
end;
end;
There are currently 1 users browsing this thread. (0 members and 1 guests)