Хе Хе. Вот так изврат o_0 "Quest Arrow"
Posted: 2005-04-11 18:41:38
Code: Select all
sub SmartTracking()
################################################################################################
# Script using a quest arrow for navigating in the world. Add your points at customise section.#
################################################################################################
var fType, k=0, num=0, dist_temp=0, distance=999999999999
################## Customise section ###########################################################
# Here you can specify a "command" to turn on a tracker and your points of interest o_0 #
################################################################################################
var TLen=2 # The length of type's specification
var TRACK_BY_TYPE="Tr_N" # The text that your char must say to activate tracker.1st will search
var TRACK_BY_NAME="Tr_L" # nearest type of label(like Banks, BS etc.).2nd search by its name. 3rd
var TRACK_BY_ObjN="Tr_O" # track object.So try to give a different names for your points.
var quantity=2 # The quantity of your points(labels).Modify next ???[?] equally to q.
dim lblT[2], lblN[2], crdX[2], crdY[2]
uo.print('Loading map coordinates...')
lblT[1]="BS" # Type of point
lblN[1]="Minoc Forgery" # Name of point
crdX[1]=2473 # X coord
crdY[1]=569 # Y coord
lblT[2]="BK"
lblN[2]="Minoc Bank"
crdX[2]=2504
crdY[2]=560
uo.print('Done.')
################################################################################################
uo.DeleteJournal()
while not uo.Dead()
################## Track Nearest By Type #######################################################
if uo.inJournal(TRACK_BY_TYPE) then
fType=Right(uo.Journal(uo.InJournal(TRACK_BY_TYPE)-1), TLen)
uo.DeleteJournal()
for k=1 to quantity
if fType==lblT[k] then
dist_temp=(crdX[k]-uo.getX())*(crdX[k]-uo.getX()) + (crdY[k]-uo.getY())*(crdY[k]-uo.getY())
if dist_temp<distance then
num=k
distance=dist_temp
end if
end if
next
distance=999999999999
uo.print("Nearest " + lblT[num] + " is " + lblN[num] + " at " + \
str(crdX[num]) + " " + str(crdY[num]))
uo.track(1,crdX[num],crdY[num])
end if
################## Track By Name(Label) ########################################################
if uo.inJournal(TRACK_BY_NAME) then
fType=Mid(uo.Journal(uo.InJournal(TRACK_BY_NAME)-1), 2*Len(uo.GetName())+3, \
Len(uo.Journal(uo.InJournal(TRACK_BY_NAME)-1))-2*Len(uo.GetName())+3)
uo.DeleteJournal()
for num=1 to quantity
if fType==lblN[num] then
uo.print(lblN[num] + " is " + lblT[num] + " and can be found at " + \
str(crdX[num]) + " " + str(crdY[num]))
uo.track(1,crdX[num],crdY[num])
end if
next
end if
################## Track object ################################################################
if uo.inJournal(TRACK_BY_ObjN) then
fType=Mid(uo.Journal(uo.InJournal(TRACK_BY_ObjN)-1), 2*Len(uo.GetName())+3, \
Len(uo.Journal(uo.InJournal(TRACK_BY_ObjN)-1))-2*Len(uo.GetName())+3)
uo.DeleteJournal()
if IsNumber(fType) then
uo.print("Tracking " + str(fType) + ". To stop tracking just say: " + str(fType))
else
uo.print("Tracking " + fType + ". To stop tracking just say: " + fType)
end if
while not uo.inJournal(fType) and not uo.Dead()
uo.track(fType)
wait(500)
wend
uo.track(0)
end if
################## Stop tracker when reached the place #########################################
if uo.getX()==crdX[num] and uo.getY()==crdY[num] then
uo.track(0)
end if
################################################################################################
wait(500)
wend
uo.print("Probably you are dead. An arrow will point to your body." + \
" Script[SmartTracking] is terminated!")
uo.track(1,uo.getX(),uo.getY())
end sub
Я бы сделал через чтение из файла, но мороки столько... и невозможно это по причине нехватки нужных вещей в скриптовом модуле =) Хоть бери и переписывай его для себя =))
Ах да забыл совсем. Пользование:
(say) Tr_N BS (Track Nearest BlackSmith)
(say) Tr_L Minoc Bank (Track Minoc Bank)
(say) Tr_O Lost_Soul (Track player Lost_Soul. Add his serial before you use this command)
(say) Tr_O 0x0000D1FD (Track Object with serial 0x0000D1FD. Same as previous)