"Invalid escape character sequence" is ?

Komaqtion

You can change this now in User CP.
Reaction score
469
Hi!
I was just wondering what this sentence means?
I get that error in this line in my attempt at starting to work with JASS:

local string e = "Abilities\Spells\NightElf\Taunt\TauntCaster.mdl"

What am I doing wrong ?

PS: Does any1 know how come i can't use CODE wrapping or any of those things, because it just don't seem to work. I can't even click those icons when im writing a reply... and I can either use the Quick reply button to reply to posts. i have 2 use the Quote button to be able to write posts
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
JASS:
local string e = "Abilities\Spells\NightElf\Taunt\TauntCaster.mdl"


Should be

JASS:
local string e = "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"


You must have double \ in the JASS strings if you're refering to "\".

Think of the first one as a "start" for the escape character sequence, the second one is the actual character you're using (break line would be \n for example instead of |n).
 

Komaqtion

You can change this now in User CP.
Reaction score
469
JASS:
local string e = "Abilities\Spells\NightElf\Taunt\TauntCaster.mdl"


Should be

JASS:
local string e = "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"


You must have double \ in the JASS strings if you're refering to "\".

Oh ok thanks you sooo much!!
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Ok but now i got an other error that i don't know what it means:
"Local declaration after first statement"

It refferes to these lines:

"loop
local integer i = 1
exitwhen i==4 <-- This one
local string e = "Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl"
local location loc = GetUnitLoc(GetTriggerUnit()) <-- This one
local location loco = OffsetLocation(loc,i*2,i*2) <-- This one
endloop <-- This one
endfunction"


BTW: Sorry for dubble post!!!!
 

SFilip

Gone but not forgotten
Reaction score
634

Komaqtion

You can change this now in User CP.
Reaction score
469
Ok thanks =)

Also...is there a function that is like polar offset as in GUI ??

EDIT: Sorry found it XD

But what is the local for a special effect?

And also, is there any none BJ functions to get last created unit/special effect ???
 

wraithseeker

Tired.
Reaction score
122
Yes, just convert it from GUI to Jass and you get it , but it is a BJ which alot people here don't really like for making code more efficent.

There is a native but I forgot which..
 

cleeezzz

The Undead Ranger.
Reaction score
268
misread
what do you mean "what is the local of a special effect?"
its a string?
if you want to avoid last create sfx, then set it as a variable. set sfx = AddSpecialEffect(blah,blah,blah) or just destroy it as you create it. call DestroyEffect(AddSpecialEfect(blah,blah,blah))
 

Komaqtion

You can change this now in User CP.
Reaction score
469
but if I create a special effect and then set it to a local, why do i use DestroyEffect(AddSpecialEffect()) ???
Why not use DestroyEffect(e)
where e is the variable set for the effect ?
will this create the effect as i set it to a variable ?

This is the trigger:
JASS:
function Spell_Check takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == &#039;0000&#039; ) ) then
        return false
    endif
    return true
endfunction

function Spell takes nothing returns nothing
local location l = GetUnitLoc(GetTriggerUnit())
local string s = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
call AddSpecialEffectLoc(s,l)
call DestroyEffect(GetLastCreatedEffectBJ())
call RemoveLocation(l)
set s = null
endfunction

function Effects takes nothing returns nothing
local integer i = 1
local string e = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
local location loc = GetUnitLoc(GetTriggerUnit())
local location loco = PolarProjectionBJ(loc,200.,i*90)
loop
exitwhen i==4
call AddSpecialEffectLoc(e,loco)
call DestroyEffect(GetLastCreatedEffectBJ())
call RemoveLocation(loc)
call RemoveLocation(loco)
set e = null
endloop
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_006 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_006 = CreateTrigger()
    call TriggerAddCondition(gg_trg_Untitled_Trigger_006,Condition(function Spell_Check))
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Untitled_Trigger_006,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(gg_trg_Untitled_Trigger_006,function Spell)
endfunction
 

SFilip

Gone but not forgotten
Reaction score
634
There is no point in having the effect variable if you're just going to destroy it right away.
And strings don't have to be nulled, but locations do.
And you probably don't want to use GetLastCreatedEffectBJ (or any GetLastWhatever) in Jass.
And your condition can be simplified like this:
JASS:
function Spell_Check takes nothing returns boolean
    return (GetSpellAbilityId() == &#039;0000&#039;)
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Then how am i supposed to destroy them??? (the effects i mean XD)
And am i supposed to remove the location first and then null it or what ?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
And as i asked before =), does this create the effect right also and then destroy it ?
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Yes. But not all effects are displayed, only those who have no animation names. Such as Thunder Clap, War Stomp, Taunt, Howl of Terror, etc.
 

Charapanga

New Member
Reaction score
46
Anything that returns something can be used to set the type variable the function returns, be it global, be it local, be it array...
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Not to mention that the above function won't work, since the native CreateUnit doesn't set bj_lastCreatedUnit, while the BJ-version does. :)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
So I'm just wondering, are these triggers quite efficient now then ?

JASS:
function Spell_Check takes nothing returns boolean
    return (GetSpellAbilityId() == &#039;0000&#039;)
endfunction

function Spell takes nothing returns nothing
    local location l = GetUnitLoc(GetTriggerUnit())
    local string s = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
    call DestroyEffect(AddSpecialEffectLoc(s,l))
    call RemoveLocation(l)
    set l = null
endfunction

function Effects takes nothing returns nothing
local integer i = 1
local string e = &quot;Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl&quot;
local location loc = GetUnitLoc(GetTriggerUnit())
local location loco
loop
exitwhen i==4
set loco = PolarProjectionBJ(loc,200.,i*90)
call DestroyEffect(AddSpecialEffectLoc(e,loco))
call RemoveLocation(loc)
call RemoveLocation(loco)
set i = i+1
endloop
set i = 0
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_006 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_006 = CreateTrigger()
    call TriggerAddCondition(gg_trg_Untitled_Trigger_006,Condition(function Spell_Check))
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Untitled_Trigger_006,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(gg_trg_Untitled_Trigger_006,function Spell)
endfunction


JASS:
function Trig_Untitled_Trigger_006_Actions takes nothing returns nothing
local string e = &quot;Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl&quot;
local integer i = (&#039;Hpal&#039;)
local location l = (GetRectCenter(GetPlayableMapRect()))
local unit u = (CreateUnitAtLoc(Player(0),i,l,bj_UNIT_FACING)) 
call PanCameraTo((GetLocationX(l)),(GetLocationY(l)))
call RemoveLocation (l)
call TriggerSleepAction(5.)
set l = GetUnitLoc(u)
call DestroyEffect(AddSpecialEffectLoc(e,l))
call RemoveLocation (l)
set l = null
set i = 0
set u = null
endfunction
//===========================================================================
function InitTrig_UntitledTrigger006 takes nothing returns nothing
    set gg_trg_UntitledTrigger006 = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_UntitledTrigger006, 1.0)
    call TriggerAddAction( gg_trg_UntitledTrigger006, function Trig_Untitled_Trigger_006_Actions )
endfunction


EDIT: But how do i pan the camera for only player red, without BJ:s ?
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top