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.
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.
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.
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 ;) )
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.
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.
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.
I don't think that looking at the compiled output is of much help since its pretty obfuscated and you can already see that with the import manager.
I might have used the wrong formulation here, I am not talking about the compiled output, I am talking about the source code. The compiled output will be replacing the map script, of course, but there is the option to save and load the source code to the map as well.
Currently, this only includes the g++ source files in the map's mpq archive, and you can't look at their contents within the import manager, because they don't have a supported file ending. But since the triggers are unused for an injected map script anyway, we might as well use them to display the source code. People could have a look at the code, even though they won't be able to change anything.
Another question: How do I declare and use an array of classes?
Foo*bar;
works for Foo being a class, but
Foo[1]*bar;
gives me an error message:
"Damage System\Damage System[25, 1]: You can only make dynamic instansiations of classes."
I just started working with enrichments, and the editor crashed on me, when attempting:
UnitFromId(233).evasion=.5;
with evasion obviously being a unit enrichment of type fixed. Changing this to:
unitu=UnitFromId(233);u.evasion=.5;
fixed the crash and works just fine ingame.
Also, I was not able to send the crash log, it complained about my internet connection, which works just fine.
Another suggestion: What about showing the source script in the trigger editor, if you choose to save the galaxy++ source files into the map? You could make your editor generate folders and custom script objects to show up in the trigger editor, instead of just import the stuff without a chance to look at the script from within the galaxy editor. Obviously, you would not be able to change the script within the map and the syntax highlighting would be messed up, but you would at least be able to see the script without actually having your editor available. You could also include some advertising, like "Want to code like this? Try Galaxy++!" :p
This will be helpful for people looking at maps, which use G++
Apparently, vanilla galaxy supports for - loops now (did I miss a changelog or something?), so you could make your compiler use that instead of a while loop.
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.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).
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
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 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 ;)
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.
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.
crashes the compiler.
Also, I do not seem to be able to send error messages anymore.
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.
I might have used the wrong formulation here, I am not talking about the compiled output, I am talking about the source code. The compiled output will be replacing the map script, of course, but there is the option to save and load the source code to the map as well.
Currently, this only includes the g
++
source files in the map's mpq archive, and you can't look at their contents within the import manager, because they don't have a supported file ending. But since the triggers are unused for an injected map script anyway, we might as well use them to display the source code. People could have a look at the code, even though they won't be able to change anything.Another question: How do I declare and use an array of classes?
works for Foo being a class, but
gives me an error message:
"Damage System\Damage System[25, 1]: You can only make dynamic instansiations of classes."
I just started working with enrichments, and the editor crashed on me, when attempting:
with evasion obviously being a unit enrichment of type fixed. Changing this to:
fixed the crash and works just fine ingame.
Also, I was not able to send the crash log, it complained about my internet connection, which works just fine.
Another suggestion: What about showing the source script in the trigger editor, if you choose to save the galaxy
++
source files into the map? You could make your editor generate folders and custom script objects to show up in the trigger editor, instead of just import the stuff without a chance to look at the script from within the galaxy editor. Obviously, you would not be able to change the script within the map and the syntax highlighting would be messed up, but you would at least be able to see the script without actually having your editor available. You could also include some advertising, like "Want to code like this? Try Galaxy++
!" :pThis will be helpful for people looking at maps, which use G
++
Happy anniversary!
It has gone a long way since then ;) (if this is anywhere close to correct english)
Apparently, vanilla galaxy supports for - loops now (did I miss a changelog or something?), so you could make your compiler use that instead of a while loop.
@g4borg: Go
As long as you paste valid galaxy code, it should work.
Is it intentional, that toString typecasts are only executed, if you concatenate strings? If yes, whats wrong about typecasting always?
Now you cannot test your code without renaming one of the source files to MapScript.galaxy
++
, it seems.