Jump to content

Recommended Posts

Posted
  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

No I mean you have to redraw the window every 1/60th of a second or however fast the game refreshes its own screen.

Redraw the window...huh ok but I use. GUICreate so every 1/60th I do GuiDelete() and remake GUI ?

Not the same thing as winapi window

Posted

It works !!! but it refresh all window so i want to have more information than helpfile about _WinAPI_RedrawWindow , more precise i want to know how configure this constant :

Global Const $tagRECT = "int Left;int Top;int Right;int  Bottom"

I want to configure this "int Left;int Top;int Right;int Bottom" , just strange with quotes...

Posted

It's just asking for the top,top left,bottom,and bottom right of your window. You can use WinGetPos() to do that :), at least I think that's what it's asking for.

Posted

It's just asking for the top,top left,bottom,and bottom right of your window. You can use WinGetPos() to do that :), at least I think that's what it's asking for.

Thats what I was thinking for but how I do the global constant ?

$pos=WinGetPos("crosshair")
Global Const $Rect =$pos[0]&$pos[1]&$pos[3]&$pos[4]

Thats strange because you have 4 positions in one constant I don't know how to do it !

Thanks for anyhelp!

Posted (edited)

This is a bit outta my domain. Is the crosshair going to move or simply be in the center of the screen? If it moves I don't think you can use a constant unless you're constantly redeclaring it (hehehe,pun). I could be wrong since I haven't used the API functions before and most of this is from my short time working with C++ but if it is done as you put then from the looks of what you posted above I'd think it would have to be something like:

$pos = WinGetPos("crosshair")
Global Const $Rect = $pos[0] & ";" & $pos[1] & ";" & $pos[2] & ";" & $pos[3]

Like I said I could be wrong because I haven't used the API functions but it's worth a shot right?

Edit: Looking over the helpfile you could just do

_WinAPI_RedrawWindow($GUI,0,0,$RDW_UPDATENOW)

I think.

Edited by dbzfanatic
Posted (edited)

It works !!! but it refresh all window so i want to have more information than helpfile about _WinAPI_RedrawWindow , more precise i want to know how configure this constant :

Global Const $tagRECT = "int Left;int Top;int Right;int  Bottom"

I want to configure this "int Left;int Top;int Right;int Bottom" , just strange with quotes...

It's a declaration for a rect struct.

Sample usage:

$rect=DllStructCreate($tagRECT)
DllStructSetData("Left",0)
DllStructSetData("Top",0)
DllStructSetData("Right",800)
DllStructSetData("Bottom",600)

:)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Posted (edited)

$rect=DllStructCreate($tagRECT)
  DllStructSetData("Left",0)
  DllStructSetData("Top",0)
  DllStructSetData("Right",800)
  DllStructSetData("Bottom",600)

Thanks for your reply but it has some error and i don't know how to use it with _WinAPI_RedrawWindow

ERROR: DllStructSetData() [built-in] called with wrong number of args.

DllStructSetData("Bottom",600)

$HDL=WinGetHandle($win,"")
 _WinAPI_RedrawWindow($HDL,$TagRECT,1,$WM_PAINT)
Edited by FireFox
Posted

$rect=DllStructCreate($tagRECT)
   DllStructSetData("Left",0)
   DllStructSetData("Top",0)
   DllStructSetData("Right",800)
   DllStructSetData("Bottom",600)

Thanks for your reply but it has some error and i don't know how to use it with _WinAPI_RedrawWindow

ERROR: DllStructSetData() [built-in] called with wrong number of args.

DllStructSetData("Bottom",600)

$HDL=WinGetHandle($win,"")
  _WinAPI_RedrawWindow($HDL,$TagRECT,1,$WM_PAINT)

That's embarrassing :)

Here's the correct one:

$rect=DllStructCreate($tagRECT)
   DllStructSetData($rect,"Left",0)
   DllStructSetData($rect,"Top",0)
   DllStructSetData($rect,"Right",800)
   DllStructSetData($rect,"Bottom",600)

Pass $rect to redraw window.

Broken link? PM me and I'll send you the file!

Posted

Thanks crosshair is now visible on game :)

But I have another problem : when I shoot in game (so I click on crosshair) I return to desktop...:)

Anysuggestions ? thanks for answers !

Posted

That's a tricky problem. My guess would be the crosshair app is taking the focus instead of leaving it on the game. Maybe try adding GUISetState(@SW_DISABLE) after you show it?

Posted (edited)

That's a tricky problem. My guess would be the crosshair app is taking the focus instead of leaving it on the game. Maybe try adding GUISetState(@SW_DISABLE) after you show it?

Thanks, work fine for that :)

Again another problem : In the game left mouse click don't work so it can't shoot because I click on crosshair...

Edited by FireFox
Posted (edited)

I've tried _MouseSetOnEvent UDF but now i can't click anywhere in the game because i don't know how i can send to game to shoot...

An example here :

#include <MouseSetOnEvent_UDF.au3>

While 1
Sleep(10)
_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_Mouse")
WEnd

Func _Mouse()
;Here i want script to send Left mouse click to game
EndFunc
Edited by FireFox
Posted (edited)

Try this in your While 1 loop:

If _IsPressed("01") Then
$pos = MouseGetPos()
ControlClick(*window name*,"","","primary",1,$pos[0],$pos[y]
EndIf

Try sticking that above your message loop in the while.

Edit: also you've been here long enough to know most of us consider it rude to bump within 24 hours of your previous post, much less 10 minutes. Please edit next time.

Edited by dbzfanatic
Posted (edited)

Try this in your While 1 loop:

If _IsPressed("01") Then
   $pos = MouseGetPos()
   ControlClick(*window name*,"","","primary",1,$pos[0],$pos[y]
   EndIf

Try sticking that above your message loop in the while.

Edit: also you've been here long enough to know most of us consider it rude to bump within 24 hours of your previous post, much less 10 minutes. Please edit next time.

Thanks for your reply but i have one error : ControlClick() called with illegal argument 4: "primary" :)

ControlClick("Counter-Strike Source","","","primary",1,510,382)

And I have the lastest beta version...

Edited by FireFox
Posted

I get that sometimes too which makes no sense.

Button Normal Swapped

"" Left Left

"left" Left Left

"middle" Middle Middle

"right" Right Right

"primary" Left Right

"main" Left Right

"secondary" Right Left

"menu" Right Left

Just replace primary with left.
Posted

@dbzfanatic

Thanks it works now another problem :

When I press "left mouse" it shoot in game, but when I want to plant bomb (left mouse down) It always send one click so I can't plant bomb...

If _IsPressed("01") Then
            $POS=MouseGetPos()
            ControlClick("Counter-Strike Source","","","Left",1,$POS[0]-2,$POS[1]-2)
        EndIf

Perhaps script like _Ispresseddown ?

Posted

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...