Tool Galaxy parser

Anker

New Member
Reaction score
0
Code:
# function StructTest() {
#     myStruct myStructTest;
#     myStructTest.a = 256;
#     myStructTest.b = 874;
#

#     UIDisplayMessage(PlayerGroupAll(), 4, StringToText(IntToString(myStructTest.b)));
# }

That isn't valid Galaxy...

Oh, come on, that's valid.

I have tried this, and it displays "874". I think he just mistyped "function".
 

Anker

New Member
Reaction score
0
Yep just replace "function" with "void".

attachment.php


1.jpg
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
So What would you use for a number like 5.5. I cant find real anywhere...
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
Ill look around, But Is known yet if its possible to have a unit set to yaw, pitch, roll with code?
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Parser updated, works with most of the code posted here.

Except:
  1. -=, +=, etc style statements. Question: Does this work on all different binary operators (|=) (&&=), (&=), (/=) etc or just a few? I'm guessing that it doesn't work on the equality operators (==, >=) since the syntax for that doesn't make sense.
  2. Some usage of nested arrays/pointer dereferences (and declarations). I'm trying to figure out how to remove some ugly repetition before fixing this.
  3. Function pointer calls (The kind j4l reported giving errors in game).

Another question: Does this work (compiles and executes)
Code:
struct murder {
    string means;
    string time;
};

void apply(murder* attempt, string target){
    UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(target+" has died at "+attempt->time+" by: "+attempt->means+"."));
}
bool testthings (bool testConds, bool runActions) {
    murder how;
    how.time="midnight";
    how.means="axe to the fricking face";
    apply(&how,"A young boy");
    return true;
}
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
Code:
struct human {
    string name;
};

void test()
{
    human mark;
    string aName = "tom";
   
    mark.name = aName;
}

Why wont this pass the Parser?
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
Thanks. That did it.

What about this? Or how would you do it with in array of structs?

Code:
struct person
{
    string name;
};


void setup()
{
    //Dont Work
    person[2] aPlayer;
    aPlayer[0]->name = "Mark";
     
    //Works
    //person aPlayer;
    //aPlayer->name = "Mark";

}
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Code:
struct human {
    string name;
};

void test()
{
    human mark;
    string aName = "tom";
   
    mark.name = aName;
}

Why wont this pass the Parser?
Does that code compile is sc2? Please note that the parser is very much alfa software, always test the code in sc2 regardless of what the parser tells you. Please report any inconsistency between sc2 and the parser, I don't have the beta so I need other peoples input to figure out the correct syntax :p
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
I will be more clear for now on.

That only passed the alpha parser. So Not 100% chance it works in starcraft 2. I can not test it to be sure.
 

Anker

New Member
Reaction score
0
Code:
struct human {
    string name;
};

void test()
{
    human mark;
    string aName = "tom";
   
    mark.name = aName;
}

Why wont this pass the Parser?
Try "->" instead of ".".



You can't be serious! You are using '->' after a struct name, not a pointer. And you say "That did it."

Are you truly playing the same Starcraft 2 as mine?


My code:

Code:
struct myStruct {
    int a; 
    string b; 
};

void StructTest() {
    myStruct myStructTest;
    myStructTest.a = 256;
    myStructTest.b = "ABC";
    UIDisplayMessage(PlayerGroupAll(), 4, StringToText(IntToString(myStructTest.a)));
    UIDisplayMessage(PlayerGroupAll(), 4, StringToText(myStructTest.b));
}

It 100% works.

1.jpg


And myStructTest->a = "ABC" will never work.

See for youself, just put this MeleeAI.galaxy under SC2 InstallPath(ie.X:\...\StarCraft II Beta) and run any map with AI, you will see "256" and "ABC".
View attachment MeleeAI.galaxy.zip
 

Vestras

Retired
Reaction score
248
You can't be serious! You are using '->' after a struct name, not a pointer. And you say "That did it."

Are you truly playing the same Starcraft 2 as mine?


My code:

Code:
struct myStruct {
    int a; 
    string b; 
};

void StructTest() {
    myStruct myStructTest;
    myStructTest.a = 256;
    myStructTest.b = "ABC";
    UIDisplayMessage(PlayerGroupAll(), 4, StringToText(IntToString(myStructTest.a)));
    UIDisplayMessage(PlayerGroupAll(), 4, StringToText(myStructTest.b));
}

It 100% works.

View attachment 35994


And myStructTest->a = "ABC" will never work.

See for youself, just put this MeleeAI.galaxy under SC2 InstallPath(ie.X:\...\StarCraft II Beta) and run any map with AI, you will see "256" and "ABC".
View attachment 35996

I know, I just saw that the parser accepted it. Too lazy to try in SC2 to see if it's correct ;)
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Parser updated. I think it parses all examples in this thread (plus hopefully a lot more valid code), except the ones that actually contains syntax errors (j4l I'm looking at you). It also parses some syntactically invalid code, but I think I'll defer that checking to the (unwritten) type check for saner code.
 

ZugZugZealot

New Member
Reaction score
33
Code:
const int RED = 0x0000FF;
const int GREEN = 0x00FF00;
const int BLUE = 0xFF0000;

const int canHasPie = 0x0001;
const int isAwesome = 0x0002;
const int causeLaughter = 0x0004;
const int dances = 0x0008;
const int isPervert = 0x0010;

void DoThings(int flags) {
   if ( (flags & canHasPie)>0 ) { UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "Here's a pie!" )); }
   if ( (flags & isAwesome)>0) { UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "You are awesome!" )); }
   if ( (flags & causeLaughter)>0 ) { UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "I lol'd!" )); }
   if ( (flags & dances)>0 ) { 
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "<(''<)" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " <(''<)" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " (>'')>" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " <(''<)" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " <(  )>" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " (>'')>" ));
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( " <('')>" ));
   }
   if ( (flags & isPervert)>0 ) { 
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "Scanning harddrive..." )); 
      UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText( "Fap results: 29401" )); 
   }
}

int GetRed(int rgbVal) {return (rgbVal & RED);}

int GetGreen(int rgbVal) {return (rgbVal & GREEN);}

int GetBlue(int rgbVal) {return (rgbVal & BLUE);}

void testFunc()
{
   int i = 0x0000FF;
   int rgbVal = 0xFFFF80;
   
   UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText("red is " + IntToString(GetRed(rgbVal))));

   DoThings(canHasPie|isPervert);
}

Yay! It uses 'or' and 'and' operators!

Sadly it doesn't like bitwise-left and bitwise-right. =(
 
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