Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Python Moving Items

Ask for help
Post Reply
arul
Posts: 1
Joined: 10.08.2016 21:50

Python Moving Items

Post by arul »

Hello,

I'm experiencing the following problem while trying to move items via Python:

Code: Select all

for ore in [0x19B7, 0x19B8, 0x19B9, 0x19BA]:
    MoveItems(Backpack(), ore, -1, 0x4015AC5D, 0, 0, 0, 1000)
The problem is that no matter what delay I set via the last argument (tried even 10000), only half of the items are actually moved and this is printed in the journal:

Code: Select all

[21:39:45:540] System: System You must wait to perform another action.
[21:39:45:540] System: Some inspecific error when moving item! Code 5
[21:39:46:266] System: System You must wait to perform another action.
[21:39:46:266] System: Some inspecific error when moving item! Code 5
I've tried to do the move manually:

Code: Select all

def find_ore_items():
    found = []
    for ore in [0x19B7, 0x19B8, 0x19B9, 0x19BA]:
        FindType(ore, Backpack())
        found += GetFindedList()
    return found

for ore in find_ore_items():
    DragItem(ore, 0)
    Wait(2000)
    DropItem(0x4015AC5D, 0, 0, 0)
    Wait(2000)
Again, even if I set both Waits to something crazy high like 20000, this still appears in journal and only half of the items is moved:

Code: Select all

[21:42:24:703] System: System You must wait to perform another action.
[21:42:24:703] System: Some inspecific error when moving item! Code 5
[21:42:25:447] System: System You must wait to perform another action.
[21:42:25:447] System: Some inspecific error when moving item! Code 5
Conversely, if I try to execute this Pascal program:

Code: Select all

Program New;
  var ore: Array of Cardinal;
  var i: Integer;
begin
  ore := [$19B7, $19B8, $19B9, $19BA];
  for i := 0 to Length(ore) - 1 do
  begin             
    MoveItems(Backpack, ore[i], -1, $4015AC5D, 0, 0, 0, 800);   
  end;
end.
It executes just fine moving all the items from backpack to the target container.

I find this really weird, the Python API doesn't really do anything beyond invoking the native function via ctypes.

Any ideas? :)
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Python Moving Items

Post by Vizit0r »

will check it soon
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
innominee
Neophyte
Neophyte
Posts: 23
Joined: 13.08.2011 0:36
Contact:

Re: Python Moving Items

Post by innominee »

There is strange problems with delay in Python, including Wait() function. You can use time module :

Code: Select all

import time

time.sleep(5) ## In Seconds
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Python Moving Items

Post by Vizit0r »

innominee wrote:There is strange problems with delay in Python, including Wait() function. You can use time module :

Code: Select all

import time

time.sleep(5) ## In Seconds
bad recomendation. In this version of Stealth no need to use Sleep instead of Wait - events will not works in this case.
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
Post Reply