Jump to content

Recommended Posts

Hey there!


I've been developing a artificial intelligence.

My first hard task was letting the A.I know when a sentence is found in memory with different words

What i tried to do here is simply, get all the words in user sentence that could be used
as a identifier
        example: Steve Jobs
        then identify the sentence purpose with the words we found in the past "for" loop
        example: Do/Know/You/Who/Steve/Jobs
        Compare the example in the following matching sentences in memory.
        1-Steve jobs was a known person
        2-Do you know who barack obama is?
        3-Do you know Steve jobs?
        4-Do you know who steve jobs is?
        5-How much money steve jobs had
        Then find the sentence that has way more matches than the other ones, remember that if the identifier words were not found
        (Steve jobs) then the sentence is invalid.
        Every sentence has a different answer and is important that the right one is chosen.

If there's no more than the half of words in matches, then assign a variable the result of function, such as a return but for a global var.

I couldn't figure out how to do that with StringRegExp.

I honestly need help with detecting identifiers on memory sentences.

I would also like to let the AI know typos, meaning that moeny and money means the same thing.

Any help is hugely appreciated.


Edited by DynamicRookie
Link to post
Share on other sites
9 hours ago, DynamicRookie said:

My first hard task was letting the A.I know when a sentence is found in memory with different words

Is this an excel file where your memory database found for validation?


9 hours ago, DynamicRookie said:

       Compare the example in the following matching sentences in memory.
        1-Steve jobs was a known person
        2-Do you know who barack obama is?
        3-Do you know Steve jobs?
        4-Do you know who steve jobs is?
        5-How much money steve jobs had

Secondly, if this were database validation then that would be easy for excel UDF by Water. But off course, you need to GUICtrlRead() for the input made by the user for the word validation.

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to post
Share on other sites

For the typos, you have a few ways, depending on how lenient you want to make it.

1- The simplest would probably be to count the letters in each word (maybe store it in a data structure), so "apple" would be 1a, 2p, 1l, 1e. Then, you do a search and find a match in the word "papel". Problem: Anagrams. You could also make it accept a difference of 1 (leniency).

2- Check that two words match, but also check the +1/-1 char of the word for the letter in case they swtich it like I did for the word "switch". E.g. [w][t][c][h] and [w][t][c][h]:
0=0, 1=1, 2!=2, check 2+1=2 (2 and 3 are now found, so you can skip 3), 4=4, 5=5.

Pretend there is no strikeout above ^. The forum put it there.

Edited by IAMK
Link to post
Share on other sites
13 hours ago, FMS said:

maybe of topic on your question but I am also building AI (code here)
Maybe we can compare some code ?
I'm curious on your take on the math :)

I'm not skilled or something honestly, i'm just trying to let my code be simple so debugging is easier, however, so far i could do self-learning, memory checking, non-supervised learning, GUI, Inputs, memory arrays, weight, neurons, temporal lobes (This will let the AI know that "My name is Rookie" will be reffered if the user says "What's my name?", i have made it up to 1000 messages and the sentences are kind of encrypted for privacy and saved in a file), and check if the AI is original.


The AI is interesting to talk to, but my objective is to make it entertaining, not only for use but for coding it, like a hobbie.

I checked ur AI thread and it looks really interesting, but hard to debug.

I'd appreciate if you explained me how it works, cause i'm really curious!

Link to post
Share on other sites
13 hours ago, Andreik said:

AI is a complex concept and usually is a mixture of many algorithms combined. For what you need a good start would be to play with levenshtein distance. This is an algorithm to check the similarities of strings.

Yeah, i have thought of that, but i made a extremely easy system that only took me about 10 minutes.

Is, checking strings letters, every letter has a value, then we replace all the letters by their values and sum them all, that means that, in example, msas and mass are both worth 16.

Very easy system, i'll also add a system so it can check for duplicated letters, missing letters, and extra letters.

About the learning system, it is designed to change topic as soon as the sentence the user provided was not found in memory, then tell another person (or to the same user in a different session) the sentence the other user said, and store the answer.

Link to post
Share on other sites

