Jump to content

Greetings, Simple script question


Recommended Posts

Greetings,

I am trying to make or modify a script.. That will press 4 numeric keys in sequence i.e 0,9,8,7 then pause 9 seconds then do so again...

Thats the simple part I suppose the tough part is how to make it to where the script can be paused and un-paused by using any key in particular or a mouse button...

I'll take the easy part if thats all I can get and I'll just have to deal with close & run..

Any help, is appreciated

TA

Link to comment
Share on other sites

Greetings,

    I am trying to make or modify a script.. That will press 4 numeric keys in sequence i.e 0,9,8,7 then pause 9 seconds then do so again...

    Thats the simple part I suppose the tough part is how to make it to where the script can be paused and un-paused by using any key in particular or a mouse button...

    I'll take the easy part if thats all I can get and I'll just have to deal with close & run..

    Any help, is appreciated

TA

<{POST_SNAPBACK}>

Cake! Just replace "Title" and "Text" with the correct values. "Text" is optional.

#Region Options and Hotkeys
Opt("SendKeyDelay",50); Delay of 50ms between keystrokes
Opt("WinTitleMatchMode",4); advanced win title matching mode.
HotKeySet("{F10}","PauseIt"); set hotkey F10 to toggle the pause
HotKeySet("{ESC}","MyExit"); set the hotkey ESC to quit script.
#EndRegion

#Region Variable Initialization
$pause = 0
$hwnd_window = WinGetHandle("Title","Text")
#EndRegion

#Region Primary Data Loop
While 1; infinate loop start
   Sleep(10); small pause to keep from eating all the CPU ticks.
   If $pause = 0
      Winactivate($hwnd_window); activate window
      Send("0987"); send the text
      Sleep(9000); wait 9 seconds
   Else
      Sleep(500)
   EndIf
WEnd; infinate loop end
#EndRegion

#Region Functions
Func PauseIt(ByRef $pause)
   If $pause = 0 then $pause = 1
   If $pause = 1 then $pause = 0
EndFunc

Func MyExit()
   Exit
EndFunc
#EndRegion

This seems like it'd be a good script to run in City of Heros.

Is that what it's for?

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

I get an error message:

*************

Line 16

If $pause = 0

Error: "if" statements must have a "Then" keyword

**********

Cake! Just replace "Title" and "Text" with the correct values. "Text" is optional.

What value? I am not a scripter if you can't tell :lmao:

This seems like it'd be a good script to run in City of Heros.

Is that what it's for?

No it is for D@0C, to auto twizt My healing chantz so I may focus on fighting as a Paladin.

The battle begins I run the script.. fight while my chantz are rolled for me then when the battle is over I pause the script...

Yes I could hit 4 keys but then I am focusing on that more than on the battle itself..

TA

Link to comment
Share on other sites

I get an error message:

*************

Line 16

If $pause = 0

Error: "if" statements must have a "Then" keyword

**********

Then simply put a "then" after the $pause = 0

What value? I am not a scripter if you can't tell :)

The correct value is the window title as given by the AU3Info tool. Formerly known as "Window Spy." I personally prefer to use the classname.

Example:

Opt("WinTitleMatchMode",4) ; critical!! Allows classname use

WinWait("classname=City of Heros") ; Wait until the window exists.

I was successfully running a modified version of this for my CoH account last night. Started the script in a "paused" state. Pause toggle key worked, and so did the exit...

I'll post this afternoon when I go home for lunch or this evening when I get home.

Edit: Posted script

;~;;; This script starts in a paused state
;~;;; Currently group heal is set to 5.  Change as desired.
;~;;; Also, tweak with the timing as required.

#Region Options and Hotkeys
Opt("SendKeyDelay",50); Delay of 50ms between keystrokes
Opt("WinTitleMatchMode",4); advanced win title matching mode.
HotKeySet("{pause}","PauseIt"); set hotkey F10 to toggle the pause
HotKeySet("{ESC}","MyExit"); set the hotkey ESC to quit script.
#EndRegion

#Region Variable Initialization
Dim $pause = 1
#EndRegion

#Region Primary Data Loop
WinWait("classname=City Of Heroes"); Wait for window to exist.
$hwnd_CoH = WinGetHandle("classname=City Of Heroes")
While 1; infinate loop start
   Sleep(10); small pause to keep from eating all the CPU ticks.
   If $pause = 0 Then
      Winactivate($hwnd_CoH); activate window
      Send("5"); send the keystroke.  5 in my case is group heal power.
      Sleep(12000); wait 12 seconds
   Else
      Sleep(500); If paused, sleep for 1/2 second.
        If Not WinExists($hwnd_CoH) Then Exit
   EndIf
WEnd; infinate loop end
#EndRegion

#Region Functions
Func PauseIt(ByRef $pause)
   If $pause = 0 then 
        $pause = 1
    ElseIf $pause = 1 then 
        $pause = 0
    EndIf
EndFunc

Func MyExit()
   Exit
EndFunc
#EndRegion
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Blue_Drache,

Thank you very much for your help thus far I feel I am very close to what I seek but alas am not there yet.. :D

I have simulated this using the AI spy tool & notepad using the classname for notepad and it works.. I use the classname for my game as per the AI Spy tool.. as Illustrated below and it does not work... :)

Also in order to keep the script running I actually had to remove the line:

If Not WinExists($hwnd_CoH) Then Exit

Which would seem to illistrate to me the script is not identifying the window (best guess) but I have cut & pasted the Classname exactly out of the AI Spy tool... Also I have tried this in windowed mode vs fullscreen mode and still no luck...

So this is the complete script modified thus far to my needs, I am hoping you can assist me to get this going...

;~;;; This script starts in a paused state

;~;;; Currently twisting is set to 0987.  Change as desired.

;~;;; Also, tweak with the timing as required.

#Region Options and Hotkeys

Opt("SendKeyDelay",50); Delay of 50ms between keystrokes

Opt("WinTitleMatchMode",4); advanced win title matching mode.

HotKeySet("{F2}","PauseIt"); set hotkey F2 to toggle the pause

HotKeySet("{ESC}","MyExit"); set the hotkey ESC to quit script.

#EndRegion

#Region Variable Initialization

Dim $pause = 1

#EndRegion

#Region Primary Data Loop

WinWait("classname=DAoCMWC"); Wait for window to exist.

$hwnd_CoH = WinGetHandle("classname=DAoCMWC")

While 1; infinate loop start

  Sleep(10); small pause to keep from eating all the CPU ticks.

  If $pause = 0 Then

      Winactivate($hwnd_CoH); activate window

      Send("0987"); send the keystroke.  0987 in my case is twisting.

      Sleep(9000); wait 9 seconds

  Else

      Sleep(500); If paused, sleep for 1/2 second.

        If Not WinExists($hwnd_CoH) Then Exit

  EndIf

WEnd; infinate loop end

#EndRegion

#Region Functions

Func PauseIt(ByRef $pause)

  If $pause = 0 then

        $pause = 1

    ElseIf $pause = 1 then

        $pause = 0

    EndIf

EndFunc

Func MyExit()

  Exit

EndFunc

#EndRegion

Thanks again for all your help thus far, I couldn't have gotten this far without your help!

TA

Link to comment
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
 Share

  • Recently Browsing   0 members

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