Code: Select all
;include ClassTask.ahk, some functions and settings
#include GameHeader.ahk
;Copyright (c) D.Donchev
;inform user that helper is runned
MsgBox(,,"Game Helper.", 3)
;create and push tash to list
taskAcc:= new Task("AcountLogin.ahk")
;create, push, run and end task
!Space::(new Task("Rewards.ahk")).run().end()
!S:: (new Task("RewardsSnapshot.ahk")).run().end()
#S:: (new Task("ChatSpam.ahk")).run().end()
#0::
while GetKeyState("LWin")
Sleep 1
DD_BtnSend("000000")
return
#9::
#Numpad0::
while GetKeyState("LWin")
Sleep 1
(new Task("AuctionSetup.ahk")).run().end()
return
;init taskAcc and run (no end) >>> taskAcc variable keep DRY (Don`t Repeat Yourself) principle
#Right::taskAcc.run(,iniREAD("GameAccounts.ini", "Status", "CurrAcc")+1) ;it look like .get() but from different .ini
#Left:: taskAcc.run(,iniREAD("GameAccounts.ini", "Status", "CurrAcc")-1)
#Down:: taskAcc.run(,iniREAD("GameAccounts.ini", "Status", "CurrAcc")+0)
#End:: taskAcc.run(,iniREAD("GameAccounts.ini", "Status", "AccNumb")+0)
#1::
#Home:: taskAcc.run(,1)
#2:: taskAcc.run(,2)
#3:: taskAcc.run(,3)
#N::
a:= InputBox("ACC NUMBER",,"W150 H100",iniREAD("GameAccounts.ini", "Status", "CurrAcc")+0)+0
if !ErrorLevel, taskAcc.run(,a)
return
;keep tracking for user defined price of goods
#P::(new Task("BuyItemCheck.ahk")).run().end() ;call BuyItemForce.ahk too if check is TRUE
;forced buy goods
!X::(new Task("BuyItemForce.ahk",,0)).run().end()
#!Q::ExitApp
Why (new Task()).run().end()?
1. new Task(TaskName) - create control for TaskName (and push it to Task.List - if master going to close all child processes invited to close too).
2. .run() - run TaskName - when process is short and straight it is not necessary Task.List to keep control till the end of Master, but only till TaskName close itself.
3. .end() - unsubscribe TaskName from Task.List and clear .VAR and/or .AHK depend of options this.exit.
This way we have control over "child" process till it in run and release CPU and Memory resources when it close.
DONT FORGET!
Class Task - create and keep only control to the "child" process - not the same process.
Class Task - give possibilities to run MULTI processing - but real multitasking become from windows.
THE LAST started script hold and cover SHORTCUTS of already started scripts (if SHORTCUTS duplication).
Enjoy!