Jump to content

Recommended Posts

Posted

 

SetTarget(const Name: string): Boolean; overload; Set target by name

const Name : string - name is a constant and naturally also a string, not an integer for example.

Boolean - true or false. See: https://en.wikipedia.org/wiki/Boolean_data_type

overload - no idea.

 

Way to use that command in your script:

begin

SetTarget('Mycharname')

end.

 

Targets whatever with name 'Mycharname'

Posted

such arg is set to read-only inside given function, you use it for safty / clarity and also optimization cuz compiler won't assume you may change these vars

Posted (edited)

EDIT: I try edit script for buy all, buff, and go to imperial tomb, but idk why dont work, i think is any problem in Buy mana part, but i read 30 times and dont know where is error :/ Char move to this coordinates: 147727, -58521, -2981, he buff and buy ss, but after just do nothing.

var MP, Shot: TL2Item;
buff: TL2Buff;
function buffCheck: Boolean;
begin
  Engine.MoveTo(147727, -58521, -2981);
        delay(1000);
  Engine.MoveTo(147746, -55697, -2742);
    if (not User.Buffs.ByID(1062, buff) or (buff.endtime<300000)) then begin //1062 wich buff id checking
        Result:=true;
        Delay(1000);
  Engine.SetTarget('buffer');                                      ///buffer
   engine.dlgopen;
    Delay(1000);
    Engine.BypassToServer('Quest 555_NPCBuffer cast 4373 x x'); 
        Delay(1000);
    end;
Result:=false;
end;

function BuyMP:boolean;
begin
if not Inventory.User.ByID(728, MP) or (MP.count<800) then begin //728 mp id ,10 or less then buy MP so probably change it for your count
result:=true;
        Delay(1000);
  Engine.SetTarget('Sellena');                                      ///gmshop
   engine.dlgopen;
    Delay(1000);
  Engine.DlgSel('Potion');
        delay(1000);
        Engine.NpcExchange(728, 1100);  //728 mp id, 2 is count how many buy it
        delay(1000);
        end;
        result:=false;
  Engine.CancelTarget;
end;

function BuyShot:boolean;
begin
if not Inventory.User.ByID(3951, Shot) or (Shot.count<4500) then begin //1463 is d grade shot id, change for your shot id, 900 or less then buy shots
result:=true;
        Delay(1000);
  Engine.SetTarget('Sellena');                                      ///gmshop
   engine.dlgopen;
        Delay(1000);
  Engine.DlgSel('Soulshots');
        Delay(1000);
        Engine.NpcExchange(3951, 12);   //3951 id, 50 is count wich buy
        delay(1000);
        end;
        result:=false;
end;


function deadCheck: Boolean;
begin
Result := false;
    if User.Dead then begin
        Result := true;
        Print('Dead. Pressing to village.');
        Delay(1000);
        Engine.FaceControl(0,false);
        Engine.GoHome;
        Delay(10000);
    end;
end;

begin
while true do begin
delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;                      
                             
    if user.inrange(-181346, -75785, -2731, 300) then begin  //coordinates after teleport
        Print('Moving');
        Engine.MoveTo(177893, -75352, -2728);      //path to spot
        Engine.MoveTo(177956, -78138, -3379);
        Engine.MoveTo(177947, -80965, -4026);
        Print('ON!');
        Delay(500);
        Engine.FaceControl(0, true);  //turn on bot
        while not deadCheck do delay(1000); //while not dead, do nothing and wait.
    end;
end;
end.

Think problem is i need buy from same npc ss/mana.

Edited by CristianPascual
Posted

Correct me if I'm wrong, but where do you call functions: buyShot, buyMp and buffCheck in your loop???

 

 

At first: put Result:= false after "begin" in each function. Change range from 5000 to like 15000(if still won't work make path to get closer to the teleport NPC).

 

Also I recommend to put this:

delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;   

in a function, and call this function after rbf or shopping is done.

Posted

i guess he play interlude

 

Nope, is L2 H5, server is l2stars. Dont know what l2pack use this server.

 

 

Correct me if I'm wrong, but where do you call functions: buyShot, buyMp and buffCheck in your loop???

 

 

At first: put Result:= false after "begin" in each function. Change range from 5000 to like 15000(if still won't work make path to get closer to the teleport NPC).

 

Also I recommend to put this:

delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;   

in a function, and call this function after rbf or shopping is done.

 

 

I put result=false after begin, and range is now 15000 but same problem.

 

I cant make this function and call function after rebuff or shopping done, cause shopping dont work do you understand what want i do? If i remove me berseker buff and i if dont have ss/mana potions, char just rebuff, buy ss, and returns to the coordinates of the beginning (Engine.MoveTo(147746, -55697, -2742) [;)] .

 

If i have berseker and soulshots, char do nothing, just move to coordinates all time.

Sorry for this english.

Posted

in buyshot function i see you change id so need change here too 

if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
  • 10 months later...
Posted

 

change Engine.BypassToServer to your server or use Engine.DlgSel this script works l2blaze/l2neo i think

begin
while true do begin
  Engine.SetTarget(31521);                                      ///jeremy
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31521-1.htm');
  Engine.MoveTo(150404,-113188,-2141);
  Engine.MoveTo(150533,-114686,-1779);
  Engine.MoveTo(151344,-115006,-1611);
  Engine.CancelTarget;
  Engine.MoveTo(154492,-114995,-1567);
  Engine.MoveTo(157224,-115436,-1922);
  Engine.MoveTo(157381,-115407,-1896);
  Engine.MoveTo(157358,-115501,-1921);
  Engine.MoveTo(157598,-115486,-1927);
  Engine.SetTarget(31543);                                    ////pulin
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  delay(500) ;
  Engine.bypasstoserver('Quest 621_EggDelivery 31543-1.htm');
  Delay(500);
  Engine.MoveTo(156803, -115366, -1880);
  Engine.MoveTo(155365, -114559, -1625);
  Engine.CancelTarget;
  Engine.MoveTo(154269, -113957, -1604);
  Engine.MoveTo(152599, -113547, -1658);
  Engine.MoveTo(152072, -113343, -1626);
  Engine.MoveTo(151519, -112861, -1999);
  Engine.MoveTo(151244, -112937, -2124);
  Engine.MoveTo(151203, -112241, -2287);
  Engine.MoveTo(153632, -110383, -2675);
  Engine.MoveTo(154994, -107157, -2697);
  Engine.MoveTo(155599, -105710, -2755);
  Engine.SetTarget(31544);                                      /// naff
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31544-1.htm');
  Delay(500);            
  Engine.MoveTo(155621,-105697,-2780);
  Engine.MoveTo(154776,-104491,-2810);
  Engine.CancelTarget;
  Engine.MoveTo(153253,-101918,-2757);
  Engine.MoveTo(152601,-101212,-2943);
  Engine.MoveTo(149277,-100863,-2943);
  Engine.MoveTo(148429,-100919,-2994);
  Engine.MoveTo(146268,-101937,-2872);
  Engine.MoveTo(144957,-102812,-3556);
  Engine.MoveTo(141104,-105238,-3650);
  Engine.MoveTo(140773,-105450,-3659);
  Engine.MoveTo(140748,-105458,-3625);
  Engine.SetTarget(31545);                                      ///crocus
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31545-1.htm');
  Delay(500);
  Engine.MoveTo(140722,-105729,-3654);
  Engine.MoveTo(140862,-108560,-3654);
  Engine.CancelTarget;
  Engine.MoveTo(141469,-109301,-3616);
  Engine.SetTarget(31546);                                    ////kuber
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31546-1.htm');
  Delay(500);
  Engine.MoveTo(142274, -109216, -3587);
  Engine.MoveTo(143990, -108702, -3503);
  Engine.CancelTarget;
  Engine.MoveTo(146375, -108965, -3252);
  Engine.MoveTo(147727, -108871, -2899);
  Engine.MoveTo(148785, -108902, -2639);
  Engine.MoveTo(149347, -109226, -2515);
  Engine.MoveTo(149506, -110728, -2294);
  Engine.MoveTo(147948, -113046, -2157);
  Engine.MoveTo(147899, -113372, -2150);
  Engine.MoveTo(147528, -113301, -2112);
  Engine.SetTarget(31547);                                    /////beolin
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31547-1.htm');
  Delay(500);
  Engine.MoveTo(147591,-113304,-2108);
  Engine.MoveTo(148037,-113126,-2163);
  Engine.MoveTo(148908,-112712,-2096);
  Engine.MoveTo(149508,-112634,-2090);
  Engine.SetTarget(31521);                                  ///jeremy
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31521-3.htm');
  Delay(500);
  end;
 end.

This one is working on todays l2neo but after he deliver eggs and finish the quest he cant take a new one and hes just running the course w/o the quest taken. Any help with that?

  • Vision locked this topic
Guest
This topic is now closed to further replies.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock