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

help variable

Post by theon » 16 Apr 2021, 20:46

when I write the name in the gui it doesn't work, it only works if I write directly in the code = x
Full code:

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#WinActivateForce ; need to test it
#include gdip.ahk
SetTitleMatchMode, RegEx
#Warn All, Off    ; #Warn eables warnings to assist with detecting common errors, while "all, off" makes them all disabled
#Persistent
pToken := Gdip_Startup()
SendMode InputThenPlay
global food

Gui Add, Edit, x72 y64 w71 h21 vnome1,
Gui Add, Edit, x72 y84 w71 h21 vnome2,
Gui Add, Edit, x72 y104 w71 h21 vnome3,
Gui Add, Edit, x72 y124 w71 h21 vnome4,
Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1


4::
Random, rand4, 600000, 840000
Random, rand5, 100000, 300000
SetTimer afk, %rand4%
SetTimer, online, %rand5%
return
3::
Reload
return
2::
SetTimer casa, 500
Random, rand3, 70000, 600000
SetTimer, comer, %rand3%
return
casa:
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)
	}
}

mem := new _ClassMemory("ahk_exe client_dx.exe")
if !isObject(mem)
    msgbox failed to open a handle


namechar := mem.readString(mem.BaseAddress + 0x55AE84 , 15, utf-8)


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



	 ;~ monster%A_Index% := mem.WriteString(mem.BaseAddress + 0x55A11C, "novo", "UTF-8", Offset%A_Index%*)



loop,11
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "%name1%") 
OR (ReadEOClient%A_Index% = "%name2%")
OR (ReadEOClient%A_Index% = "%name3%") 
OR (ReadEOClient%A_Index% = "%name4%") )

{
}
else
{
WinSetTitle ,RetroCores, , Client
FormatTime, TimeString, T12, Time
GuiControl,,char12, %TimeString%
dormir()
Sleep,3000
Pause
}
return

desloger(){
loop,5
{
ControlSend,, {Ctrl Down}q{Ctrl Up},Client
}}
return
dormir(){
{
	
global client_id := "Client"
      DllCall("Data\mousehook64.dll\RightClick", "AStr", client_id, "INT", 766 , "INT", 254 -25)
	  Sleep,300	  
}}
return
login(){
{
	ControlSend,, {Enter},Client
	Sleep, 2000
global client_id := "Client"
      DllCall("Data\mousehook64.dll\LeftClick", "AStr", client_id, "INT", 284 , "INT", 348 -20)
	  Sleep,300

}}
return

comer(){
	loop,1
{
	
global client_id := "Client"
      DllCall("Data\mousehook64.dll\RightClick", "AStr", client_id, "INT", 1283 , "INT", 300)
	  Sleep,300
}}
return

afk:
loop,3
{
Random, var, 0, 4

afkl := mem.read(mem.BaseAddress + 0x55AE00, "int", 0x3C)
afk := mem.write(mem.BaseAddress + 0x55AE00, var, "int", 0x3C)
Sleep,500
afk := mem.write(mem.BaseAddress + 0x55AE00, afkl, "int", 0x3C)
Sleep,500
}
return 
online:
If (StrLen(namechar) > 2)
{
}
else
{
	login()
}
return

GuiClose:
ExitApp
return



part that I think was wrong

Code: Select all

loop,11
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "%name1%") 
OR (ReadEOClient%A_Index% = "%name2%")
OR (ReadEOClient%A_Index% = "%name3%") 
OR (ReadEOClient%A_Index% = "%name4%") )
please help me :superhappy:
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 16 Apr 2021, 22:04

You don't use " or % around variables in expressions except in certain cases like where you used % with A_Index:

Code: Select all

