Author Topic: Help with pathfind character on ship?  (Read 7810 times)

0 Members and 1 Guest are viewing this topic.

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: Help with pathfind character on ship?
« Reply #15 on: November 14, 2010, 12:53:47 PM »
0
spoke too soon, it doesn't stop pathfinding...  :-[

Haha...... funny, I was typing my last post as you wrote this one.......... I must be clairvoyant!

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Help with pathfind character on ship?
« Reply #16 on: November 14, 2010, 12:57:14 PM »
0
spoke too soon, it doesn't stop pathfinding...  :-[

Haha...... funny, I was typing my last post as you wrote this one.......... I must be clairvoyant!

JaF

I had a typo... it works!!!
Code: [Select]
gosub movesouthofmast
sub movesouthofmast
repeat
    finditem ENX g_10  ;find tillerman within 10 tiles
    wait 20
until #findkind <> -1
    set %southofmastX #findx - 1
    set %southofmastY #findy - 3
repeat
    event pathfind %southofmastx %southofmasty
    wait 10
until #charposx = %southofmastx && #charposy = %southofmasty
    ;return
    halt


Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: Help with pathfind character on ship?
« Reply #17 on: November 14, 2010, 01:03:25 PM »
0
Ok, it works... but with your typo you at least experienced what "could" happen.  I still suggest the failsafe.  Your choice of course, its your code :)

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Help with pathfind character on ship?
« Reply #18 on: November 14, 2010, 01:09:49 PM »
0
hmmm, a failsafe.  *thinks* what could go wrong? or do you mean another check to see if char is in right location?

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: Help with pathfind character on ship?
« Reply #19 on: November 14, 2010, 01:18:38 PM »
0
hmmm, a failsafe.  *thinks* what could go wrong? or do you mean another check to see if char is in right location?


a fail safe would be an alternate way to get out of a repeat loop...  so until you fing the mast or until the timer is up  etc.  so if a recall failed then you wouldnt be stuck in that loop

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: Help with pathfind character on ship?
« Reply #20 on: November 14, 2010, 01:22:20 PM »
0
do #scnt  is the variable in uo that is the current time.  the first line below i add time to the current time to set a safety time.
the last line, the until line, i keep sending it to repeat that area of code until if does not find or ( || ) means or the preset time is reached.  25 = 25 seconds when doing timers... diff than wait 20

Code: [Select]
set %safety_timer_long #scnt + 25
repeat
if #menubutton = pause
gosub pause
cmpPix 1 f
{
gosub healpet
}
finditem %killit
until #findcnt < 1 || #scnt > %safety_timer_long


Offline seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Help with pathfind character on ship?
« Reply #21 on: November 14, 2010, 01:47:30 PM »
0
@ JaF:

 I missed your earlier post about the failsafe.  I can see the importance.  Better yet then, I'd want it to take me to the other side of the ship mast.... DOH!!!  Here we go again!


Thank you guys, I really appreciate your help.  Let me know if I can be of service.




Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: Help with pathfind character on ship?
« Reply #22 on: November 14, 2010, 02:08:21 PM »
0
Code: [Select]
set %safetytime #scnt + 15
repeat
    event pathfind %southofmastx %southofmasty #charposZ
    wait 10
until #charposx = %southofmastx && #charposy = %southofmasty || #scnt > %safetytime
set %safetytime #scnt + 15
repeat
     event pathfind %southofmastx1 %southofmasty1 #charposZ
     wait 10
until #charposx = %southofmastx1 && #charposy = %southofmasty1 || #scnt > %safetytime
if #charposx = ( %southofmastx1 && #charposy = %southofmasty1 ) || #charposx = ( southofmastx && #charposy = southofmasty )
   gosub NEXTSUB
else
 {
  Display You can not get to either of your preset pathfinding spots.  Script will now halt.
  halt
 }


You would have to set your %southofmastx1 and %southofmasty1 positions of course.  I would set them just below the line where you set the %southofmastx..... positions.

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Help with pathfind character on ship?
« Reply #23 on: November 14, 2010, 02:23:08 PM »
0
Thankyou JaF...  I think I will leave it how it is with the timeout only for now.  Only thing that could get in the way of my location I want to get to is a stray meteorite. I think.... *crosses fingers*  but I am glad to have learned that little tid-bit, because it will come in handy for future subs.

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: Help with pathfind character on ship?
« Reply #24 on: November 14, 2010, 02:38:05 PM »
0
:)  Good Luck!

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

Offline Oracle

  • Hero Member
  • *
  • Posts: 888
  • Activity:
    0%
  • Reputation Power: 14
  • Oracle barely matters.Oracle barely matters.
  • Gender: Male
  • We always want something that we cannot have...!
  • Respect: +97
  • Referrals: 3
    • View Profile
Re: Help with pathfind character on ship?
« Reply #25 on: November 14, 2010, 03:30:36 PM »
0
That is so great of you guys to help "Seeriusly".  You all seemed to jump right in there and give him a helping hand.  I am impressed at how responsive all you guys were too! 

OH and JaF -- I had that Avatar first!    :D  Pretty cool Avatar, isn't it!?   ;)

ORACLE
Get me a Straw...because I suck...!
PIXEL CRACK -- Love it! Crave it! Want it! Got to have it!

Offline JustAnotherFace

  • Hero Member
  • *
  • Posts: 530
  • Activity:
    0%
  • Reputation Power: 8
  • JustAnotherFace has no influence.
  • Gender: Male
  • My new toy....
  • Respect: +24
  • Referrals: 4
    • View Profile
Re: Help with pathfind character on ship?
« Reply #26 on: November 14, 2010, 03:40:20 PM »
0
That is so great of you guys to help "Seeriusly".  You all seemed to jump right in there and give him a helping hand.  I am impressed at how responsive all you guys were too! 

OH and JaF -- I had that Avatar first!    :D  Pretty cool Avatar, isn't it!?   ;)



Ooops LOL...I KNEW I stole that avatar from somewhere, just couldnt remember from where... I should of guessed it was from here! lol.... I will change it :) Sorry about that Oracle!

JaF
All that tyranny needs to gain a foothold is for people of good conscience to remain silent.
Thomas Jefferson

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: Help with pathfind character on ship?
« Reply #27 on: November 15, 2010, 02:42:55 PM »
0
using #findkind <> -1   is a bad habbit that seems to spread like the plaugue...

Although it works its not easy to make sense of...   better is to use #findcnt  (the count of the number of items found  0...x )

#findcnt > 0  = #findkind <> -1

just my 2cents.

 
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 seeriuslyTopic starter

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Help with pathfind character on ship?
« Reply #28 on: November 15, 2010, 04:25:30 PM »
0
wow it sounds so logical!  Thanks EN

Tags: