Help InsertAt

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Help InsertAt

14 Sep 2022, 20:00

I need help InsertAt
my address is like this

Code: Select all

 [0x14, 0x30]
Offset%OFFSET_ATUAL%.InsertAt(1, 0x0 ) ; this one will add 0x0 at the end but when he adds this 0x0 in the next loop the 0x0 has to be 0x0 +4 staying,

Code: Select all

loop, 1 [0x0, 0x14, 0x30]
loop, 2 [0x04, 0x0, 0x14, 0x30]
loop, 2 [0x08, 0x0, 0x0, 0x14, 0x30]
loop, 3 [0x12, 0x0, 0x0, 0x14, 0x30]
I will put my code below

Code: Select all


Loop 11 ; Para criarmos 10 arrays
{
	OFFSET_ATUAL := A_Index 
	Offset%OFFSET_ATUAL% := [0x14, 0x30]
	Loop % A_Index ; 
	{
		Offset%OFFSET_ATUAL%.InsertAt(1, 0x0 ) ;
		
	}
}

Thank you very much in advance
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: Help InsertAt

15 Sep 2022, 06:43

I tried like this not right

Code: Select all

SetFormat, IntegerFast, hex
Loop 11 ; Para criarmos 10 arrays
{
	OFFSET_ATUAL := A_Index 
	Offset%OFFSET_ATUAL% := [0x14, 0x30]
	Loop % A_Index ; 
	{
	Offset%OFFSET_ATUAL%.InsertAt(1, 0x0, count ) 
                global count += 0x4		
	}
}

User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Help InsertAt

15 Sep 2022, 06:52

Hi,

The pattern in your example is a bit puzzling. I recommend describing it in more detail, step by step.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: Help InsertAt

15 Sep 2022, 07:08

mikeyww wrote:
15 Sep 2022, 06:52
Hi,

The pattern in your example is a bit puzzling. I recommend describing it in more detail, step by step.
hello, what I'm trying to do is that it has to add 0x0 dps of 0x14 in loop 2 it will add + 1 0x0 and now with + 0x4 only in 0x4 it goes up + 4bytes, like this one below

Code: Select all

loop, 1 [0x0, 0x14, 0x30]
loop, 2 [0x04, 0x0, 0x0, 0x14, 0x30]
loop, 2 [0x08, 0x0, 0x0, 0x0, 0x14, 0x30]
loop, 3 [0x12, 0x0, 0x00, 0x00, 0x14, 0x30]
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Help InsertAt

15 Sep 2022, 07:23

I'm not sure why there are two loop 2's. Perhaps others can figure it out or understand it.
User avatar
boiler
Posts: 17384
Joined: 21 Dec 2014, 02:44

Re: Help InsertAt

15 Sep 2022, 07:37

I believe that is because there are two iterations of the inner loop within the second iteration of the outer loop (so there would be three items for the third loop, four for the fourth, etc.), but I agree that the desired outcome is not at all clear and needs to be described (much) better.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: Help InsertAt

15 Sep 2022, 07:56

boiler wrote:
15 Sep 2022, 07:37
I believe that is because there are two iterations of the inner loop within the second iteration of the outer loop (so there would be three items for the third loop, four for the fourth, etc.), but I agree that the desired outcome is not at all clear and needs to be described (much) better.
my English is a little bad, it is already add 0x00 at the end of the offset, after the 0x0 is added, I want it to also add a BufferPointer = + 0x4 to every loop first loop , 0x4 second loop 0x8 so on

Code: Select all

read::

SetFormat, IntegerFast, hex
Loop 11 ; To create 11 arrays
{
	OFFSET_ATUAL := A_Index ; We save the current integration value of the outer loop so we can use it inside the inner loop below.
	Offset%OFFSET_ATUAL% := [0x14, 0x30] ; We start with the basic array model
	Loop % A_Index ;And then we'll loop through the current iteration number
	{
		Offset%OFFSET_ATUAL%.InsertAt(1, 0x0 ) ; To insert as many 0x0 elements as the current iteration (for example, in the 5th iteration we will insert 5 0x0 elements)
	}
}

Loop 11
{
	Readt%A_Index% := mem.readString(mem.BaseAddress + 0x952EE0, 15, "utf-8",  Offset%A_Index%*)

}
I tried to do this and it didn't work

Code: Select all

Offset%OFFSET_ATUAL%.InsertAt(1, 0x0, count ) 
                global count += 0x4	
User avatar
boiler
Posts: 17384
Joined: 21 Dec 2014, 02:44

Re: Help InsertAt

15 Sep 2022, 08:07

0x8 plus 0x4 is not 0x12, it’s 0xC. Internally, it’s the same integer whether you want to ultimately view it in hex or decimal. You might as well say you want it to be 4, 8, 12, 16, … (which is 0x4, 0x8, 0xC, 0x10, …).
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: Help InsertAt

15 Sep 2022, 09:11

boiler wrote:
15 Sep 2022, 08:07
0x8 plus 0x4 is not 0x12, it’s 0xC. Internally, it’s the same integer whether you want to ultimately view it in hex or decimal. You might as well say you want it to be 4, 8, 12, 16, … (which is 0x4, 0x8, 0xC, 0x10, …).
This has to be in hex, how would i do?
User avatar
boiler
Posts: 17384
Joined: 21 Dec 2014, 02:44

Re: Help InsertAt

15 Sep 2022, 17:31

No, it doesn’t have to be in hex. 0xC is the same as 12 to AHK (and everyone else that understands number systems) no matter what you might think. And if you think that it needs to go from 0x4 to 0x8 and then to 0x12 because you’re adding 0x4 each time, then you don’t understand what you really want or how hex works.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: apeironn, Bing [Bot], Descolada and 210 guests