if  ((ReadEOClient%A_Index% = name1) 
OR (ReadEOClient%A_Index% = name2)
OR (ReadEOClient%A_Index% = name3) 
OR (ReadEOClient%A_Index% = name4) )
Also, if those are supposed to be the variable names from the GUI, the ones in the GUI are named nome1, nome2, etc., not name1, name2, etc. And I don't see where you have a Gui, Submit or anything to retrieve the values from the GUI.


One other thing: Why are you including Gdip.ahk and calling Gdip_Startup()?
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 17 Apr 2021, 08:31

boiler wrote:
16 Apr 2021, 22:04
You don't use " or % around variables in expressions except in certain cases like where you used % with A_Index:

Code: Select all

if  ((ReadEOClient%A_Index% = name1) 
OR (ReadEOClient%A_Index% = name2)
OR (ReadEOClient%A_Index% = name3) 
OR (ReadEOClient%A_Index% = name4) )
Also, if those are supposed to be the variable names from the GUI, the ones in the GUI are named nome1, nome2, etc., not name1, name2, etc. And I don't see where you have a Gui, Submit or anything to retrieve the values from the GUI.


One other thing: Why are you including Gdip.ahk and calling Gdip_Startup()?
Gdip_Startup my error
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 17 Apr 2021, 20:43

@boiler
boiler, Are there any characters appearing in my search that I would like to ignore, Has as ?
follow the print
Image

full code:

Code: Select all

#Include <classMemory>
#SingleInstance,Force
#NoEnv
#WinActivateForce ; need to test it

SetTitleMatchMode, RegEx
#Warn All, Off    ; #Warn eables warnings to assist with detecting common errors, while "all, off" makes them all disabled
#Persistent

SendMode InputThenPlay
global food

Gui, add, Text, x20 y20 w70 h40 vchar,
Gui, add, Text, x20 y40 w70 h40 vchar2,
Gui, add, Text, x20 y60 w70 h40 vchar3, 
Gui, add, Text, x20 y80 w70 h40 vchar4,
Gui, add, Text, x20 y100 w70 h40 vchar5,
Gui, add, Text, x130 y20 w70 h40 vchar6,
Gui, add, Text, x130 y40 w70 h40 vchar7,
Gui, add, Text, x130 y60 w70 h40 vchar8,
Gui, add, Text, x130 y80 w70 h40 vchar9,
Gui, add, Text, x130 y100 w70 h40 vchar10,
Gui, add, Text, x130 y120 w70 h40 vchar11,

Gui +LastFound +AlwaysOnTop
Gui Show, w400 h200, Elder Bot - LOGar Maker  V.1.1


SetTimer casa, 500
return
casa:
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
{
	OFFSET1_ATUAL := A_Index ; Salvamos o valor da iteração atual do loop externo para poder usá-lo dentro do loop interno abaixo.
	Offset1%OFFSET_ATUAL1% := [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
	{
		Offset1%OFFSET_ATUAL1%.InsertAt(1, 0x0) ; Para inserir tantos elementos 0x0 quanta for a iteração atual (por exemplo, na 5a iteração, inseriremos 5 elementos 0x0)
	}
}


mem := new _ClassMemory("ahk_exe client_dx.exe")
if !isObject(mem)
    msgbox failed to open a handle


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



loop,11

If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "name1") 
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"))

{
}
else
{
desloger()
}
return

desloger(){
loop,5
{
ControlSend,, {Ctrl Down}q{Ctrl Up},lname1
ControlSend,, {Ctrl Down}q{Ctrl Up}, lname2
ControlSend,, {Ctrl Down}q{Ctrl Up},lmane3

}}



return 
GuiClose:
ExitApp
return
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 17 Apr 2021, 21:00

Sorry, I don’t understand what you’re asking.
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 17 Apr 2021, 21:04

It looks like you’re not pointing to the correct memory address. I don’t have any real experience with reading memory, so maybe someone else can help you.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 17 Apr 2021, 22:11

I think I explained it wrong I want my if ingore these characters
when he scans and finds these types of characters is for him to ignore
@boiler

