Jump to content

MrPink

Members
  • Posts

    6
  • Joined

  • Last visited

MrPink's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. but its funny that we both found 2 solutions almost at the same time ;o) thank you anyway for your effort !!
  2. i used the code to change it for my needs. my script catches x and y from a panel and then move the dot without leaving a trace (the point is updated every 100ms, but can be adapted). flickering is still not solved, but i could not find an apropriate solution for that. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("", 340, 330) GUISetOnEvent($GUI_EVENT_CLOSE,"close") $GraphWidth = 273 $GraphHeight = 273 $graph = GUICtrlCreateGraphic(48, 15, $GraphWidth, $GraphHeight) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) $yMax = 1024 ;this is the upper label for y axis $yMin = 0 ;this is the lower label for y axis $xMax = 1024 ;this is the upper label for x axis $xMin = 0 ;this is the lower label for x axis GUICtrlCreateLabel($yMax,15,10,20,15,$SS_RIGHT) GUICtrlCreateLabel($yMin,15,280,20,15,$SS_RIGHT) GUICtrlCreateLabel($xMax,307,295,20,15,$SS_CENTER) GUICtrlCreateLabel($xMin,38,295,20,15,$SS_CENTER) GUISetState() $fXcoordold=1 $fYcoordold=1 While 1 $graph = GUICtrlCreateGraphic(48, 15, $GraphWidth, $GraphHeight) ;---------- GET THE X,Y VALUES ----------------------------------- If WinExists("x-coords") Then $fXcoord = Number(ControlGetText("x-coords", "", "Edit1")) $fYcoord = Number(ControlGetText("y-coords", "", "Edit1")) EndIf ;----------------------------------------------------------------- ;---------- PLOT THE POINTS -------------------------------------- GUICtrlSetGraphic ($graph,$GUI_GR_DOT,Gen_Abs_Pix_x($fXcoord,$xMin,$xMax,$GraphWidth), Gen_Abs_Pix_y($fYcoord,$yMin,$yMax,$GraphHeight)) GUICtrlSetGraphic ($graph,$GUI_GR_REFRESH) ;----------------------------------------------------------------- Sleep(50) GUICtrlDelete($graph) WEnd func Gen_Abs_Pix_x($x,$low,$high,$width) $out = (($width/($high-$low))*(($high-$low)*(($x-$low)/($high-$low)))) Return $out EndFunc func Gen_Abs_Pix_y($y,$low,$high,$height) $out = ($height - (($height/($high-$low))*(($high-$low)*(($y-$low)/($high-$low))))) Return $out EndFunc func close() Exit EndFunc
  3. i found at least the solution for erasing the old points. easily delete the GUI and create a new one ;o) here is the working code (the flickering is still not solved): #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("", 340, 330) GUISetOnEvent($GUI_EVENT_CLOSE,"close") $GraphWidth = 273 $GraphHeight = 273 $graph = GUICtrlCreateGraphic(48, 15, $GraphWidth, $GraphHeight) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) $yMax = 1024 ;this is the upper label for y axis $yMin = 0 ;this is the lower label for y axis $xMax = 1024 ;this is the upper label for x axis $xMin = 0 ;this is the lower label for x axis GUICtrlCreateLabel($yMax,15,10,20,15,$SS_RIGHT) GUICtrlCreateLabel($yMin,15,280,20,15,$SS_RIGHT) GUICtrlCreateLabel($xMax,307,295,20,15,$SS_CENTER) GUICtrlCreateLabel($xMin,38,295,20,15,$SS_CENTER) GUISetState() $fXcoordold=1 $fYcoordold=1 While 1 $graph = GUICtrlCreateGraphic(48, 15, $GraphWidth, $GraphHeight) ;---------- GET THE X,Y VALUES ----------------------------------- If WinExists("x-coords") Then $fXcoord = Number(ControlGetText("x-coords", "", "Edit1")) $fYcoord = Number(ControlGetText("y-coords", "", "Edit1")) EndIf ;----------------------------------------------------------------- ;---------- PLOT THE POINTS -------------------------------------- GUICtrlSetGraphic ($graph,$GUI_GR_DOT,Gen_Abs_Pix_x($fXcoord,$xMin,$xMax,$GraphWidth), Gen_Abs_Pix_y($fYcoord,$yMin,$yMax,$GraphHeight)) GUICtrlSetGraphic ($graph,$GUI_GR_REFRESH) ;----------------------------------------------------------------- Sleep(50) GUICtrlDelete($graph) WEnd func Gen_Abs_Pix_x($x,$low,$high,$width) $out = (($width/($high-$low))*(($high-$low)*(($x-$low)/($high-$low)))) Return $out EndFunc func Gen_Abs_Pix_y($y,$low,$high,$height) $out = ($height - (($height/($high-$low))*(($high-$low)*(($y-$low)/($high-$low))))) Return $out EndFunc func close() Exit EndFunc
  4. thats what i thought too .. but then you will still see the black dots because of the flickering (it is updated every 100ms). so it draws white dots over the black dots, but the black dots are still there and will show up once in a while ;o) BTW i couldn't find out how to stop the flickering either. what i read was that it is because of renewed everything at the refresh.
  5. Hello, i want to clean a graph that i filled with dots. It should show a dot that is moving within a graph but at the moment i see all dots that were drawn. I take the x and y values from different panels. Here is my script: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("", 340, 330) GUISetOnEvent($GUI_EVENT_CLOSE,"close") $GraphWidth = 273 $GraphHeight = 273 $graph = GUICtrlCreateGraphic(48, 15, $GraphWidth, $GraphHeight) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) $yMax = 100 ;this is the upper label for y axis $yMin = 0 ;this is the lower label for y axis $xMax = 100 ;this is the upper label for x axis $xMin = 0 ;this is the lower label for x axis GUICtrlCreateLabel($yMax,15,10,20,15,$SS_RIGHT) GUICtrlCreateLabel($yMin,15,280,20,15,$SS_RIGHT) GUICtrlCreateLabel($xMax,307,295,20,15,$SS_CENTER) GUICtrlCreateLabel($xMin,38,295,20,15,$SS_CENTER) GUISetState() While 1 ;---------- GET THE X,Y VALUES ----------------------------------- If WinExists("x-coords") Then $fXcoord = Number(ControlGetText("x-coords", "", "Edit1")) $fYcoord = Number(ControlGetText("y-coords", "", "Edit1")) ;~ MsgBox(64, "Text", $sText) EndIf ;----------------------------------------------------------------- ;---------- PLOT THE POINTS ---------- GUICtrlSetGraphic ($graph,$GUI_GR_DOT,Gen_Abs_Pix_x($fXcoord,$xMin,$xMax,$GraphWidth), Gen_Abs_Pix_y($fYcoord,$yMin,$yMax,$GraphHeight)) GUICtrlSetGraphic ($graph,$GUI_GR_REFRESH) ;----------------------------------------------------------------- ;~ MsgBox(0,"hallo",$sText) Sleep(100) WEnd func Gen_Abs_Pix_x($x,$low,$high,$width) $out = (($width/($high-$low))*(($high-$low)*(($x-$low)/($high-$low)))) Return $out EndFunc func Gen_Abs_Pix_y($y,$low,$high,$height) $out = ($height - (($height/($high-$low))*(($high-$low)*(($y-$low)/($high-$low))))) Return $out EndFunc func close() Exit EndFunc Can someone give me a hint how i can possibly clear the GUI from the old points ??
  6. try this one at the beginning of your script: Opt("SendKeyDownDelay", 100) ;100 milliseconds by default keystrokes from autoit are only 5ms .. for some games you need a longer period for the game to detect the keystroke
×
×
  • Create New...