Script load failed: Syntax error when map starts?

Komaqtion

You can change this now in User CP.
Reaction score
469
Hello!

I just started scripting in the Galaxy language and I'm having some trouble with importing the files with the script inside it.
I followed this tutorial to try and start, but I also made my own trigger for a spell I had in mind (just a Blink spell with some AoE damage) and I used Galaxy++ to check the syntax of the code, and there were none. And then I imported the files, and renamed it MapScript.galaxy (and then after I saved it dissapeared from the Import palette) and then I start the game, and red text appears in the bottom left saying "Script load failed: Syntax error"... ( And of course noting happens with the spell :( )

Code:
//==================================================================================================
//
// <Your Map> MapScript
//
// Name:   <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "MainScript.galaxy"

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void InitMap () {
    Main();
}

Code:
//==================================================================================================
//
// <Your Map> MainScript
//
// Name:   <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "TriggerLibs/NativeLib"
include "Globals.galaxy"
include "MapInit.galaxy"
include "BurningStep.galaxy"
include "Debug.galaxy"

//--------------------------------------------------------------------------------------------------
// Trigger: Initialization
//--------------------------------------------------------------------------------------------------

void InitTriggers () {
    
    //====================================================================\\
    gt_MapInit = TriggerCreate("MapInit");
    TriggerAddEventMapInit(gt_MapInit);
    //====================================================================\\
    
    //====================================================================\\
    gt_BurningStep = TriggerCreate("BurningStep_Main");
    TriggerAddEventUnitAbility( gt_BurningStep, null, AbilityCommand( "Blink", 0 ), 0, false );
    //====================================================================\\
    
    //====================================================================\\
    gt_DebugMode = TriggerCreate("DebugMode_Main");
    TriggerAddEventUnitOrder( gt_DebugMode, null, AbilityCommand( "move", 0 ) );
    TriggerAddEventUnitOrder( gt_DebugMode, null, AbilityCommand( "stop", 0 ) );
    TriggerAddEventUnitOrder( gt_DebugMode, null, AbilityCommand( "attack", 0 ) );
    //====================================================================\\
}

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void InitLibs () {
    libNtve_InitLib();
}

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void Main () {
    InitLibs();
    InitTriggers();
    InitGlobals();
}

Code:
//==================================================================================================
//
// <Your Map> Globals
//
// Name:  <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "TriggerLibs/NativeLib"

//Objects

//Triggers
trigger gt_MapInit;
trigger gt_BurningStep;
trigger gt_DebugMode;

// Variables

//--------------------------------------------------------------------------------------------------
// Globals Initialization
//--------------------------------------------------------------------------------------------------
void InitGlobals () {
}

Code:
//==================================================================================================
//
// <Your Map> SetupGame
//
// Name:   <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "TriggerLibs/NativeLib"
include "Globals.galaxy"

void MapInit () {
    UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText("I Has Init!"));
}

Code:
//==================================================================================================
//==================================================================================================
//
// Test Map - Spell - Burning Step
//
// Name:   <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "TriggerLibs/NativeLib"
include "Globals.galaxy"

const fixed SPELL_RANGE = 50.0;

//static void SPELL_DAMAGE ( unit

static unit Caster = null;

void UnitGroupLoop ( unitgroup uGroup ) {
    int groupNum = UnitGroupCount( uGroup, c_unitCountAll );
    
    unit u = null;
    //unitgroup grp = UnitGroupCopy( uGroup );
    
    UIDisplayMessage( PlayerGroupAll(), c_messageAreaDebug, UnitGetType( Caster ) );
    
    if ( groupNum <= 0 ) { return; }
    
    if ( groupNum == 1 ) { u = UnitGroupUnit( uGroup, 1 ); UnitDamage( Caster, null, u, 50 ); UIDisplayMessage( PlayerGroupAll(), c_messageAreaDebug, UnitGetType( u ) ); return; }
    
    while ( groupNum > 0 ) { u = UnitGroupUnit( uGroup, groupNum ); UnitDamage( Caster, null, u, 50 ); groupNum -= 1; UIDisplayMessage( PlayerGroupAll(), c_messageAreaDebug, UnitGetType( u ) ); }
    
    //return;
}

void BurningStep_Main ( bool testConds ) {
    
    Caster = EventUnit();
    
    if (testConds) {
        if (!(UnitIsAlive(Caster))) { return; }
    }
    
    //abilcmd spellAbil = EventUnitAbility();
    
    point spellPoint = EventUnitTargetPoint();
    
    point castPoint = UnitGetPosition( Caster );
    fixed castX = PointGetY( castPoint );
    fixed castY = PointGetX( castPoint );
    
    region spellRange = RegionCircle( castPoint, SPELL_RANGE );
    unitgroup spellDmgd = UnitGroup( null, c_playerAny, spellRange, UnitFilterStr( "Ground,Air,Alive;Self,Ally" ), 0 );
    
    UnitGroupAddUnitGroup( spellDmgd, UnitGroup( null, c_playerAny, spellRange, UnitFilterStr( "Ground,Air,Alive;Self,Ally" ), 0 ) );
    
    UnitGroupLoop( spellDmgd );
    
    UnitSetPosition(Caster, libNtve_gf_PointFromPositionAndAngle(spellPoint, UnitGetFacing(Caster)), true);
}

Code:
//==================================================================================================
//
// <Your Map> SetupGame
//
// Name:   <Your Map>
// Author: <Your Name>
//
//==================================================================================================

include "TriggerLibs/NativeLib"
include "Globals.galaxy"

const bool DEBUG_MODE = true;

void DebugMode_Main () {
    abilcmd ab = EventUnitAbility();
    unit u = EventUnit();
    order o = EventUnitOrder();
    
	if DEBUG_MODE {
	    UIDisplayMessage( PlayerGroupAll(), c_messageAreaDebug, AbilityCommandGetAbility( ab ) );
		UIDisplayMessage( PlayerGroupAll(), c_messageAreaDebug, AbilityCommandGetAbility( OrderGetAbilityCommand( o ) ) );
	}
}

Those are all my triggers atm and I'm really sorry to ask this question but, what inside those could cause trouble ? :S
 

Sevion

The DIY Ninja
Reaction score
424
When you change the file to MapScript.galaxy it should disappear. If it says there's a syntax error, then there is one somewhere in your code. You might want to go through manually to see if you can find any syntax errors. I don't trust programs like Galaxy++ to find syntax errors (at least not in Galaxy since it's so new).
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yeah, I know what syntax error means :p But I just wanted help finding it ;) And Galaxy++ has been quite good åt finding easy errors at least.
 
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