Author Topic: [V6.1.3, Python] Script Snippet  (Read 6381 times)

0 Members and 1 Guest are viewing this topic.

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
[V6.1.3, Python] Script Snippet
« on: November 03, 2013, 07:59:49 PM »
0
I haven't seen many Python script snippets using Stealth so I figured I'd post a simple example.  Hopefully this helps other people who are getting into Stealth and want to use Python.

Below is a snippet that opens your character's backpack and then opens all of the backpacks within your characters backpack.  Copy and paste the code into a text file with the .py extension.  Then load it up in Stealth and run it.

Code: [Select]
import stealth

stealth.AddToSystemJournal("Begin")

#Open Backpack
backpackID = stealth.Backpack()
stealth.UseObject(backpackID)
stealth.Wait(1000)

#Find all backpacks within your backpack
backpackType = 0x0E75
allColors = 0xFFFF

# Search character backpack for backpacks of all colors, don't search recursively
stealth.FindTypeEx(backpackType, allColors, backpackID, False)

#Loop over all backpacks found and open them
result = stealth.GetFindedList()
stealth.AddToSystemJournal("Backpacks found:\t%d" %(stealth.FindCount()))
for bpID in result:
    stealth.UseObject(bpID)
    stealth.Wait(1000)
   
stealth.AddToSystemJournal("All Done")

I'm using Python 2.7 but this snippet should work in either Python 2.x or Python 3.x.

« Last Edit: November 04, 2013, 04:52:14 AM by slyone »
Started playing back at the Second Age

Offline Johnz125

  • Restricted
  • *
  • Posts: 2
  • Activity:
    0%
  • Reputation Power: 1
  • Johnz125 has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: [V6.1.3, Python] Script Snippet
« Reply #1 on: June 09, 2014, 11:58:42 PM »
0
A new knowledge for me the best.