Learning Scopes! Syntax Error, Please help!

Beetlebomb

New Member
Reaction score
43
Hey guys, I did a forum search before posting this thread.

I have a problem very similar to this thread, but that thread was never able to solve the problem.

I'm using New Gen WE, and I'm saving my vJASS trigger with Ctrl+S, not TESH because I know it doesn't support it.

So, here's my trigger:

JASS:
scope ScopeName initializer RestoreHero // I get the error on this line saying: Unexpected " initializer RestoreHero ". When I try to save the map(using Ctrl+S).

private function Heal takes nothing returns nothing
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_MAX_LIFE, 9999.)
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_MAX_MANA, 9999.)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl", GetUnitX(gg_unit_H000_0000), GetUnitY(gg_unit_H000_0000))
endfunction

//===========================================================================
private function RestoreHero takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic( t, Player(0) )
    call TriggerAddAction( t, function Heal )
endfunction
endscope


That's all of it. And I can't for the love of god figure out this problem. I've PM'd people, i've checked tutorials. It seems like a simple problem with my World Editor, but I don't know what it could be. Anyone know?

Thank you,

Beetlebomb
 

Romek

Super Moderator
Reaction score
963
Is vJass enabled?
Is the default syntax checker disabled?

"That" thread isn't using the Jasshelper syntax checker. That's the default one...
 

Beetlebomb

New Member
Reaction score
43
There is an Option in the JassHelper Tab on my main WE window that says "Disable vJass Syntax" and I have that unchecked, so it should work.

@Flare:

I have only used scopes for this trigger on my map, and I put the 'endscope' at the end of the trigger I posted. ><



>Is the default syntax checker disabled?

Where's that?
 

Flare

Stops copies me!
Reaction score
662
Is vJass enabled?
Is the default syntax checker disabled?

"That" thread isn't using the Jasshelper syntax checker. That's the default one...

That'll only give "Expected: end of line" errors (just tested it there) :p

Where's that?
Grimoire menu, but I doubt that's your problem, since the WE syntax checker shouldn't even recognise the existence of initializers (and, hence, shouldn't give an error about them)
 

Beetlebomb

New Member
Reaction score
43
Yea, I got "Disable WE syntax checker' checked. You're right, that isn't the problem.

Hmmm... any other ideas?
 

Beetlebomb

New Member
Reaction score
43
Ok, it works without the scopes and private syntax's.

I tried it without an initializer and it gave no errors, but it didn't work in-game.

I tried it with an initializer and it still didn't work.


Here's what the trigger looks like right now:

JASS:
scope Hi initializer Restore

private function Heal takes nothing returns nothing
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_LIFE, 9999.)
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_MANA, 9999.)
    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl&quot;, GetUnitX(gg_unit_H000_0000), GetUnitY(gg_unit_H000_0000)))
endfunction

//===========================================================================
private function Restore takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic( t, Player(0) )
    call TriggerAddAction( t, function Heal )
endfunction

endscope


The trigger name on the left pane is Healing Hero
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
JASS:
scope Hi initializer Restore

private function Heal takes nothing returns nothing
    call BJDebugMsg(&quot;actions are working&quot;)
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_LIFE, 9999.)
    call SetUnitState(gg_unit_H000_0000, UNIT_STATE_MANA, 9999.)
    call DestroyEffect(AddSpecialEffect(&quot;Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl&quot;, GetUnitX(gg_unit_H000_0000), GetUnitY(gg_unit_H000_0000)))
endfunction

//===========================================================================
private function Restore takes nothing returns nothing
    local trigger t = CreateTrigger()
    call BJDebugMsg(&quot;Init is working&quot;)
    call TriggerRegisterPlayerEventEndCinematic( t, Player(0) )
    call TriggerAddAction( t, function Heal )
endfunction

endscope


Try it like that, and tell us if any messages do/don't get displayed.

What should happen is at map initialization, you will see a message "Init is working", and whenever you press escape "actions are working".
 

DrEvil

FCRI Associate!
Reaction score
111
Try saving the map , if you get any errors post them here if you dont , then its no problem.
The syntax checker only works for jass , and scopes are not jass they are vjass.

EDIT - Oh you've been saving it ... hmmm .... saving it normally , always works for me .
 

SFilip

Gone but not forgotten
Reaction score
634
Well, since the code you posted saves fine for me, I'm beginning to think that your newgen version is old. Are you using 1.5a found here?
 

Beetlebomb

New Member
Reaction score
43
Nope, I'm using 1.4d.

I'll go ahead and try to install 1.5a and let you know if all goes well!

Thank you; I have a strong feeling this might be it.


EDIT: PROBLEM FIXED! Many Thanks! Now I can begin to learn how to use vJass with no problems ^^
 

Charapanga

New Member
Reaction score
46
Well i have the same problem with my scope
JASS:
scope BlinkStrike initializer Init

globals
    private constant integer SpellID = &#039;A001&#039;
    private constant string SFX = &quot;Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl&quot;
    private constant string SFXUnit = &quot;Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl&quot;
    private constant real Damage = 90.00
    private constant real AOE = 200.00
    private constant damagetype DamageType = DAMAGE_TYPE_DIVINE
    private constant attacktype AtackType = ATTACK_TYPE_CHAOS
    private constant string animation = &quot;Attack 2&quot;
    private constant real Wait = 0.9
    private unit BlinkStrikeCaster
    private location BlinkStrikeInitPos
    private location BlinkStrikeTargetPoint
endglobals

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellID
endfunction

private function Actions takes nothing returns nothing
    set BlinkStrikeCaster = GetTriggerUnit()
    set BlinkStrikeInitPos = GetUnitLoc(BlinkStrikeCaster)
    set BlinkStrikeTargetPoint = GetSpellTargetLoc()
    call AddSpecialEffectLocBJ(BlinkStrikeInitPos, SFX )
    call DestroyEffect( GetLastCreatedEffectBJ() )
    call SetUnitPositionLoc(BlinkStrikeCaster, BlinkStrikeTargetPoint)
    call AddSpecialEffectTargetUnitBJ(&quot;chest&quot;, BlinkStrikeCaster, SFXUnit)
    call DestroyEffect( GetLastCreatedEffectBJ() )
    call UnitDamagePointLoc(BlinkStrikeCaster, 0.45, AOE, BlinkStrikeTargetPoint, Damage, AttackType, DamageType)
    call SetUnitAnimation(BlinkStrikeCaster, animation)
    call TriggerSleepAction(Wait)
    call SetUnitPositionLoc(BlinkStrikeCaster, BlinkStrikeInitPos)
    set BlinkStrikeCaster = null
    set BlinkStrikeInitPos = null
    set BlinkStrikeTargetPoint = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_BlinkStrike_Conditions ) )
    call TriggerAddAction( t, function Trig_BlinkStrike_Actions )
    set t = null
endfunction

endscope
i made it 5 minutes ago, and i'm getting syntax errors like there's no tomorow, i have Normal WE Syntax checker disabled, vJass Syntax enabled, Version 1.5 but it still gives me a 'Beep'-load of errors...
 

Charapanga

New Member
Reaction score
46
Yes, line one has over 5 syntax errors, that it's outside of function and all that, then all the globals have 3 errors that they are outside functions etc
and the line "Globals" has 2 errors that it's outside of function...
etc. etc. etc.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top