Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 01:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Whileschleifen >.<

Discussion on Whileschleifen >.< within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2009
Posts: 393
Received Thanks: 46
Whileschleifen >.<

Hallo, 2 teile meiens scripts:

1)
Code:
While True
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
	Case $Button1
		MsgBox(1, "Anleitung", "Drückt Start um zu Schlagen,Picupen und Aura/Sk anzumach und Potten um Blaue|Rote pots zu schlucken.Dazu müssen Aura F1 und Blaue|Rote pots 1und 2 sein", 1000)
	Case $Button2
		MsgBox*BLABLABLA habe ich mal raus genommen...*
	Case $Button3
		GUICtrlSetBkColor($Button3, 0x00FF00)
		GUICtrlSetBkColor($Button4, Default)
		GUICtrlSetBkColor($Button5, Default)
		GUICtrlSetBkColor($Button6, Default)
		GUICtrlSetBkColor($Button7, Default)
		GUICtrlSetStyle($Button4, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button5, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button6, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button7, $GUI_SS_DEFAULT_BUTTON)
		_Start() ; Startfunktion aufrufen, Variable $start wird auf 1 gesetzt
	Case $Button4
		GUICtrlSetBkColor($Button3, Default)
		GUICtrlSetBkColor($Button4, 0xFFFF00)
		GUICtrlSetBkColor($Button5, Default)
		GUICtrlSetBkColor($Button6, Default)
		GUICtrlSetBkColor($Button7, Default)
		GUICtrlSetStyle($Button3, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button5, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button6, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button7, $GUI_SS_DEFAULT_BUTTON)
		_pause() ; Pausefunktion aufrufen, Variable $start wird auf 0 gesetzt
	Case $Button5
		GUICtrlSetBkColor($Button3, Default)
		GUICtrlSetBkColor($Button4, Default)
		GUICtrlSetBkColor($Button5, 0xFF0000)
		GUICtrlSetBkColor($Button6, Default)
		GUICtrlSetBkColor($Button7, Default)
		GUICtrlSetStyle($Button3, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button4, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button6, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button7, $GUI_SS_DEFAULT_BUTTON)
		_Ende()
	Case $Button6
		GUICtrlSetBkColor($Button3, Default)
		GUICtrlSetBkColor($Button4, Default)
		GUICtrlSetBkColor($Button5, Default)
		GUICtrlSetBkColor($Button6, 0x00FF00)
		GUICtrlSetBkColor($Button7, Default)
		GUICtrlSetStyle($Button4, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button5, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button3, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button7, $GUI_SS_DEFAULT_BUTTON)
		_Start2()
	Case $Button7
		GUICtrlSetBkColor($Button3, Default)
		GUICtrlSetBkColor($Button4, Default)
		GUICtrlSetBkColor($Button5, Default)
		GUICtrlSetBkColor($Button6, Default)
		GUICtrlSetBkColor($Button7, 0x00FF00)
		GUICtrlSetStyle($Button4, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button5, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button3, $GUI_SS_DEFAULT_BUTTON)
		GUICtrlSetStyle($Button6, $GUI_SS_DEFAULT_BUTTON)
		_Start3()
EndSwitch
Dazu:Man sieht ja das ich mit While True da rum gebastelt habe. bis zu button 6 wechselt es bei 3-6 die farben. nur dann:

2)
Code:
If $start3 = 1 And TimerDiff($t) > 1 Then
	While 1
	$timerInit1 = TimerInit() ; Initialisiert einen Timer mit den Namen $timerInit1 und setzt ihn auf 0
	Sleep(5000) ; Wartet 5000 ms
	$timerInit2 = TimerInit() ; Initialisiert einen Timer mit den Namen $timerInit2 und setzt ihn auf 0
	$timerDiff1 = TimerDiff($timerInit1) ; Liest den Stand des Timers $timerInit1 aus und speichert ihn in $timerDiff1
	$timerDiff2 = TimerDiff($timerInit2) ; Liest den Stand des Timers $timerInit1 aus und speichert ihn in $timerDiff1
	; Generiert einen ToolTip um die aktuellen Timerstände anzuzeigen
	If $timerDiff1 >= 59000 Then ; Wenn Timerstand von $timerDiff1 größer als 10000ms dann:
		Send("^h")
		Sleep(500)
		Send("{F1}")
		Sleep(500)
		Send("^h") ; - zeige eine MsgBox
		$timerInit1 = TimerInit() ; - Initialisiert einen Timer mit den Namen $timerInit1 und setzt ihn auf 0
	EndIf
	If $timerDiff2 >= 59000 Then ; Wenn Timerstand von $timerDiff1 größer als 10000ms dann:
		Send("^h")
		Sleep(1500)
		Send("{F1}")
		Sleep(500)
		Send("^h")

		$timerInit2 = TimerInit()
	EndIf
