BillLuvsU Posted February 4, 2005 Posted February 4, 2005 Is it possible to have two diferent while loops editing the same GUI at the same time? Somthing like #include<guiconstants.au3> guicreate("test",400,400) $test1=guictrlcreatelabel("A",190,200) $test2=guictrlcreatelabel("B",210,200) guisetstate() while 1 guictrlsetpos($test1,100,200) sleep(2000) guictrlsetpos($test1,190,200) andwhile 1 guictrlsetpos($test2,300,200) sleep(2000) guictrlsetpos($test2,210,200) wend [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
Developers Jos Posted February 4, 2005 Developers Posted February 4, 2005 could you explain why you would want that ?? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Wolvereness Posted February 4, 2005 Posted February 4, 2005 (edited) You can say:guictrlsetpos($test1,100,200) guictrlsetpos($test2,300,200) sleep(2000) guictrlsetpos($test1,190,200) guictrlsetpos($test2,210,200)OrAdlibEnable("hello",2000) Func Hello() guictrlsetpos($test2,300,200) guictrlsetpos($test2,210,200); this is EXACTLY what your currently asking... EndFunc While 1 guictrlsetpos($test1,100,200) sleep(2000) guictrlsetpos($test1,190,200) WEnd If you give the actual code you need in 2 different while loops someone can do it for you. Edited February 4, 2005 by Wolvereness Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]
BillLuvsU Posted February 7, 2005 Author Posted February 7, 2005 ok, i am making a game using autoit and I'm using the _IfPressed function for controls but I need monsters and NPCs to also move WHILE the charecter is moving. [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
ioliver Posted February 7, 2005 Posted February 7, 2005 (edited) #include<guiconstants.au3> guicreate("test",400,400) $test1=guictrlcreatelabel("A",190,200) $test2=guictrlcreatelabel("B",210,200) $Go=GUICtrlCreateButton("Go", 350, 350) guisetstate() while 1 $msg = GUIGetMsg() Select Case $msg = $Go guictrlsetpos($test1,100,200) guictrlsetpos($test2,300,200) sleep(2000) guictrlsetpos($test1,190,200) guictrlsetpos($test2,210,200) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop wend I'm not sure if this helps, I haven't tested it, but couldn't you just eliminate the 2nd While...Wend loop. See Above. The 2 chars (labels: A & should move at the same time. Hope that helps, Ian Edited February 7, 2005 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
BillLuvsU Posted February 7, 2005 Author Posted February 7, 2005 that should help with how i've set it up but it might appear a bit laggy... [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
ioliver Posted February 7, 2005 Posted February 7, 2005 Great, let me know when you're finished. I'd like to check out your game. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
zcoacoaz Posted February 7, 2005 Posted February 7, 2005 sounds really hard, if only autoit could do multi-threading (is that what its called im not sure) [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
Administrators Jon Posted February 7, 2005 Administrators Posted February 7, 2005 sounds really hard, if only autoit could do multi-threading (is that what its called im not sure)Good job we've always had multithreading, otherwise we would have been very bored without games in the 80s Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
ioliver Posted February 7, 2005 Posted February 7, 2005 @Jon, or anyone else: Is that possible? I can't think of a way to have one object constantly moving in a GUI, and at the same time have another object move using user input... I hope I phrased that correctly. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Developers Jos Posted February 7, 2005 Developers Posted February 7, 2005 @Jon, or anyone else:Is that possible? I can't think of a way to have one object constantly moving in a GUI, and at the same time have another object move using user input... I hope I phrased that correctly.Thanks,Ian<{POST_SNAPBACK}>Did you have a look at AdlibEnable() ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Administrators Jon Posted February 7, 2005 Administrators Posted February 7, 2005 @Jon, or anyone else:Is that possible? I can't think of a way to have one object constantly moving in a GUI, and at the same time have another object move using user input... I hope I phrased that correctly.Thanks,IanIt doesn't happen at the same time. Its just a loop that is done so quickly it seems to be at the same time. Do you have a Multi CPU machine? Probably not, so how come your email is downloading in the background as your read this? All the tasks get split into small slices that each take turns to receive processing time. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
ioliver Posted February 7, 2005 Posted February 7, 2005 #include<guiconstants.au3> guicreate("test",400,400) $test1=guictrlcreatelabel("A",190,200) $test2=guictrlcreatelabel("B",210,200) $Go=GUICtrlCreateButton("Go", 350, 350) guisetstate() AdlibEnable("_CharMove", 500) While 1 $msg = GUIGetMsg() Select Case $msg = $Go guictrlsetpos($test1,100,200) Sleep(2000) guictrlsetpos($test1,190,200) EndSelect If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func _CharMove() GUICtrlSetPos($test2, 300, 200) Sleep(2000) GUICtrlSetPos($test2, 210, 200) Sleep(2000) EndFunc I just tried AdlibEnable(). Code Above. But when I press the 'Go' button Char: A does not move. What am I missing? Thanks for your time, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
BillLuvsU Posted February 7, 2005 Author Posted February 7, 2005 (edited) as for the controls i'm gonna have something like this. if _ispressed('22')=1 then while _ispressed('22')=1 $chary=$chary-1 guictrlsetpos($char,$charx,$chary) $rand=int(random(1,5)) if $rand=1 then $monx = $mox + 1 guictrlsetpos($mon1,$monx,$mony) elseif $rand=2 then $monx = $monx - 1 guictrlsetpos($mon1,$monx,$mony) elseif $rand=3 then $mony = $mony + 1 guictrlsetpos($mon1,$monx,$mony) elseif $rand=4 then $mony = $mony - 1 guictrlsetpos($mon1,$monx,$mony) endif sleep(5) wend endif Of course thats only for down and in the final it will have walking avi's but you get the idea. Edited February 7, 2005 by fear1313 [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
phillip123adams Posted February 7, 2005 Posted February 7, 2005 Is it possible to have two diferent while loops editing the same GUI at the same time?<{POST_SNAPBACK}>Here's a modified version of your original script. The "A" follows the cursor around, the GO button randomly relocates "B", and "C" and "D" bounce around continuously.expandcollapse popup#include<guiconstants.au3> guicreate("test",400,400) $test1=guictrlcreatelabel("A", 190, 200) $test2=guictrlcreatelabel("B", 210, 200) $test3=guictrlcreatelabel("C", 100, 200) $test4=guictrlcreatelabel("D", 290, 200) $Go=GUICtrlCreateButton("Go", 350, 350) guisetstate() opt("MouseCoordMode", 0) $iAuto1 = 1 $iDelay = 500 $iStart = TimerInit() while 1 $msg = GUIGetMsg() Select Case $msg = $Go $iX1 = Random(20, 380, 1) $iY1 = Random(20, 320, 1) $iX2 = Random(20, 380, 1) $iY2 = Random(20, 320, 1) guictrlsetpos($test2,$iX2,$iY2) case $msg = $GUI_EVENT_CLOSE ExitLoop Case $iAuto1 = 1 $aPos = MouseGetPos() guictrlsetpos($test1, $aPos[0] - 10, $aPos[1] - 45) If TimerDiff($iSTART) >= $iDelay Then $iX1 = Random(20, 380, 1) $iY1 = Random(20, 320, 1) $iX2 = Random(20, 380, 1) $iY2 = Random(20, 320, 1) guictrlsetpos($test3,$iX1,$iY1) guictrlsetpos($test4,$iX2,$iY2) $iStart = TimerInit() EndIf EndSelect wend Phillip
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now