PoppiPippo 0 Posted March 25, 2019 Share Posted March 25, 2019 How can i set an hotkey for activating functions inside a script? Here an example, what's wrong? Spoiler import player import net import app class Test(): def __init__(self): self.__BuildKeyDict() def __BuildKeyDict(self): onPressKeyDict = {} onPressKeyDict[app.DIK_SPACE] = lambda : self.StartHot() self.onPressKeyDict = onPressKeyDict def StartHot(self): net.SendChatPacket("/unmount") player.ClickSkillSlot(3) for i in xrange(player.INVENTORY_PAGE_SIZE*3): ItemValue = player.GetItemIndex(i) if ItemValue == 666: net.SendItemUsePacket(i) Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10334 Posted March 25, 2019 Forum Moderator Share Posted March 25, 2019 def OnKeyDown(self, key): try: self.onPressKeyDict[key]() except KeyError: pass except: raise return True 1 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now