Show Posts

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.


Messages - sharpie

Pages: [1]
1
Stealth Client / Re: [Python] Working with events
« on: September 22, 2018, 02:29:50 PM »
What is the purpose of the Wait(100)? I noticed it does not work if there isn't a wait.

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.

2
Stealth Client / Re: [Python] Working with events
« on: September 21, 2018, 01:29:13 PM »
So, correct me if I'm wrong, but this should be working perfectly:

Code: [Select]
foundSomeone = False
HUMANS = [0x0190, 0x0191]

def evDrawObjectHandler(serial):
    global foundSomeone
    AddToSystemJournal(serial)
    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
        AddToSystemJournal('Stopped handler')
       
def main():
    while True:
        SetEventProc('evDrawObject', evDrawObjectHandler)
        if foundSomeone:
            AddToSystemJournal('Found someone!')
            return

main()

It's just looping and not finding anyone, the types are correct, I've double checked.

3
Stealth Client / Re: [Python] Working with events
« on: September 20, 2018, 02:36:36 AM »
That makes sense. Is there anyway to handle seeing 5-6 non human mobiles at once and it not break the script?

4
Stealth Client / Re: [Python] Working with events
« on: September 19, 2018, 08:37:25 PM »
So does execution jump to the event handler and stop executing the other code? Or does the code keep working?

Your code looks like when the handler is executed, the loop doesn't break. Is this true?

Right now, with my script set up the same way, it still freezes once it sees any kind of character. There are monsters nearby that are totally stopping my script in its tracks!

5
New member introductions /
« on: September 19, 2018, 04:08:12 PM »
Thanks guys!

6
Stealth Client / Re: [Python] Working with events
« on: September 19, 2018, 03:43:06 PM »
Ahh that makes more sense! How do you stop whatever the script is doing to allow the event to play correctly? Like actually recall, and then eventually reset it.

Edit: I'll paste the code I'm trying to run so you can understand what I'm trying to do.

Quote
def emergencyRecall(serial):
    HUMANS = 0x0190, 0x0191

    if serial != Self() or GetType(serial) in HUMANS:
        return
    SetEventProc('evDrawObject', None)  # turn off the handler
    FindType(0x0F06, Backpack()) #invis pot
    UseObject(FindItem())
    Wait(100)
    ClientPrint('Player near!')
    recallHome()

I put the enable handler where you mentioned.

Edit 2: I don't think I understand how the event is supposed to work. If I run up on my miner with another character it doesn't even print 'Player near!'.

7
Stealth Client / [Python] Working with events
« on: September 19, 2018, 02:23:41 PM »
Hello! I'm trying to figure out the best way to use an event to search for enemy players and then run a function when it finds one. I thought I'd read the API and am doing it right, but my logic must be flawed.

Code: [Select]
def emergencyRecall(ID):
    if ID != Self()
        #FindType(0x0F06, Backpack()) #invis pot
        #UseObject(FindItem())
        #Wait(100)
        recallHome()

SetEventProc(evDrawGamePlayer, emergencyRecall)

I'm getting NameError: name 'evDrawGamePlayer' is not defined.

Any advice? Thanks!!

8
Stealth Client / Re: [Python] How to access the current time
« on: September 19, 2018, 12:13:14 AM »
Thank you!!

9
New member introductions /
« on: September 18, 2018, 03:26:01 PM »

10
Stealth Client / [Python] How to access the current time
« on: September 18, 2018, 02:39:06 PM »
Hi! I've been learning Stealth/Python and I've run into a snag. I can't seem to figure out how to actually make a variable with the current time. Most of the stuff in the API gives me name 'xyz' is not defined. I'm sure there's an easy way!

Ex:

I'm trying to use Now in the WaitJournalLine command.

findMsg = WaitJournalLine(Now(), endMsg + "|" + stopMsg, 25000)

Pages: [1]