i think a unixtime function to prevent using timers in functions like autopots...
is a better post...
a LOT of python hacks seem to use timers for this..
Code:
functiontoactivatetimer
timer here...
functiontodeactivatetimer
timer 999999999999999999999
function here
code...
timer
to me code like this is dumb
Code:
AutoPotRed = "on"
class mybla(ui.ThinBoard):
code to initicialize dialog here....
self.autopotredlast = self.blabla.unixtime()
self.potsinterval = 300
def OnRender(self):
global autopotsred
unixtime = self.blabla.unixtime()
if str(AutoPotRed) == "on":
lastusedon = unixtime - self.autopotredlast
if lastusedon > self.potsinterval:
self.AutoPotRed()
def AutoPotRed()
getHP....
loop through inventory...
and here...
if ItemValue == 27001 or ItemValue == 27002 or ItemValue == 27003:
self.autopotredlast = self.blabla.unixtime()
net.SendItemUsePacket(i)
break
class blabla:
def unixtime(self):
return long((round(time.clock(),7) + 0.5) * 1000)
I posted the actual unixtime function... because it was one thing on my code
that kinda gave me a hard time to get something that actually works proper for an older python version such as the one in metin
and some parts here and there just to make people understand how to make an autopotter without using timers
with this one you can also decide how long it should take between pots so the autopotting looks "human" instead of potting like 30 pots in 1 second
and it's based on the time when you last potted...so even if you lag...pots will never be sent like 10 at once ;]
setting a timer to 999999999999999999999 or whatever..doesnt actually turn it off..and for players that play all day and keep turning off/on the pots...this adds uselessness to the userspace
also keep in mind that OnRender (only updates when frames are updated)
so if you lagggggg so much that the screen freezes for quite a long time...the autopotting wont work...
so you can use something like OnUpdate to check if the HP is less than 50% of the autopots value..to prevent the char from dying ;]
hope this helps whoever is interested...happy hacking ;]
PS: I still haven't figured out how to bind keys in python scripts..someone care to enlighten me? tks