help variable Topic is solved

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

Re: help variable

19 Apr 2021, 21:35

boiler wrote:
19 Apr 2021, 21:26
theon wrote: in this if you can only pass examples names:
dragon lord
dragon
Rat
Cave Rat
not names with numbers and symbols

example:
Ca? E Rat
Frog#
ra3
^ at
this is bad can't
Do you mean the following line?

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "[\^?$%#@]")
You just said symbols. You didn’t say anything about numbers. It should be catching anything with the symbols ^?$%#@ in it.
look at the print, see the selected part in red this is not to appear in the search
Image
because it has symbols
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: help variable

19 Apr 2021, 21:41

You specified certain symbols before. If you want only letters (and spaces), then it would be this:

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z]+$")
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

19 Apr 2021, 22:09

boiler wrote:
19 Apr 2021, 21:41
You specified certain symbols before. If you want only letters (and spaces), then it would be this:

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z]+$")
I think the opposite was done, the names disappeared and the bugs were just kkk

Image
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

19 Apr 2021, 22:10

theon wrote:
19 Apr 2021, 22:09
boiler wrote:
19 Apr 2021, 21:41
You specified certain symbols before. If you want only letters (and spaces), then it would be this:

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z]+$")
I think the opposite was done, the names disappeared and the bugs were just kkk

Image


code:

Code: Select all

Loop 11
{

	ReadEOClient%A_Index% := mem.readString(mem.BaseAddress + 0x55B11C, 15, "utf-8",  Offset%A_Index%*)	
	if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z']+$")
	GuiControl,,char%A_Index%, % ReadEOClient%A_Index%
}	



loop,11
if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z']+$")
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "Name") 
OR (ReadEOClient%A_Index% = "Name")
OR (ReadEOClient%A_Index% = "Name")
OR (ReadEOClient%A_Index% = "Name")
OR (ReadEOClient%A_Index% = "Name"))

{
}
else
{
desloger()
}
return
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

19 Apr 2021, 22:20

boiler wrote:
19 Apr 2021, 21:41
You specified certain symbols before. If you want only letters (and spaces), then it would be this:

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z]+$")
i change to

Code: Select all

 if RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z']+$")
and it worked = D

I took the "!"
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: help variable

19 Apr 2021, 22:21

Yes, sorry. Forgot to remove that.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

19 Apr 2021, 22:26

boiler wrote:
19 Apr 2021, 22:21
Yes, sorry. Forgot to remove that.
Relax
thank you very much I think there is no more stuff to fix it is perfect = D

:dance: :dance: :dance:

thank you very much learns a lot from you, then I have another question if you have a long list of names in the if I can use a txt file?

exemplo:

Code: Select all

if (ReadEOClient%A_Index% = text.txt)

text.txt

Code: Select all

text := bruno,jal,breno,jao,pedro,paulo
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: help variable

20 Apr 2021, 05:29

You read the text.txt file into the text variable like this:

Code: Select all

FileRead, text, text.txt

