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
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top