Author Topic: fast & safe drag and drop sub  (Read 7164 times)

0 Members and 1 Guest are viewing this topic.

Offline NeoTopic starter

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
fast & safe drag and drop sub
« on: September 19, 2011, 07:34:13 AM »
0
Lagging out while drag and dropping was always a big crash cause for me...

So I wrote this sub, which I'm now using in my private miner and my lumber 1.0, to move stuff...

Code: [Select]
;Usage: gosub neo_dragdrop %itemtomove %bagtomoveto %amount (ex: gosub neo_dragdrop #findid #backpackid #findstack -> will move the whole stack of #findid to your backpack)

;======= drag and drop sub =======
sub neo_dragdrop
  namespace push
  namespace local neodragdrop
  set !item %1
  set !bag %2
  set !amount %3
  set !timeout1 #scnt2 + 10
  set !timeout2 #scnt + 6
  repeat
    event property !bag
  until Stones in #property
  set !initcnt #property
  exevent drag !item !amount
  exevent dropc !bag
  repeat
    repeat
      event property !bag
    until Stones in #property
    set !newcnt #property
  until !initcnt <> !newcnt || #scnt >= !timeout2
  if !initcnt = !newcnt
  {
    event macro 9 7
    wait 1
    nextCPos 776 577 ; change this to where you want the backpack to open
    event macro 8 7
    gosub gumpwait container_gump N/A #backpackid ; -> change this to your gumpwait sub
    wait 15
  }
  repeat
  until #scnt2 >= !timeout1
  namespace pop
return
;======= end sub =======

The idea here is using event property on the destination container, so that you can actually check for when the item is in fact moved to that container. If this happens before 1 second, it will wait until that second is up before moving on... If it takes more than 1 second, it will wait until the property changes on the destination container to move on... If this takes more than 6 seconds, it's probably some ghosting/lag issue, and it will reopen your backpack before moving on... This can also be changed to reopen some other container you're getting stuff from, if that's the case for you...

I found this pretty useful to avoid crashes while moving stuff due to lag issues...

Hope people can find this useful too...

cheers

neo
« Last Edit: September 19, 2011, 08:46:48 AM by frneo »
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: fast & safe drag and drop sub
« Reply #1 on: September 19, 2011, 08:33:42 AM »
0
Excellent... mind if i snag this into my libraries (I'll add a credit comment of course).

This is only for moving a container .. so i would also rename it  :)  Excellent.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline NeoTopic starter

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: fast & safe drag and drop sub
« Reply #2 on: September 19, 2011, 08:38:03 AM »
0
Excellent... mind if i snag this into my libraries (I'll add a credit comment of course).

This is only for moving a container .. so i would also rename it  :)  Excellent.

Yeah, this only for moving items from anywhere into containers, if that's what you meant... It's called "sub dragdrop" in my lumber, or something like that... Guess I should rename it here as well... Thanks for the tip...

And I wouldn't mind, you're free to use it as you want! :)

cheers

neo

EDIT: I forgot to mention... I found that the container you're moving stuff into must be visible on your screen, for the property to be properly set... For instance, if you're moving it to a container inside your home, that gets "invisible" to you after you recall somewhere and recall back home, then the property for that container won't be properly set, causing issues...
« Last Edit: September 19, 2011, 10:36:17 AM by frneo »
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: fast & safe drag and drop sub
« Reply #3 on: September 19, 2011, 05:57:00 PM »
0
Be sure to idiot proof it and have a check to make sure the destination container exists......
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: fast & safe drag and drop sub
« Reply #4 on: September 22, 2011, 04:37:28 AM »
0
I'm wondering if opening your paperdoll will initialize your backpack to get an accurate count of items?
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline NeoTopic starter

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: fast & safe drag and drop sub
« Reply #5 on: September 22, 2011, 06:57:39 AM »
0
I'm wondering if opening your paperdoll will initialize your backpack to get an accurate count of items?
I'm not sure I know what you mean...

To use finditem * C_ , #backpackid ?
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: fast & safe drag and drop sub
« Reply #6 on: September 22, 2011, 07:11:32 AM »
0
I was referring to the event macro 9 7 to open the backpack and then contpos it where you want it. What is the purpose of doing that? I assumed it was to refresh the count in the backpack??

That's why I was thinking that opening the backpack paperdoll would accomplish the same thing.
« Last Edit: September 22, 2011, 07:16:26 AM by Cerveza »
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline NeoTopic starter

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: fast & safe drag and drop sub
« Reply #7 on: September 22, 2011, 08:13:53 AM »
0
I was referring to the event macro 9 7 to open the backpack and then contpos it where you want it. What is the purpose of doing that? I assumed it was to refresh the count in the backpack??

That's why I was thinking that opening the backpack paperdoll would accomplish the same thing.
Oh... I don't know if opening the paperdoll refreshes your backpack...

Usually if you can't move an item after a few seconds, it's because of ghosting of that item inside your backpack, and the only way I know to get rid of that is by reopening the backpack...

The only thing I know about opening the paperdoll it that thing where the monsters will all target you when you open it...
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: fast & safe drag and drop sub
« Reply #8 on: September 22, 2011, 08:42:31 AM »
0
Item ghosting is a pain...

exevent dropc #backpackID usually drops it into the pack. I was thinking you were opening the backpack to get the item refresh on what's inside, if it's a ghosting issue then the paperdoll may not work.

I don't think toggling paperdoll attracts monsters any longer.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline MeWonUo

  • Hero Member
  • *
  • Posts: 913
  • Activity:
    0%
  • Reputation Power: 11
  • MeWonUo barely matters.MeWonUo barely matters.
  • Gender: Male
  • Respect: +85
  • Referrals: 1
    • View Profile
Re: fast & safe drag and drop sub
« Reply #9 on: September 22, 2011, 01:14:45 PM »
0
Item ghosting is a pain...

exevent dropc #backpackID usually drops it into the pack. I was thinking you were opening the backpack to get the item refresh on what's inside, if it's a ghosting issue then the paperdoll may not work.

I don't think toggling paperdoll attracts monsters any longer.

Paperdoll popping is still live and kicking.  Fantastic tool for champ spawns.

Offline rana70

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 2
    • View Profile
    • MyScripts
Re: fast & safe drag and drop sub
« Reply #10 on: October 09, 2011, 04:29:38 AM »
0
Hi,

I am not the expert here, but I guess this part of your SUB
without any extra wait command will cause a lot trouble
to higher ping (>70) users  ;)
Code: [Select]
...
  set !initcnt #property
  exevent drag !item !amount
  exevent dropc !bag
...

cu

Offline NeoTopic starter

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: fast & safe drag and drop sub
« Reply #11 on: October 09, 2011, 05:02:35 AM »
0
Actually, as long as the total wait time is 1 second, you don't need a pause between exevent drag and exevent dropc...

The lowest ping I get is 180 @ Atlantic, and this is the best way I found so far to avoid crashes! :)

If you get a chance, give this a go on shards where you have higher ping...

cheers!
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Tags: