Hilfe zu meinem programm...

04/10/2010 09:29 Franzknut#1
Hallo,

ich hab mich mal an ein keines programm gesetzt, welches mir einen signalton gibt, wenn mich z.b. in wow jemand anschreibt.

So sieht das programm zz aus:

#include <Sound.au3>

while 1
$whisper = pixelsearch (42,438, 337, 685, 0x5F3B65, 10)
If Not @error = 1 then
_sound()
While 1
WEnd
endif
wend
Func _sound()
$snd = _SoundOpen("C:\Dokumente und Einstellungen\Dtex.DTEX-YI8SXFHVNC\Desktop\Alarm.wav")
_SoundPlay($snd)
EndFunc

Ich habe dieses programm nicht vollständig selbst geschrieben, sondern bisschen zusammen gewürfelt...

ich verstehe alles daraus, jedoch folgendes nicht:

Func _sound()
$snd = _SoundOpen("C:\Dokumente und Einstellungen\Dtex.DTEX-YI8SXFHVNC\Desktop\Alarm.wav")
_SoundPlay($snd)
EndFunc

wieso muss dort iwas mit Func sein?... ich habe alle Funcs mal weggelassen und dann spielt er keinen sound ab..

nun ja so wie das programm nun ist, spielt er wie er soll einen sound ab, jedoch nur einmal... wenn mich etwas später wieder einer anschreibt, dann spielt er keinen sound mehr ab. außerdem dauert es etwas zu lange bis er den sound abspielt... wie kann ich diese zeit verringern?

wäre echt nett, wenn mir jemand helfen könnte...
mfg
04/10/2010 09:46 Franzknut#2
ah ok sry... ich glaub ich habs problem selber gelöst... so sieht mein programm aus:

#include <Sound.au3>
dim $zahler
$zahler = 0
dim $snd

HotKeySet("{NUMPAD7}", "_StartBot")
HotKeySet("{NUMPAD9}", "_PauseBot")
HotKeySet("{NUMPADSUB}", "_EndeBot")

Global $Active = 0

while 1
if $Active = 1 Then
Controlsend ("World of Warcraft", "", "", "{1}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{2}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{3}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{4}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{5}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{6}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{7}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{8}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{9}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{0}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{e}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{f}")
sleep (5)
Controlsend ("World of Warcraft", "", "", "{g}")
sleep (5)
$zahler = $zahler + 1
If $zahler = 30 Then
Controlsend ("World of Warcraft", "", "", "{q}")
$zahler = 0
EndIf
$whisper = pixelsearch (11,10, 1895, 1026, 0x5F3B65, 10)
If Not @error = 1 then
_sound()
sleep (10000)
Endif
EndIf
WEnd

Func _StartBot()
$Active = 1
EndFunc

Func _PauseBot()
$Active = 0
EndFunc

Func _EndeBot()
Exit
EndFunc

Func _sound()
$snd = _SoundOpen("C:\Dokumente und Einstellungen\Dtex.DTEX-YI8SXFHVNC\Desktop\Alarm.wav")
_SoundPlay($snd)
EndFunc

Iwelche verbesserungsvorschläge?
mfg
04/11/2010 15:52 Wellard#3
If you have an English translation I could probably help.
04/12/2010 09:30 epiTR#4
Code:
sleep(5)
sehr kurze Pausen, falls du fünf Sekunden meintest dann müsste es so sein:

Code:
sleep(5000)
04/12/2010 17:11 Franzknut#5
Mit hilfe meinte ich es vllt. besser ordnen bzw es sinnvoller zu gestalten oder so... sleep (5) is bewusst gewählt.

With "help" i meant propably to make is a lil bit smarter or more sensefull...

mfg