charly911, if you use Script by Voron ("Бот кач локомотив") there is o lot of errrs in this script,because olny Voron (as I known) use and test this script, so if something did'nt work correct - try to fix by yourself.
Put there a code of the function to calculate distance, and example, where and how do you use it?
Here is the code i tried to use to calculate the nearest Mob in the area:
This is just a test i made, its all a mess :P
What i wanted to do was to create a data base of Mobs position, determine the nearest, and when i pressed the button, the PJ (Player) run to that location. Result: only some times worked, why? i don't know. :'(
I have to re-write it, but i have not enought time as i am working and i have to study.
Maybe this weekend i'll do it, with the corresponding explanation.
I made this script to add it into another, that worked. This is the main working script:
delphi Код:
--------------------------------------------------------------------------
{This is very stupid bot, that works fine :D
The way it search mobs is very simple.
He moves to one of four secific points, and all the time uses /targetnext
When he finaly targets a mob, he atacks, until mod is dead.
Then he try to target another, and if no mob is targeted he goes to another position.
If his HP goes less than 55%, he drinks a greater Healing Pot, and if it is lower than 10% he dispears (not log off, but mobs cant atack)
until his HP goes more than 1/2.
He also try to use skills every time he can.
To select the four positions, the only thing that must be made, is to clic one button (Pos1/2/3/4), an then clic on the place you want
to set it.
}const PJName='UlTrApLeX';
var act,PotID1,PotID2,PotID3,PotID4:integer; me1:char; me2:char; me3:char; me4:char; nm:integer; t1:char; t2:char; t3:char; t4:char; nt:integer; shade:integer; mz:integer; pz:integer; tz:integer; hz:integer; MaxHP,CurHP,MaxMP,Shadow,CurMP,MaxCP,CurCP,ATT,TS,MyCorX,MyCorY,MyCorZ,CoordPpalX,CoordPpalY,CoordPpalZ,Contador,Posicion,Coord,Activo,Activo2,CoordX,CoordY,CoordZ,i: integer;
CoordX1,CoordX2,CoordX3,CoordY1,CoordY2,CoordY3,CoordZ1,CoordZ2,CoordZ3,CoordX4,CoordY4,CoordZ4,Espera,Esperando,AutoSelect,AutoSelect2,PJInfoAct,PJInfoAct2,p,RaceID,SexID,ClassID,MoveOK,MoveOK2,UsandoPot:integer;
m,m2,m3:TMemo; frm,frm2,frm3:TForm; Message,NombreDelPJ,Name,Sex,Race, Class: string;
button: tbutton;
etext3: TEdit;
IDdelPJ,VerificarID,Accuracy,Vicio,ShadowEterno,BichosMuertos:integer;
timer1,timer2,timer3: TTimer;
MiID,IDObtenida,IDTemporal,IDActualizable,NeedLoc,Comienzo:integer;
UltimaX,UltimaY,UltimaZ,UltimaXa,UltimaYa,UltimaZa,Memorizar,LocX1,LocX2,LocX3,LocX4,LocY1,LocY2,LocY3,LocY4,LocZ1,LocZ2,LocZ3,LocZ4:integer;
penel,penel2,penel3:TPanel;
ProgressBar1: TProgressBar;
Label1: TLabel;
penel4,penel0: TPanel;
statusBar: TStatusbar;
////000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000//procedure Init;
begin
frm := TForm.Create(nil);
frm.Caption := 'Movimiento';
frm.BorderStyle := bsSizeable;
frm.Position := poScreenCenter;
frm.Width:=210;
frm.Height:=900;
m:=TMemo.Create(frm);
m.parent:=frm;
m.align:=alClient;
m.ReadOnly:=true;
m.ScrollBars:=ssBoth;
penel:=TPanel.Create(frm);
penel.parent:=frm;
penel.align:=alBottom;
penel.Width:=150;
penel.height:=30;
penel2:=TPanel.Create(frm);
penel2.parent:=frm;
penel2.align:=alBottom;
penel2.Width:=150;
penel2.height:=30;
penel3:=TPanel.Create(frm);
penel3.parent:=frm;
penel3.align:=alBottom;
penel3.Width:=150;
penel3.height:=30;
penel4:=TPanel.Create(frm);
penel4.parent:=frm;
penel4.align:=alBottom;
penel4.Width:=150;
penel4.height:=17;
{penel0:=TPanel.Create(frm);
penel0.parent:=frm;
penel0.align:=alBottom;
penel0.Width:=150;
penel0.height:=30;
StatusBar:=TStatusBar.Create(penel0);
StatusBar.parent:=penel0;
StatusBar.Width:=200; }
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=25;
button.caption:='ID';
button.onClick:=@VerifID;
button.hint:='Verifica ID del PJ.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='1';
button.onClick:=@Memo1;
button.hint:='Memoriza ubicacion 1.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='2';
button.onClick:=@Memo2;
button.hint:='Memoriza ubicacion 2.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='3';
button.onClick:=@Memo3;
button.hint:='Memoriza ubicacion 3.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='4';
button.onClick:=@Memo4;
button.hint:='Memoriza ubicacion 4.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=55;
button.caption:='Contador';
button.onClick:=@ContBichos;
button.hint:='Verifica ID del PJ.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 1';
button.onClick:=@IrMemo1;
button.hint:='Ir a ubicacion 1.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 2';
button.onClick:=@IrMemo2;
button.hint:='Ir a ubicacion 2.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 3';
button.onClick:=@IrMemo3;
button.hint:='Ir a ubicacion 3.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 4';
button.onClick:=@IrMemo4;
button.hint:='Ir a ubicacion 4.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=50;
button.caption:='On / Off';
button.onClick:=@ActDes;
button.hint:='Activa / Desactiva el BOT.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=70;
button.caption:='Auto Target';
button.onClick:=@AutoSel;
button.hint:='Auto Target On/Off.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=60;
button.caption:='Movimiento';
button.onClick:=@PMoveOK;
button.hint:='Movimiento automatico.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=20; ////////////////////////////////////
button.caption:='R';
button.onClick:=@Reset;
button.hint:='Resetea contador de Bichos matados.';
Label1:=TLabel.Create(penel4);
Label1.parent:=penel4;
Label1.align:=alLeft;
Label1.Width:=20;
Label1.Caption:=' HP: ';
Progressbar1:= tprogressbar.create(penel4);
Progressbar1.parent:=penel4;
Progressbar1.align:=alLeft;
Progressbar1.Width:=175;
Progressbar1.Height:=20;
Progressbar1.Step:=1;
Progressbar1.Max:=100;
Progressbar1.Min:=0;
//ProgressBar1.PbColor:=Red;
frm.Show; // Initialice Variables
MiID:=0;
Activo:=0;
Activo2:=1;
PjinfoAct:=0;
PJInfoAct2:=1;
AutoSelect:=0;
AutoSelect2:=1;
MoveOK:=0;
MoveOK2:=1;
ShadowEterno:=1;
UsandoPot:=0;
BichosMuertos:=0;
Progressbar1.Position:=0;
//******************
timer1:=TTimer.Create(nil);
timer1.OnTimer:=@OnTimer1;
timer1.enabled:=true;
timer1.interval:=500;
//*****************
timer2:=TTimer.Create(nil);
timer2.OnTimer:=@OnTimer2;
timer2.enabled:=true;
timer2.interval:=500;
//******************
timer3:=TTimer.Create(nil);
timer3.OnTimer:=@OnTimer3;
timer3.enabled:=true;
timer3.interval:=1000;
//******************end;
procedure Free;
begin
m.Free;
frm.Free;
timer1.Free;
timer2.Free;
timer3.Free;
end;
procedure VerifID; // verify if i got my player IDbeginif(IDObtenida=1)and(MiID<>0)then m.Lines.Add('ID obtenida correctamente. ID: '+inttostr(MiID));
end;
procedure Memo1;
begin
Memorizar:=1;
NeedLoc:=1;
end;
procedure Memo2;
begin
Memorizar:=2;
NeedLoc:=1;
end;
procedure Memo3;
begin
Memorizar:=3;
NeedLoc:=1;
end;
procedure Memo4;
begin
Memorizar:=4;
NeedLoc:=1;
end;
procedure IrMemo1; // move to memory location 1begin
buf:=#$01;
WriteD(LocX1);
WriteD(LocY1);
WriteD(LocZ1);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 1.');
end;
procedure IrMemo4; // move to memory location 4begin
buf:=#$01;
WriteD(LocX4);
WriteD(LocY4);
WriteD(LocZ4);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 4.');
end;
procedure IrMemo2; // move to memory location 2begin
buf:=#$01;
WriteD(LocX2);
WriteD(LocY2);
WriteD(LocZ2);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 2.');
end;
procedure IrMemo3; // move to memory location 3begin
buf:=#$01;
WriteD(LocX3);
WriteD(LocY3);
WriteD(LocZ3);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 3.');
end;
procedure ActDes; // Bot On/Offbeginif Activo=1thenbegin
Activo:=0;
Activo2:=0;
Message:='Bot desactivado';
m.Lines.Add(Message);
end;
if(Activo=0)and(Activo2=1)thenbegin
Activo:=1;
Message:='Bot activado';
m.Lines.Add(Message);
end;
Activo2:=1;
end;
procedureReset; //not use :Pbeginend;
procedure PMoveOK; // Automatic movement On/Offbeginif MoveOK=1thenbegin
MoveOK:=0;
MoveOK2:=0;
Message:='Movimiento automatico desactivado.';
m.Lines.Add(Message);
end;
if(MoveOK=0)and(MoveOK2=1)thenbegin
MoveOK:=1;
Message:='Movomiento automatico activado.';
m.Lines.Add(Message);
end;
MoveOK2:=1;
end;
procedure AutoSel; // Auto Target On/Offbeginif AutoSelect=1thenbegin
AutoSelect:=0;
AutoSelect2:=0;
Message:='Auto Select desactivado';
m.Lines.Add(Message);
end;
if(AutoSelect=0)and(AutoSelect2=1)thenbegin
AutoSelect:=1;
Message:='Auto Select activado';
m.Lines.Add(Message);
end;
AutoSelect2:=1;
end;
//**********************************************************************// SKILL//procedure OnTimer1(Sender: TObject); // Skill usebeginif(TS=1)and(ATT=1)thenbegin{buf:=Hstr('2F 10 00 00 00 00 00 00 00 00 ');
SendToServer;
buf:=Hstr('45 02 00 00 00');
SendToServer;}
buf:=Hstr('2F 07 01 00 00 00 00 00 00 00');
SendToServerEx(PJName);
buf:=Hstr('45 02 00 00 00');
SendToServerEx(PJName);
end;
end;
//*************************************************// AUTO SELECT//procedure OnTimer2(Sender: TObject); // Targetnextbeginif(TS=0)and(AutoSelect=1){and (Espera=0)}thenbegin
buf:=Hstr('45 04 00 00 00'); // Selecciona.
SendToServerEx(PJName);
end;
end;
//*************************************************// ATACAR!!!//procedure OnTimer3(Sender: TObject); // Atackkkbeginif(Ts=1)thenbegin
buf:=Hstr('45 02 00 00 00'); // Ataca.
SendToServerEx(PJName);
ATT:=1;
end;
end;
//*********************************************procedure ContBichos; // Shows number of killed mobsbegin
m.lines.Add('.........................');
m.lines.Add('Total de Bichos matados: '+inttostr(BichosMuertos));
m.lines.Add('.........................');
end;
////000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000//begin// Obtener ID del PJ - Obtain Players IDif FromServer and(ConnectName=PJName)and(pck[1]=#$04)thenbegin
MiID:=ReadD(18);
IDObtenida:=1;
end;
// *****************************************************************************if FromServer and(ConnectName=PJName)and(pck[1]=#$01)then// Update Posbegin
IDTemporal:=ReadD(2);
if IDTemporal=MiID thenbegin
UltimaXa:=ReadD(6);
UltimaYa:=ReadD(10);
UltimaZa:=ReadD(14);
UltimaX:=ReadD(18);
UltimaY:=ReadD(22);
UltimaZ:=ReadD(26);
{m.Lines.Add('Recibido correctamente...');
m.Lines.Add('Coordenadas:');
m.Lines.Add(' Xa:'+inttostr(UltimaXa));
m.Lines.Add(' Ya:'+inttostr(UltimaYa));
m.Lines.Add(' Za:'+inttostr(UltimaZa));
m.Lines.Add(' X:'+inttostr(UltimaX));
m.Lines.Add(' Y:'+inttostr(UltimaY));
m.Lines.Add(' Z:'+inttostr(UltimaZ));}
IDActualizable:=1;
if NeedLoc=1thenbeginif Memorizar=1then// Updates memory Loc1begin
LocX1:=UltimaXa;
LocY1:=UltimaYa;
LocZ1:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 1 actualizada.');
end;
if Memorizar=2then// Updates memory Loc2begin
LocX2:=UltimaXa;
LocY2:=UltimaYa;
LocZ2:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 2 actualizada.');
end;
if Memorizar=3then// Updates memory Loc3begin
LocX3:=UltimaXa;
LocY3:=UltimaYa;
LocZ3:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 3 actualizada.');
end;
if Memorizar=4then// Updates memory Loc4begin
LocX4:=UltimaXa;
LocY4:=UltimaYa;
LocZ4:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 4 actualizada.');
end;
end;
end;
end;
//******************************************************************************if Activo=1thenbegin// Guarda valores de HP y MP - Update HP and MP Values// -----------------------------if FromServer and(ConnectName=PJName)and(pck[1]+pck[6]=#$0E#$04)thenbegin
CurHP:=ReadD(14);
MaxHP:=ReadD(22);
CurCP:=ReadD(30);
MaxCP:=ReadD(38);
if(CurHP<MaxHP/8)then// Me queda muy poca HP - If very little HP, Disapear!!begin
Shadow:=1;
end;
if(CurHP<MaxHP/1.8)and(UsandoPot=0)and(Shadow<>10)then// Little HP, Drink Potbegin
buf:=Hstr('14 54 D6 13 40 00 00 00 00'); // Poco HP ---- CAMBIAR CAMBIAR CAMBIAR CAMBIAR CAMBIAR
SendToServerEx(PJName);
//Message:='Menos de 66% de HP, tomo Pot';
m.Lines.Add('Tengo '+inttostr(CurHP)+'HP, tomo pot..');
UsandoPot:=1;
end;
if(CurHP=MaxHP)then// Tengo todo el HP - Full HP :Dbegin
Message:='HP al 100%';
m.Lines.Add(Message);
end;
if(CurCP<MaxCP/2)then// Me quieren PKear - Player ataks me, Desapear!!begin
Shadow:=3;
end;
Progressbar1.Position:=trunc((CurHP/MaxHp)*100);
end;
//****************************************************//********************************************************************// Muy poca vida// -----------------------if Shadow=1then// Disapear!!begin
buf:=Hstr('14 54 D6 13 40 00 00 00 00'); // Poco HP ---- CAMBIAR CAMBIAR CAMBIAR CAMBIAR CAMBIAR
SendToServerEx(PJName);
shade:=1;
buf:=#$48#$00#$00#$FE#$FF#$7F#$AB#$03#$00#$E9#$F1#$FF#$FF#$88#$D4#$00#$00#$00#$00#$00#$00;
SendToServerEx(PJName);
Message:='Menos del 10% de HP, desaparezco!';
m.Lines.Add(Message);
TS:=0;
ATT:=0;
Shadow:=10;
end;
//------------------------------------------------------------if Shadow=10then// Returnbeginif(CurHP>MaxHP/2)then Shadow:=2;
end;
//*************************************************************************// Volver de Shadowmelt// --------------------------if Shadow=2then// Returnbegin
shade:=0;
buf:=#$30#$00#$00;
SendToServerEx(PJName);
Message:='REcupere HP, volvi!';
m.Lines.Add(Message);
Shadow:=0;
Shadoweterno:=1;
end;
//****************************************************************************// Me PKean// ------------if Shadow=3then// Player atackssbegin
buf:=#$38;
WriteS('Chau PT!!!');
WriteD(0);
SendToServerEx(PJName);
shade:=1;
buf:=#$48#$00#$00#$FE#$FF#$7F#$AB#$03#$00#$E9#$F1#$FF#$FF#$88#$D4#$00#$00#$00#$00#$00#$00;
SendToServerEx(PJName);
Message:='Me ataco otro PJ y desapareci.';
m.Lines.Add(Message);
TS:=0;
ATT:=0;
delay (10000);
Shadow:=10;
end;
//**************************************************************************//*******************************************************************// Muerte// ----------------if FromServer and(ConnectName=PJName)and(pck[1]=#$06)then// Mob diedbegin
ATT:=0; // No ataca
TS:=0; // No tiene nada seleccionado
buf:=Hstr('45 05 00 00 00'); // Levantar drop
SendToServerEx(PJName);
m.Lines.Add('------------ Bicho muerto.........');
BichosMuertos:=BichosMuertos+1;
end;
//***********************************************************************// Selecciono?????// ----------------------if FromServer and(ConnectName=PJName)and(pck[1]=#$A6)then// Target selectedbegin
TS:=1;
end;
//*********************************************************************// Unselected???// ----------------if FromServer and(ConnectName=PJName)and(pck[1]=#$A2)then//Target not selected, Select!!begin
TS:=0;
ATT:=0;
buf:=Hstr('45 04 00 00 00'); // selecciona. (Target Next)
SendToServerEx(PJName);
end;
if TS=0thenbegin
buf:=Hstr('45 04 00 00 00'); // selecciona. (Target Next)
SendToServerEx(PJName);
buf:=Hstr('45 05 00 00 00'); // Levantar drop
SendToServerEx(PJName);
end;
if MoveOK=1thenbeginif(Contador=1)and(TS=0)then IrMemo1; // Move to locations...if(Contador=100)and(TS=0)then IrMemo2;
if(Contador=200)and(TS=0)then IrMemo3;
if(Contador=300)and(TS=0)then IrMemo4;
end;
Contador:=Contador+1;
IF Contador>400then Contador:=0;
if shade = 1thenbeginif FromClient and(pck[1]=#$30)then pck:='';
end;
//if FromServer and (pck[1]+pck[2]+pck[3]=#$7f#$00#$00) then UsandoPot:=0;if FromServer and(ConnectName=PJName)and(pck[1]+pck[2]+pck[3]+pck[4]+pck[5]+pck[6]+pck[7]+pck[8]+pck[9]+pck[10]+pck[11]+pck[12]+pck[13]+pck[14]+pck[15]+pck[16]+pck[17]+pck[18]+pck[19]+pck[20]+pck[21]=Hstr('64 5C 00 00 00 01 00 00 00 04 00 00 00 F5 07 00 00 01 00 00 00'))then UsandoPot:=0;
if FromServer and(ConnectName=PJname)and(pck[1]=#$27)and(pck[12]=#$03)and(pck[13]=#$06)thenbegin
PotID1:=ReadC(6);
PotID2:=ReadC(7);
PotID3:=ReadC(8);
PotID4:=ReadC(9);
m.Lines.Add('Greater Healing Potion');
m.Lines.Add('ObjectID='+inttostr(PotID1)+inttostr(PotID2)+inttostr(PotID3)+inttostr(PotID4));
end;
end;
end.
--------------------------------------------------------------------------
I know it is a dissaster but it finished like that because it started as a little simple script, but then i added some lines, then other and other and other... I have to re-write it also, but it requires time, that i don't have...
Maybe some parts are useful to some body, that is why i posted it...
If some one have some question about the scripts, just ask
Charly.
P.S.: i entered the code using CODE between [], and at the end /CODE, also between [], but the reserved words as "procedure" didn't appeared highlighted, am i doing it well???
--> Edited, now it's ok
--> New edit, i added some explanations of the code....
Последний раз редактировалось charly911, 25.08.2008 в 02:20.
воть это мой третий скрипт по счету, который висит окошкоми показывает статы, можно добавить все что угодно пишитеа еще лучше, кто подправит ошибку при выключении - пирожокinvalid pointer operation а так все путем
delphi Код:
//монитор, показывает хп\мп\вес\имя :)//мспользуется в процессах когда нужно nofreeondisconect//ну или когда вам захочется//тестировался на l2c6 alpha //v0.1b - первая версия//v0.2b - изменет алгоритм принудительного обновления//(c)metalFanconst
name = 'metalFan' ;
//Warning! Не поставишь имя - вылетишь из игры! xDvar frm: TForm; m: TMemo; Button: TButton; MaxHP,CurHP,MaxMP,CurMP,CurLoad,MaxLoad,i: integer;
CharName: string;
procedure Init;
begin//формочка
frm := TForm.Create(nil);
frm.Caption := 'Info by metalFan v0.2b';
frm.BorderStyle := bsDialog;
frm.Position := poScreenCenter;
frm.Width:=250;frm.Height:=125;
frm.OnClose := @FormClose;
m:=TMemo.Create(frm);
m.parent:=frm;
m.align:=alClient;
m.ReadOnly:=true;
m.ScrollBars:=ssBoth;
Button := TButton.Create(frm);
Button.Parent := frm;
Button.Caption := 'Refresh';
Button.Left := 125;
Button.Top := 15;
Button.onClick := @ForceUpdate;
frm.show;
end;
//закрываем формочку procedure free;
begin
m.free;
Button.Free;
frm.free;
end;
//принудительное обновление procedure ForceUpdate;
begin buf:=Hstr('45 01 00 00 00 00 00 00 00 00');
SendToServerEx(name);
delay(50); buf:=Hstr('45 01 00 00 00 00 00 00 00 00');
SendToServerEx(name);
end;
//(c)NLObP скажи нет случайному закрытию формы procedure FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caNone;
end;
procedure OnDisconnect(WithClient: Boolean); //Вызывается при установке соединения begin
NoFreeOnClientDisconnect;
NoFreeOnServerDisconnect;
end;
//думалка beginif FromServer and(ConnectName=name)and(pck[1]=#$04)thenbegin
i:=22; CharName:=ReadS(i); i:=i+48; MaxHP:=ReadD(i); CurHP:=ReadD(i); MaxMP:=ReadD(i); CurMP:=ReadD(i); i:=i+4; CurLoad:=ReadD(i); MaxLoad:=ReadD(i);
//выводим на экран это дело
m.lines.add('Name ' + CharName);
m.lines.add('Health ' + inttostr(CurHP) +'\' + inttostr(MaxHP));
m.lines.add('Mana ' + inttostr(CurMP)+'\' + inttostr(MaxMP));
m.lines.add('Load ' + inttostr(CurLoad)+'\' + inttostr(MaxLoad)); end;
end.
Добавлено через 6 минут
кстати как код вставлять а не цитату?
Последний раз редактировалось NLObP, 24.07.2008 в 13:47.
Причина: Добавлено сообщение
//закрываем формочку
procedure free;
begin m.free;
frm.free;
Button.Free;
end;
Неправильный порядок вызова процедур.
Уничтожение формы, последнее что должно быть в нашем случае. Мне так кажеться, что frm.free достаточно одной. Сделай так:
delphi Код:
procedure free;
begin
m.free;
Button.Free;
frm.free;
end;
Добавлено через 2 минуты
Цитата:
Сообщение от metalFan
кстати как код вставлять а не цитату?
Самая правая решётка. Пишишь туда - delphi, и будет такое обрамление кода [ HIGHLIGHT = " delphi " ][ / HIGHLIGHT ]
Последний раз редактировалось NLObP, 24.07.2008 в 13:40.
Причина: Добавлено сообщение
Хроники Камаель.
Вобщем, в очередной раз сунувшись в кх и обнаружив полное отсутствие свитков для ТП решил посадить там перса с вот таким скриптом
delphi Код:
//Включить автоскупку - Да, выключить - Нетconst
name='';
var
OIDnpc:integer;
MyX,MyY,Myz:integer;
start:boolean;
startsk,startcmd:ttimer;
kolvocmd,i,j,jj,x,step,st,itemID,itemcount,count,IDlist:integer;
Buy:array[1..15,1..2] ofinteger; //массив для хранения ID и количества итемов в Buy-листе
CmdNpc:array[1..50] ofstring;
findt,oldpck,cmd,itemIDstr,countstr:string;
Ste:array[1..3] ofinteger; //в этом массиве содержится последовательность номеров нажимаемых кнопок в менюprocedure Init;
begin
OIDnpc:=0; //Ввести OID нпс кланхолла
startcmd:=TTimer.Create(nil); //счетчик для отсылки команд
startcmd.OnTimer:=@scmd;
startcmd.enabled:=false;
startcmd.interval:=1500;
startsk:=TTimer.Create(nil); //счетчик для частоты пробы покупки
startsk.OnTimer:=@skupka;
startsk.enabled:=false;
startsk.interval:=1000*60*1;
Ste[1]:= 3;
Ste[2]:= 4;
ste[3]:= 1;
step:=0;
count:=0;
end;
procedure Free;
begin
startsk.free;
end;
procedure scmd;
begin
sendmsg(cmd);
RequestByPassToServer(cmd);
startcmd.enabled:=false;
end;
procedure SendMsg(msg:string);
begin
buf:=#$4A;
WriteD(0);
WriteD(10);
WriteS('');
WriteS(msg);
SendToClientEx(Name);
end;
procedure Skupka;
begin
target(OIDnpc);
delay(800);
target(OIDnpc);
delay(800);
end;
procedure Target(Attacker: Integer);
begin
buf:=#$1f;
WriteD(Attacker);
WriteD(MyX);
WriteD(MyY);
WriteD(MyZ);
WriteC(00);
SendToServerEx(Name);
end;
procedure CmdNpcParc;
Begin
kolvocmd:=0;
for j:=1to50dobegin
CmdNpc[j]:='';
end;
for j:=1tolength(oldpck)dobeginfor x:=0to9dobegin
findt:=findt+oldpck[j+x];
end;
if findt='bypass -h 'thenbeginfor x:=10to25dobegin
CmdNpc[kolvocmd+1]:=CmdNpc[kolvocmd+1]+oldpck[j+x];
end;
kolvocmd:=kolvocmd+1;
end;
findt:='';
end;
end;
procedure RequestByPassToServer(cmd:string);
begin
buf:=#$23;
WriteS(cmd);
SendToServerEx(Name);
end;
procedure RequestBuyItem;
begin
buf:=#$40;
WriteD(IDlist);
WriteD(count);
for i:=1to count dobegin
WriteD(buy[i,1]);
WriteD(buy[i,2]);
end;
SendToServerEx(Name);
end;
//----------------------------------------------------------beginif FromClient and(ConnectName=name)and(pck[1]=#$59)thenbegin
MyX:=ReadD(6);
MyY:=ReadD(10);
MyZ:=ReadD(14);
end;
if FromClient and(ConnectName=name)and(pck[1]=#$34)and(pck[2]=#$06)then startsk.enabled:=true;
if FromClient and(ConnectName=name)and(pck[1]=#$34)and(pck[2]=#$05)then startsk.enabled:=false;
if fromserver and(ConnectName=name)and(pck[1]=#$19)thenbegin
oldpck:=ReadS(6);
CmdNpcParc;
ifnot startcmd.enabledthen step:=step+1;
if step=4then step:=1;
cmd:=CmdNpc[ste[step]];
startcmd.enabled:=true;
end;
if fromserver and(ConnectName=name)and(pck[1]=#$07)thenbegin
IDlist:=ReadD(6);
jj:=1;
for j:=1to15dobegin//берем первые 15 итемов из buy-листа, мне более ненужно
i:=18+((j-1)*64);
itemID:=ReadD(i);
itemcount:=ReadD(i);
if(itemID=5858)or(itemid=1829)or(itemid=7134)or(itemid=7126)thenbegin//здесь ID вещей которые хотелось бы купить
buy[jj,1]:=ItemID;
buy[jj,2]:=itemcount;
count:=count+1;
inc(jj,1);
end;
end;
if count<>0thenbegin
RequestBuyItem;
count:=0;
end;
end;
end.
Прошу вашей помощи в оптимизации скрипта, он как-то вышел кривобоко ппц
__________________ На фразы в аську типа "слух карочь 1)как точить 2)как раскачаться за 5 мин" - игнор. ИМХО идиотизм
Дай голодному рыбу - он будет один день сыт. Покажи ему, как удить рыбу - он пошлёт тебя и скажет, что у него есть более интересные занятия, чем забрасывать снасти в воду
David Kastrup @ de.comp.text.tex.
"Приобретенные навыки общения с маленькими детьми - сильно упрощают взаимопонимание на форумах..."
А вы знаете, что для качественной сварки - место шва нужно протереть спиртом?
Последний раз редактировалось Breadfan, 31.08.2008 в 15:19.
поначалу отписал ето в КРУЖКЕ НУБОВ но думаю тут ето уместней.. перенес сюда..
у вас 10 окон расставлены как артилерия на поле.. хаотично или по порядку.. вы можете с етих окон сделать РЕДИРЕКТ ИНФЫ на основного чара об том где кто ково видет.. и на основном чаре ты станеш видеть всё поле! прикинь! и ето реально сделать! город на осаде окружить трупами- хотябы 3-4 чарами.. и редирект сделать!
и ты станеш виедеть за 3 километра всех кто там в замке- бегает... жесть
таково еще я неделал но думаю ето несложно.. думаю хорошобы 4 трупа вокруг замка вплотную к стене уложить и сних инфу РЕДИРЕКТИТЬ на основного чара.. а еще думаю во время осады сделать РЕНЕЙМ НИКОВ ВАРОВ.. те налету на основном чаре переделывать ник (либо подпись) в что то типа ПРОФА,ШМОТ, и возможно состояние- типа УД.. удобно было бы.. видиш толпу мясо на осаде а в подписях у всех профа написана.. и буква означающая А или Б или Ы сет.. сразу видно кто папко а кто нет.. имхо удобно..
также думаю было бы неплохо какнибудь автоматизировать процес выделения в таргет варов.. ну не автоматически конечно но хотябы както.. лично у меня большая проблема во время осады с тем что в толпе мяса где вары со своими в перемешку- таргет взять врага.. думаю можно над бошкой стрелочку рисовать которая укажет направление откуда по тебе нанесли удар.. а также в дополнение к етому запрограмировать какоето социальное действие на то чтобы взять в таргет того кто по тебе нанес удар- последним.. если по тебе сразу 2-3 бьют то стрелочка над головой будет крутиться и показывать направление последнего удара.. и при желании нажав на социальное действия тот кто бил последним возьмется в таргет.. думаю ето удобно было бы.. также думаю что еще необходимо выделить както тех кто по тебе стреляет.. типа их НИК или подпись переделывать в что то типа "!!АХТУНГ!!" и плюс к етому состояние ПК вешать на него чтоб ник красным был , чтоб он в толпе не потерялся.. на него укажет и стрелочка и ник будет изменен и прижелании нажав кнопку- выделится в таргет
как вам идея? вроде похожее никто пока невыкладывал? может займемся? полноценным помошником на осаде?
__________________
Цитата:
Сообщение от pybukon
прежде чета попросить я немнога раскажу чтоб вы понили как мне плоха
Цитата:
Сообщение от Byrger
А как сделать мой скрипт бесконечным?
Цитата:
Сообщение от XKOR
.. каждый день ионизированной ногой протирает больную)
Цитата:
Сообщение от PsyR
Вылоджите пожалуйста скрипт на рыбалку желательно что бы сам в ВХ клал адаптированый под шоки и так же скрипт на ТТ рец, тоже с диалогами
Последний раз редактировалось VORON, 10.09.2008 в 01:08.
Идея отстой.
Попробуй прийти на осаду с включенам пакетхаком.
Думаю ты неприятно удивишся задержками.
ПВПшится нереально, даже с простейшими скриптами.