Dazu:
Habe hier halt While 1 genommen, dann geht der 7te Button auch Grün "ABER" danach kann ich nicht mehr 3,4,5,6 drücken. Als ob das Script abgestürzt sei.


Bitte um korrektur mit ";" anmerkungen. danke!
repins94 is offline  
Old 10/12/2009, 03:51   #2
 
^darkwing's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 148
Received Thanks: 31
1. Ich habe keinen Plan von AutoIT ;p
2. Es ist doch logisch das nix geht, weil dein Programm in einer while schleife Hängt. (While 1)
3. Die Lösung ist eine Bedingung zu verwenden z.B. while (run) und run hat den Wert 1 und irgendwo setzt du je nach deinen wünschen das run auf 0 um die Schleife zu beenden.
Eventuell gibt es in AutoIT das schlüsselwort "break" womit auch die Schleife verlassen wird.
^darkwing is offline  
Old 10/12/2009, 08:43   #3
 
elite*gold: 0
Join Date: Jan 2009
Posts: 393
Received Thanks: 46
Also ich denke mal das "while run" kein Command ist, da ich dann einen syntax error in den zeilen wo run und in den zeilen wo run auf 0 gesetzt wird
repins94 is offline  
Old 10/12/2009, 09:54   #4
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by repins94 View Post
Also ich denke mal das "while run" kein Command ist, da ich dann einen syntax error in den zeilen wo run und in den zeilen wo run auf 0 gesetzt wird


run ist ne variable <.<
bool run =true;
while(run)


<.<
MoepMeep is offline  
Old 10/12/2009, 10:02   #5
 
elite*gold: 0
Join Date: Jan 2009
Posts: 393
Received Thanks: 46
Quote:
Originally Posted by MoepMeep View Post


run ist ne variable <.<
bool run =true;
while(run)


<.<
ahja cO hatt grade 0 gehollfen...
repins94 is offline  
Old 10/12/2009, 10:26   #6
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,426
Received Thanks: 1,888
Quote:
Originally Posted by repins94 View Post
ahja cO hatt grade 0 gehollfen...

Nur weil du es nicht verstehst?

pseudocode incoming!
Code:
int run = 1
while(run==1)
// tu etwas
if(bedingung)
run=0
MoepMeep is offline  
Old 10/12/2009, 10:43   #7
 
elite*gold: 0
Join Date: Jan 2009
Posts: 393
Received Thanks: 46
Quote:
Originally Posted by MoepMeep View Post
Nur weil du es nicht verstehst?

pseudocode incoming!
Code:
int run = 1
while(run==1)
// tu etwas
if(bedingung)
run=0
da ich das if ja denke ich mal vor das start setzen muss sieht es nun aus iwe folgt,

int run = 2
while(run==2)
If $start3 = 1 And TimerDiff($t) > 1 Then
bla
bla
bla
$timerInit2 = TimerInit()
EndIf
run=0

ergibt SyntaxError...

könnte man mir die schritte nicht einfahc mit einem

$blablabla ; Macht blablabla

und halt anhand einfacher bsp erklären, dann kann ich es ja auch verstehen, das ist wie wenn du einem 6 klässler binomiche formeln an dne kopf haust und er würde sie nicht verstehen, es sei denn er hatte si eschon, also ist er deswegen auch nicht gleich ein idiot !

Nächster veduch:

dort geht das script dann ne milli sec auf und wieder zu
repins94 is offline  
Old 10/12/2009, 11:52   #8
 
bassbanane's Avatar
 
elite*gold: 116
Join Date: Oct 2007
Posts: 677
Received Thanks: 248
Vielleicht solltest du dir mal die Error Message angucken, die im Scite Editor ausgegeben wird ;-) Dein Problem is "AdlibEnable (5000)" , da fehlt eine Funktion die er alle 5 Sek. aufrufen soll..
bassbanane is offline  
Old 10/12/2009, 13:52   #9
 
elite*gold: 0
Join Date: Jan 2009
Posts: 393
Received Thanks: 46
Quote:
Originally Posted by bassbanane View Post
Vielleicht solltest du dir mal die Error Message angucken, die im Scite Editor ausgegeben wird ;-) Dein Problem is "AdlibEnable (5000)" , da fehlt eine Funktion die er alle 5 Sek. aufrufen soll..
ja nur wie osll ich die funktion denn definieren? ... nenn mir mal bitte di efunk für fenster farben geben <.> und das immer... also ohne pause
repins94 is offline  
Old 10/12/2009, 18:58   #10
 
bassbanane's Avatar
 
elite*gold: 116
Join Date: Oct 2007
Posts: 677
Received Thanks: 248
Ja wenn nicht mal du weißt wieso das AdlibEnable da drin is dann weiß ich nich was du dir da gebastelt hast....
bassbanane is offline  
Reply




All times are GMT +2. The time now is 01:43.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.