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
964
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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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