Spinner385 Posted September 1, 2012 Share Posted September 1, 2012 (edited) This is the update event in my More HotKeys Please mod. I wanted to go ahead and see if anyone had any ideas to speed this up? Some people with slower systems say the response could be better. I know from load testing that under very heavy strain it can slow down to where you have to make deliberate keypresses. I'll explain below. Event OnUpdate() If key0 != input.GetNthKeyPressed(0) key0 = input.GetNthKeyPressed(0) Stop = False endif If key1 != input.GetNthKeyPressed(1) key1 = input.GetNthKeyPressed(1) Stop = False endif If key2 != input.GetNthKeyPressed(2) key2 = input.GetNthKeyPressed(2) Stop = False endif If !Stop Stop = True If key0 > 1 int i = 0 while KeyPressA[i] != 0 && i <= 50 int test = KeyPressA[i] If key0 == test || key1 == test || key2 == test If SetKeyCastVar.getvalue() == 0 bool Found = False If !Utility.IsInMenuMode() Found = FindKey(key0, key1, key2) Endif If Found RegisterForSingleUpdate(MHP_Update.getvalue()) Return endif Endif endif i += 1 endwhile endif endif If SetKeyCastVar.getvalue() == 1 debug.notification("Saving HotKeys...") SetArrays() debug.notification("HotKeys Saved!") SetKeyCastVar.setvalue(0) Endif RegisterForSingleUpdate(MHP_Update.getvalue()) EndEvent KeyPressA[] holds the hotkeys they set, I set it up so once you reach 0 you can stop searching it. SetKeyCastVar tells the script to save the data they just selected (1) and lets it know if they are pressing keys because they are setting them (!0). The find key function determines what type of key was pressed and where it is in the array. Then goes on from there to take action. Possibly the shear size of the entire script is the problem (40 kb). I don't think it should matter though as this is the only portion that actually monitors keypresses and that is the issue. I tried making this part a separate script but had the same result. Update is at 0.01 btw. It runs great for me and I have to spawn like 10 or more dragons to really notice any problems. I would like to make it run good for everyone though. Thnx in advance Edited September 1, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Recommended Posts