Xoniks
offline
Опыт:
1,858Активность: |
Что у меня тут неправильно?? и есть ли где утечки?
» код
((код jass
function time takes nothing returns nothing
local timer t = GetExpiredTimer( ) local integer tkey = GetHandleId( t ) call FlushChildHashtable(Hash, tkey) call DestroyTimer(t) set t=null endfunction function Trig_Creep_Actions takes nothing returns nothing local unit u local integer i local integer j = 0 local timer t = CreateTimer( ) loop exitwhen j == 5 set i = 0 call TimerStart(t, 2., false, function time) j = j+1 loop exitwhen i == 2 call CreateNUnitsAtLoc( 1, Creep[1], Player(12), left , 270.00 ) u = GetLastCreatedUnit() call IssuePointOrderLoc(u, "attack", resp) call CreateNUnitsAtLoc( 1, Creep[1], Player(12), right , 270.00 ) u = GetLastCreatedUnit() call IssuePointOrderLoc(u, "attack", resp) i=i+1 endloop endloop set u = null endfunction )) мне надо чтобы цикл повторился 5 раз с задержой 2 сек но что то не получается |
27.02.2012, 09:24 | #1
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Ty3uK
offline
Опыт:
2,469Активность: |
Xoniks, зачем таймер?
Ty3uK добавил: Xoniks, таймер явно был не нужен, переписал, убрав бж: » Code Код:
|
27.02.2012, 09:52 | #2
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
quq_CCCP
Я белый и пушистый!
offline
Опыт:
94,598Активность: |
Xoniks, а откуда ты взял локации Left Right и resp? они неописаны как локальные, и нету udg_ следовательно они не глобальные. Утечки самое собой есть, так как используем бж функции и локации, а это не лучший вариант. Не могу понять нафиг тебе таймер и откуда ты взял хеш-таблицу? и зачем ты очищение её если ты не связал с таймером не одного объекта? Этот кусок кода нечего не делает кроме засорение памяти, вдобавок ты инициализировал хеш таблицу? Отредактировано quq_CCCP, 27.02.2012 в 10:06. |
27.02.2012, 10:01 | #3
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Nerevar
I'll be back!
offline
Опыт:
18,352Активность: |
Следовательно они глобальные и созданы в globals\endglobals |
27.02.2012, 10:02 | #4
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
quq_CCCP
Я белый и пушистый!
offline
Опыт:
94,598Активность: |
Nerevar, чёта я Globals endglobals не вижу... возможно именно из за этого ошибки? |
27.02.2012, 10:07 | #5
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Ty3uK
offline
Опыт:
2,469Активность: |
quq_CCCP, это может быть в кастом коде карты
|
27.02.2012, 10:17 | #6
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Xoniks
offline
Опыт:
1,858Активность: |
quq_CCCP, left, right, resp созданы в отдельном триггере udg там не нужен, а что использовать вместо локаций?
Xoniks добавил:
Ty3uK, таймер нужен что бы цикл внутри цикла повторялся через каждые 2 сек пока j не станет равной 5, и у тебя в коде "attack" записан в виде ID где посмотреть для всех приказов ID? Xoniks добавил:
» код
((код jass
globals hashtable Hash = InitHashtable( ) integer array Creep integer array itemid integer array itemcount integer index location left = Location( -2180, 4777 ) location right = Location( 2180, 4777 ) location resp = Location( 0, -6255 ) endglobals )) вот глобалки |
27.02.2012, 11:28 | #7
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Ty3uK
offline
Опыт:
2,469Активность: |
Xoniks, проверить не могу, накатал на коленке:
» Code Код:
Ty3uK добавил: » ID's Код:
|
27.02.2012, 11:39 | #8
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Faion
Noblesse Oblige
offline
Опыт:
30,395Активность: |
Я не пойму, координаты использовать религия не позволяет?
// Или опыт работы с jass? © Sc Отредактировано ScorpioT1000, 27.02.2012 в 13:54. |
27.02.2012, 13:19 | #9
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
Xoniks
offline
Опыт:
1,858Активность: |
Опыт работы, cJass я пока не трогал. vJass на нем понятней мне, а как с координатами сделать не напишешь? |
27.02.2012, 15:35 | #10
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|
BuxProf
БухПроф
offline
Опыт:
308Активность: |
Вместо применения локаций (left/right), используй напрямую их координаты.
Для каждой функции, которая требует точку, есть аналог с координатами (За исключением GetLocationZ, но возможно, есть и другие)
|
29.02.2012, 17:26 | #11
+0/−0
Профиль |
Приват |
Поиск |
Цитата |
IP: Записан
|