Jump to content

I need some help on a complicated problem.


Recommended Posts

Well.. First I will explain to you what my script does, so you will know. (There is no other scripts out there like this)

On an application I developed, there are "Squares" Or "Spots". These Squares each have a number that is stored in a memory value. You can move through these squares, each having a different number.

What my script does is it has a set of 100 Functions. Each of these functions is the equivalant to a square. Where it checks the sq #, if it is not the correct one then it waits for a second, then checks again. When it is the correct square it will execute a function, and then move again. It takes a couple seconds between movements, that is why it constantly checks for the value.

He is an example.. ( I would post the whole script but it is over 3,000 lines)

Func _1()
    $sq = _MemoryRead($Address, $ID) ; Reads the Sq Number
    If $sq = 3928 Then ; If the sq number is correct...
        Sleep(250)
        _function() ; then it activates a function, and then moves to the next square
    Else
        Sleep(250)
        _1() ; If the sq # is not correct, then it loops back to the same function until it is correct.
    EndIf
EndFunc

Here is the problem. Sometime for an odd reason the server lags, and therefore the movement of one square to the other does not happen. Therefore, say I am on sq #3050 and the function acts, sends the command for me to go to the NEXT square, and therefore activates the next function for #3051. Well, that command did not end up going to the server and the script is continually checking for sq #3051 instead of #3050 so it stops.

I need some way for it to loop back to the Previous Function if that function does not see the correct Sq# Within, 10 seconds.

I am thinking something like this would work.. But then I would have to go back and edit over 600 Functions, and even with a script that automatically edits these for me (Which is what I do for most tedious editing tasks) it is way too much work, and I am not even sure if it works. Any ideas?

Here is my possible(?) Solution?

$neg = 0 ; set $neg to 0

Func _2()
    $sq = _MemoryRead($Address, $ID) ; Reads the Sq Number
    If $sq = 3050 Then ; If the sq number is correct...
        Sleep(250)
        _function() ; then it activates a function, and then moves to the next square
                  $neg = 0 ; reset $neg to 0

        Else

             if $neg < 10 then 
        Sleep(1000) ; Waits one second
        _2() ; If the sq # is not correct, then it loops back to the same function until it is correct.
              $neg = $neg + 1
              EndIf

Else
_1() ; if the square is not correct after 10 seconds, then it will loop back to the previous function
$neg = 0

    EndIf
EndFunc

Please help me with this it would be very much appreciated and thank you in advance.

Also, on a side note.. NomadMemory (Which I use to find the memory values so script will work) Stops working after a while and exits the script because it has tried to read a memory so much and stops automatically for some reason (Too much load on computer) And exits out the program. To fix that I was thinking every so often the script would just restart, but I would love a better solution to this problem.

If you would like to see the full script, ask.. But it seriously has no comments or anything of the sort and you would probably not understand anything it would do. And it has around 500 Variables. Thankyou Very much.

Link to comment
Share on other sites

This is not a bot for a game. And the server that recieves the commands for movement, the movement is not sent and is therefore stuck doing nothing on the next function.

What this script does is everytime it moves sucessfully, the Function() function captures a screenshot of that square and saves it to the local hard disk.

Link to comment
Share on other sites

And what is the purpose of that dramatic construct, exactly?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Do you need to know what the purpose of the construction is to help me? I think not. If I felt it important to say why, I would have typed it. But, it is not important.. I have coded over 45,000 lines for this single script and now I need help with a simple thing. I would love that help, thank you very much.

Link to comment
Share on other sites

Do you need to know what the purpose of the construction is to help me? I think not. If I felt it important to say why, I would have typed it. But, it is not important.. I have coded over 45,000 lines for this single script and now I need help with a simple thing. I would love that help, thank you very much.

Link to comment
Share on other sites

  • Developers

Do you need to know what the purpose of the construction is to help me? I think not. If I felt it important to say why, I would have typed it. But, it is not important.. I have coded over 45,000 lines for this single script and now I need help with a simple thing. I would love that help, thank you very much.

45000 lines?

Would be interested to see that one...

Anyway... have fun with your script.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, 45000 lines. I have scripts that record the Sq # and put it into Variables and then write those variables out with the press of a hotkey etc, so that it is all manual. But seriouslly.. Can somebody please help me?

Link to comment
Share on other sites

Why do you need nomad mamory to read the values of your own script you developed?

It would be easier to just use the variables it creates.

heres a handy tip for you: If trying to disguise intent or get an answer to a problem where you dont want to post your code, you should at least put your needs into proper context, understandable to someone who does not know what you are doing, and provide a working example of your problem.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...