Sign in to follow this  
Followers 0
demandnothing

declare variable IsFloat

7 posts in this topic

#1 ·  Posted (edited)

Q1: is there a way to declare a variable as a floating object? i've posted other threads with this question in them, but i didnt generally ask the entire population of you awesome people that help me out so much.. this is what i have so far..

HotKeySet("{F1}", "_Exit")
HotKeySet("{F5}", "Start")
HotKeySet("{F6}", "Stop")

Global $ON = False
Global $color = 0x960000
Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79


$VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
$VirtualDesktopWidth = $VirtualDesktopWidth[0]
$VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
$VirtualDesktopHeight = $VirtualDesktopHeight[0]

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

$x1 = Number( $VirtualDesktopWidth/2)
$y1 = Number( $VirtualDesktopHeight/2)
$x2 = Number( $x1-125)
$y2 = Number( $x1+100)
$x3 = Number( $y1-300)
$y3 = Number( $y1+300)


While 1
    Sleep(20)
    If $ON = True Then
        $coord = PixelSearch($x2, $x3, $y2, $y3, $color, 5, 3)
        If IsArray($coord) = 1 Then
            MouseMove($coord[0],$coord[1])
        EndIf
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc
Func Start()
    $ON = True
EndFunc
Func Stop()
    $ON = False
EndFunc

its a solid script and it basically does what its told to do, its just that when it moves the mouse for me, the variable $coord moves towards the mouse, which ends up as me looking directly up and spinning like crazy.. FPS game btw..

Q2: would i be able to remove the sleep time so that its constantly scanning for the target pixel? so that when it moves my mouse it'll see the pixel move too?

Q3: im having a bit of a problem with the reaction time.. it needs to realize the pixel is there for a second before it'll react to it, is there any way to get a faster response?

Edited by demandnothing

Share this post


Link to post
Share on other sites



Q1: is there a way to declare a variable as a floating object? i've posted other threads with this question in them, but i didnt generally ask the entire population of you awesome people that help me out so much..

Did you mean floating point variable type? If not, what's a "floating" object?

this is what i have so far..

HotKeySet("{F1}", "_Exit")
HotKeySet("{F5}", "Start")
HotKeySet("{F6}", "Stop")

Global $ON = False
Global $color = 0x960000
Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79


$VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
$VirtualDesktopWidth = $VirtualDesktopWidth[0]
$VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
$VirtualDesktopHeight = $VirtualDesktopHeight[0]

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

$x1 = Number( $VirtualDesktopWidth/2)
$y1 = Number( $VirtualDesktopHeight/2)
$x2 = Number( $x1-125)
$y2 = Number( $x1+100)
$x3 = Number( $y1-300)
$y3 = Number( $y1+300)


While 1
    Sleep(20)
    If $ON = True Then
        $coord = PixelSearch($x2, $x3, $y2, $y3, $color, 5, 3)
        If IsArray($coord) = 1 Then
            MouseMove($coord[0],$coord[1])
        EndIf
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc
Func Start()
    $ON = True
EndFunc
Func Stop()
    $ON = False
EndFunc

its a solid script and it basically does what its told to do, its just that when it moves the mouse for me, the variable $coord moves towards the mouse, which ends up as me looking directly up and spinning like crazy.. FPS game btw..

What does "moves towards the mouse" mean? PixelSearch() returns an array of integer coords. What did you want it to do?

Q2: would i be able to remove the sleep time so that its constantly scanning for the target pixel? so that when it moves my mouse it'll see the pixel move too?

Testable on your own. It will peg the CPU at 100% usage, though.

Q3: im having a bit of a problem with the reaction time.. it needs to realize the pixel is there for a second before it'll react to it, is there any way to get a faster response?

Restrict the screen area PixelSearch() has to deal with to get its results faster.

Or, you could just learn to play the game yourself...

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

floating point variable type i suppose.. im not sure..

moves towards the mouse means that when the mouse moves towards the pixel, the pixel moves towards the mouse.. you never played an FPS game before? when you're looking at an object, then move your mouse to the right, the object goes to the left.. its the effects of 3D graphics in first person view.. so when the script tells my mouse to move up to the point, the point moves down in reaction with the camera angle being changed.

and i know how to play the game, i've beat it before.. i want to see how good of a score i can get so i can post on high scores list

i found this while searching

Variable Names

The first set of characters after the dollar sign ($) should be used to specify the type of data that will be held in it. The following list signifies the different prefixes and their data type significance.

$a<letter> - Array (the following letter describes the data type taken from the rest of the data types below)

$b - Binary data

$h - File or window handle

$i - Integer

$f - Boolean

$n - Floating point number

$s - String

$v - Variant (unknown/variable type of data)

The rest of the name uses capitalized words to describe the function of the variable. Names like $iC are unacceptable. "$aiWeekDayNames" or "$iCounter" are much preferable.

All variables must be declared at the beginning of the UDF with a Local scope and before they are used for the first time.

The Dim or Global keywords are ambiguous inside of a UDF and as such should be avoided, all variables should be transferred via the Function Parameters using Byref when the updated value needs to be returned.

if i use $n - floating point number, would i be able to simply change the variable $coord to $n so it'll see it as a floating point?

Edited by demandnothing

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I have some suggestions :

1) Why don't you use :

$x1 = $VirtualDesktopWidth/2

Why do you use the Number() function ?

2) You can set a third parameter to the Mousemove function, which is speed. Try setting it to 0

3) If you want the PixelSearch to be faster then you can search a smaller area of the screen. You can also change the Sleep(20) to even less, just to be sure. You can also make sure the script is running at high priority by using :

ProcessSetPriority (@AutoItPID,4)   ; this sets our own process's priority to High

P.S.: Also, floating point numbers are numbers which aren't integers, it's not what you want I think.

Edited by Inverted

Share this post


Link to post
Share on other sites

i thought it was necessary to call the result as the variable.. i'll take it out.. and thanks again.. but im still having the problem of following the target pixel in my program

Share this post


Link to post
Share on other sites

I don't understand what happens with your script. Do you mean that when the first MouseMove happens, the program tries to get the cursor ro the coords but it keeps spinning, because in first person games the cursor is locked to the center of the screen ?

Does it help at all if you use :

MouseMove ($coord[0], $coord[1], 0)

Share this post


Link to post
Share on other sites

... you never played an FPS game before?

I play FPS games on occasion, but never wasted any time trying to cheat at them.

:D

I think Inverted is on to the solution to your problems: Speed = 0 for the MouseMove().

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0