



Moderators: Murderator+, Murderator
Code: Select all
sub VagrantTamer()
var i, j, config = file( "forest.dat" ) ; файл с координатами
var animals_count = 1 ; количество животных
DIM animals[ val( str( animals_count ) ) ]
; список типов животных, которых тамим
animals[ 0 ] = "0x0000"
config.open()
var counter = config.readNumber()
DIM wx[ val( str( counter ) ) ]
DIM wy[ val( str( counter ) ) ]
i = 0
while not config.eof()
wx[ i ] = config.readNumber()
wy[ i ] = config.readNumber()
i = counter + 1
wend
config.close()
repeat
for i = 0 to counter -1
uo.setGlobal( "walk_x", str( wx[ i ] ) )
uo.setGlobal( "walk_y", str( wy[ i ] ) )
uo.exec( "run_walker" )
while uo.getGlobal( "walk_runned" ) == "true"
for j = 0 to animals_count -1
uo.findtype( animals[ j ], "-1", "ground" )
if uo.findcount() then
j = animals_count -1
stop_walker()
Walker( uo.getX( 'finditem' ), uo.getY( 'finditem' ), 2 )
tame( uo.getSerial( 'finditem' ) )
endif
next
wait( 100 )
wend
next
until false
endsub
Sub run_walker()
uo.setGlobal( "walk_runned", "true" )
Walker( val( uo.getGlobal( "walk_x" ) ), val( uo.getGlobal( "walk_y" ) ), 3 )
uo.setGlobal( "walk_runned", "false" )
endsub
Sub stop_walker()
uo.exec( "terminate run_walker" )
wait( 200 )
uo.exec( "terminate run_walker" )
wait( 200 )
uo.exec( "terminate run_walker" )
wait( 200 )
uo.setGlobal( "walk_runned", "false" )
endsub
Sub walker( x, y, prec )
; любой волкер с обходм препятствий
endsub
Sub tame( animal_id )
; лениво писать
endsub
Code: Select all
кол-во_строк
X Y
X Y
Code: Select all
var animals_count = 1 ; количество животных
DIM animals[ val( str( animals_count ) ) ]
Scripts Writer wrote:Code: Select all
var animals_count = 1 ; количество животных
DIM animals[ val( str( animals_count ) ) ]
Перевод переменной в строку, а затем опять в переменную или в целочисленное значение?
В Си никак нельзя было кол-во элементов массива определить чем либо кроме константы. Здесь по другому?