Author Topic: Dragging and Pathfinding  (Read 3968 times)

0 Members and 1 Guest are viewing this topic.

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Dragging and Pathfinding
« on: May 20, 2010, 06:11:17 AM »
0

I know that attempting to move while dragging an item is a good way to crash the client.  Can anyone tell me what the recommended waits should be on either side of a pathfind that has a drop/drag on either side of it?
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: Dragging and Pathfinding
« Reply #1 on: May 20, 2010, 08:20:32 AM »
0
how about looking for the item in the bag it was intended to be dropped in before leaving the sub or an increase in #findstack or #findcnt.  That would be the most stable across all diff connection speeds.  Just a diff way of thinking about it.

Maybe even uses the #lliftid or whatever the command is for if something is on the drag cursor still...
exevent dropc %place
while #(item still on cursor command) = 1
  wait 0

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: Dragging and Pathfinding
« Reply #2 on: May 20, 2010, 08:28:09 AM »
0
Won't exactly work with that while.... what happens if it's still on your cursor? You just wait 0 forever (or till you get discon'd).

Some type of a repeat check would be best I'd think...
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.

Scrripty

  • Guest
Re: Dragging and Pathfinding
« Reply #3 on: May 20, 2010, 09:00:44 AM »
0
Yea but that's the general idea.  The best way I think I've found for me at least, is to use a secondary script for looting.  And integrate it into the main script, so it's constantly looking for bodies.  Then have checks for healing and such.  And if your main script is performing an action, have the looting pause until it's finished.  Then I put in checks to make sure there's nothing on the cursor like C2 said.  And make sure the script doesn't try to move while there's an unignored body on the ground, and while you're looting.  I finally have got around to doing a basic looter, and it's amazing how tightly you can integrate it into another script if you're carefull.  My xhealer will xheal 2 chars, and attack spawn, and my looter will loot 99 percent of everything I want off of bodies while the script is healing/attacking without error.  I've had one crash while moving in about 2 weeks of farming in level 3 like spawn conditions...  That aint bad.  And it moves/fights/loots faster than anybody could ever do it by hand.  Script one:  Check for spawn, move to bodies, loot, move on a rail.  Script 2, xheal/attack spawn.  I think it works shockingly well. :)  The way I keep the speed up is by doing double checks for loot on body.  If I try to loot something, and a bandaid interrupts the looting, I check again to see if the item is still on the corpse.  So I never miss a thing.  Then the script pauses, lets the heal finish, then finishes looting.  You only have to pause for a split second while xhealing, so you can basically loot while xhealing if you use a "read/write" sort of check.  Sort of like in the waypoint pathfinder.  If someone wants an example I can post one.  It's pretty interesting stuff. heh  Hard to get perfect and keep speed and errors right.

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Re: Dragging and Pathfinding
« Reply #4 on: May 20, 2010, 09:10:32 AM »
0
The script I am working on doesn't work in an environment as chaotic as a looter in a spawn.  I am just making sure that I keep an NPC vendor within reach whilst dropping things on him. My current code positions the toon and starts the process. It does a check between drops to confirm the NPC is still within two tiles, and pathfinds if the NPC moves outside that check.  I had no wait in between the previous drop, the check, and the pathfind, if they were to all hit, and I think that was causing my occassional crashes.  The cursor-check/item-drop snippet check you are suggesting is probably a good way to bullet-proof the routine -- but my instinct is that a wait 10 in there might be plenty stable. 

However, it sounds like it should be possible to write a code snippet that confirms that you don't have anything on the cursor, and drops it (in your pack?) if you do, that would eliminate the crash issue in pretty much every potential application.  Any of you experts care to hazard a slice at the sub that makes that check?   While I am asking, is there a way to check if there is a booger on my cursor?
 
« Last Edit: May 20, 2010, 09:12:25 AM by Paulonius »
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Re: Dragging and Pathfinding
« Reply #5 on: May 20, 2010, 09:22:44 AM »
0
Maybe something like this?:

Code: [Select]
Sub Item_Drag_Check
Finditem #LLiftedID C_ , %Source
If #FindCnt > 0
    Return #True
Finditem #LLiftedID C_ , %Target
If #FindCnt > 0
    Return #True
exevent dropc %Source
Wait 15
Return #False

I would want it dropped back in the source (#Backpack) in this instance, but it might be preferable to drop it somewhere else in another context.  Using this I would only be initiating a wait if it really needed one.  I can also see wanting to loop back into the checks in some scenarios.  Wouldn't be that helpful in mine since the trigger for going here is that I can't reach the target, and in any event successfully hitting the target consumes the thing I am dragging...

My "booger on my cursor" question was me wondering whether there is anything in EUO that gives an indication that the cursor is carrying something.  

I suppose even more generally useful would be the two checks with a #False/#True return.  If it comes back #False I try the dropc and wait -- #True I am good to go into the pathfind.

Code: [Select]
Sub Item_Drag_Check
Finditem #LLiftedID C_ , %Source
If #FindCnt > 0
    Return #True
Finditem #LLiftedID C_ , %Target
If #FindCnt > 0
    Return #True
Return #False
« Last Edit: May 20, 2010, 09:28:56 AM by Paulonius »
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Scrripty

  • Guest
Re: Dragging and Pathfinding
« Reply #6 on: May 20, 2010, 11:11:51 AM »
0
Is there a way to get a vendor to stop moving?  Say... saying vendor buy?  Not sure that works, but worth a try.  Then you could go "vendor buy" he'd turn around and listen, right click the menu, and drag/drop your stuff on him?  I don't know if that works, but worth a try to see if they stop moving when engaged in a transaction...

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Re: Dragging and Pathfinding
« Reply #7 on: May 20, 2010, 12:08:35 PM »
0
Nail their shoes to the floor maybe?

They do stop moving for the most part while you are performing transactions.  After 20 or so transactions, they tend to take a step now and again. 
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

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: Dragging and Pathfinding
« Reply #8 on: May 20, 2010, 02:23:31 PM »
0
Just put a

Finditem %Vendor
if #findcnt > 0
{
While #finddist > 2
{
event pathfind #findx #findy #findz
wait 20
finditem %Vendor
}
}
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 PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Re: Dragging and Pathfinding
« Reply #9 on: May 20, 2010, 03:04:10 PM »
0
That is almost precisely the code that is crashing -- I have a wait 30 where you have a wait 20.

I believe it crashes when it tries to drop on the NPC, the NPC moves outside the two tiles, and then the script tries to follow the NPC too quickly after the drop.  I am betting a wait 10 before the pathfind would eliminate most crashes, but thought I would talk it through with folks to see if anyone had a better solution.


This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Scrripty

  • Guest
Re: Dragging and Pathfinding
« Reply #10 on: May 20, 2010, 03:21:01 PM »
0
No what you need is a repeat...until after the pathfind.  repeat.. until #charposx = #findx && #charposy = #findy.  Because the script continues to execute after the pathfind unless you force it to wait.  The while probly works but the repeat guarantees it works. :)

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: Dragging and Pathfinding
« Reply #11 on: May 20, 2010, 03:23:08 PM »
0
Then you will need excessive waiting when dropping.

Exevent drag #findid
wait 20
exevent dropc %Bod_Book
wait 20
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 PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +162
  • Referrals: 1
    • View Profile
Re: Dragging and Pathfinding
« Reply #12 on: May 20, 2010, 04:20:12 PM »
0
I think you guys are right. I looked at the code again and I don't have a conditional ending the pathfind, so the crash is almost certainly caused by the script still trying to pathfind while it goes to execute the next drop -- in which case the fix I was going to put in would accomplish nothing.

Thanks for the help gentlemen!
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

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: Dragging and Pathfinding
« Reply #13 on: May 20, 2010, 04:35:23 PM »
0
NO problem!
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 baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +11
  • Referrals: 5
    • View Profile
Re: Dragging and Pathfinding
« Reply #14 on: June 18, 2010, 05:25:24 PM »
0
If someone wants an example I can post one.  It's pretty interesting stuff. heh  Hard to get perfect and keep speed and errors right.

I would appreciate that, since that is close to my own project. Plus the item on cursor check. Oddly, you can cast heal with an object on cursor and last target, but not bandage. I think the cursor actually holds a ghost bandage while applying (but I AM a newb). I am suspending band-aid healing, but enabling cast healing during looting (once I get the conditions set better).

Tags: