I got a couple of deadlines comming up for some school projects, which is why I haven't been very active the last couple of days.
@Slarti: Go
Hmm.. wouldn't really call it a bug. It's meant to overload binary operators, and it's not syntactically correct to write 2*3; Still, I might be able to relax that for custom operators.
@Kueken531: Go
Good point with the mod files.. Ill look into that when I have the time. Although, you will probably need to give the compiler the script explicitly, since, if I remember correctly, you can't get the .SC2Mod file from the dependencies.
Doesn't give me any errors.. Did you forget the * in the type?
In terms of output script, it doesn't really matter if you write
Foo*f=newFoo();
or
newFoo();
Although the latter is not possible. If f in the first one is not used, it will be removed when optimizing. To be honest, if I were to make the latter possible, I would probably just insert "Foo* f =" during compilation.
Good point with the mod files.. Ill look into that when I have the time. Although, you will probably need to give the compiler the script explicitly, since, if I remember correctly, you can't get the .SC2Mod file from the dependencies.
Fine with me, just give us the possibility to add a list of usable functions or a script file, which is not added to the map script per project.
€ I would propose anyway, that you add a "scripts" folder or something, which holds the SC2 script files (the native lib and stuff), so we can update the script files manually, if SC2 gets an update.
Quote:
Doesn't give me any errors.. Did you forget the * in the type?
I am pretty sure, I didn't, but I must have made another mistake, because it works for me now.
@Slarti: Go Hmm.. wouldn't really call it a bug. It's meant to overload binary operators, and it's not syntactically correct to write 2*3; Still, I might be able to relax that for custom operators.
Yeah, you're right. My usecase is more like a "+=". Maybe I should wait for unary operator overloading. Also on the same note: do you have any plans for operator overloading via class methods? Problem is: I would like to overload an operator for a generic class but I don't think that's possible right now.
So I wonder, what happend with the last if-else? My compiler settings does not remove unused things, and inline optimization is turned off.
The -= operator seems to be irrelevant as well, since writing += instead there for instance is yielding the same result.
Edit: The issue appears to lie in that local variables fail to be compiled properly in a such way that it is not detected that the variable is used later on in the function. I fixed it temporarily by setting acceleration to a struct member variable instead.
Got some issues with your optimization/obfuscation stuff lately. I usually don't use it, just decided to test, if it still works.
I did send you a script, which caused an exception if used with the Obfuscate Strings option, it also occasionally produces invalid galaxy script when using the Use Short Names option, however I wasn't able to reproduce that reliably.
Yeah.. I see that the obfuscation feature is broken at the moment.. I really need to rewrite it completely, since it's implemented rather bad right now. Anyway, I fixed some of the bugs, and released a new version.
I wonder, Beier, why does your compiler enforce to convert code that is already valid galaxy code? For instance, that a += b becomes a = a + b, *= or for loops and similar.
Well. when I started making the editor, there were no for loops. I'm not sure about +=, but I didn't think it was valid.. To be honest, I practically never program in pure galaxy.
Now, well - many times in my code I assume that the parent of a statement is a block, which wouldn't be true if I kept for sentences - so it would require a lot of rewriting. Also, some statements in galaxy++ is translated to multiple statements in galaxy, which would be impossible if the statement is in a for.
+= was valid code from the start, but I didn't learn about it until like 6 months in.
Suggestion with very low priority: When you inject a script to a map and open it for the first time, a "Could not find triggers" error message is shown; after saving and re-opening the map, this message disappears. So, I assume, your editor deletes the entire trigger file, and the editor re-adds a blank one or something similar. You could create this empty file right away to avoid the error message.
Today I learned something new about Galaxy Script. You can only use ints as array indices and no bytes/shorts. This results in errors with enum -> int conversions:
text[1]enumToTextArray;Initializer{enumToTextArray[(int)Enum.ENUMVALUE]="ENUMVALUE Description";// class only there so it does not get inlinedFooBar*f=newFooBar();Enume=f->e;TriggerDebugOutput(1,enumToTextArray[(int)e],true);}enumEnum{ENUMVALUE}classFooBar{Enume=Enum.ENUMVALUE;}
This throws an error when starting sc2 "Array index require an integer value". I guess the easiest way to fix it would be to only use ints when converting from enums and no bytes/shorts... Sucks, but is not too bad.
Search & replace support for script of dialogs (currently it searches only non-dialog script files)
After writing a typecast statement like (int), the suggestion box doesn't pop up, not even when trying to force it with ctrl+space.
Don't take me to the script immediately after defining a dialog event. I want to be able to define a bunch of events first and then script them. Make me switch to the script by pressing enter or double-clicking on the event only.
The switch is not a bug. In the documentation it does say "Note that it is possible to fall through to the next case if one doesn't write break, like it is done from marine to zealot."
The switch is not a bug. In the documentation it does say "Note that it is possible to fall through to the next case if one doesn't write break, like it is done from marine to zealot."
Yes, it should be able to fall though, but the 2nd case should only be called, if the case itself is true, right? For this code, the 2nd case should never ever be true; the switch variable is always true and the case is always false. Even if it falls through the first case, it should not run the 2nd one in this case, or did I misunderstand something?
Well.. for each switch case the test is basically switchVar == testExp. How can the other case be true without being the exact same thing as the first case? Or why would you want to identical cases?
Well.. for each switch case the test is basically switchVar == testExp. How can the other case be true without being the exact same thing as the first case? Or why would you want to identical cases?
It is working as intended as it is
For your implementation of a switch, this is true; in a sense, fall-through doesn't even has a reason to exist.
But from my understanding, a switch should be able to do this:
switch(i){case>4:
{Print("i is bigger than 4");}case>8:
{Print("Wow! And its even bigger than 8!");}}
This way, the fall-through would actually make sense.
Yours doesn't support this, because we can only check exact values for the switchVar.
I don't have that much programming experience, so I might simply misunderstand the concept of switch and fall-through, but my version somehow makes more sense to me than yours.
€ nvm, looked it up, and, of course, your version is correct and I was wrong. Still, I have a hard time understanding this decision ;)
Suggestion: Don't automatically add the } after a {, when typing it within a string.
2 problems with InvokeAsync:
How do I use it on a class method? Doing something like this:
results in an exception and will probably be hard to detect, because of the 2 instances of >
(however using (*f). instead of -> causes an exception as well).
However have you the documention in an other support than there : http://www.sc2mapster.com/assets/galaxy-editor-beier
Because it's annoying to move the screen on right and left to read the full sentences.
I've downloaded the last .zip, but unless i've missed it, there is no documentation inside it.
And when it's about scripting i obviously prefer written documentation than videos.
I got a couple of deadlines comming up for some school projects, which is why I haven't been very active the last couple of days.
@Slarti: Go Hmm.. wouldn't really call it a bug. It's meant to overload binary operators, and it's not syntactically correct to write 2*3; Still, I might be able to relax that for custom operators.
@Kueken531: Go Good point with the mod files.. Ill look into that when I have the time. Although, you will probably need to give the compiler the script explicitly, since, if I remember correctly, you can't get the .SC2Mod file from the dependencies.
Doesn't give me any errors.. Did you forget the * in the type?
In terms of output script, it doesn't really matter if you write
or
Although the latter is not possible. If f in the first one is not used, it will be removed when optimizing. To be honest, if I were to make the latter possible, I would probably just insert "Foo* f =" during compilation.
Fine with me, just give us the possibility to add a list of usable functions or a script file, which is not added to the map script per project.
€ I would propose anyway, that you add a "scripts" folder or something, which holds the SC2 script files (the native lib and stuff), so we can update the script files manually, if SC2 gets an update.
I am pretty sure, I didn't, but I must have made another mistake, because it works for me now.
Yeah, you're right. My usecase is more like a "+=". Maybe I should wait for unary operator overloading. Also on the same note: do you have any plans for operator overloading via class methods? Problem is: I would like to overload an operator for a generic class but I don't think that's possible right now.
Also, a new Bug that throws an exception:
There seems to be some new issues which halted my project abit again:>
I'll include what's relevant, if you need more code, I could provide so.
This is my usecase.
There seems to be an error at the compiling, as that transforms to_
So I wonder, what happend with the last if-else? My compiler settings does not remove unused things, and inline optimization is turned off. The -= operator seems to be irrelevant as well, since writing += instead there for instance is yielding the same result.
Edit: The issue appears to lie in that local variables fail to be compiled properly in a such way that it is not detected that the variable is used later on in the function. I fixed it temporarily by setting acceleration to a struct member variable instead.
Got some issues with your optimization/obfuscation stuff lately. I usually don't use it, just decided to test, if it still works.
I did send you a script, which caused an exception if used with the Obfuscate Strings option, it also occasionally produces invalid galaxy script when using the Use Short Names option, however I wasn't able to reproduce that reliably.
Yeah.. I see that the obfuscation feature is broken at the moment.. I really need to rewrite it completely, since it's implemented rather bad right now. Anyway, I fixed some of the bugs, and released a new version.
I wonder, Beier, why does your compiler enforce to convert code that is already valid galaxy code? For instance, that a += b becomes a = a + b, *= or for loops and similar.
Well. when I started making the editor, there were no for loops. I'm not sure about +=, but I didn't think it was valid.. To be honest, I practically never program in pure galaxy.
Now, well - many times in my code I assume that the parent of a statement is a block, which wouldn't be true if I kept for sentences - so it would require a lot of rewriting. Also, some statements in galaxy
++
is translated to multiple statements in galaxy, which would be impossible if the statement is in a for.Don't fix what ain't broken :)
+= was valid code from the start, but I didn't learn about it until like 6 months in.
Suggestion with very low priority: When you inject a script to a map and open it for the first time, a "Could not find triggers" error message is shown; after saving and re-opening the map, this message disappears. So, I assume, your editor deletes the entire trigger file, and the editor re-adds a blank one or something similar. You could create this empty file right away to avoid the error message.
Today I learned something new about Galaxy Script. You can only use ints as array indices and no bytes/shorts. This results in errors with enum -> int conversions:
Turns into:
This throws an error when starting sc2 "Array index require an integer value". I guess the easiest way to fix it would be to only use ints when converting from enums and no bytes/shorts... Sucks, but is not too bad.
Yeah, bytes can't be used as indexes. Another easy way to fix it (yet looking stupid) is to add 0 to the expression (eg. array[i + 0])
Suggestions:
Bug with array properties:
Bug with switch:
prints:
True
False
Even if I am not adding a break, it shouldn't run the 2nd case, right?
The switch is not a bug. In the documentation it does say "Note that it is possible to fall through to the next case if one doesn't write break, like it is done from marine to zealot."
Yes, it should be able to fall though, but the 2nd case should only be called, if the case itself is true, right? For this code, the 2nd case should never ever be true; the switch variable is always true and the case is always false. Even if it falls through the first case, it should not run the 2nd one in this case, or did I misunderstand something?
Bug with inline functions:
causes an unhandled exception
Well.. for each switch case the test is basically switchVar == testExp. How can the other case be true without being the exact same thing as the first case? Or why would you want to identical cases?
It is working as intended as it is
For your implementation of a switch, this is true; in a sense, fall-through doesn't even has a reason to exist.
But from my understanding, a switch should be able to do this:
This way, the fall-through would actually make sense.
Yours doesn't support this, because we can only check exact values for the switchVar.
I don't have that much programming experience, so I might simply misunderstand the concept of switch and fall-through, but my version somehow makes more sense to me than yours.
€ nvm, looked it up, and, of course, your version is correct and I was wrong. Still, I have a hard time understanding this decision ;)
Suggestion: Don't automatically add the } after a {, when typing it within a string.
2 problems with InvokeAsync:
How do I use it on a class method? Doing something like this:
results in an exception and will probably be hard to detect, because of the 2 instances of >
(however using (*f). instead of -> causes an exception as well).
Also, how do we invoke a delegate asynchronously?
Looks interesting.
However have you the documention in an other support than there : http://www.sc2mapster.com/assets/galaxy-editor-beier Because it's annoying to move the screen on right and left to read the full sentences. I've downloaded the last .zip, but unless i've missed it, there is no documentation inside it.
And when it's about scripting i obviously prefer written documentation than videos.
Thanks for the bug reports. :)
@Kestudy: Go
I'm not sure what you mean about moving the screen on the right and left. I don't have any horizontal scrollbar or anything when I read it :s