Ah ok, misunderstood you there. Yeah, that could be useful, but wouldn't that be a lot of work for something that might not even be used? For me, its a nice-to-have but I can think of a lot of other, more important things.
Ah ok, misunderstood you there. Yeah, that could be useful, but wouldn't that be a lot of work for something that might not even be used? For me, its a nice-to-have but I can think of a lot of other, more important things.
I doubt, it is that much work. The trigger stuff should just be an XML file. But you are right, its not important.
Suggestion: Arrays with string index. Basically just a wrapper for a data table call.
Foo[1]* f; would be a pointer to a one dimensional array of Foo structs (not classes). But even if Foo is a struct, that does not work since pointers to fixed size arrays do not exist (pretty much like in C++). Foo[]* f; would work (pointer to a dynamic Foo-struct array).
Arrays with string as index would definitely be useful. I really would like more than strings though, like triggers, units or whatever but I guess the SC2 limitations don't allow for that.
To have a more general way of doing this, I propose Operator Overloading. Then one could write a generic table class with appropriate [] operators taking strings or whatever is wanted. I am also a fan of the << and >> operators in C++ for streams or container classes, (+,-,*,/) for vectors, ...)
Just because I recently had difficulty with this, I want expand on that. The above statement only declares the initial array of 42 Foo pointers that don't point to anything (technically I think they are all pointing to the same object, but not important). To actually use the array, you'd have to go through and declare each one in something like:
OK, here are some more suggestions. Of course everything is subject to discussion and does not have to be useful.
Galaxy++ Language Suggestions
Operator Overloading: Pretty much as it is used in C++. Maybe there have to be some changes such as the []= operator in vJass for array-assignment.
Enums: These could be either simple C style enums that are just bytes/shorts/ints (whatever fits) or Java style object enums that are basically classes with predefined instantiations. Behavior for enums would include that they are switch-able. Also using them as array indexes may be useful (requiring a (implicit) enum -> int cast). A cast in the opposite direction should always have to be explicit if it should even be possible. I would vote for the Java style enums so that one can easily associate some data fields with the enums.
Virtual/Abstract Methods/Interfaces: Allowing to overwrite methods from the superclass. Either allowing to overwrite every method that is defined or having a special keyword (like virtual in C++) to mark methods that they can get overwritten. I'm not sure how it would get implemented (binary if/elses or something like Strilanc has written some pages before this). Also having a better implementation for Delegates would be nice (e.g. binary if/else over ints and not linear if/else over strings).
Initializers. It seems that a trigger with the default "if (ranAsync) wait" body is created for every Initializer. Since the user can't call these by himself, they could be implemented with only one trigger and a fixed wait(0) at the beginning. The trigger used for the calling of the functions could get deleted after the initialization is done.
Editor Suggestions
Better Navigation/Keyboard Support
Some examples for this (every mentioned key combination is just an example):
ctrl+arrowkeys to jump over complete words (or over CamelCase word parts as most IDEs are doing it)
ctrl+shift+arrowkeys to also select the text in between jumps
Some key to jump up and down between methods (for example: ctrl+alt+up would jump to the previous method/function in the current file)
Outline support
"Go To Declaration" support: ctrl+mouse-click on a class/variable/function call and the declaration of it is opened. Of course this would not work for native/libNtve functions.
Using shift+mousewheel scrolls pages
Deleting a line: Pressing ctrl+d deletes the lines the are currently selected, if nothing is selected the current line where the carret is, is deleted. Its surprising how useful I find this function in other Editors/IDEs.
Duplicating content: Pressing ctrl+alt+(up/down) duplicates the currently selected lines above the selection/under the selection. If nothing is selected the line where the cursor is, is duplicated.
Moving content: Pressing alt+(up/down) move the currently selected lines up and down. If nothing is selected the line where the cursor is, is moved.
ctrl+Enter creates a new line after the current one
Other
Templates/Snippets: Allowing to write "for" and the autocompletion would propose to replace it with a for loop. Hitting a special key (like Tab) would jump through specific hotspots like the name of the iteration variable, the loop condition and the loop body. Hard to explain, hope you understand what I mean. Most IDEs have it, the FingerText Plugin for Notepad++ also works like this.
A Unit Filter Gui: Right now the Galaxy++ Editor is superior to the normal Trigger/Galaxy Editor in nearly every aspect. But when I have to write a unitfilter I am still opening up the Trigger Editor, defining the filter with the gui, and copy pasting the resulting script into the Galaxy++ File. I simply do not know where to put all the c_targetFilterXXX variables. Having a gui like the one for creating Class Constructors would help greatly. But not only should it be possible to crate new filters but also to change existing ones.
Preprocessor: Well maybe not a full fletched one as the C-Preprocessor but having different compile configurations like release and debug would be nice. When compiling in debug mode, one could disable optimization flags, enable some testing-cheats and debug output.
Do we have a way to cast a struct or class to an integer? Or do we need to add a unique id to the struct itself in addition to the id it already has in the generated code? Casting with (int) Class or trying to use the currentStruct - variable from the generated script didn't work.
€ this was tested for an array struct, where you actually have an integer as id. For data table structs with string keys, it could still cast to int, though.
The reason initializers are in one trigger pr initializer is the limit on the ammount of stuff that can be done in one trigger. With loops and stuff, I have no way of know how much stuff one initializer is doing. Putting them all into one trigger could reach the limit.
Wow, I just accidentaly overloaded a function, and it seems to work. Didn't even know, you added support for function overloading. I cannot find it in the documentation, either.
@Slarti: Go
The reason initializers are in one trigger pr initializer is the limit on the ammount of stuff that can be done in one trigger. With loops and stuff, I have no way of know how much stuff one initializer is doing. Putting them all into one trigger could reach the limit.
Ok this topic is pretty low priority since it works without errors but here is what I mean in more detail:
The main advantage would be that the triggers required to initialize everything are cleaned up after the initialization is done while also requiring less space. I don't know how much overhead the destruction of triggers costs performance wise but I don't think it's that much.
Maybe the creation of the Galaxy++ Triggers{events{} conditions{} actions{}} could also happen in one function without hitting the execution limit.
But again this should be the least of your concerns, since everything is working as it is right now.
So, I would like something to avoid having to write repetitive code like that. In vJass, we had Textmacros, which could shorten this quite significantly, they would look kind of like this (G++ - ified ;) )
Obviously, the order before the stop should be saved and re-issued after the wait. However, the generated script just stops the unit and then re-issues the stop.
Another bug with your dialog designer: The generated code for a specified event tried to register an event for a trigger, which was not created yet. This happened, when I was creating the dialog in the Events part for a trigger (which I am probably not supposed to). Doing so in an initializer works fine.
which obviously is wrong. The compiler tries to re-use the id variable, but it was still needed.
This is part of a huge map script; I was not able to create the same behavior in a controlled testmap or to narrow it down further. However, setting k to zero beforehand seems to fix this issue; I just declared it without initializing first.
€ apparently not. Sometimes, it works sometimes it still generates the incorrect script o_0
I attached the entire map script; you will find the quoted part in the Hero Pick - file
The scrip is completely messed up, btw. It used to work with an earlier version, but now I get flooded with errors. I am pretty sure, some of them are related to a similar problem.
Hmm.. that looks weird.. I'm still working on the big rewrite and fixing its bugs though. Before I get that done, I can't really release any bug fixes, because the program is too unstable - at this point I got error reports popping up all the time :).
I know it's been a while, but changing the naming really has ramifications everywhere.. Also, as I said earlier, I do have other things to do apart from this project.
Anyway.. only advice I can really give right now is to use fields when it bugs on you like that.. It shouldn't join them.
What's this program written in? I may be able to help if you want
I'm good with C# and Java, among others
Haven't used Cpp or Python in ages, but once I get rolling I'm fine
How would I use that to stop a local variable from being replaced by the compiler? Just replacing the declaration with this results in a syntax error.
Quote:
most likely there's no check due Array[0] being actually accessible. don't make sense if you actually define it like that :P
Maybe this is intentional; in Galaxy++, a size of 0 would sort of make sense for dynamic arrays at least. However, in plain galaxy, a size of 0 is not allowed, and causes a compiler error.
So far, I should have the compiler part done, and about half of the suggestion list done. But once I get that done, there will be some time with bug fixing.
The compiler is written in c#. It's probably not be a bad idea to bring others aboard for faster updates - although there are a lot of code for someone to wrap his head around - and that's probably even harder right now where the code won't compile.
What I meant was to use global fields instead of local variables. It won't merge a field with a local variable.
Okay, thanks.
Unfortunately, similar bugs happen all over my map script. I would need to replace a huge amount of locals with globals to fix all the bugs, and for my messy script, it is very hard to spot the exact locations this malfunction happens, especially because it is not reported as an error.
I would need to check the entire generated script vs the source files and once you fixed the bug, I'd have to change it back... might as well rewrite the entire map script xD. Wish me luck.
Quote:
So far, I should have the compiler part done, and about half of the suggestion list done. But once I get that done, there will be some time with bug fixing.
Ah ok, misunderstood you there. Yeah, that could be useful, but wouldn't that be a lot of work for something that might not even be used? For me, its a nice-to-have but I can think of a lot of other, more important things.
For fixed-sized arrays:
For dynamically sized arrays:
Thank you, that was about the only variant I didn't try -.-
Why does Foo[1] *f; not work, btw? Or should it?
I doubt, it is that much work. The trigger stuff should just be an XML file. But you are right, its not important.
Suggestion: Arrays with string index. Basically just a wrapper for a data table call.
@Kueken531: Go
Foo[1]* f; would be a pointer to a one dimensional array of Foo structs (not classes). But even if Foo is a struct, that does not work since pointers to fixed size arrays do not exist (pretty much like in C
++
). Foo[]* f; would work (pointer to a dynamic Foo-struct array).Arrays with string as index would definitely be useful. I really would like more than strings though, like triggers, units or whatever but I guess the SC2 limitations don't allow for that.
To have a more general way of doing this, I propose Operator Overloading. Then one could write a generic table class with appropriate [] operators taking strings or whatever is wanted. I am also a fan of the << and >> operators in C
++
for streams or container classes, (+,-,*,/) for vectors, ...)Just because I recently had difficulty with this, I want expand on that. The above statement only declares the initial array of 42 Foo pointers that don't point to anything (technically I think they are all pointing to the same object, but not important). To actually use the array, you'd have to go through and declare each one in something like:
This only applies to arrays of pointers.
crashes the compiler.
Also, I do not seem to be able to send error messages anymore.
OK, here are some more suggestions. Of course everything is subject to discussion and does not have to be useful.
Galaxy
++
Language Suggestions++
. Maybe there have to be some changes such as the []= operator in vJass for array-assignment.++
) to mark methods that they can get overwritten. I'm not sure how it would get implemented (binary if/elses or something like Strilanc has written some pages before this). Also having a better implementation for Delegates would be nice (e.g. binary if/else over ints and not linear if/else over strings).Editor Suggestions
Better Navigation/Keyboard Support
Some examples for this (every mentioned key combination is just an example):
Other
++
also works like this.++
Editor is superior to the normal Trigger/Galaxy Editor in nearly every aspect. But when I have to write a unitfilter I am still opening up the Trigger Editor, defining the filter with the gui, and copy pasting the resulting script into the Galaxy++
File. I simply do not know where to put all the c_targetFilterXXX variables. Having a gui like the one for creating Class Constructors would help greatly. But not only should it be possible to crate new filters but also to change existing ones.That should be it for now :)
Do we have a way to cast a struct or class to an integer? Or do we need to add a unique id to the struct itself in addition to the id it already has in the generated code? Casting with (int) Class or trying to use the currentStruct - variable from the generated script didn't work.
€ this was tested for an array struct, where you actually have an integer as id. For data table structs with string keys, it could still cast to int, though.
So much to do, so little time :( I got some less optional projects demanding time as well..
The error server should be back up - sorry about that.
@Slarti: Go
The reason initializers are in one trigger pr initializer is the limit on the ammount of stuff that can be done in one trigger. With loops and stuff, I have no way of know how much stuff one initializer is doing. Putting them all into one trigger could reach the limit.
@Kueken531: Go
If you look at some generated dialog code, you will find a secret unannounced cast :)
I didn't add it to the documentation, or announce it in a changelog, because I kind of dislike it, but it is needed in some situations.
Wow, I just accidentaly overloaded a function, and it seems to work. Didn't even know, you added support for function overloading. I cannot find it in the documentation, either.
Indeed, it is a little... ugly. Maybe just change it to the usual cast syntax? (int) pFoo / (pFoo) v
Anyway, this will be useful for me :)
Don't worry, take your time. The tool is already amazing; I didn't think, it would develop so fast at all.
Just think about WC3, and how much time passed until stuff like vJass came up.
Hey "haste makes waste", take your time.
Ok this topic is pretty low priority since it works without errors but here is what I mean in more detail:
The following code
Currently translates to this:
While it could compile to something like this:
The main advantage would be that the triggers required to initialize everything are cleaned up after the initialization is done while also requiring less space. I don't know how much overhead the destruction of triggers costs performance wise but I don't think it's that much.
Maybe the creation of the Galaxy
++
Triggers{events{} conditions{} actions{}} could also happen in one function without hitting the execution limit. But again this should be the least of your concerns, since everything is working as it is right now.I would like support for anything, that speeds up a repetitive task like this:
So, I would like something to avoid having to write repetitive code like that. In vJass, we had Textmacros, which could shorten this quite significantly, they would look kind of like this (G
++
- ified ;) )You get the idea; they would also support simple loops etc.
Granted, they are a little ugly in vJass, if someone can think of an alternative, I won't complain ;)
Found a bug with the Inline functionality. Doing something like this:
results in following generated code:
Obviously, the order before the stop should be saved and re-issued after the wait. However, the generated script just stops the unit and then re-issues the stop.
Another bug with your dialog designer: The generated code for a specified event tried to register an event for a trigger, which was not created yet. This happened, when I was creating the dialog in the Events part for a trigger (which I am probably not supposed to). Doing so in an initializer works fine.
I currently have a weird issue, where something like this:
gets converted into this:
which obviously is wrong. The compiler tries to re-use the id variable, but it was still needed.
This is part of a huge map script; I was not able to create the same behavior in a controlled testmap or to narrow it down further. However, setting k to zero beforehand seems to fix this issue; I just declared it without initializing first.
€ apparently not. Sometimes, it works sometimes it still generates the incorrect script o_0
I attached the entire map script; you will find the quoted part in the Hero Pick - file
The scrip is completely messed up, btw. It used to work with an earlier version, but now I get flooded with errors. I am pretty sure, some of them are related to a similar problem.
€ uploaded the wrong script, re-uploaded
Hmm.. that looks weird.. I'm still working on the big rewrite and fixing its bugs though. Before I get that done, I can't really release any bug fixes, because the program is too unstable - at this point I got error reports popping up all the time :).
I know it's been a while, but changing the naming really has ramifications everywhere.. Also, as I said earlier, I do have other things to do apart from this project.
Anyway.. only advice I can really give right now is to use fields when it bugs on you like that.. It shouldn't join them.
What's this program written in? I may be able to help if you want
I'm good with C# and Java, among others
Haven't used Cpp or Python in ages, but once I get rolling I'm fine
What do you mean by fields? Arrays?
Your compiler allows arrays with a size of 0, which cause an ingame error (and don't make much sense).
public int i {get;set;}
most likely there's no check due Array[0] being actually accessible. don't make sense if you actually define it like that :P
How would I use that to stop a local variable from being replaced by the compiler? Just replacing the declaration with this results in a syntax error.
Maybe this is intentional; in Galaxy
++
, a size of 0 would sort of make sense for dynamic arrays at least. However, in plain galaxy, a size of 0 is not allowed, and causes a compiler error.So far, I should have the compiler part done, and about half of the suggestion list done. But once I get that done, there will be some time with bug fixing.
@Wyatt124: Go
The compiler is written in c#. It's probably not be a bad idea to bring others aboard for faster updates - although there are a lot of code for someone to wrap his head around - and that's probably even harder right now where the code won't compile.
@Kueken531: Go
What I meant was to use global fields instead of local variables. It won't merge a field with a local variable.
If the g
++
compiler can generate invalid code, then that is a bug, so arrays of size 0 should be reported as an error, or removed by the compiler.Okay, thanks.
Unfortunately, similar bugs happen all over my map script. I would need to replace a huge amount of locals with globals to fix all the bugs, and for my messy script, it is very hard to spot the exact locations this malfunction happens, especially because it is not reported as an error.
I would need to check the entire generated script vs the source files and once you fixed the bug, I'd have to change it back... might as well rewrite the entire map script xD. Wish me luck.
Glad to hear that :)