• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Expected End Of Line Error

Status
Not open for further replies.
Level 3
Joined
Feb 21, 2005
Messages
26
hey, I just started learning Jass yesterday and i need help with why my if statements keep giving me a End Of Line Error.

JASS:
function Trig_Up_Sides takes nothing returns nothing
        //If the unit wasnt in a location where you could move to 4 locations it looks for locations with 3 movements
    local region Region
    local integer i=10//location checker
    local integer x=0

        loop
    set Region = udg_Location[x]
    set x=x+1   
            exitwhen x==5
                endloop

            loop
        set Region = udg_Location[i]
        set i=i+6
                exitwhen i==136 
                    endloop
endfunction
function Trig_Up_Actions takes nothing returns nothing
    local region Region
    local integer i=11//location checker
    local integer x=15//for 3 space regions they go from x1-x5 when it reaches this it will tell i to add 6 to it
    set udg_CurrentLocation[GetConvertedPlayerId(GetTriggerPlayer())] = GetTriggeringRegion()
     
        loop
    set Region = udg_Location[i] 
//Looks for locations that can move 3 spaces
                                                                  //////////////////////////////////
if i==x then set i=i+ set x=x+10 else endif          //Error! Expected End Of Line//
    set i=i+1                                                 //////////////////////////////////
            exitwhen    i==145
                endloop                                                                                                                                   
if udg_CurrentLocation[GetConvertedPlayerId(GetTriggerPlayer())] != Region then call 
TriggerAddAction( gg_trg_Up, function Trig_Up_Sides ) else  endif   //Error! Expected End //Of Line
endfunction                                                                                                                                             

//===========================================================================
function InitTrig_Up takes nothing returns nothing
    set gg_trg_Up = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Up, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction( gg_trg_Up, function Trig_Up_Actions )
endfunction
 
Level 11
Joined
Jul 12, 2005
Messages
764
Is this only a problem with the JASS-tags, or is your script a mess?
JASS:
loop
    set Region = udg_Location[i]
    if i==x then
        set i=i+    //You missed somthing here!!
        set x=x+10
    else
    endif
    set i=i+1
    exitwhen    i==145
endloop
if udg_CurrentLocation[GetConvertedPlayerId(GetTriggerPlayer())] != Region then
    call TriggerAddAction( gg_trg_Up, function Trig_Up_Sides )
else
endif

EDIT
Ok, i see the jass-tags are working well, so clean up your script!
 
Level 3
Joined
Feb 21, 2005
Messages
26
After trying that i get
expected 'then'
expected 'endif'
expected 'endif'
expected 'endif'

on the first if statement the then line and the endif line
and on the second if statement
expected 'then'
expected 'endif'
expected 'endif'
expected 'endif
with the then error on the if and the endif on the if the then and the endif line
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Your "if" uses are messed up. . .
THIS IS NOT ENGLISH THIS IS JASS!
You must clearly use line breaks when using if commands to tell the interpreter exlactly WHERE the imput ends for the if and where the if action ends.

JASS:
function Trig_Up_Sides takes nothing returns nothing
    local region Region
    local integer i=10
    local integer x=0
    loop
        set Region = udg_Location[x]
        set x=x+1 
        exitwhen x==5
    endloop
    loop
        set Region = udg_Location[i]
        set i=i+6
        exitwhen i==136 
    endloop
endfunction

function Trig_Up_Actions takes nothing returns nothing
    local region Region
    local integer i=11
    local integer x=15
    set udg_CurrentLocation[GetConvertedPlayerId(GetTriggerPlayer())] = GetTriggeringRegion()
    loop
        set Region = udg_Location[i] 
        if i==x then
            set x=x+10
        endif
        set i=i+1
        exitwhen i==145
    endloop 
    if udg_CurrentLocation[GetConvertedPlayerId(GetTriggerPlayer())] != Region then
        call TriggerAddAction( gg_trg_Up, function Trig_Up_Sides )
    endif
endfunction 

function InitTrig_Up takes nothing returns nothing
    set gg_trg_Up = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Up, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddAction(gg_trg_Up, function Trig_Up_Actions)
endfunction

Hope you this passes the syntax check since I have not tested it although it should.

AND SEE THEN JASS TAGS DO WORK!!!!!!
But for some reason paskovich your script is not showing as jassed. . .
Seems the jass thing is bugged since it is not indenting properly when I have told it to.
Well it seems the indenting is fixed but "line breaks" are not excepted outside the functions. . .
 
Last edited:
Status
Not open for further replies.
Top