CodyBarrett Posted January 9, 2009 Share Posted January 9, 2009 i ahve a question about arrays.. if i set an array to a random number and have (if you can see in my sig i have 'Decisions Decisions'= (D-D) in it lol its a type of 'Magic Eight Ball' that im making, since im not very good at making decisions (gofigure) and in stead of making it 100 lines long of randoms and guictrsetdata() i UPGRADED D-D and made the cod e look like this expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #Include <Timers.au3> #include <WindowsConstants.au3> $GUI = GUICreate ('Decisions...',100,100,-1,-1,-1,BitOR(128,$WS_EX_TOPMOST )) $B = GUICtrlCreateButton('Go',5,5,90,80) $lable = GUICtrlCreateLabel('Maybe',25,85,50,20,$SS_CENTER) $Choice = 1 $Ran = 0 GUISetState() While 1 $M = GUIGetMsg() If $M = $B Then $T = _Timer_Init() GUICtrlSetData($B,0) Do GUICtrlSetState($B, $GUI_DISABLE ) $Ran = Random(0,100,1) GUICtrlSetData($B,GUICtrlRead($B) + $Ran) sleep(800) GUICtrlSetState($B,$GUI_ENABLE) Until _Timer_Diff($T) >= 19000 If GUICtrlRead($B) >= 9500 Then GUICtrlSetData($Lable,'Yes') Else GUICtrlSetData($Lable,'No') EndIf EndIf if $M = $GUI_EVENT_CLOSE Then Exit endif WEnd ok what i want to know is... can i make an array instead of this and have each of the 19 subs a random number then check them evey 19 seconds to see if the added up sums are >= half of the total random number ex; 19x100=1900/2=950 or something like that anyway i want every second to have a random number, then add the numbers up and after 19 seconds checks it any ideas if i can do this with an array [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Achilles Posted January 9, 2009 Share Posted January 9, 2009 i ahve a question about arrays.. if i set an array to a random number and have (if you can see in my sig i have 'Decisions Decisions'= (D-D) in it lol its a type of 'Magic Eight Ball' that im making, since im not very good at making decisions (gofigure) and in stead of making it 100 lines long of randoms and guictrsetdata() i UPGRADED D-D and made the cod e look like this expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #Include <Timers.au3> #include <WindowsConstants.au3> $GUI = GUICreate ('Decisions...',100,100,-1,-1,-1,BitOR(128,$WS_EX_TOPMOST )) $B = GUICtrlCreateButton('Go',5,5,90,80) $lable = GUICtrlCreateLabel('Maybe',25,85,50,20,$SS_CENTER) $Choice = 1 $Ran = 0 GUISetState() While 1 $M = GUIGetMsg() If $M = $B Then $T = _Timer_Init() GUICtrlSetData($B,0) Do GUICtrlSetState($B, $GUI_DISABLE ) $Ran = Random(0,100,1) GUICtrlSetData($B,GUICtrlRead($B) + $Ran) sleep(800) GUICtrlSetState($B,$GUI_ENABLE) Until _Timer_Diff($T) >= 19000 If GUICtrlRead($B) >= 9500 Then GUICtrlSetData($Lable,'Yes') Else GUICtrlSetData($Lable,'No') EndIf EndIf if $M = $GUI_EVENT_CLOSE Then Exit endif WEnd ok what i want to know is... can i make an array instead of this and have each of the 19 subs a random number then check them evey 19 seconds to see if the added up sums are >= half of the total random number ex; 19x100=1900/2=950 or something like that anyway i want every second to have a random number, then add the numbers up and after 19 seconds checks it any ideas if i can do this with an arrayYou could... this would probably be easier though: Func _GenerateNumbers() $sum = 0 For $i = 1 to 19 $sum += Random(0,100,1) Next return $sum EndFuncAnd then just check every 19 seconds if that is over your number, if not the call the function again.. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
CodyBarrett Posted January 10, 2009 Author Share Posted January 10, 2009 well.... whats the $i used for lol i know its an array but how do i put it in [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] 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