Page 2 of 3
Re: help variable
Posted: 18 Apr 2021, 23:03
by boiler
If you mean after choosing Load from the menu, it still shows the MsgBox after I load it and then click on it. Are you expecting it to run bruna without even clicking on it after you load it? It doesn’t run the code at the label based on whether it’s checked or not. It runs it when it gets clicked on.
Re: help variable
Posted: 18 Apr 2021, 23:08
by theon
boiler wrote: ↑18 Apr 2021, 23:03
If you mean after choosing Load from the menu, it still shows the MsgBox after I load it and then click on it. Are you expecting it to run bruna without even clicking on it after you load it? It doesn’t run the code at the label based on whether it’s checked or not. It runs it when it gets clicked on.
ahh, how can I load the checkbox function as soon as I load it?
Re: help variable
Posted: 18 Apr 2021, 23:15
by boiler
You put code in that checks the value of the checkbox when you load the values from the ini file, then uses
Gosub to execute the subroutine if it’s checked.
Re: help variable
Posted: 18 Apr 2021, 23:20
by theon
boiler wrote: ↑18 Apr 2021, 23:15
You put code in that checks the value of the checkbox when you load the values from the ini file, then uses
Gosub to execute the subroutine if it’s checked.
can you give me an example in this code?
Code: Select all
Gui Add, CheckBox, x280 y80 w73 h23 vruna gbruna , Rune
Gui Show, w439 h274, test
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
return
Re: help variable
Posted: 18 Apr 2021, 23:23
by boiler
Code: Select all
load:
IniRead, runa, %SelectedFile%, bot variables, runa
GuiControl,, runa, %runa%
if runa
gosub, bruna
return
Re: help variable
Posted: 18 Apr 2021, 23:27
by theon
boiler wrote: ↑18 Apr 2021, 23:23
Code: Select all
load:
IniRead, runa, %SelectedFile%, bot variables, runa
GuiControl,, runa, %runa%
if runa
gosub, bruna
return
ty ty ty ty ^^
Re: help variable
Posted: 18 Apr 2021, 23:30
by theon
boiler wrote: ↑18 Apr 2021, 23:23
Code: Select all
load:
IniRead, runa, %SelectedFile%, bot variables, runa
GuiControl,, runa, %runa%
if runa
gosub, bruna
return
I have one more problem how do I load a code like that?
he does not accept the foodx and foody pos from iniread
Code: Select all
foodd:
gui,submit,nohide
if (foodd)
{
{
global client_id := namechar
DllCall("Data\mousehook64.dll\RightClick", "AStr", client_id, "INT", foodx , "INT", foody -25)
}}
return
Re: help variable
Posted: 18 Apr 2021, 23:56
by boiler
Just do the same thing for those checkboxes. If they’re checked then gosub to their subroutines.
Re: help variable
Posted: 19 Apr 2021, 20:14
by theon
boiler wrote: ↑18 Apr 2021, 23:56
Just do the same thing for those checkboxes. If they’re checked then gosub to their subroutines.
@boiler
it saves the position in the config.ini but when loing it doesn’t read the foodx and foody positions why?
do I have to put a gui, edit for him to read?
code pos x and y
Code: Select all
#SingleInstance,Force
#NoEnv
#WinActivateForce ; need to test it
Gui Add, CheckBox, x280 y128 w82 h23 vfoodd gbfoodd, Food
Gui Add, Button, x144 y96 w68 h28 ggetpos_life_1 vgetpos_life_1, Pos Food
Gui Show, w439 h274, test
return
bfoodd:
If (foodd=1)
settimer,foodd,9000
else
settimer,foodd,OFF
return
foodd:
gui,submit,nohide
if (foodd)
{
{
global client_id := namechar
DllCall("Data\mousehook64.dll\RightClick", "AStr", client_id, "INT", foodx , "INT", foody -25)
}}
return
getpos_life_1:
CoordMode, ToolTip, Window
CoordMode, Mouse, Window
CoordMode, Pixel, Window
WinActivate, %namechar%
WinMinimize, ahk_id %MainBotWindow%
SetColor()
return
SetColor(){
While(!GetKeyState("ctrl")){
ToolTip,Press ""Ctrl"" to set Search Food
MouseGetPos,foodx,foody,
}
ToolTip,
WinActivate, ahk_id %MainBotWindow%
}
return
load:
IniRead, foodx, %SelectedFile%, bot variables, foodx
IniRead, foody, %SelectedFile%, bot variables, foody
if foodd
gosub, bfoodd
return
save(){
IniWrite, %foody%, %SelectedFile%, bot variables, foody
IniWrite, %foodx%, %SelectedFile%, bot variables, foodx
}
return
GuiEscape:
GuiClose:
ExitApp
Code: Select all
[bot variables]
foody=335
foodx=1296
thx
Re: help variable Topic is solved
Posted: 19 Apr 2021, 20:42
by boiler
The lines below result in foodx not being read from the .ini file:
Code: Select all
if (SelectedFile = "")
IniRead, foodx, %SelectedFile%, bot variables, foodx
IniRead, foody, %SelectedFile%, bot variables, foody
The
if statement says to only execute the line following it if the SelectedFile variable is empty. Since it is not (otherwise none of the variables could be read since you haven’t selected the file), then the
IniRead, foodx... line doesn’t get executed. The only way that
if statement makes sense is if it’s followed by
return or something like that, as shown here:
Code: Select all
if (SelectedFile = "")
return
IniRead, foodx, %SelectedFile%, bot variables, foodx
IniRead, foody, %SelectedFile%, bot variables, foody
Re: help variable
Posted: 19 Apr 2021, 20:50
by boiler
It looks like your code has changed since the version I just pulled lines from. You should post your full code as it currently stands. There is only so much review and debugging I can do of your hundreds of lines of code, though.
Re: help variable
Posted: 19 Apr 2021, 20:55
by theon
boiler wrote: ↑19 Apr 2021, 20:50
It looks like your code has changed since the version I just pulled lines from. You should post your full code as it currently stands. There is only so much review and debugging I can do of your hundreds of lines of code, though.
ok,
my full code
something else on that RegExMatch line has to accept only words like a to z
why he should only check names, not symbols
Re: help variable
Posted: 19 Apr 2021, 21:07
by boiler
theon wrote: ↑
something else on that RegExMatch line has to accept only words like a to z
why he should only check names, not symbols
What do you mean only check names? It checks ReadEOClient1 to ReadEOClient11 for those symbols because that’s what you said you wanted it to do. What are you saying it should do instead?
Re: help variable
Posted: 19 Apr 2021, 21:11
by boiler
You still have these lines in for no reason:
Code: Select all
#include gdip.ahk
;Start up gdip
pToken := Gdip_Startup()
Re: help variable
Posted: 19 Apr 2021, 21:16
by theon
boiler wrote: ↑19 Apr 2021, 21:07
theon wrote: ↑
something else on that RegExMatch line has to accept only words like a to z
why he should only check names, not symbols
What do you mean only check names? It checks ReadEOClient1 to ReadEOClient11 for those symbols because that’s what you said you wanted it to do. What are you saying it should do instead?
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
Re: help variable
Posted: 19 Apr 2021, 21:17
by theon
boiler wrote: ↑19 Apr 2021, 21:11
You still have these lines in for no reason:
Code: Select all
#include gdip.ahk
;Start up gdip
pToken := Gdip_Startup()
I forgot to delete
Re: help variable
Posted: 19 Apr 2021, 21:19
by boiler
One thing I see is that you attempt to get the values of foodx and foody in this function:
Code: Select all
SetColor(){
While(!GetKeyState("ctrl")){
ToolTip,Press ""Ctrl"" to set Search Food
MouseGetPos,foodx,foody,
}
ToolTip,
WinActivate, ahk_id %MainBotWindow%
}
return
...but they are local to that function only because you did not declare them as global variables like you did for many others.
Re: help variable
Posted: 19 Apr 2021, 21:20
by theon
boiler wrote: ↑19 Apr 2021, 21:19
One thing I see is that you attempt to get the values of foodx and foody in this function:
Code: Select all
SetColor(){
While(!GetKeyState("ctrl")){
ToolTip,Press ""Ctrl"" to set Search Food
MouseGetPos,foodx,foody,
}
ToolTip,
WinActivate, ahk_id %MainBotWindow%
}
return
...but they are local to that function only because you did not declare them as global variables like you did for many others.
this part I tested and is working normal
Re: help variable
Posted: 19 Apr 2021, 21:26
by boiler
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.
Re: help variable
Posted: 19 Apr 2021, 21:29
by boiler
theon wrote: ↑19 Apr 2021, 21:20
this part I tested and is working normal
Tested how? Whatever values it gets for foodx and foody wouldn’t be able to used anywhere outside the function, and they’re not even used inside the function, so why do you have the MouseGetPos line?