arcker Posted October 22, 2009 Posted October 22, 2009 (edited) AutoIt Poker NoLimitVersion alphaUncomplete (bugged) ( last revision = 07/2008 )Hi folks ! I've just found this project of mine while I was working on a tcp event script.I've past so many times on it.So, what is it ?=> It's a client / server script to play / host poker games.=> It's completely turned in tcp event ( not with kip udf btw ).It's uncomplete but you can test it : start a server in localhost and launch several clients.It's unfinished since there is a lot of bugs, and I've no time to seek them.My goal was to finish with a complete GDI+ good looking client. One year and a half ago, it was hard since GDI+ was new to the forum. Now we can make it.I have to finish so much like service udf so I've not much time, but I really want to finish this one.Last note though : not icon / file / other thing included. All is generated by playing with fonts.Compile with production version of autoit ( or edit the opt("OnExitFunc") line )Update 23/10/2009 : added stats.au3 and ASock.au3. Just saw a JRowe topic about hand statistics, but dunno if i can adapt it on this game.Your host, arcker.client.au3server.au3Stats.au3ASock.au3 Edited October 23, 2009 by arcker -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
UEZ Posted October 22, 2009 Posted October 22, 2009 (edited) ASock.au3 can be found here: ASock.au3 but what about Stats.au3?UEZ Edited October 22, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
toxicvn Posted October 22, 2009 Posted October 22, 2009 I think Stats.au3 is statistics.au3 http://www.autoitscript.com/forum/index.php?showtopic=14789 or attachment file attachment http://www.autoitscript.com/forum/index.php?app=core&module=attach§ion=attach&attach_id=12082 expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1 (Beta 66) and later ; Author: peethebee <peethebee@gmx.de> ; Version: 1.0 - Beta 3 ; Release Date: 17th August 2005, Beta as of 2nd of December 2007 ; Forum Thread: http://www.autoitscript.com/forum/index.php?showtopic=14789 ; ; Script Function: ; UDF to display statistics/data. ; ; ---------------------------------------------------------------------------- #include <Array.au3> ;=================================== ;=================================== ;======== relative data ============ ;=================================== ;=================================== ;========================================================================================================================= ; ; Description: Show a pie graph with your position, data, and colors. ; Syntax: _stat_draw_pie($_stat_values, [$_stat_left, $_stat_top, [$_stat_width, [$_stat_height, [$_stat_sort, [$_stat_colors]]]]]) ; Parameter(s): $_stat_values: array containing values in absolute or relative format or a string in the format "1,6,89", ; $_stat_left, $_stat_top, $_stat_width, $_stat_height, $_stat_sort: if 1, the values are sorted, $_stat_colors: hex colors in an array ; or a string in the format "0xffffff.0xc6c6c6". ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): the id of the control created (for use with GuiCtrlDelete) ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_pie($_stat_values, $_stat_left = 0, $_stat_top = 0, $_stat_width = 150, $_stat_height = 150, $_stat_sort = 1, $_stat_colors = "0x20B333.0xFFFF00.0xE93333.0xFFCC33.0x33338F.0xFFFFFF.0x999999.0xCC3399.0x000000") If Not IsArray($_stat_values) Then $_stat_values = StringReplace($_stat_values, " ,", ",") $_stat_values = StringReplace($_stat_values, ", ", ",") $_stat_values = StringSplit($_stat_values, ",") _ArrayDelete($_stat_values, 0) EndIf If Not IsArray($_stat_colors) Then $_stat_colors = StringSplit($_stat_colors, ".") _ArrayDelete($_stat_colors, 0) EndIf ; make sure that enough colors are availible $num_colors = UBound($_stat_colors) - 1 While UBound($_stat_values) > UBound($_stat_colors) ReDim $_stat_colors[UBound($_stat_colors) + 1] $_stat_colors[UBound($_stat_colors) - 1] = $_stat_colors[UBound($_stat_colors) - 2 - $num_colors] ;_ArrayDisplay($_stat_colors, "Farben") WEnd _stat_make_values_relative($_stat_values) Dim $_stat_names[UBound($_stat_values)] $data = _ArrayMerge($_stat_values, $_stat_names, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 0) EndIf GUISetState(@SW_LOCK) $graph_id = GUICtrlCreateGraphic ($_stat_left, $_stat_top, $_stat_width, $_stat_height) If $_stat_width >= $_stat_height Then $radius = Round($_stat_width / 2) - 0.1 * $_stat_width Else $radius = Round($_stat_height / 2) - 0.1 * $_stat_height EndIf ; shadow: GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, 0x000000) GUICtrlSetGraphic (-1, $gui_gr_pie, Round($_stat_width / 2) + 0.04 * $radius, Round($_stat_height / 2) + 0.03 * $radius, $radius, 0, 360) For $i = 0 To UBound($_stat_values) - 1 ; single pie part GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, $data[$i][2]) GUICtrlSetGraphic (-1, $gui_gr_pie, Round($_stat_width / 2) - 0.04 * $radius, Round($_stat_height / 2) - 0.03 * $radius, $radius, _stat_percent_to_degrees(_stat_array_sum_2_dim($data, 0, $i - 1, 0)), _stat_percent_to_degrees($data[$i][0])) Next GUISetState(@SW_UNLOCK) Return $graph_id EndFunc ;==>_stat_draw_pie ;========================================================================================================================= ; ; Description: Show a half pie graph with your position, data, and colors. ; Syntax: _stat_draw_half_pie($_stat_values, [$_stat_left, $_stat_top, [$_stat_width, [$_stat_height, [$_stat_sort, [$_stat_colors]]]]]) ; Parameter(s): $_stat_values: array containing values in absolute or relative format or a string in the format "1,6,89", ; $_stat_left, $_stat_top, $_stat_width, $_stat_height, $_stat_sort: if 1, the values are sorted, $_stat_colors: hex colors in an array ; or a string in the format "0xffffff.0xc6c6c6". ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): the id of the control created (for use with GuiCtrlDelete) ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_half_pie($_stat_values, $_stat_left = 0, $_stat_top = 0, $_stat_width = 150, $_stat_height = 150, $_stat_sort = 1, $_stat_colors = "0x20B333.0xFFFF00.0xE93333.0xFFCC33.0x33338F.0xFFFFFF.0x999999.0xCC3399.0x000000") If Not IsArray($_stat_values) Then $_stat_values = StringReplace($_stat_values, " ,", ",") $_stat_values = StringReplace($_stat_values, ", ", ",") $_stat_values = StringSplit($_stat_values, ",") _ArrayDelete($_stat_values, 0) EndIf If Not IsArray($_stat_colors) Then $_stat_colors = StringSplit($_stat_colors, ".") _ArrayDelete($_stat_colors, 0) EndIf ; make sure that enough colors are availible $num_colors = UBound($_stat_colors) - 1 While UBound($_stat_values) > UBound($_stat_colors) ReDim $_stat_colors[UBound($_stat_colors) + 1] $_stat_colors[UBound($_stat_colors) - 1] = $_stat_colors[UBound($_stat_colors) - 2 - $num_colors] ;_ArrayDisplay($_stat_colors, "Farben") WEnd _stat_make_values_relative($_stat_values) Dim $_stat_names[UBound($_stat_values)] $data = _ArrayMerge($_stat_values, $_stat_names, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 0) EndIf GUISetState(@SW_LOCK) $graph_id = GUICtrlCreateGraphic ($_stat_left, $_stat_top, $_stat_width, $_stat_height) If $_stat_width >= $_stat_height Then $radius = Round($_stat_width / 2) - 0.1 * $_stat_width Else $radius = 0.9 * $_stat_height EndIf ; shadow: GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, 0x000000) GUICtrlSetGraphic (-1, $gui_gr_pie, Round($_stat_width / 2) + 0.04 * $radius, Round($_stat_height / 2) + 0.03 * $radius, $radius, 0, 180) For $i = 0 To UBound($_stat_values) - 1 ; single (half) pie part GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, $data[$i][2]) GUICtrlSetGraphic (-1, $gui_gr_pie, $_stat_width / 2 - 0.04 * $radius, $_stat_height / 2 - 0.03 * $radius, $radius, _stat_percent_to_degrees(_stat_array_sum_2_dim($data, 0, $i - 1, 0)) / 2, _stat_percent_to_degrees($data[$i][0]) / 2) Next GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, 0x000000) GUICtrlSetGraphic (-1, $gui_gr_pie, $_stat_width / 2 + 0.04 * $radius, $_stat_height / 2 + 0.03 * $radius, $radius / 3, 0, 180) GUICtrlSetGraphic (-1, $gui_gr_color, , 0xECE9D8) ;GUICtrlSetGraphic (-1, $gui_gr_color, 0xECE9D8, 0xECE9D8) GUICtrlSetGraphic (-1, $gui_gr_pie, $_stat_width / 2 + 0.09 * $radius, $_stat_height / 2 + 0.025 * $_stat_height, $radius / 3, 0, 180) GUISetState(@SW_UNLOCK) Return $graph_id EndFunc ;==>_stat_draw_half_pie ;========================================================================================================================= ; ; Description: Show a bar char with your position, data, and colors. ; Syntax: ; Parameter(s): $_stat_values: array containing values in absolute or relative format or a string in the format "1,6,89", ; $_stat_left, $_stat_top, $_stat_width, $_stat_height, $_stat_sort: if 1, the values are sorted, $_stat_colors: hex colors in an array ; or a string in the format "0xffffff.0xc6c6c6". ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): the id of the control created (for use with GuiCtrlDelete) ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_rel_bar($_stat_values, $_stat_left = 0, $_stat_top = 0, $_stat_width = 50, $_stat_height = 200, $_stat_sort = 1, $_stat_colors = "0x20B333.0xFFFF00.0xE93333.0xFFCC33.0x33338F.0xFFFFFF.0x999999.0xCC3399.0x000000") If Not IsArray($_stat_values) Then $_stat_values = StringReplace($_stat_values, " ,", ",") $_stat_values = StringReplace($_stat_values, ", ", ",") $_stat_values = StringSplit($_stat_values, ",") _ArrayDelete($_stat_values, 0) EndIf If Not IsArray($_stat_colors) Then $_stat_colors = StringSplit($_stat_colors, ".") _ArrayDelete($_stat_colors, 0) EndIf ; make sure that enough colors are availible $num_colors = UBound($_stat_colors) - 1 While UBound($_stat_values) > UBound($_stat_colors) ReDim $_stat_colors[UBound($_stat_colors) + 1] $_stat_colors[UBound($_stat_colors) - 1] = $_stat_colors[UBound($_stat_colors) - 2 - $num_colors] WEnd _stat_make_values_relative($_stat_values) Dim $_stat_names[UBound($_stat_values)] $data = _ArrayMerge($_stat_values, $_stat_names, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 0, 1) EndIf GUISetState(@SW_LOCK) $graph_id = GUICtrlCreateGraphic ($_stat_left, $_stat_top, $_stat_width, $_stat_height) $_stat_height = $_stat_height - 10 - 0.02 * $_stat_height $_stat_width = $_stat_width - 10 $_stat_top = 0.05 * $_stat_top If $_stat_sort = 1 Then _ArraySort($_stat_values) ; shadow: GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, 0x000000) GUICtrlSetGraphic (-1, $gui_gr_rect, 5 + 0.05 * $_stat_width, 5 + 0.02 * $_stat_height, 0.95 * $_stat_width - 3, 0.98 * $_stat_height) For $i = 0 To UBound($_stat_values) - 1 GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000, $data[$i][2]) $_stat_top_bar = (_stat_array_sum_2_dim($data, 0, $i - 1, 0) / 100) * $_stat_height + 3 + $_stat_top $_stat_height_bar = ($data[$i][0] / 100) * $_stat_height + 3 GUICtrlSetGraphic (-1, $gui_gr_rect, 3, $_stat_top_bar, 0.95 * $_stat_width - 3, $_stat_height_bar) Next GUISetState(@SW_UNLOCK) Return $graph_id EndFunc ;==>_stat_draw_rel_bar ;=========================== ;=========================== ;==== general functions ==== ;=========================== ;=========================== ;========================================================================================================================= ; ; Description: Show a legend explaining a pie or bar char. ; Syntax: _stat_draw_legend($_stat_names, [$_stat_left, [$_stat_top, [$_stat_width, [$_stat_height, [$_stat_sort, [$_stat_colors, [$_stat_values]]]]]]]) ; Parameter(s): $_stat_values: array containing names or a string in the format "name1,phantsay,peethebee", ; $_stat_left, $_stat_top, $_stat_width, $_stat_height, $_stat_sort: if 1, the values are sorted, $_stat_colors: hex colors in an array ; or a string in the format "0xffffff.0xc6c6c6", $_stat_values: array or string containing the values ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): the ids of the controls created ([0]: id of the graphic, the rest for the labels. For use with _stat_draw_remove) ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_legend($_stat_names, $_stat_left = 0, $_stat_top = 0, $_stat_width = 150, $_stat_height = 150, $_stat_sort = 0, $_stat_colors = "0x20B333.0xFFFF00.0xE93333.0xFFCC33.0x33338F.0xFFFFFF.0x999999.0xCC3399.0x000000", $_stat_values = "") If Not IsArray($_stat_names) Then $_stat_names = StringReplace($_stat_names, " ,", ",") $_stat_names = StringReplace($_stat_names, ", ", ",") $_stat_names = StringSplit($_stat_names, ",") _ArrayDelete($_stat_names, 0) EndIf $display_values = 0 If IsArray($_stat_values) or $_stat_values <> "" Then $display_values = 1 If Not IsArray($_stat_values) Then $_stat_values = StringReplace($_stat_values, " ,", ",") $_stat_values = StringReplace($_stat_values, ", ", ",") $_stat_values = StringSplit($_stat_values, ",") _ArrayDelete($_stat_values, 0) EndIf _stat_make_values_relative($_stat_values) EndIf If Not IsArray($_stat_colors) Then $_stat_colors = StringSplit($_stat_colors, ".") _ArrayDelete($_stat_colors, 0) EndIf ; make sure that enough colors are availible $num_colors = UBound($_stat_colors) - 1 While UBound($_stat_values) > UBound($_stat_colors) ReDim $_stat_colors[UBound($_stat_colors) + 1] $_stat_colors[UBound($_stat_colors) - 1] = $_stat_colors[UBound($_stat_colors) - 2 - $num_colors] WEnd GUISetState(@SW_LOCK) Dim $ids[UBound($_stat_names) + 1] $ids[0] = GUICtrlCreateGraphic ($_stat_left, $_stat_top, $_stat_width, $_stat_height) ; sort it If $display_values = 0 Then Dim $_stat_values[UBound($_stat_names)] $data = _ArrayMerge($_stat_values, $_stat_names, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 1) EndIf Else $data = _ArrayMerge($_stat_values, $_stat_names, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 0) EndIf EndIf ; border: GUICtrlSetGraphic (-1, $gui_gr_color, 0x000000);, $GUI_GR_NOCOLOR) GUICtrlSetGraphic (-1, $gui_gr_rect, 2, 2, $_stat_width - 4, $_stat_height - 4) For $i = 0 To UBound($_stat_names) - 1 ; single pie part GUICtrlSetGraphic ($ids[0], $gui_gr_color, 0x000000, $data[$i][2]) GUICtrlSetGraphic ($ids[0], $gui_gr_rect, 10, 10 + $i * 25, 10, 10) If $display_values = 1 Then $ids[$i + 1] = GUICtrlCreateLabel($data[$i][1] & " (" & StringFormat("%.1f", $data[$i][0]) & "%)", $_stat_left + 30, $_stat_top + 7 + $i * 25, $_stat_width - 40, 20) Else $ids[$i + 1] = GUICtrlCreateLabel($data[$i][1], $_stat_left + 30, $_stat_top + 7 + $i * 25, $_stat_width - 40, 20) EndIf Next GUISetState(@SW_UNLOCK) Return $ids EndFunc ;==>_stat_draw_legend ;========================================================================================================================= ; ; Description: Deletes a prevous painted diagram. ; Syntax: _stat_draw_remove($id) ; Parameter(s): $id: id or ids of controls as returned by the other functions ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): None ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_remove($id) If Not IsArray($id) Then GUICtrlDelete($id) Else For $i = 0 To UBound($id) - 1 If $id[$i] <> "no_id" And $id[$i] <> "" Then GUICtrlDelete($id[$i]) Next EndIf EndFunc ;==>_stat_draw_remove ;=========================== ;=========================== ;====== absolute data ====== ;=========================== ;=========================== ;========================================================================================================================= ; ; Description: Draws absolute data. ; Syntax: ; Parameter(s): ; Requirement(s): v3.1.1.66 (beta) or later ; Return Value(s): ids ; Author(s): peethebee <peter_opali@gmx.de> ; Note(s): None ; ;========================================================================================================================= Func _stat_draw_absolute_data($_stat_values, $_stat_names, $_stat_colors = "0xff0000", $type = "dots", $advanced = "", $_stat_sort = 0, $_stat_left = 25, $_stat_top = 25, $_stat_width = 250, $_stat_height = 250, $y_min = -1, $y_max = -1, $y_steps = 4, $stat_win_handle = "") $nullpos = 0 GUISetState(@SW_LOCK) If Not IsArray($_stat_colors) Then $_stat_colors = StringSplit($_stat_colors, ".") _ArrayDelete($_stat_colors, 0) EndIf ; make sure that enough colors are availible $num_colors = UBound($_stat_colors) - 1 While UBound($_stat_values) > UBound($_stat_colors) ReDim $_stat_colors[UBound($_stat_colors) + 1] $_stat_colors[UBound($_stat_colors) - 1] = $_stat_colors[UBound($_stat_colors) - 2 - $num_colors] WEnd $data = _ArrayMerge($_stat_names, $_stat_values, $_stat_colors) If $_stat_sort = 1 Then $data = _ArraySort2Dim($data, 1) EndIf If $y_max = -1 Then ; calculate maximum $y_max = 0 For $i = 0 To UBound($_stat_values) - 1 If $_stat_values[$i] > $y_max Then $y_max = $_stat_values[$i] Next $y_max = 1.05 * $y_max ; add 5% EndIf If $y_min = -1 Then ; calculate minimum $y_min = 0 For $i = 0 To UBound($_stat_values) - 1 If $_stat_values[$i] < $y_min Then $y_min = $_stat_values[$i] Next $y_min = 1.05 * $y_min ; add 5% EndIf Dim $ids[50] $ids[0] = GUICtrlCreateGraphic ($_stat_left, $_stat_top, $_stat_width, $_stat_height) GUICtrlSetGraphic ($ids[0], $gui_gr_color, 0x00FF00) ; Debug: draw rect: ; GUICtrlSetGraphic ($ids[0], $gui_gr_rect, 0, 0, $_stat_width, $_stat_height) ; If you want a bg color: GUICtrlSetBkColor($ids[0], 0xffffff) Dim $steps[$y_steps + 3] If $y_min >= 0 And $y_max >= 0 Then $space = $y_max - $y_min ElseIf $y_min <= 0 And $y_max <= 0 Then $space = $y_min - $y_max Else ; min < 0, max >= 0 $space = 0 - $y_min + $y_max EndIf $null = 0 For $i = $y_steps To 1 Step - 1 $steps[$i] = ($space / ($y_steps + 1)) * $i + $y_min If $steps[$i] = "0" Then $null = $i $steps[$i] = StringFormat("%.1f", $steps[$i]) ; Choose the y-values' format here! Next ; min $steps[UBound($steps) - 2] = $y_min If $y_min = "0" Then $null = 1 $steps[UBound($steps) - 2] = StringFormat("%.1f", $steps[UBound($steps) - 2]) ; Choose the y-values' format here! ; max $steps[UBound($steps) - 1] = $y_max If $y_max = "0" Then $null = $y_steps + 4 $steps[UBound($steps) - 1] = StringFormat("%.1f", $steps[UBound($steps) - 1]) ; Choose the y-values' format here! ; create labels to get their space usage $labels_max_width = 10 For $j = $y_steps + 3 To 2 Step - 1 $ids[$j] = GUICtrlCreateLabel($steps[$j - 1], 3 + $_stat_left, 15 * $j + $_stat_top) $pos = ControlGetPos($stat_win_handle, "", $ids[$j]) If $pos[2] > $labels_max_width Then $labels_max_width = $pos[2] Next If $y_min < 0 And $y_max > 0 And $null = 0 Then $ids[1] = GUICtrlCreateLabel("0", 3 + $_stat_left, 150 + $_stat_top) $pos = ControlGetPos($stat_win_handle, "", $ids[$y_steps + 2]) If $pos[2] > $labels_max_width Then $labels_max_width = $pos[2] $null = 1 Else $ids[1] = "no_id" EndIf ; Draw y-axis GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 1) GUICtrlSetGraphic ($ids[0], $gui_gr_color, 0x000000);, 0x000000) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $labels_max_width + 5, $_stat_height - 25) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $labels_max_width + 5, 5) ; Draw arrow GUICtrlSetGraphic ($ids[0], $gui_gr_line, $labels_max_width, 10) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $labels_max_width + 5, 5) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $labels_max_width + 10, 10) $drawing_height = $_stat_height - 25 - 20 For $t = $y_steps + 4 To 1 Step - 1 $y_pos = $drawing_height + 20 - _stat_rel(GUICtrlRead($ids[$t]) - $y_min, $space, $drawing_height) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $labels_max_width + 2, $y_pos) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $labels_max_width + 8, $y_pos) If $t = $null Then $nullpos = $y_pos If $ids[$t] <> "no_id" Then $position = ControlGetPos($stat_win_handle, "", $ids[$t]) ; could cause problems, if window is not visible while drawing. ;~ ; in that case you should insert the winhandle here! GUICtrlSetPos($ids[$t], $_stat_left + $labels_max_width - $position[2], $_stat_top + $y_pos - 6) EndIf Next ; Draw x-axis GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 1) GUICtrlSetGraphic ($ids[0], $gui_gr_color, 0x000000) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $labels_max_width + 5, $nullpos) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $_stat_width - 5, $nullpos) ; Draw arrow GUICtrlSetGraphic ($ids[0], $gui_gr_line, $_stat_width - 10, $nullpos - 5) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $_stat_width - 5, $nullpos) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $_stat_width - 10, $nullpos + 5) $drawing_width = $_stat_width - $labels_max_width - 4 - 15 For $i = 1 To UBound($_stat_values) ; mark position $x_pos = $labels_max_width + ($drawing_width / UBound($_stat_values)) * $i - 5 GUICtrlSetGraphic ($ids[0], $gui_gr_move, $x_pos, $nullpos - 3) GUICtrlSetGraphic ($ids[0], $gui_gr_line, $x_pos, $nullpos + 3) $ids[$y_steps + 4 + $i] = GUICtrlCreateLabel($data[$i - 1][0], 0, 0) $pos = ControlGetPos($stat_win_handle, "", $ids[$y_steps + 4 + $i]) ; could cause problems, if window is not visible while drawing. ;~ in that case you should insert the winhandle here! GUICtrlSetPos($ids[$y_steps + 4 + $i], $_stat_left + $x_pos - $pos[2] / 2 + 4, $_stat_top + $_stat_height - 22) Next ; Drawing data For $i = 1 To UBound($_stat_values) $val_x_pos = $labels_max_width + ($drawing_width / UBound($_stat_values)) * $i - 5 $val_y_pos = $drawing_height + 20 - _stat_rel($data[$i - 1][1], $space, $drawing_height) + ($nullpos - $drawing_height - 20) If $type = "" Then $type = "dots" GUICtrlSetGraphic ($ids[0], $gui_gr_color, 0x000000, $data[$i - 1][2]) Select Case $type = "dots" GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 2) GUICtrlSetGraphic ($ids[0], $gui_gr_dot, $val_x_pos, $val_y_pos) Case $type = "line" GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 2) If $i > 1 Then GUICtrlSetGraphic ($ids[0], $gui_gr_line, $val_x_pos, $val_y_pos) GUICtrlSetGraphic ($ids[0], $gui_gr_dot, $val_x_pos, $val_y_pos) Else GUICtrlSetGraphic ($ids[0], $gui_gr_dot, $val_x_pos, $val_y_pos) GUICtrlSetGraphic ($ids[0], $gui_gr_move, $val_x_pos, $val_y_pos) EndIf Case $type = "bars" If $data[$i - 1][1] < 0 Then GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 1) GUICtrlSetGraphic ($ids[0], $gui_gr_rect, $val_x_pos - $advanced / 2, $nullpos, $advanced, $val_y_pos - $nullpos) Else GUICtrlSetGraphic ($ids[0], $gui_gr_pensize, 1) GUICtrlSetGraphic ($ids[0], $gui_gr_rect, $val_x_pos - $advanced / 2, $val_y_pos, $advanced, $nullpos - $val_y_pos + 1) EndIf EndSelect Next GUISetState(@SW_UNLOCK) Return $ids EndFunc ;==>_stat_draw_absolute_data ;=========================== ;=========================== ;==== helping functions ==== ;=========================== ;=========================== Func _stat_make_values_relative(ByRef $_stat_array) $sum = _stat_array_sum($_stat_array, 0, UBound($_stat_array) - 1) For $i = 0 To UBound($_stat_array) - 1 $_stat_array[$i] = ($_stat_array[$i] / $sum) * 100 ; results in values like 10, 45, 3.98 Next Return $_stat_array EndFunc ;==>_stat_make_values_relative Func _stat_array_sum($_stat_array, $start, $end) $ret = 0 For $j = $start To $end $ret = $ret + $_stat_array[$j] Next Return $ret EndFunc ;==>_stat_array_sum Func _stat_array_sum_2_dim($_stat_array, $start, $end, $pos) $ret = 0 For $j = $start To $end $ret = $ret + $_stat_array[$j][$pos] Next Return $ret EndFunc ;==>_stat_array_sum Func _stat_percent_to_degrees($value) Return ($value / 100) * 360 EndFunc ;==>_stat_percent_to_degrees Func _stat_rel($value, $relation_before, $relation_after) Return ($value / $relation_before) * $relation_after EndFunc ;==>_stat_rel Func _ArrayMerge($_stat_array1, $_stat_array2, $_stat_array3) Dim $_stat_array_res[UBound($_stat_array1)][3] For $i = 0 To UBound($_stat_array1) - 1 $_stat_array_res[$i][0] = $_stat_array1[$i] $_stat_array_res[$i][1] = $_stat_array2[$i] $_stat_array_res[$i][2] = $_stat_array3[$i] Next Return $_stat_array_res EndFunc ;==>_ArrayMerge Func _ArraySort2Dim($_stat_array, $2dim_pos, $reverse = 0) $_stat_arraylength = UBound($_stat_array) - 1 Dim $newarray[$_stat_arraylength + 1][3] $counter = 0 Do $max = -1000000 For $j = 0 To $_stat_arraylength if ($_stat_array[$j][$2dim_pos] > $max) Then $max = $_stat_array[$j][$2dim_pos] Next if ($max <> - 1000000) Then For $j = 0 To $_stat_arraylength If ($_stat_array[$j][$2dim_pos] = $max) Then If $reverse = 0 Then $newarray[$counter][0] = $_stat_array[$j][0] $newarray[$counter][1] = $_stat_array[$j][1] $newarray[$counter][2] = $_stat_array[$j][2] $_stat_array[$j][$2dim_pos] = -1000000 Else $newarray[$_stat_arraylength - $counter][0] = $_stat_array[$j][0] $newarray[$_stat_arraylength - $counter][1] = $_stat_array[$j][1] $newarray[$_stat_arraylength - $counter][2] = $_stat_array[$j][2] $_stat_array[$j][$2dim_pos] = -1000000 EndIf $counter = $counter + 1 EndIf Next EndIf until ($max = -1000000) Return $newarray EndFunc ;==>_ArraySort2Dim
playlet Posted October 22, 2009 Posted October 22, 2009 (edited) --- Edited August 18, 2016 by playlet
arcker Posted October 23, 2009 Author Posted October 23, 2009 Sry guys, was late when i posted it. Added stats.au3 ( calculate the hands ) and ASock.au3, with modified things if i remember well. -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
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