I'm very new to Galaxy, and I cannot figure out why I'm getting a syntax error.
intsafeZone=30;tempRegion=RegionRect(0,0,safeZone,safeZone);RegionSetCenter(tempRegion,heroPoint);fixedavgDistanceFromCenterToEdge=(Pow(mapSizeX,2)+Pow(mapSizeY,2))/4;fixedtempfixedX=RandomFixed(mapSizeX/4-offset,mapSizeX/4+offset);fixedtempfixedY=RandomFixed(mapSizeY/4-offset,mapSizeY/4+offset);fixedheroX=PointGetX(heroPoint);//x-loc of herofixedheroY=PointGetY(heroPoint);intaddX=1;//for while loop logicintaddY=1;
I get a syntax error here, if I try to run the code as is.
I don't see any general syntax errors like ; or forgotten brackets. But since you didn't show us the whole code we can't see if all variables used are declared correctly. Also make sure you give the functions the correct amount and type of parameters.
Don't have any syntax errors when I compile. Neither does anything else if I comment out these three lines.
But...if I don't comment out those lines, I get a syntax error for every single line after those three. I tried commenting out every line after those three, and every line after those commented lines gets a syntax error.
Well, i'm not familiar with Galaxy, but with other programming languages errors are usually a line or two after the actual error. Sometimes a lot further if you forgot to declare a variable. Are heroPoint and tempRegion declared and set to something? If not, make sure to set them to something.
Galaxy requires you to declare all variables first before you do any other statements.
The reason the line with the avgDistanceFromCenterToEdge declaration is pointed at is because that is the first time you declare something new after running regular statements.
When you comment out those regular statements, like you said, it will work fine.
Move the "tempRegion =" and the "RegionSetCenter" lines beneath the "int addY =" line and it should work.
I'm very new to Galaxy, and I cannot figure out why I'm getting a syntax error.
I get a syntax error here, if I try to run the code as is.
However, if I comment out the first 3 lines, then there is no syntax error. Anybody know why that is?
Also, I have no idea how Galaxy's automated garbage collector works. Do non-global variables get automatically cleaned up once the function is done?
Thanks in advance :)
I don't see any general syntax errors like ; or forgotten brackets. But since you didn't show us the whole code we can't see if all variables used are declared correctly. Also make sure you give the functions the correct amount and type of parameters.
tempRegion and heroPoint are global variables (well, I don't actually know if they are). But they would be if this is C. I declared them like this:
The first three lines
Don't have any syntax errors when I compile. Neither does anything else if I comment out these three lines.
But...if I don't comment out those lines, I get a syntax error for every single line after those three. I tried commenting out every line after those three, and every line after those commented lines gets a syntax error.
I'm so confused.
@ShooperMAN: Go
Well, i'm not familiar with Galaxy, but with other programming languages errors are usually a line or two after the actual error. Sometimes a lot further if you forgot to declare a variable. Are heroPoint and tempRegion declared and set to something? If not, make sure to set them to something.
@wOlfLisK: Go
I don't think you're truly understanding the problem here. But yes, I do have these declared:
Here is the problem:
Galaxy requires you to declare all variables first before you do any other statements.
The reason the line with the avgDistanceFromCenterToEdge declaration is pointed at is because that is the first time you declare something new after running regular statements.
When you comment out those regular statements, like you said, it will work fine.
Move the "tempRegion =" and the "RegionSetCenter" lines beneath the "int addY =" line and it should work.
@MTops: Go
Ohhhh, well that's pretty inconvenient. Do I have to do this for the entire code, or just per function?
@ShooperMAN:
This is per scope.
Pretty useless code, but it's for demonstration purposes... :)
http://wiki.sc2mapster.com/galaxy/script/language-overview/#w-hint
feel free to write solutions into the wiki, in order to make wiki better.
@avogatro: Go
It's already on there... :D