• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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,258
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