HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

expected name?

04-10-2004, 05:45 PM#1
-={tWiStÄr}=-
I always get this error message if i like disable my trigger then try to reenable it. even if its in the GUI. its also on lines that like have nothing to do with variables and they are directly written from the gui. so whats up? all the lines around it are fine also.
04-10-2004, 06:49 PM#2
fugly
well usually 1 error can cause lots of stuff that WE thinks are errors, maybe you made a typo somewhere, or miss-spelled some thing
My question is what is means by
Code:
Expected ' 
04-10-2004, 09:10 PM#3
-={tWiStÄr}=-
no typo, its directly from GUI all i did was change the globals to locals (and of course defined the local :D.)
04-10-2004, 09:15 PM#4
weaaddar
Hows about you give us the trigger where the error is located?
04-10-2004, 09:20 PM#5
-={tWiStÄr}=-
Code:
function Trig_Lightning_Storm_on_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Lightning_Storm_on_Func022A takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Lightning_Storm_on_Actions takes nothing returns nothing
    local group lightinggroup
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), GetUnitLoc(GetSpellAbilityUnit()), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), 250.00, 0), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), 0.00, 250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), -250.00, 0), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), 0.00, -250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), 250.00, 250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), 250.00, -250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), -250.00, 250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    call CreateNUnitsAtLoc( 1, 'u000', Player(0), OffsetLocation(GetUnitLoc(GetSpellAbilityUnit()), -250.00, -250.00), bj_UNIT_FACING )
    call GroupAddUnitSimple( GetLastCreatedUnit(), lightinggroup )
    [color=red]call TriggerSleepAction( ( I2R(GetUnitAbilityLevelSwapped('A00M', GetSpellAbilityUnit()) * 5.00 ) + 10.00 ) )[/color]
    call ForGroupBJ( lightinggroup, function Trig_Lightning_Storm_on_Func022A )
endfunction

//===========================================================================
function InitTrig_Lightning_Storm_on takes nothing returns nothing
    set gg_trg_Lightning_Storm_on = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Storm_on, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Lightning_Storm_on, Condition( function Trig_Lightning_Storm_on_Conditions ) )
    call TriggerAddAction( gg_trg_Lightning_Storm_on, function Trig_Lightning_Storm_on_Actions )
endfunction
red line is where i get the error.
04-10-2004, 10:51 PM#6
weaaddar
call TriggerSleepAction(GetUnitAbilityLevel(GetTriggerUnit(),'A00M')* 5.00 + 10.00 )

Try the line as that.
04-10-2004, 11:02 PM#7
Vexorian
And expected ' means expected ) , lol blizzard

Also twistar, on a side note, your trigger has like 100000 leaks, please remove the locations
04-10-2004, 11:11 PM#8
-={tWiStÄr}=-
what locations... without them it will like not make the units which is what the triggers all about... what do you mean?
and weaader all u changed was the getunitabilitylevelswapped to get unitabilitylevel and got rid of 1 ) but ill try it anyways. ill edit in a sec.
edit: nope didnt work.
04-11-2004, 01:58 AM#9
-={tWiStÄr}=-
lightning group isnt used anywhere else but i figured it out. if you ever get the error expected name... ignore it. i only get the error when i disable then enable a trigger. but now ive got 1 or 2 probs. i got it to work.. but only 1 of the units is created and its the first 1 also they never disapear. but it does work fine in the GUI version so im assuming when WE converts it screws something up. so now what im trying to do is implement my local into the GUI code. the line thats broken is
Code:
call ForGroup(lightninggroup, (RemoveUnit(GetEnumUnit()))
i know the prob is in the 2nd argument part because its supposed to be a callback and im like wtf o_O so i tried that and i get some argument void error. the way GUI does it is it calls another function that removes the unit but you cant do that with the custom script action so.. what do i do?
04-11-2004, 11:51 AM#10
jmoritz
The way you did it before (or the WE did it) is correct. You define a seperate function that removes the GetEnumUnit(), and use that in your call to ForGroup.

Code:
function Trig_Lightning_Storm_on_Func022A takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction
call ForGroup(lightninggroup, function Trig_Lightning_Storm_on_Func022A)

If it isn't creating the units in the first place, it can't remove them either, so you should be looking for a bug in the first part of your trigger, not the ForGroup part.

Also, the WE _always_ converts GUI to JASS code, and it never screws up (as far as I know). If it works in GUI, and you convert it to custom text, nothing changes, because WE _always_ converts it to custom text. You just don't get to see the JASS code if you don't ask for it (convert to custom text).

What Lord Vexorian meant was your are not using RemoveLocation at the end of your trigger. Every time you use GetUnitLoc, a location object is created. This takes up memory. If you don't call RemoveLocation, it never gets removed. Aftet playing your map for a while, you might notice memory usage of war3 going up (in process list in windows), resulting in slowdown. To prevent this, change your code like this:

Code:
local location unitloc = GetUnitLoc(GetSpellAbilityUnit())

call CreateNUnitsAtLoc( 1, 'u000', Player(0), unitloc, bj_UNIT blah etc etc
etc.

// at end of trigger:
call RemoveLocation(unitloc)
04-11-2004, 12:10 PM#11
AIAndy
You forgot to replace the GetUnitLoc stuff in the CreateUnits call with unitloc in your example code.
04-11-2004, 04:04 PM#12
-={tWiStÄr}=-
but i cant make it call from another function cause im using custom script. and will RemoveLocation(unitLoc) get rid of it for all the times i use it?
edit: ok im trying jass again... it should work...
edit2: oh and never mide the question about removelocation, i thought unitLoc was a function just saw it was local.
edit3: lol... 3 edits... well its not working. its translated directly from GUI except i replaced the whole GetUnitLoc function thing with unitLoc but it still only creates the 1 and never removes it.
edit4: theres comes an edit point when you start to feel stupid... hmm. well i found something else out. the prob only happens when i put the unit into the local group. when it's global theyre fine.
04-11-2004, 11:36 PM#13
AIAndy
You probably did not initialise the local group with CreateGroup()
04-12-2004, 12:28 AM#14
-={tWiStÄr}=-
Quote:
Originally Posted by AIAndy
You probably did not initialise the local group with CreateGroup()
oh.. well what i did to make it work (which i did) was made it = null so
local group lightninggroup = null
but CreateGroup() would work also?
04-12-2004, 10:58 AM#15
jmoritz
The correct way to do it is local group lightninggroup = CreateGroup(). GroupAddUnit probably creates the group if it is null, but not when uninitialized.