Then you can check to see if the name in ReadEOClient%A_Index% is found anywhere in the list of names with this line (must be like this, don't add parentheses or anything):

Code: Select all

if ReadEOClient%A_Index% in %text%

The file text.txt must include all the names separated by commas and nothing else. Don't add spaces after the commas or break them into separate lines. Spaces in a name are OK, just don't put spaces between the names. Just like this:

Code: Select all

bruno,jal,breno,jao,pedro,Big Tuf,Lizzy Scout,paulo

Demonstration script:

Code: Select all

ReadEOClient1 := "jao"
ReadEOClient2 := "max"
ReadEoClient3 := "Big Tuf"

; the following line would be replaced by the FileRead line in the actual script:
text := "bruno,jal,breno,jao,pedro,Big Tuf,Lizzy Scout,paulo"
; FileRead, text, text.txt

loop, 3
	if ReadEOClient%A_Index% in %text%
		MsgBox, % ReadEOClient%A_Index% " is in the list"
	else
		MsgBox, % ReadEOClient%A_Index% " was not found"
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

20 Apr 2021, 07:30

boiler wrote:
20 Apr 2021, 05:29
You read the text.txt file into the text variable like this:

Code: Select all

FileRead, text, text.txt

Then you can check to see if the name in ReadEOClient%A_Index% is found anywhere in the list of names with this line (must be like this, don't add parentheses or anything):

Code: Select all

if ReadEOClient%A_Index% in %text%

The file text.txt must include all the names separated by commas and nothing else. Don't add spaces after the commas or break them into separate lines. Spaces in a name are OK, just don't put spaces between the names. Just like this:

Code: Select all

bruno,jal,breno,jao,pedro,Big Tuf,Lizzy Scout,paulo

Demonstration script:

Code: Select all

ReadEOClient1 := "jao"
ReadEOClient2 := "max"
ReadEoClient3 := "Big Tuf"

; the following line would be replaced by the FileRead line in the actual script:
text := "bruno,jal,breno,jao,pedro,Big Tuf,Lizzy Scout,paulo"
; FileRead, text, text.txt

loop, 3
	if ReadEOClient%A_Index% in %text%
		MsgBox, % ReadEOClient%A_Index% " is in the list"
	else
		MsgBox, % ReadEOClient%A_Index% " was not found"
not working = x

Code: Select all

loop,11

if RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z']+$")
	if(ReadEOClient%A_Index% in %text%)
If (StrLen(ReadEOClient%A_Index%) > 3) 
if  ((ReadEOClient%A_Index% = namechar) 
OR (ReadEOClient%A_Index% = name2)
OR (ReadEOClient%A_Index% = name3) 
OR (ReadEOClient%A_Index% = name4) 
OR (ReadEOClient%A_Index% = name5) 
OR (ReadEOClient%A_Index% = name6) 
OR (ReadEOClient%A_Index% = name7) 
OR (ReadEOClient%A_Index% = name8) )
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: help variable

20 Apr 2021, 08:19

Just to make sure you wouldn’t do that, I specifically said:
boiler wrote:
20 Apr 2021, 05:29
Then you can check to see if the name in ReadEOClient%A_Index% is found anywhere in the list of names with this line (must be like this, don't add parentheses or anything):

Code: Select all

if ReadEOClient%A_Index% in %text%
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

24 Apr 2021, 08:45

boiler wrote:
20 Apr 2021, 08:19
Just to make sure you wouldn’t do that, I specifically said:
boiler wrote:
20 Apr 2021, 05:29
Then you can check to see if the name in ReadEOClient%A_Index% is found anywhere in the list of names with this line (must be like this, don't add parentheses or anything):

Code: Select all

if ReadEOClient%A_Index% in %text%
@boiler

in this function it does a name tracking, is it possible to make the repeated names not be printed?

Code: Select all

Loop 11 ; Para criarmos 10 arrays
{
	OFFSET_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
	Offset%OFFSET_ATUAL% := [0xC, 0xF4] ; Iniciamos com o modelo básico da array
	Loop % A_Index ; E aí vamos fazer um loop pelo número da iteração atual
	{
		Offset%OFFSET_ATUAL%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
}

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

}



	 
loop,11

if RegExMatch(ReadEOClient%A_Index%, "^[ a-zA-Z']+$")
If (StrLen(ReadEOClient%A_Index%) > 2) 
if  ((ReadEOClient%A_Index% = namechar) 
OR (ReadEOClient%A_Index% = name2)
OR (ReadEOClient%A_Index% = name3) 
OR (ReadEOClient%A_Index% = name4) 
OR (ReadEOClient%A_Index% = name5) 
OR (ReadEOClient%A_Index% = name6) 
OR (ReadEOClient%A_Index% = name7) 
OR (ReadEOClient%A_Index% = name8) )

{
}
else
{
desloger()
GuiControl,,char%A_Index%, % ReadEOClient%A_Index% ;here cannot have repeated names

}
return
like this, I know it's not right

Code: Select all

if RegExMatch(ReadEOClient%A_Index%, "names%A_Index")

see he scanned and found the padre, more print in all gui, text I just wanted him to print in one, not to repeat names
Image
User avatar
boiler
Posts: 16915
Joined: 21 Dec 2014, 02:44

Re: help variable

24 Apr 2021, 10:07

It would make the thread less cluttered if you didn’t quote my previous post when you reply unless you’re doing so to refer to something specific in it.

To avoid repeated names, you have to store the names in a list and check whether it’s in the list or not. One way is similar to what I showed you before. Put the lines shown below around your GuiControl line:

Code: Select all

if ReadEOClient%A_Index% not in namelist
{
	namelist := LTrim(namelist "," ReadEOClient%A_Index%, ",")
	GuiControl,,char%A_Index%, % ReadEOClient%A_Index%
}

Demonstration:

Code: Select all

ReadEOClient1 := "jao"
ReadEOClient2 := "max"
ReadEoClient3 := "Big Tuf"
ReadEOClient4 := "jao"
ReadEOClient5 := "playa"
ReadEoClient6 := "Big Tuf"
loop 6
	if ReadEOClient%A_Index% not in %namelist%
		namelist := LTrim(namelist "," ReadEOClient%A_Index%, ",")
MsgBox, % namelist

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, zerox and 354 guests