Code: Select all

loop,11
if ignored == ^, ?, $ ,%, #, @
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "name1") 
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"))

{
}

Code: Select all

example if the name contains $% # @ any of these symbols and to be ignored, $bolier
$bolier = was ignored because of $
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 17 Apr 2021, 22:22

Do you really need to know which character it found and store it in a variable, or do you just want it skipped if it contains any of those characters?
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 17 Apr 2021, 22:28

boiler wrote:
17 Apr 2021, 22:22
Do you really need to know which character it found and store it in a variable, or do you just want it skipped if it contains any of those characters?
this if any name has an illegal character it is to be ignored
example $bolier
%test $test
cannot have symbols
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 17 Apr 2021, 22:33

Code: Select all

loop,11
if !RegExMatch(ReadEOClient%A_Index%, "[\^?$%#@]")
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "name1") 
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"))

{
}

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

Re: help variable

Post by theon » 17 Apr 2021, 23:20

didn't work there's a way to do it, ta finding this square and I want to ignore it too > ""
boiler wrote:
17 Apr 2021, 22:33

Code: Select all

loop,11
if !RegExMatch(ReadEOClient%A_Index%, "[\^?$%#@]")
If (StrLen(ReadEOClient%A_Index%) > 2)    
if  ((ReadEOClient%A_Index% = "name1") 
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"))

{
}

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 17 Apr 2021, 23:44

Like this. Two in a row is how you “escape” it.

Code: Select all

if !RegExMatch(ReadEOClient%A_Index%, "[\^?$%#@""]")
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 18 Apr 2021, 21:03

@boiler,Thank you very much, if you are not too upset, can you take another doubt?
Last edited by theon on 18 Apr 2021, 23:48, edited 1 time in total.
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 18 Apr 2021, 21:31

I’m not sure what you’re asking, but did you check that the .ini file contains all the info you think it does?
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 18 Apr 2021, 21:40

@boiler
boiler wrote:
18 Apr 2021, 21:31
I’m not sure what you’re asking, but did you check that the .ini file contains all the info you think it does?
yes, it has all the ini, but it does not perform the checkbox functions when selected by IniRead


code config ini.

Code: Select all

[bot variables]
foody=224
foodx=
manaa=180
key=F1
tempo=1
nome=Gamer
name2=test2
name3=test3
name4=test4
name5=test5
name6=test6
name7=test7
name8=test8
manalow=10
loggin=0
afk=0
runa=0
foodd=0
nomana=0
noblank=0
adesconectou=0
deslogar=0
lux=0

load:

Code: Select all

Gui, submit, nohide
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.ini)
if (SelectedFile = "")
IniRead, foodx, %SelectedFile%, bot variables, foodx
IniRead, foody, %SelectedFile%, bot variables, foody
IniRead, manaa, %SelectedFile%, bot variables, manaa
IniRead, key, %SelectedFile%, bot variables, key
IniRead, tempo, %SelectedFile%, bot variables, tempo
IniRead, nome, %SelectedFile%, bot variables, nome
IniRead, name2, %SelectedFile%, bot variables, name2
IniRead, name3, %SelectedFile%, bot variables, name3
IniRead, name4, %SelectedFile%, bot variables, name4
IniRead, name5, %SelectedFile%, bot variables, name5
IniRead, name6, %SelectedFile%, bot variables, name6
IniRead, name7, %SelectedFile%, bot variables, name7
IniRead, name8, %SelectedFile%, bot variables, name8
IniRead, manalow, %SelectedFile%, bot variables, manalow
IniRead, loggin, %SelectedFile%, bot variables, loggin
IniRead, afk, %SelectedFile%, bot variables, afk
IniRead, runa, %SelectedFile%, bot variables, runa
IniRead, lux, %SelectedFile%, bot variables, lux
IniRead, foodd, %SelectedFile%, bot variables, foodd
IniRead, loggin, %SelectedFile%, bot variables, loggin
IniRead, noblank, %SelectedFile%, bot variables, noblank
IniRead, nomana, %SelectedFile%, bot variables, nomana
IniRead, adesconectou, %SelectedFile%, bot variables, adesconectou
IniRead, deslogar, %SelectedFile%, bot variables, deslogar

