HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem using handle vars.

09-30-2006, 12:25 PM#1
zeroXD
I have a knockback trigger, witch is supposed to push an attacked unit backwards and axelerate negatively. But somehow the stupid WE's syntax checker comes up with an error on every single line of jass in my map, and ive tried disabling the trigger and the error wont occur.

Heres the code:
Collapse JASS:
function Trig_testing_Conditions takes nothing returns boolean
    if ( not( GetUnitTypeId( GetAttacker() ) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_testing_Update takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit target=GetHandleUnit( t, "target" )
local real angle=GetHandleReal( t, "angle" )
local real dist=GetHandleReal( t, "dist" )
local location loc=PolarProjectionBJ( GetUnitLoc( target ), dist, angle )
    call SetUnitPositionLoc( target, loc )
    if ( dist<=0 ) then
        call FlushHandleLocals( t )
        call DestroyTimer( t )
    else
    call SetHandleInt( t, "dist", dist-0.2 )
    call RemoveLocation( loc )
    endif
set target=null
endfunction

function Trig_testing_Actions takes nothing returns nothing
local timer t=CreateTimer()
local unit target=GetTriggerUnit()
local real dist=20
local location loca=GetUnitLoc( GetAttacker() )
local location locb=GetUnitLoc( GetTriggerUnit() )
local real angle=AngleBetweenPoints( loca, locb )
    call RemoveLocation(loca)
    call RemoveLocation(locb)
    call SetHandleReal( t, "dist", dist )
    call SetHandleHandle( t, "target", target )
    call SetHandleReal( t, "angle", angle )
    call TimerStart( t, 0.033, true, function Trig_testing_Update )
endfunction

//===========================================================================

function InitTrig_testing takes nothing returns nothing
    set gg_trg_testing=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_testing, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition( gg_trg_testing, Condition( function Trig_testing_Conditions ) )
    call TriggerAddAction( gg_trg_testing, function Trig_testing_Actions )
endfunction

Its using kattanas handle vars, and i attach my map in case it is the implentation of the functions i have done wrong.
09-30-2006, 12:41 PM#2
Daelin
Collapse JASS:
function Trig_testing_Update takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit target=GetHandleUnit( t, "target" )
local real angle=GethandleReal( t, "angle" )

Watch out. In the last line you made a case-sensitivity mistake. It is GetHandleReal and not GethandleReal.

~Daelin
09-30-2006, 12:43 PM#3
zeroXD
Whoops, easy to do mistakes :p
Fixing now.

EDIT: No error now, but nothing happens (???), whats wrong now?
EDIT again...: The trigger was disabled, but when i enabled it and saved, the worldeditor got fatal error XD.
09-30-2006, 12:56 PM#4
Vexorian
hmnn you probably have another parse error, it is a pity that WEHelper doesn't stop World editor from parsing re-enabled triggers, cause it would prevent that crash, but if you use WEHelper you can then cut the contents of the trigger, enable the trigger, paste the contents again, save and you will get better syntax error messages (and no silly crashes)
09-30-2006, 01:51 PM#5
zeroXD
Done that, now i get an error from the syntax checker that the line
Collapse JASS:
call RemoveLocation( loc )
the syntax check says this
"Line 613: Invalid argument type (real)"

Erhem, whats going on?

If i remove or comment out that line the editor crashes again.
09-30-2006, 01:58 PM#6
blu_da_noob
Your problem is the line above it. You're trying to store a real with SetHandleInt.
09-30-2006, 02:44 PM#7
zeroXD
Thanks, alot.
Still why would the syntax checker tell me that the wrong line was wrong?
09-30-2006, 02:46 PM#8
Vexorian
if you used World Editor it is because it is lame

If you used WEHelper, you have a line with line breaks inside of a string above , replace the line breaks with \n
09-30-2006, 04:01 PM#9
moyack
I don't know if you're using JASSCRAFT or a tool like that. This software makes your life really easy.

I use JASS SHOP PRO, it has been the program that fits better my JASS needs.
09-30-2006, 04:05 PM#10
zeroXD
Well, i made it work, but still i think i should download that world editor hack with the good syntax checker... could be good to have now.
09-30-2006, 04:11 PM#11
moyack
Well, this is just my opinion, but I strongly suggest to write JASS code with JASS SHOP PRO, visually is more confortable, and this version has autocomplexion, which helps you to avoid those boring mispelling mistakes, and the syntax checker is really fast and reliable.
09-30-2006, 04:34 PM#12
zeroXD
I download jass shop pro then.
Out of what you are telling, i bet its better than KaTTaNas jass editor, witch i currently got.

Oh, yeah, this is a lot more comfortable to use, (i dled it) btw havent checked the syntax checker yet, but i will propably do some bi spelling mistakes and the check it out.