NLObP, а смысл генерить большие формы? Фаст скрипт от этого жутко тормозить. Я тож сначала в дельфе накидаю примерную формочку, а потом перекладываю в Фаст скрипт. Пример:
delphi Код:
const General = 0;
Shout = 1;
Privat = 2;
Party = 3;
Clan = 5;
Trade = 8;
Ally = 9;
var BotForm:TForm;
ChatPanel,MyChat: TPanel;
MyText: TEdit;
btSend,btExit: TButton;
f:tstringlist;
reChat:TRichEdit;
lbTargetInfo:TLabel;
chChatType,chFriends,chMyText:TComboBox;
pbMyCP,pbMyHP,pbMyMP,pbTargetHP:TProgressBar;
gbMyPanel,gbTargetPanel,gbMyCP,gbMyHP,gbMyMP,gbTargetHP:TGroupBox;
rgChatType,rgChatType1,rgChatType2,rgChatType3,rgChatType4,rgChatType5,rgChatType6:TRadioButton;
isNotExit:boolean;
ChatType:byte;
FriendName:string;
procedure CreateBotForm;
begin
BotForm := TForm.Create(nil);
BotForm.Caption := 'Bot Form designed & programmed by QaK';
BotForm.BorderStyle := bsSizeable;
BotForm.Position := poScreenCenter;
BotForm.Width:=600;
BotForm.Height:=390;
//=============== My Attr Panel ==========================
gbMyPanel:=TGroupBox.Create(BotForm);
gbMyPanel.parent:=BotForm;
gbMyPanel.caption:=' [BotName] ';
gbMyPanel.ShowHint:=true;
gbMyPanel.Hint:=' [BotName] ';
gbMyPanel.height:=115;
gbMyPanel.width:=130;
gbMyPanel.left:=0;
gbMyPanel.top:=0;
//gbMyPanel.visible:=false;
//==================== CP ================================
gbMyCP:=TGroupBox.Create(gbMyPanel);
gbMyCP.parent:=gbMyPanel;
gbMyCP.Color:=$0090FF;
gbMyCP.caption:=' CP: 0/0 ';
gbMyCP.height:=33;
gbMyCP.width:=120;
gbMyCP.left:=5;
gbMyCP.top:=14;
pbMyCP:=TProgressBar.Create(gbMyPanel);
pbMyCP.parent:=gbMyPanel;
pbMyCP.smooth:=true;
pbMyCP.max:=1200;
pbMyCP.min:=0;
pbMyCP.position:=1200;
pbMyCP.step:=1;
pbMyCP.height:=16;
pbMyCP.width:=110;
pbMyCP.left:=10;
pbMyCP.top:=26;
//==================== HP ================================
gbMyHP:=TGroupBox.Create(gbMyPanel);
gbMyHP.parent:=gbMyPanel;
gbMyHP.Color:=clRed;
gbMyHP.caption:=' HP: 0/0 ';
gbMyHP.height:=33;
gbMyHP.width:=120;
gbMyHP.left:=5;
gbMyHP.top:=48;
pbMyHP:=TProgressBar.Create(gbMyPanel);
pbMyHP.parent:=gbMyPanel;
pbMyHP.smooth:=true;
pbMyHP.max:=1200;
pbMyHP.min:=0;
pbMyHP.position:=1200;
pbMyHP.step:=10;
pbMyHP.height:=16;
pbMyHP.width:=110;
pbMyHP.left:=10;
pbMyHP.top:=60;
//==================== MP ================================
gbMyMP:=TGroupBox.Create(gbMyPanel);
gbMyMP.parent:=gbMyPanel;
gbMyMP.Color:=$FF7000;
gbMyMP.caption:=' MP: 0/0 ';
gbMyMP.height:=33;
gbMyMP.width:=120;
gbMyMP.left:=5;
gbMyMP.top:=80;
pbMyMP:=TProgressBar.Create(gbMyPanel);
pbMyMP.parent:=gbMyPanel;
pbMyMP.smooth:=true;
pbMyMP.max:=1200;
pbMyMP.min:=0;
pbMyMP.position:=1200;
pbMyMP.step:=10;
pbMyMP.height:=16;
pbMyMP.width:=110;
pbMyMP.left:=10;
pbMyMP.top:=92;
//================== Target Info Panel ===================
gbTargetPanel:=TGroupBox.Create(BotForm);
gbTargetPanel.parent:=BotForm;
gbTargetPanel.caption:=' [TargetName] ';
gbTargetPanel.ShowHint:=true;
gbTargetPanel.Hint:=' [TargetName] ';
gbTargetPanel.height:=115;
gbTargetPanel.width:=195;
gbTargetPanel.left:=130;
gbTargetPanel.top:=0;
//gbTargetPanel.visible:=false;
//==================== HP ================================
gbTargetHP:=TGroupBox.Create(gbTargetPanel);
gbTargetHP.parent:=gbTargetPanel;
gbTargetHP.Color:=clRed;
gbTargetHP.caption:=' HP: 0/0 ';
gbTargetHP.height:=33;
gbTargetHP.width:=185;
gbTargetHP.left:=5;
gbTargetHP.top:=14;
pbTargetHP:=TProgressBar.Create(gbTargetPanel);
pbTargetHP.parent:=gbTargetPanel;
pbTargetHP.smooth:=true;
pbTargetHP.max:=1200;
pbTargetHP.min:=0;
pbTargetHP.position:=1200;
pbTargetHP.step:=10;
pbTargetHP.height:=16;
pbTargetHP.width:=175;
pbTargetHP.left:=10;
pbTargetHP.top:=26;
//=============== Info ==========================================
lbTargetInfo:=TLabel.Create(gbTargetPanel);
lbTargetInfo.parent:=gbTargetPanel;
lbTargetInfo.left:=7;
lbTargetInfo.top:=46;
lbTargetInfo.caption:='Prof: StormScreamer'+#13+'WeaponEnch:10';
//================== Chat Panel ================================
ChatPanel:=TPanel.Create(BotForm);
ChatPanel.parent:=BotForm;
ChatPanel.align:=alBottom;
ChatPanel.height:=245;
//================== My Chat Panel =============================
MyChat:=TPanel.Create(ChatPanel);
MyChat.parent:=ChatPanel;
MyChat.align:=alBottom;
MyChat.height:=24;
chChatType:=TComboBox.Create(MyChat);
chChatType.parent:=MyChat;
chChatType.Align:=alLeft;
LoadChatType;
chChatType.ItemIndex:=0;
chChatType.DropDownCount:=9;
chChatType.Style:=csDropDownList;
chChatType.Width:=70;
chChatType.OnChange:=@chChatTypeOnChange;
chFriends:=TComboBox.Create(MyChat);
chFriends.parent:=MyChat;
chFriends.Align:=alNone;
chFriends.ItemIndex:=0;
chFriends.Style:=csDropDown;
chFriends.Width:=100;
chFriends.Left:=chChatType.Width+2;
chFriends.Top:=1;
chFriends.AutoComplete:=true;
chFriends.OnKeyPress:=@chFriendsOnKeyPress;
chMyText:=TComboBox.Create(MyChat);
chMyText.parent:=MyChat;
chMyText.align:=alNone;
chFriends.Style:=csDropDown;
chMyText.width:=440;
chMyText.top:=1;
chMyText.left:=73;
chMyText.onKeyPress:=@chMyTextOnKeyPress;
reChat:=TRichEdit.Create(ChatPanel);
reChat.parent:=ChatPanel;
reChat.Align:=alTop;
reChat.left:=0;
reChat.Top:=348;
reChat.Width:=BotForm.Width-5;
reChat.Height:=200;
reChat.ScrollBars:=ssVertical;
btSend:=TButton.Create(MyChat);
btSend.parent:=MyChat;
btSend.align:=alRight;
btSend.caption:='Test';
btSend.onClick:=@btSendClick;
btExit:=TButton.Create(BotForm);
btExit.parent:=BotForm;
btExit.Left:=515;
btExit.Top:=5;
btExit.align:=alNone;
btExit.caption:='Exit';
btExit.onClick:=@btExitClick;
rgChatType:=TRadioButton.Create(ChatPanel);
rgChatType.parent:=ChatPanel;
rgChatType.align:=alLeft;
rgChatType.caption:='All';
rgChatType.width:=40;
rgChatType.Checked:=True;
rgChatType1:=TRadioButton.Create(ChatPanel);
rgChatType1.parent:=ChatPanel;
rgChatType1.align:=alLeft;
rgChatType1.caption:='Shout';
rgChatType1.width:=50;
rgChatType2:=TRadioButton.Create(ChatPanel);
rgChatType2.parent:=ChatPanel;
rgChatType2.align:=alLeft;
rgChatType2.caption:='Trade';
rgChatType2.width:=50;
rgChatType3:=TRadioButton.Create(ChatPanel);
rgChatType3.parent:=ChatPanel;
rgChatType3.align:=alLeft;
rgChatType3.caption:='Party';
rgChatType3.width:=50;
rgChatType4:=TRadioButton.Create(ChatPanel);
rgChatType4.parent:=ChatPanel;
rgChatType4.align:=alLeft;
rgChatType4.caption:='Clan';
rgChatType4.width:=50;
rgChatType5:=TRadioButton.Create(ChatPanel);
rgChatType5.parent:=ChatPanel;
rgChatType5.align:=alLeft;
rgChatType5.caption:='Ally';
rgChatType5.width:=50;
rgChatType6:=TRadioButton.Create(ChatPanel);
rgChatType6.parent:=ChatPanel;
rgChatType6.align:=alLeft;
rgChatType6.caption:='Hero';
rgChatType6.width:=50;
//========================================================
isNotExit:=true;;
f:=tstringlist.create;
BotForm.Show;
chMyText.setfocus;
ChatType:=0;
FriendName:='';
end;
procedure DestroyBotForm;
begin if isNotExit then
begin
gbMyCP.Free;
gbMyHP.Free;
gbMyMP.Free;
pbMyCP.Free;
pbMyHP.Free;
pbMyMP.Free;
gbMyPanel.Free;
gbTargetHP.Free;
pbTargetHP.Free;
gbTargetPanel.Free;
reChat.Free;
btSend.Free;
rgChatType.Free;
rgChatType1.Free;
rgChatType2.Free;
rgChatType3.Free;
rgChatType4.Free;
rgChatType5.Free;
rgChatType6.Free;
chMyText.Free;
chFriends.Free;
chChatType.Free;
MyChat.Free;
ChatPanel.Free;
f.free;
BotForm.Free;
end;
end;
procedure chChatTypeOnChange(Sender: TObject);
begin if (chChatType.ItemIndex=3)or(chChatType.ItemIndex=7)
then begin chMyText.Left:=173;
chMyText.Width:=340;
FriendName:=chFriends.Text;
end
else begin FriendName:='';
chMyText.Left:=73;
chMyText.Width:=440;
end;
ChatType:=GetChatType;
chMyText.SetFocus;
end;
procedure chFriendsOnChange(Sender: TObject);
begin //MyText.SetFocus;
end;
procedure chFriendsOnKeyPress(Sender: TObject; var Key: Char);
var notexist:boolean;
i:integer;
begin if ord(key)=13 then
begin notexist:=true;
for i:=0 to chFriends.Items.Count-1 do
if chFriends.Items[i]=chFriends.text then notexist:=false;
if notexist then chFriends.Items.add(chFriends.text);
chMyText.SetFocus;
end;
end;
procedure cbChatKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
end;
procedure chMyTextOnKeyPress(Sender: TObject; var Key: Char);
var notexist:boolean;
i:integer;
begin
if ord(key)=13 then
begin notexist:=true;
FriendName:=chFriends.text;
for i:=0 to chMyText.Items.Count-1 do
if chMyText.Items[i]=chMyText.text then notexist:=false;
if notexist then chMyText.Items.add(chMyText.text);
printmessage(gbMyPanel.Caption,chMyText.Text,ChatType);
chMyText.SetFocus;
end;
end;
procedure btExitClick;
begin DestroyBotForm;
isNotExit:=false;
end;
procedure btSendClick;
var i,i1:integer;
a:array [1..9] of string;
begin //i:=Round(random*10000000);
//i1:=Round(random*i);
reChat.SetFocus;
//reChat.SelAttributes.Color:=cllime;
//reChat.Lines.Add(TimeToStr(Now)+' test system');
//sendmessage(reChat.Handle,wm_keydown,8,0);
//sendmessage(reChat.Handle,wm_keyup,8,0);
//SetmyHPStatus(i1,i);
//TargetUnselect;
//pbmycp.position:=pbmycp.position-10;
//gbmypanel.caption:=inttostr(i1)+'/'+inttostr(i);
//f.text:=f.text+inttostr(i1)+'/'+inttostr(i)+#13;
//f.savetofile('1.txt');
{a[1]:=' [Shout]>';
a[2]:=' [Trade]>';
a[3]:='[Whisper]>';
a[4]:=' [Hero]>';
a[5]:=' [Party]>';
a[6]:=' [Clan]>';
a[7]:=' [Ally]>';
a[8]:=' [GM]>';
a[9]:=' )>';}
{a[1]:='[Shout]>';
a[2]:='[Trade]>';
a[3]:='[Whisper]>';
a[4]:='[Hero]>';
a[5]:='[Party]>';
a[6]:='[Clan]>';
a[7]:='[Ally]>';
a[8]:='[GM]>';
a[9]:='[Friend]>';}
{i:=Round(Random*(8))+1;}
//reChat.lines.add('[General]>'+gbMyPanel.Caption+':'+MyText.Text);
//targetunselect;
printmessage(gbMyPanel.Caption,chMyText.Text,4);
chMyText.SetFocus;
end;
procedure Init; //Вызывается при включении скрипта
begin
CreateBotForm;
end;
procedure Free; //Вызывается при выключении скрипта
begin
DestroyBotForm;
end;
procedure LoadChatType;
begin chChatType.Items.add('General');
chChatType.Items.add('Shout');
chChatType.Items.add('Trade');
chChatType.Items.add('Private');
chChatType.Items.add('Party');
chChatType.Items.add('Clan');
chChatType.Items.add('Ally');
chChatType.Items.add('Friend');
chChatType.Items.add('Hero');
end;
function GetChatType:byte;
begin case chChatType.ItemIndex of
0,1:Result:=chChatType.ItemIndex;
2:Result:=8;
3:Result:=2;
4:Result:=3;
5:Result:=4;
6:Result:=9;
7:Result:=100;
8:Result:=101;
end;
end;
procedure PrintMessage(WhoSay,Text:string;ChatType:byte);
var mes:string;
begin reChat.SetFocus;
mes:='('+TimeToStr(Now)+') ';
case ChatType of
0:mes:=mes+'[General]';
1:mes:=mes+'[Shout]';
2:mes:=mes+'[Private]';
3:mes:=mes+'[Party]';
4:mes:=mes+'[Clan]';
5:mes:=mes+'[]';
6:mes:=mes+'[]';
7:mes:=mes+'[]';
8:mes:=mes+'[Trade]';
9:mes:=mes+'[Ally]';
100:mes:=mes+'[Friend]';
end;
mes:=mes+'>'+WhoSay+':'+Text;
reChat.Lines.Add(mes);
end;
procedure TargetUnselect;
begin SetTargetName(' [NoTarget] ');
SetTargetHPStatus(0,0);
SetTargetInfo(' No Target Selected');
end;
procedure SetMyName(MyName:String);
begin gbMyPanel.Caption:=MyName;
gbMyPanel.Hint:=MyName;
end;
procedure SetTargetName(TargetName:string);
begin gbTargetPanel.Caption:=TargetName;
gbTargetPanel.Hint:=TargetName;
end;
procedure SetTargetInfo(TargetInfo:String);
begin lbTargetInfo.caption:=TargetInfo;
end;
procedure SetMyCPStatus(CurrentCP,MaxCP:integer);
begin pbMyCP.position:=CurrentCP;
if pbMyCP.max<>MaxCP then pbMyCP.max:=MaxCP;
gbMyCP.caption:=' CP:';
if CurrentCP<9 then gbMyCP.caption:=gbMyCP.caption+' ';
if CurrentCP<99 then gbMyCP.caption:=gbMyCP.caption+' ';
if CurrentCP<999 then gbMyCP.caption:=gbMyCP.caption+' ';
if CurrentCP<9999 then gbMyCP.caption:=gbMyCP.caption+' ';
gbMyCP.caption:=gbMyCP.caption+IntToStr(CurrentCP)+'/'+IntToStr(MaxCP);;
if MaxCP<9 then gbMyCP.caption:=gbMyCP.caption+' ';
if MaxCP<99 then gbMyCP.caption:=gbMyCP.caption+' ';
if MaxCP<999 then gbMyCP.caption:=gbMyCP.caption+' ';
if MaxCP<9999 then gbMyCP.caption:=gbMyCP.caption+' ';
end;
procedure SetMyHPStatus(CurrentHP,MaxHP:integer);
begin pbMyHP.position:=CurrentHP;
if pbMyHP.max<>MaxHP then pbMyHP.max:=MaxHP;
gbMyHP.caption:=' HP:';
if CurrentHP<9 then gbMyHP.caption:=gbMyHP.caption+' ';
if CurrentHP<99 then gbMyHP.caption:=gbMyHP.caption+' ';
if CurrentHP<999 then gbMyHP.caption:=gbMyHP.caption+' ';
if CurrentHP<9999 then gbMyHP.caption:=gbMyHP.caption+' ';
gbMyHP.caption:=gbMyHP.caption+IntToStr(CurrentHP)+'/'+IntToStr(MaxHP);;
if MaxHP<9 then gbMyHP.caption:=gbMyHP.caption+' ';
if MaxHP<99 then gbMyHP.caption:=gbMyHP.caption+' ';
if MaxHP<999 then gbMyHP.caption:=gbMyHP.caption+' ';
if MaxHP<9999 then gbMyHP.caption:=gbMyHP.caption+' ';
end;
procedure SetMyMPStatus(CurrentMP,MaxMP:integer);
begin pbMyMP.position:=CurrentMP;
if pbMyMP.max<>MaxMP then pbMyMP.max:=MaxMP;
gbMyMP.caption:=' MP:';
if CurrentMP<9 then gbMyMP.caption:=gbMyMP.caption+' ';
if CurrentMP<99 then gbMyMP.caption:=gbMyMP.caption+' ';
if CurrentMP<999 then gbMyMP.caption:=gbMyMP.caption+' ';
if CurrentMP<9999 then gbMyMP.caption:=gbMyMP.caption+' ';
gbMyMP.caption:=gbMyMP.caption+IntToStr(CurrentMP)+'/'+IntToStr(MaxMP);;
if MaxMP<9 then gbMyMP.caption:=gbMyMP.caption+' ';
if MaxMP<99 then gbMyMP.caption:=gbMyMP.caption+' ';
if MaxMP<999 then gbMyMP.caption:=gbMyMP.caption+' ';
if MaxMP<9999 then gbMyMP.caption:=gbMyMP.caption+' ';
end;
procedure SetTargetHPStatus(CurrentHP,MaxHP:integer);
begin pbTargetHP.position:=CurrentHP;
if pbTargetHP.max<>MaxHP then pbTargetHP.max:=MaxHP;
gbTargetHP.caption:=' HP:';
if CurrentHP<9 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<99 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<9999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<99999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<999999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if CurrentHP<9999999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
gbTargetHP.caption:=gbTargetHP.caption+IntToStr(CurrentHP)+'/'+IntToStr(MaxHP)+' ';
if MaxHP<9 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<99 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<9999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<99999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<999999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
if MaxHP<9999999 then gbTargetHP.caption:=gbTargetHP.caption+' ';
end;
//основная часть скрипта
//вызывается при приходе каждого пакета если скрипт включен
begin
end.
это только форма - заготовка под аутгейм - но она дико тормозякает, поэтому не вижу смысла делать формочки сложности более 5ти элементов - ибо тормоза, ИМХО формочки надо делать в дллках.