GuiControl,, manaa, %manaa%
GuiControl,, key, %key%
GuiControl,, nome, %nome%
GuiControl,, tempo, %tempo%
GuiControl,, name2, %name2%
GuiControl,, name3, %name3%
GuiControl,, name4, %name4%
GuiControl,, name5, %name5%
GuiControl,, name6, %name6%
GuiControl,, name7, %name7%
GuiControl,, name8, %name8%
GuiControl,, manalow, %manalow%
GuiControl,, loggin, %loggin%
GuiControl,, afk, %afk%
GuiControl,, runa, %runa%
GuiControl,, lux, %lux%
GuiControl,, foodd, %foodd%
GuiControl,, loggin, %loggin%
GuiControl,, noblank, %noblank%
GuiControl,, nomana, %nomana%
GuiControl,, adesconectou, %adesconectou%
GuiControl,, deslogar, %deslogar%

save :

Code: Select all

save(){
   GuiControlGet, manaa,, manaa
   GuiControlGet, key,, key
   GuiControlGet, nome,, nome
   GuiControlGet, tempo,, tempo
    GuiControlGet, name2,, name2
    GuiControlGet, name3,, name3
    GuiControlGet, name4,, name4
    GuiControlGet, name5,, name5
    GuiControlGet, name6,, name6
    GuiControlGet, name7,, name7
    GuiControlGet, name8,, name8
	GuiControlGet, manalow,, manalow
	GuiControlGet, loggin,, loggin
	GuiControlGet, afk,, afk
	GuiControlGet, runa,, runa
	GuiControlGet, lux,, lux
	GuiControlGet, foodd,, foodd
	GuiControlGet, loggin,, loggin
	GuiControlGet, nomana,, nomana
	GuiControlGet, noblank,, noblank
	GuiControlGet, adesconectou,, adesconectou
	GuiControlGet, deslogar,, deslogar
	
 
   IniWrite, %manaa%, %SelectedFile%, bot variables, manaa
   IniWrite, %foody%, %SelectedFile%, bot variables, foody
   IniWrite, %foodx%, %SelectedFile%, bot variables, foodx
   IniWrite, %key%, %SelectedFile%, bot variables, key
   IniWrite, %tempo%, %SelectedFile%, bot variables, tempo
   IniWrite, %nome%, %SelectedFile%, bot variables, nome
     IniWrite, %name2%, %SelectedFile%, bot variables, name2
     IniWrite, %name3%, %SelectedFile%, bot variables, name3
     IniWrite, %name4%, %SelectedFile%, bot variables, name4
     IniWrite, %name5%, %SelectedFile%, bot variables, name5
     IniWrite, %name6%, %SelectedFile%, bot variables, name6
     IniWrite, %name7%, %SelectedFile%, bot variables, name7
     IniWrite, %name8%, %SelectedFile%, bot variables, name8
	 IniWrite, %manalow%, %SelectedFile%, bot variables, manalow
	 IniWrite, %loggin%, %SelectedFile%, bot variables, loggin
	 IniWrite, %afk%, %SelectedFile%, bot variables, afk
	 IniWrite, %runa%, %SelectedFile%, bot variables, runa
	 IniWrite, %foodd%, %SelectedFile%, bot variables, foodd
	 IniWrite, %loggin%, %SelectedFile%, bot variables, loggin
	 IniWrite, %nomana%, %SelectedFile%, bot variables, nomana
	 IniWrite, %noblank%, %SelectedFile%, bot variables, noblank
	 IniWrite, %adesconectou%, %SelectedFile%, bot variables, adesconectou
	 IniWrite, %deslogar%, %SelectedFile%, bot variables, deslogar
	 IniWrite, %lux%, %SelectedFile%, bot variables, lux
	 
	 
}
GUI
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 18 Apr 2021, 22:30

