Tool Galaxy parser

phyrex1an

Staff Member and irregular helper
Reaction score
447
What exactly does it parse into? o_O
A haskell data structure. Check src/Galaxy/SyntaxTree.hs. As such, this doesn't really do that much. Think of it as a library for more useful tools.

Can we has [GALAXY] tagz nao? :)
They can has highlight native list.
This is not really related to a syntax highlighter but yeah, it is coming.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Parser has been updated based on j4l's array example.

@Jesus4Lyf: Have you tried to get the parser running? It should function as a poor syntax checker (with plenty of false positives/negatives and somewhat cryptic error messages). I guess that you don't get any error reporting from sc2 itself so it should be an improvement :p
 

Jesus4Lyf

Good Idea™
Reaction score
397
@Jesus4Lyf: Have you tried to get the parser running? It should function as a poor syntax checker (with plenty of false positives/negatives and somewhat cryptic error messages). I guess that you don't get any error reporting from sc2 itself so it should be an improvement :p
I can't be stuffed trying to compile it. >.<' (ie. I can't double click it, so I'm not sure what to do. ;))
So far I'm just writing in Notepad++, importing into a map with Ladik's, then having it run in SC2 BETA, and seeing if it works... :p
 

Jesus4Lyf

Good Idea™
Reaction score
397
Failed to parse this:
JASS:
//==================================================================================================
// 
// Generated Map Script
// 
// Name:   First TD
// Author: Jesus4Lyf
// 
//==================================================================================================
include &quot;TriggerLibs/NativeLib&quot;
//include &quot;TriggerLibs/natives&quot;

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

//--------------------------------------------------------------------------------------------------
// Snippets
//--------------------------------------------------------------------------------------------------
unitgroup PlayerUnits(int player){
	return AIFindUnits(player,null,Point(0,0),500000,c_noMaxCount);
}


//--------------------------------------------------------------------------------------------------
// Trigger Variables
//--------------------------------------------------------------------------------------------------
trigger gt_MeleeInitialization;

void testFunc(){
	unitgroup GG=PlayerUnits(1);
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(UnitGroupCount(GG,c_unitCountAll))));
}

/////
// Super cool
bool gt_OnChat_Func (bool testConds, bool runActions) {
	int i=32;
	
	testFunc();
	
//	while (i&gt;0){
//		i-=1;
//		UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(i)));
//		UIDisplayMessage(PlayerGroupAll(), 3, StringToText(IntToString(i)));
//		Wait(0,0);
//	}
	
	return true;
}

//--------------------------------------------------------------------------------------------------
// Trigger: Melee Initialization
//--------------------------------------------------------------------------------------------------
bool gt_MeleeInitialization_Func (bool testConds, bool runActions) {
    // Actions
    if (runActions) {
        MeleeInitResources();
        MeleeInitUnits();
        MeleeInitAI();
        MeleeInitOptions();
    }
	gt_OnChat_Func(false,false);
    return true;
}

//--------------------------------------------------------------------------------------------------
void gt_MeleeInitialization_Init () {
    gt_MeleeInitialization = TriggerCreate(&quot;gt_MeleeInitialization_Func&quot;);
    TriggerAddEventMapInit(gt_MeleeInitialization);
	
	TriggerAddEventChatMessage(TriggerCreate(&quot;gt_OnChat_Func&quot;), 1, &quot;&quot;, false);
	TriggerAddEventChatMessage(TriggerCreate(&quot;gt_OnChat_Func&quot;), 1, &quot;&quot;, true);
}

//--------------------------------------------------------------------------------------------------
// Trigger Initialization
//--------------------------------------------------------------------------------------------------
void InitTriggers () {
    gt_MeleeInitialization_Init();
}

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

(Just some demo code I'm working on, mindlessly. It compiles in SC2 beta.)
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Galaxy looks really promising, hopefully it follows through at release. :s
 

Jesus4Lyf

Good Idea™
Reaction score
397
Umm.
JASS:
typedef int[3] ArrType;

Works.
JASS:
void readattwo (ArrType ar){
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}

Works.
JASS:
void readattwo (int[3] ar){
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}

Works.
JASS:
void readattwo (int[] ar){
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}

Does not work.
JASS:
ArrType someVar;
readattwo(someVar);

Does not work. o_O

So I think it's half implemented.

Edit:
Holy crap, this compiles:
JASS:
typedef int[3] ArrType;
void readattwo (ArrType* ar){
	//UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString(ar[2])));
}

:D
>Galaxy looks really promising
Does now.

Edit: WINNER!
Figured out pointer syntax.
JASS:
typedef int[3] ArrType;
ArrType testArr;
void readattwo (ArrType* ar){
	UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(IntToString((*ar)[2])));
}
bool testthings (bool testConds, bool runActions) {
	ArrType* someVar = &amp;testArr;
	testArr[2]=7;
	testArr[1]=9;
	testArr[0]=3;
	readattwo(someVar);
    return true;
}

Compiles. This is getting cooler and cooler. :D

Whee. I'm the first person to use array pointers in SC2 and post about it online... :p
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
What are pointers in Galaxy? They can't be like C ones... Can they? o_O
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Ooo.. Maybe I should start playing around with this.
 

Jesus4Lyf

Good Idea™
Reaction score
397
WIN
JASS:
struct murder {
    string means;
    string time;
};
murder[128] pool;
void apply(murder* attempt, string target){
    UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(target+&quot; has died at &quot;+attempt-&gt;time+&quot; by: &quot;+attempt-&gt;means+&quot;.&quot;));
}
bool testthings (bool testConds, bool runActions) {
    murder* how=&amp;(pool[0]);
    how-&gt;time=&quot;midnight&quot;;
    how-&gt;means=&quot;axe to the fricking face&quot;;
    apply(how,&quot;A young boy&quot;);
    return true;
}

Compiles. The first example of structs in Galaxy! Just took 5 hours or so of sitting here trial and erroring. :D

Now I have to say... the learning curve is huge for newbies. People are gonna struggle.. =/

>Wait, your saying they ARE like in C?
Yes.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
Oh damn. I think we're going to have some fun with this.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Jesus is the first coder. Watch he figures out bytecode all over again. That would be hilarious.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Jesus is the first coder. Watch he figures out bytecode all over again.
I'm already giving that a shot.
JASS:
int[128] byteCode;
bool testthings (bool testConds, bool runActions) {
    trigger t=TriggerCreate(&quot;byteCode&quot;);
    if (t!=null){
        UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(&quot;Problems.&quot;));
    }
    TriggerAddEventChatMessage(t, 1, &quot;&quot;, false);
    return true;
}

Amusingly enough, this spells problems. But it also throws a function not found error, so I'm not sure if something can be done with it..
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
How are you trying all this? Inserting the code into a map and running it?
 

Jesus4Lyf

Good Idea™
Reaction score
397
Inserting the code into a map and running it?
Yeah. Using Ladik's MPQ to import it into the galaxy mapscript of a map. It's kind of tedious... There's no syntax error messages, any syntax errors causes the entire script to be discarded. Actually, I found any XML errors cause the XML data files to be discarded, also, it seems...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top