

Зарание спасибо
Moderators: Murderator+, Murderator
Code: Select all
;==================================
; Script Name: RKSpotAutoWalker.txt
; Author: Roadkill
; Version: 1.1
; Client Tested with: 4.0.3d
; EUO version tested with: build 0093
; Shard OSI / FS: OSI
; Revision Date: 15Jul04
; Public Release: 10Jul04
; Global Variables Used: none
; Purpose: Auto or manual long-distance pathfinding to a spot with continuous
; distance & direction-arrow. If auto enabled (3rd param #true) it
; AUTO-PATHFINDS no matter how far the spot is! Autosenses if called
; or standalone andadjusts. Auto-unblocks. Auto-adjusts for hills.
;==================================
;Instructions: Can be run standalone or "called", it autosenses. If called, use:
;example: call RKSpotAutoWalker.txt xcoord ycoord <#true/#false, autowalk?> <use menu?T/F>
;--where xcoord/ycoord are where you want to go, 3rd param enables autowalk if #true
; or if #false just gives continuous direction and distance and you manually walk there.
; The 4th param #true/#false is whether to use the menu, #true uses it. This is for
; those using this CALLED as a plugin who have their own menu.
set %mapxcoord %1
set %mapycoord %2
set %autoSpotWalk %3
set %useSAWmenu %4
set %SWexitCmd exit
set %symbols щьшюъэчыN
set !zfix 15
if %0 = 0 || %0 = n/a
{
initevents
set %autoSpotWalk #true
set %mapxcoord #charposx
set %mapycoord #charposy
set %SWexitCmd halt
set %useSAWmenu #true
gosub SAWmenu
display ok Demo-Mode. This is your spot, we'll pathfind back here.$
+ Now run like hell off somewhere and then hit PLAY
pause
}
set %autoWalkMsg go-auto
if %autoSpotWalk
set %autoWalkMsg go-manual
if %useSAWmenu
gosub SAWmenu
set !ptime #scnt + 3
set !oldx #charposx
set !oldy #charposy
set !pathfindFailures 0
gosub AlwaysRun
sawloop:
if #menubutton = ToggleAutoWalk
gosub ToggleAutoWalk
gosub DistToSpot %mapxcoord %mapycoord dist
gosub FindThingsDir %mapxcoord %mapycoord spotdir
set !picksymbol %spotdir + 1
str mid %symbols !picksymbol 1
menu set textdist %dist
menu set textsymbol #strres
if %dist = 0
{
wait 10
%SWexitCmd
}
if ! %autoSpotWalk
goto sawloop
if #charposx = !oldx && #charposy = !oldy && #scnt > !ptime
gosub unblock %spotdir
if #scnt > !ptime
{
set !ptime #scnt + 3
set !oldx #charposx
set !oldy #charposy
}
gosub GetPathFindingWaypoint %mapxcoord %mapycoord 5 waypointx waypointy
deletejournal
event pathfind %waypointx %waypointy #charposz
wait 5
scanjournal 1
if get_there in #journal
{
set !pathfindFailures !pathfindFailures + 1
set !zfix !zfix * -1
set !waypointz #charposz + !zfix
;double the vertical offset after 3 pathfind failures
if !pathfindFailures > 3 3
set !waypointz !waypointz + !zfix
event sysmessage adjusting zfix
wait 10
deletejournal
event pathfind %waypointx %waypointy !waypointz
wait 5
scanjournal 1
}
if pathfinding in #journal
set !pathfindFailures 0
goto sawloop
;==============
sub SAWmenu
menu Clear
menu Window Size 100 100
menu Font Name Wingdings
menu Font Size 30
menu Font Style b
menu Font Color red
menu Font Transparent #false
menu Font Align Left
menu Text textsymbol 0 0 -
menu font size 10
menu font name ariel
menu text text1 0 70 distance:
menu text textdist 0 85 %dist
menu button ToggleAutoWalk 0 55 85 15 %autoWalkMsg
menu show
return
;===========
SUB FindThingsDir
;ver 1.2 10Jul04 by Roadkill
;purpose: find the direction from you that a thing is
;%1= #findx of object, it's UO world coord
;%2=#findy of object, it's UO world coord
;%3= the name of the return var, i.e. 'dir', 'thingsdirection' by default
;%3 holds its dir from you 0-nw 1-n 2-ne 3-e 4-se 5-s 6-sw 7-w 8-sametile
;* @example call rksubs.txt FindThingsDir %mapxcoord %mapycoord spotdir
SET !itsX %1
SET !itsY %2
if %0 < 3
set %3 thingsdirection
IF !itsX = #charposx && !itsY < #charposy
SET % . %3 1 ;N
IF !itsX > #charposx && !itsY < #charposy
SET % . %3 2 ;NE
IF !itsX > #charposx && !itsY = #charposy
SET % . %3 3 ;E
IF !itsX > #charposx && !itsY > #charposy
SET % . %3 4 ;SE
IF !itsX = #charposx && !itsY > #charposy
SET % . %3 5 ;S
IF !itsX < #charposx && !itsY > #charposy
SET % . %3 6 ;SW
IF !itsX < #charposx && !itsY = #charposy
SET % . %3 7 ;W
IF !itsX < #charposx && !itsY < #charposy
SET % . %3 0 ;NW
IF !itsX = #charposx && !itsY = #charposy
SET % . %3 8 ;same tile
RETURN
;=========================
;**
;* @name DistToSpot
;* @author Roadkill
;* @ver 1.0 10Jul04
;* @purpose find the distance between you and a spot
;* @params %1= spot xcoord, required
;* %2= spot ycoord, required
;* @%3= the var to return the distance in
;* @returns: @%3 holds distance
;* @example call rksubs.txt DistToSpot %mapxcoord %mapycoord dist
;* @status
Sub DistToSpot
set !_xDist ( #charposx - %1 ) abs
set !_yDist ( #charposy - %2 ) abs
set % . %3 !_ydist
if !_xdist > !_ydist
set % . %3 !_xdist
return
;===========================
;**
;* @name GetPathFindingWaypoint
;* @author Roadkill
;* @ver 1.0 10Jul04
;* @purpose picks a "waypoint" some distance towards a final spot you're working to.
;* if incremental distance > 11, 11 is used, if dist <= 11 the spot itself returned
;* @params %1= spot xcoord, required
;* %2= spot ycoord, required
;* %3 = the distance from you to pick the waypoint, 11 is max
;* @%4= the var to return waypoint x coord
;* @%5= the var to return waypoint y coord
;* @returns: @%4 and %5
;* @example call rksubs.txt GetPathFindingWaypoint %mapxcoord %mapycoord 5 waypointx waypointy
;* @status
sub GetPathFindingWaypoint
if %3 > 11
set %3 11
if abs ( #charposx - %1 ) <= 11 && abs ( #charposy - %2 ) <= 11
{
set % . %4 %1
set % . %5 %2
return
}
set % . %4 #charposx - %3
if #charposx < %1
set % . %4 #charposx + %3
if #charposx = %1
set % . %4 #charposx
set % . %5 #charposy - %3
if #charposy < %2
set % . %5 #charposy + %3
if #charposy = %2
set % . %5 #charposy
return
;==========
sub Unblock
;%1 is %spotdir
event sysmessage unblocking!
wait 10
set !revdir %1 - 4
if %1 < 4
set !revdir %1 + 4
event macro 5 !revdir
wait 1
event macro 5 !revdir
if !revdir >= 2
set !revdir !revdir - 2
else
set !revdir !revdir + 2
event macro 5 !revdir
wait 1
event macro 5 !revdir
return
;=========
SUB AlwaysRun
;purpose: ensure that always run is toggled on
EVENT MACRO 32 0
WAIT 2
IF now_on IN #SYSMSG
RETURN
EVENT MACRO 32 0
RETURN
;===========
sub ToggleAutoWalk
;changes %autospotwalk and %autowalkmsg, assumes they are global
set #menubutton n/a
if %autoSpotWalk
{
set %autoSpotWalk #false
set %autoWalkMsg go-auto
}
else
{
set %autoSpotWalk #true
set %autoWalkMsg go-manual
}
menu set ToggleAutoWalk %autoWalkMsg
return
;======end of RKSpotAutoWalker.txt============
;ver 1.1 added go-auto/manual button
Code: Select all
set %symbols щьшюъэчыN
SLAK wrote:Хе-хе...
Если б я ещё хоть чтото понимал в изе![]()
Зы: 6 строка рабочего кода, это она так и выгядит?Code: Select all
set %symbols щьшюъэчыN
Edred wrote:А по поводу первого - язык в Изе еще проще чем в инжекте...
;Instructions: Can be run standalone or "called", it autosenses. If called, use:
;example: call RKSpotAutoWalker.txt xcoord ycoord <#true/#false, autowalk?> <use menu?T/F>
;--where xcoord/ycoord are where you want to go, 3rd param enables autowalk if #true
; or if #false just gives continuous direction and distance and you manually walk there.
; The 4th param #true/#false is whether to use the menu, #true uses it. This is for
; those using this CALLED as a plugin who have their own menu.
Code: Select all
call RKSpotAutoWalker.txt xcoord ycoord <#true/#false, autowalk?> <use menu?T/F>
Code: Select all
; Процедура перемещения чара для скриптов инжекта
; Считывает все параметры из регистри
;
; v.1.03 (c) Edred, переделка под RKSpotAutoWalker
;
initevents
set *1 0
set *2 0
loop:
if *1 <> 0
{
wait 2
call RKSpotAutoWalker.txt *1 *2 #true #false
set *1 0
}
goto loop
Code: Select all
Auto-fighting/killing of victims. Auto Defends if attacked. Can be run as plugin or standalone. Many tactics choices, including various magery, necro, all melee skills, peace combos, pets, pets with peace, pets with magery, etc. Script also works with Roadkill's HealthWatch to keep you healed while it fights.
Edred wrote:Изи - очень сильная штучка. Гораздо сильнее каждого компонента по отдельности или любых других комбинаций скриптовых утилит.