If you're asking why the food checkbox and others doesn't save and update, it seems pretty obvious. The variable name for the checkbox is foodd (two d's):

Code: Select all

Gui Add, CheckBox, x280 y128 w82 h23 vfoodd Checked%foodd% gbfoodd, Food
...and you don't have a global variable set for foodd, only for food (and foodx and foody), so your Save() function doesn't see it.

And you don't have global variables set for variables in tab 2 (noblank, nomana, etc) either.
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 18 Apr 2021, 22:33

boiler wrote:
18 Apr 2021, 22:30
If you're asking why the food checkbox and others doesn't save and update, it seems pretty obvious. The variable name for the checkbox is foodd (two d's):

Code: Select all

Gui Add, CheckBox, x280 y128 w82 h23 vfoodd Checked%foodd% gbfoodd, Food
...and you don't have a global variable set for foodd, only for food (and foodx and foody), so your Save() function doesn't see it.

And you don't have global variables set for variables in tab 2 (noblank, nomana, etc) either.
it saves and loads right more when it loads with checkbox check = 1 it does not execute the function
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 18 Apr 2021, 22:36

he load more does not execute the gbrune fuction

Code: Select all

Gui Add, CheckBox, x280 y80 w73 h23 vruna gbruna , Rune


bruna:
gui,submit,nohide
If (runa=1){
	settimer,runa,500
	GuiControl, Disable, key
	GuiControl, Disable, manaa
	}
else
{
	settimer,runa,OFF ;check = 0 so dont loop
	GuiControl, enable, key
	GuiControl, enable, manaa
	}
	return

runa:
Gui, Submit, Nohide
if (runa)
{
SetFormat, float, 0.0 

if mana > %manaa%
{
   ControlSend,,{%key%}, %namechar%
     Sleep, 1000
}}

return


load:
IniRead, runa, %SelectedFile%, bot variables, runa
GuiControl,, runa, %runa%
return

save:
GuiControlGet, runa,, runa
IniWrite, %runa%, %SelectedFile%, bot variables, runa
my english is bad, what I'm trying to say is that it takes load and selects the checkbox but does not activate the gbrune functions and etc.
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help variable

Post by boiler » 18 Apr 2021, 22:40

Yes it does. Maybe it doesn't do anything, so you need to fix the code in bruna, but change it to this to prove it executes it:

Code: Select all

bruna:
MsgBox, here ; <<< IF MSGBOX SHOWS, IT EXECUTED IT
gui,submit,nohide
If (runa=1){
	settimer,runa,500
	GuiControl, Disable, key
	GuiControl, Disable, manaa
	}
else
{
	settimer,runa,OFF ;check = 0 so dont loop
	GuiControl, enable, key
	GuiControl, enable, manaa
	}
	return
theon
Posts: 124
Joined: 23 Jun 2019, 15:39

Re: help variable

Post by theon » 18 Apr 2021, 22:55

boiler wrote:
18 Apr 2021, 22:40
Yes it does. Maybe it doesn't do anything, so you need to fix the code in bruna, but change it to this to prove it executes it:

Code: Select all

bruna:
MsgBox, here ; <<< IF MSGBOX SHOWS, IT EXECUTED IT
gui,submit,nohide
If (runa=1){
	settimer,runa,500
	GuiControl, Disable, key
	GuiControl, Disable, manaa
	}
else
{
	settimer,runa,OFF ;check = 0 so dont loop
	GuiControl, enable, key
	GuiControl, enable, manaa
	}
	return
if I choose normal it performs, but if it is through iniread it does not perform
Post Reply

Return to “Ask for Help (v1)”