psychopyro212 Posted March 14, 2012 Share Posted March 14, 2012 For some reason when i run this its memory usage just goes up by about 44 kb or so a second. expandcollapse popup#include <dir.au3> Global $x = 1 Global $y = 0 Global $sleep = 100 IniWrite($dir, "Vars", "varx", $x) IniWrite($dir, "Vars", "vary", $y) HotKeySet("{down}", "down") HotKeySet("{up}", "up") HotKeySet("{left}", "left") HotKeySet("{right}", "right") While 1 Sleep($sleep) processed() iniw() WEnd Func Iniw() IniWrite($dir, "Vars", "varx", $x) IniWrite($dir, "Vars", "vary", $y) EndFunc ;==>Iniw Func processed() Global $processed = IniRead($dir, "Process", "Input", "") EndFunc ;==>processed Func down() If $processed = 1 Then $x = Int($x + 1) If $x = 5 Then $x = 4 Else EndIf EndIf IniWrite($dir, "Process", "Input", "0") EndFunc ;==>down Func up() If $processed = 1 Then $x = Int($x - 1) If $x = 0 Then $x = 1 Else EndIf EndIf IniWrite($dir, "Process", "Input", "0") EndFunc ;==>up Func right() If $processed = 1 Then $y = Int($y + 1) If $y = 97 Then $y = 96 Else EndIf EndIf IniWrite($dir, "Process", "Input", "0") EndFunc ;==>right Func left() If $processed = 1 Then $y = Int($y - 1) If $y = -1 Then $y = 0 Else EndIf EndIf IniWrite($dir, "Process", "Input", "0") EndFunc ;==>left Any help with my problem or others you see please feel free to tell me what i screwed up Link to comment Share on other sites More sharing options...
JohnOne Posted March 14, 2012 Share Posted March 14, 2012 I'd hazard a guess that It's the global variable you are redeclaring every millisecond. 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 More sharing options...
psychopyro212 Posted March 14, 2012 Author Share Posted March 14, 2012 Im not entirely sure I know how to rewrite it with out useing that variable like that... I use this script to communicate with another via a ini file and that is used so when the other script reads the change in the ini file it outputs a 1 for "processed" and after this script makes a change it puts a 0 in so nothing else in this script runs until the other script reads the change Link to comment Share on other sites More sharing options...
JohnOne Posted March 14, 2012 Share Posted March 14, 2012 Move declaration outside of functionGlobal $processedFunc processed()$processed = IniRead($dir, "Process", "Input", "")EndFunc ;==>processed IceDryst 1 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 More sharing options...
psychopyro212 Posted March 14, 2012 Author Share Posted March 14, 2012 Ahh i see what i did live and learn i guess thank you johnone! 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