Sign in to follow this  
Followers 0
James

Refresh Control

6 posts in this topic

Hey,

I am still working on my game. Just to let anyone know, whom may be interested, I have done the following:

  • If you are 10 away from reaching 0 then the number you need to make turns green (almost)
  • You now need to make 0 (equation entered is taken away from the number you need to make)
  • Registration (With the function I created (found in my blog))
  • Errors are now logged in error.log
  • Thanks to larry, it now draws on the screen, Winner! or Try Again!
  • Animated Window
  • Help is now in a seperate file for easy updating
Anyway, I have now decided I will work on the first point in my list.

Func RealTime()
    $MathRead = GUICtrlRead($NumberEntry)
    $Equation = GUICtrlRead($ToMake)
    If $MathRead <> $CTRLRead And StringLen($MathRead) > 1 Then
        $value = $Random - Execute($MathRead)
        GUICtrlSetData($ToMake, $value)
    EndIf
    If $Equation < 11 Then
        GUICtrlSetColor($ToMake, 0x00ff00)
    Else
        GUICtrlSetColor($ToMake, 0x4682b4)
    EndIf
EndFunc   ;==>RealTime

But the control just keeps flashing. It tries to update itself with nothing. Any ideas?

-James

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well, I have changed the flickering to only start when the number has changed.

Func RealTime()
    $MathRead = GUICtrlRead($NumberEntry)
    $Equation = GUICtrlRead($ToMake)
    If $MathRead <> $CTRLRead And StringLen($MathRead) > 1 Then
        $value = $Random - Execute($MathRead)
        GUICtrlSetData($ToMake, $value)
    EndIf
    If $Equation < $CTRLRead Then
        If $Equation < 11 Then
            GUICtrlSetColor($ToMake, 0x00ff00)
        Else
            GUICtrlSetColor($ToMake, 0x4682b4)
        EndIf
    EndIf
EndFunc   ;==>RealTime

It now starts flickering after a while.

Edited by JamesB

Share this post


Link to post
Share on other sites

You don't give much to help you... but looking at your data provided... I can see that you're probably calling this function every loop.

2 things you might think of...

1. Remove the data from the $NumberEntry control and see if that helps.

2. And or, store the last known value (after you've committed the statement to be true) in a Global variable, and use that as an extra Condition, if it = the last known value, then don't update.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry, I thought I explained. So I could create a new function, which will check if the number = the old number if not it updates.

Thanks Smoke,

-James

You might have explained... but the code uses vars outside what you have provided... so you leave us guessing.

Let's ASSume for a moment... that i know what you are doing based on your "Var" names.

GUICtrlRead() may return the numbers you've entered, but they are strings, not numbers/int's.... that should be enough of a hint to help with some issues (such as this would turn false even if it were true $Equation < $CTRLRead a lot.)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0