Jump to content

Decisions Desicions


Recommended Posts

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

#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

Link to comment
Share on other sites

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

#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

You could... this would probably be easier though:

Func _GenerateNumbers()
$sum = 0
For $i = 1 to 19
$sum += Random(0,100,1) 
Next 
return $sum
EndFunc
And 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

well.... whats the $i used for lol i know its an array but how do i put it in

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...