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".
 

rover2341

Is riding a roller coaster...Wee!
Reaction score
114
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
114
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
Staff member
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
114
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
114
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
Staff member
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
114
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
Staff member
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.
  • The Helper The Helper:
    Time does not go by faster as you get older just your perception of it. I read some studies about this when you get older you perceive time differently then when you are young
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Happy Sunday!
    +1
  • The Helper The Helper:
    I will be out of town until Sunday evening
    +1
  • The Helper The Helper:
    I am back! Did you miss me LOL
    +1
  • jonas jonas:
    where did you go?
  • The Helper The Helper:
    Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
    +1
  • The Helper The Helper:
    It was a lot of fun. The RV was bad ass
  • jonas jonas:
    That sounds like fun!
    +1
  • The Helper The Helper:
    it was a blast!
  • The Helper The Helper:
    I am going to post the Youtube of the investigation in the forums when it is ready
    +1
  • jonas jonas:
    cool!
  • vypur85 vypur85:
    Sounds cool TH.
  • tom_mai78101 tom_mai78101:
    I was on a Legend of Zelda marathon...
  • tom_mai78101 tom_mai78101:
    Am still doing it now
    +1
  • jonas jonas:
    which one(s) are you playing?
  • jonas jonas:
    I played a little bit of the switch title two weeks ago and found it quite boring
  • The Helper The Helper:
    just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • The Helper The Helper:
    We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
  • The Helper The Helper:
    Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
    +1
  • Ghan Ghan:
    Beep boop
    +1
  • The Helper The Helper:
    hears robot sounds while 250 bots are on the forum lol
  • The Helper The Helper:
    Happy Saturday!

    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