Valhalla Legends Forums Archive | Battle.net Bot Development | Question about Delphi

AuthorMessageTime
MesiaH
Does anybody know of a simple chatbot source made in Delphi? I'm very interested in scoping one out...
April 5, 2003, 5:29 AM
St0rm.iD
This is taken from an ancient project I half-assed until I realized Delphi wasn't for me.

I put a TClientSocket and some other stuff on a form. Should be able to figure it out from the code.

[code]
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, StdCtrls, Unit2, BotCore;

type
TfrmMain = class(TForm)
sckMain: TClientSocket;
txtMain: TMemo;
txtSend: TEdit;
cmdSend: TButton;
GroupBox1: TGroupBox;
Label1: TLabel;
txtName: TEdit;
Label2: TLabel;
txtPassword: TEdit;
Label3: TLabel;
txtServer: TEdit;
cmdConnect: TButton;
procedure cmdConnectClick(Sender: TObject);
procedure sckMainConnect(Sender: TObject; Socket: TCustomWinSocket);
procedure sckMainRead(Sender: TObject; Socket: TCustomWinSocket);
procedure cmdSendClick(Sender: TObject);
procedure dispatchCommand(Msg: String);
private
{ Private declarations }
public
{ Public declarations }
end;

var
frmMain: TfrmMain;

implementation

{$R *.dfm}

procedure TfrmMain.cmdConnectClick(Sender: TObject);
var core: TBotCore;
begin
core.OnUser('blar','masta');
sckMain.Host := txtServer.Text;
sckMain.Active := True;
end;

procedure TfrmMain.sckMainConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
sckMain.Socket.SendText(#3#4 + txtName.Text + #13#10 + txtPassword.Text + #13#10);
end;

procedure TfrmMain.sckMainRead(Sender: TObject; Socket: TCustomWinSocket);
var s: String;
begin
s := Socket.ReceiveText();

txtMain.Text := txtMain.Text + s + #13#10;
txtMain.SelStart := txtMain.GetTextLen();
txtMain.SelLength := 0;
end;

procedure TfrmMain.dispatchCommand(Msg: String);
var id: String;
var arr: TSplitArray;
begin
arr := Split(Msg,' ');
id := arr[0];

if (id = '1001') then
begin
{}
end
end;

procedure TfrmMain.cmdSendClick(Sender: TObject);
begin
sckMain.Socket.SendText(txtSend.Text + #13#10);
txtSend.Clear();
txtSend.SetFocus();
end;

end.
[/code]
April 6, 2003, 4:50 AM
Arta
TopazChat was written in Delphi and it's connection/processing comonents were released along with it - The source for those should be instructive.
April 6, 2003, 6:30 PM
Nova1313
topaz chat is great.

As for delphi i got this maximum delphi book and it works quite well for that type of stuff..

I have a started delphi bot around somewhere I'll see if i can dig it up.

I started porting lodgebot to delphi a while ago but never finished.

Xyber (old bot programmer) and his brother had started one too I can see if they still have theirs also. But that might be the same one storm posted.
April 7, 2003, 5:16 PM

Search