How to GALA? (relatively advanced)

JerseyFoo

1/g = g-1
Reaction score
40
How does one script in GALA? The built-in editor hardly supports it.

I'm just looking for an IDE or a Tool that will give me correct debug codes, syntax high-lite somewhat properly, and support my test-constantly behavior.

This is what I've got for my first crack at it, not important disregard as you please;
PHP:
const int maxPlayers = 12;
const fixed startingCam = 40.0;
const fixed arenaRadius = 40.0;

//--------------------------------------------------------------------------------------------------
// Global Structures
//--------------------------------------------------------------------------------------------------
struct Spawn{
	string type;
	int weight;
};

struct User{
	int pid;
	bool flag;
	int minerals;
	int vespene;
	fixed savings;
	fixed x;
	fixed y;
    point location;
	Spawn spawn;
};

//--------------------------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------------------------
User[12] user;
Spawn[32] spawns;

trigger gt_Clock;

int userLength = 0;

//--------------------------------------------------------------------------------------------------
// Trigger: Init
//--------------------------------------------------------------------------------------------------
bool gt_Init_Func (bool testConds, bool runActions){
	int i = 0;
	int p = maxPlayers;
	point origin = RegionGetCenter(RegionPlayableMap());
	fixed originX = PointGetX(origin);
	fixed originY = PointGetY(origin);

	// GAME
	VisEnable(c_visTypeMask, false);
	VisEnable(c_visTypeFog, false);
	GameSetSpeedValue(c_gameSpeedFast);
	
	while ( p > 0 ){
		if ( PlayerStatus(p) != c_playerStatusActive ){ continue; }
		
		user[userLength].pid = p;
		user[userLength].minerals = 5;
		user[userLength].vespene = 0;
		user[userLength].savings = 0.0;
		userLength += 1;
		
		p -= 1;
	}

	while ( i < userLength ){
		
		user[i].x = originX + arenaRadius * Cos(1 / userLength * i * 360);
		user[i].y = originY + arenaRadius * Sin(1 / userLength * i * 360);
        user[i].location = Point(user[i].x, user[i].y);
		
		i += 1;
	}
	
	return true;
}
//--------------------------------------------------------------------------------------------------
// Trigger: Setup
//--------------------------------------------------------------------------------------------------
bool gt_Setup_Func(bool testConds, bool runActions) {
	int i = 0;
	fixed startingCam = 40.0;

	while ( i < userLength ){
		
        user[i].spawn.type = spawns[0].type;
        user[i].spawn.weight = spawns[0].weight;

		UnitCreate(1, "Bunker", 0, user[i].pid, user[i].location, 0);
		CameraSetValue(user[i].pid, c_cameraValueDistance, startingCam, 0.0, -1, 0);
		CameraPan(user[i].pid, user[i].location, 0.0, -1, 0, false);
		
		i += 1;
	}
	
	
	// UIDisplayMessage( (PlayerGroupAll()), c_messageAreaSubtitle, "poop" );
	// libNtve_gf_SetUpgradeLevelForPlayer(2, "zerglingmovementspeed", 1);
	TriggerEnable(gt_Clock, true);
	return true;
}

//--------------------------------------------------------------------------------------------------
// Trigger: Clock
//--------------------------------------------------------------------------------------------------

bool gt_Clock_Func (bool testConds, bool runActions) {
	int i = 0;

	while ( i < userLength ){

		if ( user[i].spawn.weight == user[i].spawn.weight ){
			UnitCreate(1, user[i].spawn.type, 0, user[i].pid, user[i].location, 0);
		}
		
		if ( user[i].flag == true ){
			PlayerModifyPropertyInt(user[i].pid, c_playerPropMinerals, c_playerPropOperSetTo, user[i].minerals );
			PlayerModifyPropertyInt(user[i].pid,  c_playerPropVespene, c_playerPropOperSetTo, user[i].vespene );
			user[i].flag = false;
		}
		
		i += 1;
    }



    return true;
}

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void Grr(){
	trigger gt_Init = TriggerCreate("gt_Init_Func");
	trigger gt_Setup = TriggerCreate("gt_Setup_Func");
	gt_Clock = TriggerCreate("gt_Clock_Func");

	TriggerAddEventMapInit(gt_Init);
	
	TriggerAddEventTimeElapsed(gt_Setup, 1.0, c_timeGame);

	TriggerEnable(gt_Clock, false);
	TriggerAddEventTimePeriodic(gt_Clock, 1.0, c_timeGame);
}

Aside from the tools, the language itself is... difficult.
  • Can't copy objects.
  • No inline variable updates.
  • No inline anything.
  • Constant name-conflicts.
  • No global function calls.
  • Methods?
  • Array.length?
  • Passing by reference?
  • Dynamic functions?
  • Array walking?

Normally I'd google the 50 questions or so I have, yet with all the popularity-grabs and half-baked tools/documentation this is proving impossible.

Could someone please fill me in?
 

tooltiperror

Super Moderator
Reaction score
231
Wait for the next Moonlite release, then use that. It will have GRAPE.
 

Sevion

The DIY Ninja
Reaction score
424
If you've got no other choice, then you can use Notepad or some other text editor (Notepad++ for syntax highlighting or some other text editor with this support).

Then, you can use this for a somewhat easier way to script in Galaxy: http://www.thehelper.net/forums/showthread.php/155112-How-to-Script-in-Galaxy-(Easily)

Better than that is Moonlite, which is still in development.

And yes, the language is "difficult". I'm willing to bet Blizzard intentionally did this to make users more inclined to use GUI. But they neglected to realize that many people prefer scripting over clicking.
 
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