16
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
What is the purpose of the Wait(100)? I noticed it does not work if there isn't a wait.It needs for saving some cpu time.
When I add the event in my mining script, the script will only loop through 1-2 tiles before it just stands still doing nothing. If I disable the handler, it works flawlessly. I'm wondering if the two issues are related.Can you post the script?
def object_handler(serial):
AddToSystemJournal('Character found!', serial=serial, graphic=GetType(serial), sep=' ', end='.')
def speech_handler(*args):
AddToSystemJournal(*args)
def main():
SetEventProc('evDrawObject', object_handler)
SetEventProc('evSpeech', speech_handler)
Connect()
while 1:
Wait(100)
if __name__ == "__main__":
main()
01:20:15:950 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:15:952 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:15:953 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:15:953 [Demise 1]: Character found! serial=9767 graphic=400.
01:20:15:954 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:15:956 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:15:957 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:17:695 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:17:697 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:17:698 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:17:700 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:17:702 [Demise 1]: Character found! serial=9767 graphic=400.
01:20:17:703 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:17:704 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:17:706 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:17:707 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:17:708 [Demise 1]: Character found! serial=9767 graphic=400.
01:20:19:667 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:19:690 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:19:692 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:19:694 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:19:695 [Demise 1]: Character found! serial=9767 graphic=400.
01:20:19:697 [Demise 1]: Character found! serial=9767 graphic=400.
01:20:19:860 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:21:685 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:21:686 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:21:687 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:21:689 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:21:690 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:21:691 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:23:717 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:23:719 [Demise 1]: Character found! serial=127053 graphic=401.
01:20:23:720 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:23:721 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:25:714 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:25:716 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:25:717 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:25:719 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:25:720 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:27:743 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:27:744 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:27:756 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:27:758 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:29:812 [Demise 1]: Character found! serial=479295 graphic=401.
01:20:29:813 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:29:815 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:29:816 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:29:978 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:29:980 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:30:366 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:31:811 [Demise 1]: Character found! serial=479295 graphic=401.
01:20:31:813 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:31:814 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:31:816 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:32:299 [Demise 1]: Character found! serial=479291 graphic=400.
01:20:32:301 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:32:695 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:32:857 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:33:062 [Demise 1]: Character found! serial=1616794 graphic=400.
01:20:33:842 [Demise 1]: Character found! serial=479295 graphic=401.
01:20:33:844 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:35:844 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:35:846 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:37:909 [Demise 1]: Character found! serial=479295 graphic=401.
01:20:37:911 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:37:912 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:37:914 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:39:918 [Demise 1]: Character found! serial=479295 graphic=401.
01:20:39:920 [Demise 1]: Character found! serial=479292 graphic=400.
01:20:39:921 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:39:923 [Demise 1]: Character found! serial=51438 graphic=401.
01:20:41:975 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:41:976 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:41:989 [Demise 1]: Character found! serial=479289 graphic=400.
01:20:44:042 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:44:044 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:46:106 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:48:109 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:48:111 [Demise 1]: Character found! serial=52354 graphic=401.
01:20:50:162 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:50:164 [Demise 1]: Character found! serial=127054 graphic=400.
01:20:52:165 [Demise 1]: Character found! serial=50405 graphic=401.
01:20:52:166 [Demise 1]: Character found! serial=50405 graphic=401.
import time
def f(*args):
pass
SetEventProc('evtimer1', f)
while 1:
time.sleep(1) # this is a non-stealth function
import datetime
HUMANS = 0x0190, 0x0191 # humans graphic
PICKAXE = 0x0E86 # a pickaxe graphic
foundSomeone = False
def evDrawObjectHandler(serial):
global foundSomeone # now this function can change this variable, not only read
AddToSystemJournal('Character found!', serial=serial, graphic=GetType(serial), sep=' ', end='.')
if serial != Self() and GetType(serial) in HUMANS:
foundSomeone = True
SetEventProc('evDrawObject', None) # disable the handler
FindType(0x0F06, Backpack()) #invis pot
UseObject(FindItem())
Wait(100)
ClientPrint('Player near!')
recallHome()
def MineTile(t, x, y, z):
msgEnd = 'nothing to mine|mining in rock|reach the target|far away'
msgTry = 'put|fail'
while 1:
WaitTargetTile(t, x, y, z)
UseType2(PICKAXE)
start = datetime.datetime.now()
WaitJournalLine(start, '|'.join(msgEnd, msgTry), 5000)
if InJournalBetweenTimes(msgEnd, start, datetime.datetime.now()) >= 0:
return
def main():
while 1:
SetEventProc('evDrawObject', evDrawObjectHandler)
recallToMine()
mx, my = GetX(Self()), GetY(Self())
tiles = GetStaticTilesArray(mx-2, my-2, mx+2, my+2, WorldNum(), range(1339, 1359)) # find all mining spots near the character
for tile in tiles:
MineTile(*tile)
if foundSomeone:
return # exit
recallHome()
if __name__ == '__name__':
main()
EVENTS_NAMES = (
'eviteminfo', 'evitemdeleted', 'evspeech', 'evdrawgameplayer',
'evmoverejection', 'evdrawcontainer', 'evadditemtocontainer',
'evaddmultipleitemsincont', 'evrejectmoveitem', 'evupdatechar',
'evdrawobject', 'evmenu', 'evmapmessage', 'evallowrefuseattack',
'evclilocspeech', 'evclilocspeechaffix', 'evunicodespeech',
'evbuffdebuffsystem', 'evclientsendresync', 'evcharanimation',
'evicqdisconnect', 'evicqconnect', 'evicqincomingtext', 'evicqerror',
'evincominggump', 'evtimer1', 'evtimer2', 'evwindowsmessage', 'evsound',
'evdeath', 'evquestarrow', 'evpartyinvite', 'evmappin', 'evgumptextentry',
'evgraphicaleffect', 'evircincomingtext', 'evmessengerevent',
'evsetglobalvar', 'evupdateobjstats'
)
# evDrawGamePlayer: deprecated, used no longer (use evDrawObject).
# evDrawObject : [ID : Cardinal] mobiles only
HUMANS = 0x0190, 0x0191
def emergency(serial):
if serial == Self() and GetType(serial) in HUMANS:
return
SetEventProc('evDrawGamePlayer', None) # turn off the handler
recall_home()
SetEventProc('evDrawObject', emergency) # set the handler before leaving a safe zone
Is it possible call this script from inside a python script I use? If not, does anyone have one that will work for python?It is possible to send and recieve email-messages via python. those libraries will help: smtplib, poplib, imaplib
Are you a Developer on Stealth? Just curious on your affiliation to it.Vizitor told this here