I'd appreciate if you explained me how it works, cause i'm really curious!

The AI.au3 you see is (in this case) checks "handwritten digits" and calculates the best possible digit it think it is :)
The file's beneath the ai.au3 are the mnist database (handwritten digits and it's "target")
The targets are there for the "backwards propagation".
The handwritten digits are in a grid of 28 by 28 whit a black/white of 0 to 255.

In the beggining you have 1 "array" (or vector) of 784 (28*28) whit value's of 0-255 and propagrate forward (whit matrix math E4A)  to a array[10] (1 for each digit).
you see what i mean iff you klik the label "normelized input"

pseudo code:
(input[0]*wheigt[0])+(input[1]*wheight[1])+(...))+bias = output hiddenlayer1-node1

Where you are talking about doesn't sounds like a proper AI (code who thinks for it self instead of working out a code) or am i wrong?
If not could I see your feed function?

Edited by FMS
text added

as finishing touch god created the dutch

Link to post
Share on other sites
11 hours ago, FMS said:

code who thinks for it self instead of working out a code

What do you define by thinking by itself?

About feedback system, it checks a list with an array containing words that can be used to identify the meaning of the sentence that user typed, then, after getting class of the sentence, it calculates an answer by the user responses to questions with that type of class and the word matches of those responses with the actual user input by calculating every word value and choosing the word with the highest amount of matchs, then the class, sentence, and answer get encrypted, and saved in a file.

But, the main point of my AI is not chatting, what i want to do with it is a really original concept, and i don't feel like sharing it yet.

Still, i would like to let you know i learned AU3 Programming not long ago, i work on it as a hobbie, so if you could teach me anything it would be really appreciated, that's in fact why i chose the name Rookie :P

Edited by DynamicRookie
Link to post
Share on other sites

Still, i would like to let you know i learned AU3 Programming not long ago, i work on it as a hobbie, so if you could teach me anything it would be really appreciated, that's in fact why i chose the name Rookie

I'm also not a big AU3 programmer but also I couldn't help you if I don't know what you are doing wrong :D
For this I need to see the code on whish you are having problems whit ;)



What do you define by thinking by itself?

In mine case I've a "set of handwritten digits" to test whit and for changing the weights.
Afther all te test are done and the weights found there local minimum you can put "new" handwritten digits so the AI predicts the correct output.
I mean : it's not pre-defined and still get the correct output :)

Edited by FMS

as finishing touch god created the dutch

Link to post
Share on other sites
  • 3 months later...

I was working on something similar and tackled it as follows:

Trained sentences:

- scrap the input from capital letters, dots, etc. Call the remainder as a function with the remainder as its name, the function will have a bunch of variables attached to it (reply, grammar analysis (see below), etc.)

New sentences:

  • Split input into 3 parts: the original, grammatical analysis, word roots
  • For the grammatical parts, I used treetagger and had it create a file containing the input, grammatical analysis, and root of the words:
ShellExecuteWait("C:\TreeTagger\bin\tag-english.bat", $InputFile & " > " & $OutputFile, @SW_HIDE)
  • build a 2d array of the info in $OutputFile (_DelimFile_To_Array2D)
  • build a loop that uses _ArrayFindAll to check if a specific value of the input matches the trained sentences and build up an array of the results (ideally you should do this for the original input, grammar and root, so you can compare the data).
  • get the highest matching results. For this I used a function I found on these forums, which I edited to suit my needs:
    ; FunctionName:     _ArrayMode()
    ; Description:      Returns the most frequently occuring elements in the array
    ; Syntax:           _ArrayMode( $aArray [, $iStart] )
    ; Parameter(s):     $aArray - The ByRef array to find the mode of
    ;                   $iStart - (optional) The first index to check for data, default is 0
    ; Return Value(s):  On success returns a 1D array:
    ;                       [0] = Mode (number of instances of most common data element)
    ;                       [1] = First mode element
    ;                       [2] = Second mode element (with same mode count as first)
    ;                       [n] = Last mode element (with same mode count as first)
    ;                   On failure returns 0 and sets @error
    ; Author(s):        jon8763; modified by PsaltyDS; further modified by Mortog
    Func _ArrayMode(ByRef $aArray, $iStart = 0)
        ; Get list of unique elements
        Local $aData = _ArrayElements($aArray, $iStart)
        If @error Then Return SetError(@error, 0, 0)
        If $aData[0] = 0 Then Return $aData
        ; Setup to use SOH as delimiter
        Local $SOH = Chr(01), $sData = $SOH
        ; Setup for number of dimensions
        Local $iBound1 = UBound($aArray) - 1, $Dim2 = False, $iBound2 = 0
        If UBound($aArray, 0) = 2 Then
            $Dim2 = True
            $iBound2 = UBound($aArray, 2) - 1
        ; Assemble data string for searching
        For $m = $iStart To $iBound1
            If $Dim2 Then
                ; 2D
                For $n = 0 To $iBound2
                    $sData &= $aArray[$m][$n] & $SOH
                ; 1D
                $sData &= $aArray[$m] & $SOH
        ; Check count of each unique element listed in $aData, highest count kept in $aCounts[0]
        Local $aCounts[$aData[0] + 1] = [0], $aRegExp[1]
        For $n = 1 To $aData[0]
            $aRegExp = StringRegExp($sData, $SOH & $aData[$n] & $SOH, 3)
            $aCounts[$n] = UBound($aRegExp)
            If $aCounts[$n] > $aCounts[0] Then $aCounts[0] = $aCounts[$n]
       ;create 2d array with unique numbers and their occurances
       _ArrayDelete($aCounts, 0)
       $o = _ArrayMaxIndex($aCounts)
       _ArrayDelete($aCounts, $o)
       _ArrayInsert($aCounts, 0)
       _ArrayInsert($aCounts, $o +1)
       $k = UBound($aCounts)
       Local $aCounts_2d[$k][2]
       For $i = 1 to $k step +1
       _ArrayInsert($aCounts_2d, $i-1, $aCounts[$i -1] & "|" & $aData[$i -1])
       _ArrayDelete($aCounts_2d, 0)
       Local $aRET = _ArrayMaxIndex($aCounts_2d,0,0,UBound($aData), 0)
        Return $aRET
    EndFunc   ;==>_ArrayMode


  • Attach scores to all the values based on their grammatical analysis and start comparing the input to your trained material.

Some additional thoughts you should consider:

Let's assume you have the following trained: how are you doing? and you have the input: how are you doing today? You may consider the input having a total score of 6, being 6 strings. The trained material would have a score of 5, and can figure out whether you'd like your script to remove adjectives, conjunctions and adverbs one by one to see if it gets a match to your trained data.

Even better would be to have different values for different types of words, for examples verbs could have a score of 1, adverbials of time a score of 0.7. This would probably make finding matches more accurate, and easier.

The challenging part though, will be that the word today does imply something: you could be expacted to have had a bad experience yesterday for example. The system described here is also easy for single sentences, but you'll need to build on it considerably if you want it to be able to process multiple sentences (and for example recognize a sentence with multiple questions).


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By RTFC
      Please answer me these questions three, ere the other side you see:
      Are you running a 64-bit machine with a 64-bit Windows operating system? Can your AutoIt scripts cope with having directive #AutoIt3Wrapper_UseX64=Y, and thus @AutoItX64=True? Are you sick and tired of seeing this error message?
      If you (like me) answered "YES" to all three questions, then the _HighMem library may ease your pain (the name commemorates a useful utility from the days when CPUs were still steam-powered). Forget about pathetic boot switches /3GB and /userva; in a full-fledged 64-bit environment, _HighMem can pre-allocate all available physical/virtual RAM you've got (or any smaller size you need), and manage individual allocations therein with four simple functions:
      _HighMem_StartUp( $nSize, $sUnit="GB" ) ; parse size of total region to pre-allocate, e.g. (10,"GB") _HighMem_Allocate( $nSize, $sUnit="B" ) ; returns $pOffset (new allocation's base address) _HighMem_Release( $pOffset ) ; existing allocations are identified by their offset (base address) _HighMem_CleanUp() ; close handles, release all pre-allocated memory Of course, existing AutoIt limitations remain in force (e.g., DllstructCreate() is still limited to 2 GB per call), but the maximum of 2-4 GB of virtual memory per Windows process can (under the right circumstances, in the proper environment) be circumvented. However, this is the first beta release, so glitches are likely, and performance may vary. In fact, it may not work at all for you (if you're running 32-bit, for example). And since this involves your own hardware, it's unlikely I would be able to reproduce your issues in my own work environment. Nevertheless, if you find obvious bugs or mistakes in the code, please do post. And if it works for you, that's also good to hear. My own motivation for developing it was to supercharge my matrix computing environment (Eigen4AutoIt), so it can handle matrices of any size that fit in machine RAM.
      The attached zip contains the library itself (HighMem.au3) and two test examples. HighMem_Test1 performs a dry run stress test of the allocation management system; it does not actually do any memory I/O. By contrast, HighMem_Test2 pre-allocates a 6 GB space, stores 3 x 2GB structs there, performs some basic I/O, and releases the allocations one by one. Obviously, for this to work you'll need at least that much free RAM to begin with (check with Task Manager -> Performance -> Memory if you're unsure). My own test environment has 16 GB of physical RAM, and runs W10Pro/64.
      EDIT: minor edits added to improve user experience (many more status messages if $_HighMem_Verbose=True)
      EDIT: from beta version 0.9, HighMem supports shared memory, including mutex negotiation.
    • By Gianni
      After watching this movie (https://www.youtube.com/watch?v=cPiDHXtM0VA) I wanted to try the test to see how much i could compete with that chimpanzee so i created this script.
      well, actually passing that test is a lot harder than it sounds. With the difficulty set to seven numbers and a display time of one second, I can only remember 2 or 3 numbers ... (what a disappointment)
      I can only do better if I reduce the slider to 5 numbers and increase the storage time to 2 seconds (the easyest level), a very poor performance. That chimpanzee is great.
      The script offers you a sequence of 10 random quizzes. At the end it gives you the percentage of your "level". The chimpanzee resolves on average 8 out of 10 (80%), so you can compare your performance to that of the chimpanzee.
      How to play:
      Run the script. At the beginning there are 2 sliders at the bottom of the screen where you can set the difficulty level by varying the memorization time and the amount of numbers to memorize as you like. After setting the difficulty, click the circle on the bottom left to get started. after the first move the sliders are no longer displayed until the next game, (the game lasts 10 attempts, there is a progress bar at the bottom of the screen to see where you are) between one test and the other of the ten, click on the circle to move on to the next test have fun.
      (here a related interesting video: https://www.youtube.com/watch?v=ktkjUjcZid0 )
      #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <WinAPIMisc.au3> ; HotKeySet("{ESC}", "_EndOfGame") Global $iNumbersToGuess = 7, $iExpositionTime = 1000, $iMatches = 10, $iMatchesWon Global $aNumbers[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Global $aButtons[10], $aControls[5] Global $iWinWidth = @DesktopWidth / 2, $iWinHeight = @DesktopHeight / 2, $iButtonXSide = Int($iWinWidth / UBound($aNumbers)), $iButtonYSide = Int($iWinHeight / UBound($aNumbers)), $sWinTitle = "Beat the Chimp" Global $aX[Int($iWinWidth / $iButtonXSide)], $aY[Int($iWinHeight / $iButtonYSide)], $iNdx = 0, $aPoints[3], $score, $GUIGetMsg, $iDockHeight = 50, $iProgrssHeight = 5 For $i = 0 To (Int($iWinWidth / $iButtonXSide) - 1) * $iButtonXSide Step $iButtonXSide $aX[$iNdx] = $i $iNdx += 1 Next $iNdx = 0 For $i = 0 To (Int($iWinHeight / $iButtonYSide) - 1) * $iButtonYSide Step $iButtonYSide $aY[$iNdx] = $i $iNdx += 1 Next Global Const $iDockLeftBorder = 200, $iForeColor = 0xFFFFFF, $iBackColor = 0x000000 Global $hGUI = GUICreate($sWinTitle, $iWinWidth, $iWinHeight + $iDockHeight + $iProgrssHeight, @DesktopWidth / 4, @DesktopHeight / 5) GUISetBkColor($iBackColor, $hGUI) ; the circle to continue playing $aControls[0] = GUICtrlCreateLabel(ChrW(0x25EF), 0, $iWinHeight + 1, 100, $iDockHeight, 0x01) ; GUICtrlSetTip(-1, "Click the circle," & @CRLF & "then click the squares" & @CRLF & "in numeric order.") GUICtrlSetFont(-1, 24, 900) GUICtrlSetColor(-1, $iForeColor) GUICtrlSetBkColor(-1, $iBackColor) ; slider for the amount of numbers to guess $aControls[2] = GUICtrlCreateSlider($iDockLeftBorder, $iWinHeight, $iWinWidth - $iDockLeftBorder, Int($iDockHeight / 2)) GUICtrlSetLimit(-1, 10, 5) ; 5 steps 5 (easy) to 10 (hard) GUICtrlSetData(-1, $iNumbersToGuess) ; label for the amount of quizzes $aControls[1] = GUICtrlCreateLabel("Numbers : " & GUICtrlRead($aControls[2]), 100, $iWinHeight + 1, 100) GUICtrlSetColor(-1, $iForeColor) ; slider for the exposition time $aControls[4] = GUICtrlCreateSlider($iDockLeftBorder, $iWinHeight + (Int($iDockHeight / 2)), $iWinWidth - $iDockLeftBorder, $iDockHeight / 2) GUICtrlSetLimit(-1, 8, 1) ; 8 steps (0f 250ms each) GUICtrlSetData(-1, $iExpositionTime / 250) ; label for the exposition time $aControls[3] = GUICtrlCreateLabel("ms to show : " & GUICtrlRead($aControls[4]) * 250, 100, $iWinHeight + 1 + (Int($iDockHeight / 2)), 100) GUICtrlSetColor(-1, $iForeColor) ; progress bar of the match Global $idProgressbar = GUICtrlCreateProgress(0, $iWinHeight + $iDockHeight, $iWinWidth, $iProgrssHeight) ; Create buttons For $i = 0 To 9 $aButtons[$i] = GUICtrlCreateLabel($i + 1, $iWinWidth + 5, $iWinHeight + $iDockHeight + $iProgrssHeight + 5, $iButtonXSide, $iButtonYSide, 0x01) GUICtrlSetFont($aButtons[$i], 24) GUICtrlSetColor($aButtons[$i], $iForeColor) GUICtrlSetBkColor($aButtons[$i], $iBackColor) Next GUISetState(@SW_SHOW) ; --- Main loop --- Do ; New game $iMatchesWon = 0 GUICtrlSetData($idProgressbar, 0) For $iRound = 1 To $iMatches ; the game lasts $iMatches rounds $iNdx = 0 ; reset pointer (index to the next correct answer) _HideControls(__get_IDs_by_indexes($aButtons, $aNumbers)) ; remove the numbers from the screen ; show the dock and wait (only in the first round are also shown the sliders) _ShowControls($iRound = 1 ? $aControls : $aControls[0]) ; display the dock's control(s) While 1 Switch GUIGetMsg() Case $aControls[0] ; The circle (play a new quiz) ExitLoop Case $aControls[2] ; slider to choose how many numbers to guess $iNumbersToGuess = GUICtrlRead($aControls[2]) GUICtrlSetData($aControls[1], "Numbers : " & $iNumbersToGuess) Case $aControls[4] ; slider to choose how long (milliseconds) to show the numbers $iExpositionTime = GUICtrlRead($aControls[4]) * 250 ; 8 steps of 250 milliseconds each GUICtrlSetData($aControls[3], "ms to show : " & $iExpositionTime) Case $GUI_EVENT_CLOSE _EndOfGame() EndSwitch WEnd _HideControls($aControls) ; hide the dock Sleep(750) ; wait a bit $aQuiz = _GenerateQuiz($iNumbersToGuess) ; generate random elements to guess _SpreadControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; scatter the numbers on the GUI _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; display the numbers Sleep($iExpositionTime) ; leave numbers visible for a short time _MaskControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; mask the numbers GUICtrlSetData($idProgressbar, Round($iRound / $iMatches * 100)) ; _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) ; <------------- keep numbers visible FOR DEBUG PURPOSE ONLY! While 1 ; wait for a move $GUIGetMsg = GUIGetMsg() If $GUIGetMsg = $GUI_EVENT_CLOSE Then _EndOfGame() ; scan all quiz buttons to check if one was pressed For $i = 0 To UBound($aQuiz) - 1 ; $aButtons) - 1 If $GUIGetMsg = $aButtons[$aQuiz[$i] - 1] Then If $i = $iNdx Then ; -------------------------- ; actions for a right move ; -------------------------- ; hide the guessed number _HideControls($aButtons[$aQuiz[$i] - 1]) ; --------------------------------- ; check if this round is complete ; --------------------------------- If $iNdx = (UBound($aQuiz) - 1) Then _WinAPI_PlaySound("SystemExclamation", Null, BitOR($SND_ALIAS, $SND_ASYNC)) $iMatchesWon += 1 ExitLoop 2 EndIf ; play a short ok sound ; _WinAPI_PlaySound("FaxBeep", Null, BitOR($SND_ALIAS, $SND_ASYNC)) ; "SystemAsterisk" $iNdx += 1 ; set index to next correct answer Else ; -------------------------- ; actions for a wrong move ; -------------------------- ; show all the right sequence _ShowControls(__get_IDs_by_indexes($aButtons, $aQuiz)) _WinAPI_PlaySound("DeviceFail", Null, BitOR($SND_ALIAS, $SND_ASYNC)) ; give a little time to the user to control it Sleep(1500) ; go to next step ExitLoop 2 EndIf EndIf Next WEnd ; loop till end of match $score = Round($iMatchesWon / $iMatches * 100, 2) ; percentage Select Case $score < 80 $sResult = "The chimp beat you!" Case $score > 80 $sResult = "You beat the chimp!" Case $score = 80 $sResult = "You tied the chimp." EndSelect Next ; next round ; game over? Until MsgBox($MB_YESNO + $MB_ICONINFORMATION + $MB_TASKMODAL + $MB_SETFOREGROUND, _ "Game over", _ "You got " & $score & "% correct." & @CRLF & _ "Ayumu averages 80% correct." & @CRLF & $sResult & @CRLF & @CRLF & _ "do you want to try again?") <> 6 Func _SpreadControls($aTemp) ; place the required numbers scattered on the GUI SRandom(@YEAR + @MON + @MDAY + @HOUR + @MIN + @SEC) _ArrayShuffle($aX) _ArrayShuffle($aY) ; first, place all buttons out of GUI For $i = 0 To UBound($aButtons) - 1 GUICtrlSetPos($aButtons[$i], $iWinWidth + 5, $iWinHeight + $iDockHeight + $iProgrssHeight + 5) GUICtrlSetState($aButtons[$i], $GUI_DISABLE) Next ; Then place only the numbers of this quiz in visible area For $i = 0 To UBound($aTemp) - 1 GUICtrlSetPos($aTemp[$i], $aX[$i], $aY[$i]) GUICtrlSetState($aTemp[$i], $GUI_ENABLE) Next EndFunc ;==>_SpreadControls Func _GenerateQuiz($iNumElements) ; generate an array of required random numbers SRandom(@YEAR + @MON + @MDAY + @HOUR + @MIN + @SEC) Local $aTemp[$iNumElements] _ArrayShuffle($aNumbers) For $i = 0 To $iNumElements - 1 $aTemp[$i] = $aNumbers[$i] Next _ArraySort($aTemp) Return $aTemp EndFunc ;==>_GenerateQuiz Func _ShowControls($aTemp) ; render controls visible (and enabled) $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetState($aTemp[$i], $GUI_SHOW) GUICtrlSetColor($aTemp[$i], $iForeColor) GUICtrlSetBkColor($aTemp[$i], $iBackColor) Next EndFunc ;==>_ShowControls Func _MaskControls($aTemp) ; mask the controls $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetColor($aTemp[$i], $iForeColor) GUICtrlSetBkColor($aTemp[$i], $iForeColor) Next EndFunc ;==>_MaskControls Func _HideControls($aTemp) ; hide the controls (implies disable) $aTemp = _EnforceArray($aTemp) For $i = 0 To UBound($aTemp) - 1 GUICtrlSetState($aTemp[$i], $GUI_HIDE) ; $GUI_DISABLE) ; GUICtrlSetColor($aButtons[$aTemp[$i] - 1], $iBackColor) ; GUICtrlSetBkColor($aButtons[$aTemp[$i] - 1], $iBackColor) Next EndFunc ;==>_HideControls Func _EnforceArray($vParam) ; if only one value is passed, turn it into an array of only 1 element If Not IsArray($vParam) Then Local $aTemp[1] = [$vParam] Return $aTemp EndIf Return $vParam EndFunc ;==>_EnforceArray Func __get_IDs_by_indexes(ByRef $aCtrls, ByRef $aNdxs) ; returns the handles of the controls pointed to by the indexes Local $aTemp[UBound($aNdxs)] For $i = 0 To UBound($aNdxs) - 1 $aTemp[$i] = $aCtrls[$aNdxs[$i] - 1] Next Return $aTemp EndFunc ;==>__get_IDs_by_indexes Func _EndOfGame() ; _WinAPI_PlaySound ("SystemExit" , Null, $SND_ALIAS) GUIDelete() Exit EndFunc ;==>_EndOfGame P.S. At this link (https://web.archive.org/web/20131006161544/http://games.lumosity.com/chimp.html) there is a Flash version of this game.
    • By SteveJM
      When I use DllStructCreate() to reserve a chunk of memory I would like to know if I can rely on that memory being initialized to zero. Experience suggests that it is, but I have been searching to try and find a definitive statement anywhere that this is the case. I apologise if I have missed somewhere. Part of the reason for this question is so that my next search (after my personal memory has dimmed) should yield a link to this post, hopefully with an answer.
      A number of DLLs I use have structs where a few parts have to be explicitly set and other parts are reserved with the instruction that they must be set to zero. Because DllStructCreate() appears to zero-initialise the memory, I tend to forget to do it explicitly and everything seems to work. I am wondering whether I have been lucky and am storing up trouble for myself. It seems likely that the OS has been asked for zeroed memory, but without a promise in the documentation for DllStructCreate(),  perhaps that could change? Perhaps the developers wish to reserve the right to change their minds?
    • By levila
      Hi guys, really need your help. How can i check every 5 min if my text file include String "Markus". Btw i need this function to run on my Logs file that are updated whenever some event is triggered (logs appear in same txt file). So i did test some codding to test isit possible.
      But somehow, it only detect for the 1st time String check, and keep coming the same output every time, it didnt check/read on the current txt file that has been updated.
      For this purpose i update txt file manually so i put String "Markus" and check, and try to remove it agn.
      Here is my code:
      $file = FileOpen("c:\hello.txt", 0) $read = FileRead($file) func _CheckString() If StringInStr($read, "Markus") Then $position = StringInStr($read, "Markus") MsgBox(0,"","Alert Found - Logs Line No "&$position, 5) FileClose($file) Else MsgBox(0,"","No Alert found", 5) FileClose($file) EndIf EndFunc $Mins = 0.5 ; i change to fewer min for testing purpose $Timer = TimerInit() While 1 If TimerDiff($Timer) > ($Mins * 60000) Then ; count per minute multiplied by 60sec. _CheckString() ConsoleWrite("30 Sec have passed!" & @CRLF) ; console to see if its running. $Timer = TimerInit() EndIf WEnd  
    • By ManualIT
      Guys, i need help on creating a script that restarts a program once it starts using more than 1GB of memory.
      No idea how to start on the script, i don't know which functions i should use for process memory reading.
      My mind is in total blank at the moment, so i need a kick start
  • Create New...