Jump to content

Adrenaline - Read Packets on Engine.WaitAction


Demonho

Recommended Posts

Hello,

Need help with script, need capture info about olympiad in interlude (/olympiadstat)

How can read the system messages?

 

var
	p1, p2: pointer;
    matches, wins, loss, points : integer;
    OlyStat : integer;    
begin
	//1673	1	Your current record for this Grand Olympiad is $s1 match(es), $s2 win(s) and $s3 defeat(s). You have earned $s4 Olympiad Point(s).	0	79	9B	B0	FF			0	0	0	0	0		none
	OlyStat:=1673;
	while (true) do 
    begin
    	//laSysMsg - system message appeared. P1 - message identificator (cardinal), P2 - message data (TMemoryStream).
		Engine.WaitAction([laSysMsg], p1, p2);
        if(p1=OlyStat)then
        begin
        	//need read olympiad stat from p2 
            matches:=???
            wins:=???
			loss:=???
            points:=???
        end;
    end;
end;

 

Edited by Demonho
Link to comment
Share on other sites

uses
  SysUtils;

var
  p1, p2: Pointer;
  Match, Win, Loss, Points: Cardinal;
begin
  while true do
  begin
    if Engine.WaitAction([laSysMsg], p1, p2) = laSysMsg then
    begin
      if Cardinal(p1) = 1673 then
      begin
        Match := PCardinal(Cardinal(p2) + 12)^;
        Win := PCardinal(Cardinal(p2) + 20)^;
        Loss := PCardinal(Cardinal(p2) + 28)^;
        Points := PCardinal(Cardinal(p2) + 36)^;
        print(format('Match: %d; Win: %d; Loss: %d; Points: %d', [Match, Win, Loss, Points]));
      end;
    end;
  end;
end.

 

Link to comment
Share on other sites

Thanks adr.bot

 

On 4/11/2021 at 7:53 PM, adr.bot said:

Match := PCardinal(Cardinal(p2) + 12)^;

Win := PCardinal(Cardinal(p2) + 20)^;

Loss := PCardinal(Cardinal(p2) + 28)^;

Points := PCardinal(Cardinal(p2) + 36)^;

changed to find the correct values:
 

        Match := PCardinal(Cardinal(p2))^;
        Win := PCardinal(Cardinal(p2) + 8)^;
        Loss := PCardinal(Cardinal(p2) + 16)^;
        Points := PCardinal(Cardinal(p2) + 24)^;
Link to comment
Share on other sites

25 minutes ago, Demonho said:

Thanks adr.bot

 

changed to find the correct values:
 





        Match := PCardinal(Cardinal(p2))^;
        Win := PCardinal(Cardinal(p2) + 8)^;
        Loss := PCardinal(Cardinal(p2) + 16)^;
        Points := PCardinal(Cardinal(p2) + 24)^;

np, but it is really correct values? for example when tested (interlude)
 

PCardinal(Cardinal(p2))^

gave me system message ID.

https://prnt.sc/11c67l2

Edited by adr.bot
  • Like 1
Link to comment
Share on other sites

^^ yeah!!!

In another case, for relogin purposes i need check if char is online, my idea is send a invalid command to server. If receive the Command not found, char is online.

i made a test with:
 

uses
  SysUtils;

var
  p1, p2: Pointer;
  Match, Win, Loss, Points: Cardinal;
  i: integer;
  ret: string;
begin
  while true do
  begin
    if Engine.WaitAction([laSysMsg], p1, p2) = laSysMsg then
    begin
      if Cardinal(p1) = 1987 then
      begin
        for i:= 0 to 44 do
        begin
          if i mod 2 <> 0 then Continue;
          ret:=ret+PChar(Cardinal(p2)+i)^;
        end;
      end;
      Print(ret);
    end;
  end;
end.

its correct? give me result i am expecting: SYS: Command not found.

There is a better way to read p2 on this case?

Link to comment
Share on other sites

28 minutes ago, Demonho said:

^^ yeah!!!

In another case, for relogin purposes i need check if char is online, my idea is send a invalid command to server. If receive the Command not found, char is online.

i made a test with:
 



uses
  SysUtils;

var
  p1, p2: Pointer;
  Match, Win, Loss, Points: Cardinal;
  i: integer;
  ret: string;
begin
  while true do
  begin
    if Engine.WaitAction([laSysMsg], p1, p2) = laSysMsg then
    begin
      if Cardinal(p1) = 1987 then
      begin
        for i:= 0 to 44 do
        begin
          if i mod 2 <> 0 then Continue;
          ret:=ret+PChar(Cardinal(p2)+i)^;
        end;
      end;
      Print(ret);
    end;
  end;
end.

its correct? give me result i am expecting: SYS: Command not found.

There is a better way to read p2 on this case?

i would recommend read this https://adrenalinebot.com/en/api/example/packetunit-ready-unit-working-packets-adrenaline-bot because how u read seems not right.
p2  should contain (in my case MessageID), Size, Type, and values by Type.

thats why i dont have answer for ur question in this case, because ur system message data seems odd to me xd

ps. u always can use move and check if u moved.

Edited by adr.bot
Link to comment
Share on other sites

On 4/14/2021 at 4:36 PM, adr.bot said:

ps. u always can use move and check if u moved.

see a quite more easy to implement.

Tested the unitpacket, this operations os pointers is strange a lot for me, i cant see any logic here kkkkk
 

uses
  SysUtils, PacketUnit;

var
  p1, p2: Pointer;
  Match, Win, Loss, Points: Cardinal;
  i: integer;
  ret: string;
  p : TNetworkPacket;
begin
  while true do
  begin
   
    if Engine.WaitAction([laSysMsg], p1, p2) = laSysMsg then
    begin
      if Cardinal(p1) = 1987 then
      begin
        p:=TNetworkPacket.Create(p2,46);
        Print(p.ReadS);
        p:=nil;        
      end;

      if Cardinal(p1) = 1673 then
      begin
        p:=TNetworkPacket.Create(p2,24);
        Match := p.ReadD;
        Win := p.ReadD;
        Loss := p.ReadD;
        Points := p.ReadD;
        p:=nil;
        print(format('Match: %d; Win: %d; Loss: %d; Points: %d', [Match, Win, Loss, Points]));
      end;      
    end;
  end;
end.

 

Link to comment
Share on other sites

10 minutes ago, Demonho said:

see a quite more easy to implement.

Tested the unitpacket, this operations os pointers is strange a lot for me, i cant see any logic here kkkkk
 


uses
  SysUtils, PacketUnit;

var
  p1, p2: Pointer;
  Match, Win, Loss, Points: Cardinal;
  i: integer;
  ret: string;
  p : TNetworkPacket;
begin
  while true do
  begin
   
    if Engine.WaitAction([laSysMsg], p1, p2) = laSysMsg then
    begin
      if Cardinal(p1) = 1987 then
      begin
        p:=TNetworkPacket.Create(p2,46);
        Print(p.ReadS);
        p:=nil;        
      end;

      if Cardinal(p1) = 1673 then
      begin
        p:=TNetworkPacket.Create(p2,24);
        Match := p.ReadD;
        Win := p.ReadD;
        Loss := p.ReadD;
        Points := p.ReadD;
        p:=nil;
        print(format('Match: %d; Win: %d; Loss: %d; Points: %d', [Match, Win, Loss, Points]));
      end;      
    end;
  end;
end.

 

well i mean to read to see idea how it getting read, and not actually use it.
anyways to read string (probably, should actually test), i cant tell "Position" number because ur server positions seems odd to me.

String(PChar(Cardinal(p2) + Position))

 

Link to comment
Share on other sites

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


  • Posts

    • Good luck with ur server looks decent the legend is back 🙂
    • The Photoshop Pen Tool, denoted by a pen nib icon, is a versatile tool for precise selections and paths. Click to create anchor points, drag for curves, and close paths to make selections. Refine with the Direct Selection Tool. Useful for intricate designs, cutouts, and precise selections in just a few clicks.
    • My experience with the "Developer" Ban L2JDEV.   On September 22nd, after much effort, I made the terrible decision to work with this individual. At first, everything went smoothly, even pleasantly one could say. In summary, from September 22nd to the present date, he has delivered 2 versions of the pack. The first one seemed like a beta made by someone inexperienced in development. The second one was an even older version. The latest version delivered on December 1st is an older version of ACIS and has nothing to do with what I initially purchased. There were some "improvements" he claimed to have made regarding the drop system, which, in reality, doesn't work at all; it's a delay in time. He asked for 2 more days to add everything I wanted, and, adapting to that pack because time was running out, on December 5th, he claimed he was sick (classic). On December 6th, I informed him of some issues with his drop MOD. On December 7th, I began calling and messaging him to find out what was happening, but to this date, I have never received a response from him. He is always online but never shows up. I will leave a couple of YouTube links with the entire conversation from day one through Discord and WhatsApp, including images of payments and everything else, in case someone is interested in the matter. I know time and money won't be returned with this post, but besides venting, I would appreciate everyone's support in spreading this to prevent more people from being scammed by this individual.       Minha experiência com o "Desenvolvedor" Ban L2JDEV.   Em 22 de setembro, após muito esforço, tomei a terrível decisão de trabalhar com este indivíduo. No início, tudo correu bem, até agradavelmente, poderia-se dizer. Em resumo, do dia 22 de setembro até a presente data, ele entregou 2 versões do pacote. O primeiro parecia uma versão beta feita por alguém inexperiente no mundo do desenvolvimento. O segundo era uma versão ainda mais antiga. A última versão entregue em 1º de dezembro é uma versão mais antiga do ACIS e não tem nada a ver com o que eu comprei inicialmente. Houve algumas "melhorias" que ele afirmou ter feito no sistema de drop, que na realidade não funciona de maneira alguma; é um atraso no tempo. Ele pediu mais 2 dias para adicionar tudo o que eu queria, adaptando-me a esse pacote porque o tempo estava se esgotando. Em 5 de dezembro, ele respondeu que estava doente (clássico). Em 6 de dezembro, informei sobre alguns problemas com o MOD de drop dele. Em 7 de dezembro, comecei a ligar e escrever para saber o que estava acontecendo, mas até a presente data, nunca recebi uma resposta dele. Ele está sempre online, mas nunca se manifesta. Deixarei alguns links do YouTube com toda a conversa desde o primeiro dia pelo Discord e WhatsApp, incluindo imagens dos pagamentos e tudo o mais, caso alguém esteja interessado no assunto. Eu sei que o tempo e o dinheiro não serão recuperados com este post, mas além de desabafar, eu apreciaria o apoio de todos para divulgar isso e evitar que mais pessoas sejam enganadas por este indivíduo.         Mi experiencia con el "Desarrollador" Ban L2JDEV.   el 22 de septiembre después de mucho esfuerzo, tome la terrible decisión de trabajar con este individuo, al principio todo fue fluido, hasta agradable se podría decir. Haciendo resumen, desde el 22 de septiembre a la fecha, me ha entregado 2 versiones del pack, el primero que parecía beta hecha por algún pasante por el mundo del desarrollo. Y el segundo una versión mas antigua... la ultima versión entregada el 1ro de diciembre es una versión mas antigua del acis y no tenia nada que ver con lo que había comprado al principio, unas "mejoras" de parte de el con el tema del drop, cosa que no funciona para nada, es un retraso en el tiempo. Me pidió 2 días mas para agregar todo lo que yo quería, adaptándome a ese pack porque ya el tiempo me ganaba, el 5 de diciembre me responde que estuvo enfermo, clásica. El día 6 le informo de unos problemas con su MOD de drop. el día 7 empiezo a llamarlo y a escribirle para saber que pasaba, cosa que hasta la fecha nunca he tenido una respuesta de su parte. Siempre esta en lineal, solo no da la cara. Dejare un par de links de youtube, con toda la conversación desde el primer día por discord y WhatsApp, imagenes los pagos y todo el resto por si alguien esta interesado en el tema. Se que el tiempo ni el dinero serán retornados con este post, pero además de desahogarme, agradecería el apoyo de todos para regar esto y evitar que mas gente sea estafada por este individuo Links:       
    • THE PROBLEM SOLVED!    YOU CAN LOCK THE TOPIC!          Reset PC connection, and everything will be fine, if anyone will meet a problem like that. 
  • Topics

×
×
  • Create New...