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
249
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
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart

      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