quick_sliver007 Posted May 12, 2005 Share Posted May 12, 2005 I want the script move the label until I press the spacebar. The main problem is that the label just disappears on me. Here is the script.expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: A.N.Other <myemail@nowhere.com> ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ;y = hieth ;x = wieth ; Script Start - Add your code below here #include <GuiConstants.au3> $height = 400 $width = 400 $gui = GuiCreate("MyGUI", $width, $height,(@DesktopWidth-518)/2, (@DesktopHeight-388)/2 ) $Label = GuiCtrlCreateLabel("", 200, 200, 20, 20) GUICtrlSetBkColor($label,0) GuiSetState() HotKeySet("{up}","up") While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case _IsPressed(38); the number 8 $pos = ControlGetPos($gui,"",$label) GUICtrlSetPos($label,$width,$pos[1] + 1) EndSelect WEnd Exit Func up() $pos = ControlGetPos($gui,"",$label) For $a = $pos[1] To $height GUICtrlSetPos($label,$width,$pos[1] + 1) Sleep(10) If _IsPressed(20) Then; space key ExitLoop EndIf Next EndFunc Func _IsPressed($hexKey) Local $aR, $bRv $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If $aR[0] <> 0 Then $bRv = 1 Else $bRv = 0 EndIf Return $bRv EndFunc . Link to comment Share on other sites More sharing options...
CyberSlug Posted May 12, 2005 Share Posted May 12, 2005 For the up function, try: GUICtrlSetPos($label,$pos[0],$pos[1] - 1) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
quick_sliver007 Posted May 12, 2005 Author Share Posted May 12, 2005 For the up function, try:GUICtrlSetPos($label,$pos[0],$pos[1] - 1)<{POST_SNAPBACK}>Looks like I was down instead of up, but I still have the same problem. The label just disappears. . Link to comment Share on other sites More sharing options...
buzz44 Posted May 12, 2005 Share Posted May 12, 2005 (edited) Change Func Up() to this... Func up() While 1 $pos = ControlGetPos($gui,"",$label) GUICtrlSetPos($label,$pos[0],$pos[1] - 1) If _IsPressed(20) Then ExitLoop Sleep(10) Wend EndFunc Edited May 12, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
quick_sliver007 Posted May 12, 2005 Author Share Posted May 12, 2005 Change Func Up() to this...Func up() While 1 $pos = ControlGetPos($gui,"",$label) GUICtrlSetPos($label,$pos[0],$pos[1] - 1) If _IsPressed(20) Then ExitLoop Sleep(10) Wend EndFunc<{POST_SNAPBACK}>Thanks a million. I will be using alot of this in my next game; the classic snake game. If I make it. . Link to comment Share on other sites More sharing options...
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