Have taken a pause from my map for a while, but have decided to work a little more on it now. However, I just noticed how annoying the trigger GUI is. I am used to coding in languages like Java, and I feel like the trigger GUI makes trivial tasks annoying when they should be just that, trivial. However, have already made quite a few triggers for my map and I am not sure how moving from the GUI would affect them. Should I stick with the trigger GUI or move on to galaxy?
They don't exclude each other, you can keep your current triggers and just use galaxy for any future development, or replace the Gui triggers one by one.
You can also copy the generated map script of the triggers and use that.
If you don't like Gui and are willing to learn Galaxy, there is no reason to stick with Gui, in my opinion. Its your decision after all.
However, I strongly recommend switching to a decend development environment besides the galaxy editor (for example Notepad + + or Beier's Galaxy + + editor). Stuff like autocompletion makes coding in galaxy so much more convenient.
A good suggestion for working both at the same time is to show raw form of the GUI by pressing Ctrl + D, it will convert all current GUI into their raw function name. Getting used to them will help you code in galaxy faster. galaxy is based on C, which your java knowledge will help in familiarizing.
And adding custom script along with your GUI trigger will work just as fine.
Thanks guys. Want to make sure my understanding so far is correct.
This is what I have understood from what I have read. Galaxy is very much like C but a LOT more limited. For example it doesnt allow you to dynamically allocate memory. There are no pointers and such. You cannot have real dynamic arrays (I can imagine that you can fake them, though). There is no for-loop. You have to declare the variables before they are used (no "int number = 84" I guess?). When arrays are declared you donĀ“t give the size but rather the last index. Galaxy, as a language, is statically and strongly typed. It is also compiled.
Have I understood the language? Or is there something I have missed or missunderstood?
This should work, initializing a variable is supported, so are constant variables (which need to be initialized anyway)
You just cannot do this in the middle of a function.
There are several language extentions in development, which try to bypass the limits of the Galaxy language by using precompilers. For example Galaxy++ by Beier or Andromeda by Gex. Both of them support many additional features already (pointers, dynamic memory allocation, for loops, use variables before declaration etc etc).
Of course, all those are "pseudo-features", the precompiler translates all this to standard galaxy again (like translates for to while loops, declares variables at the top automatically, uses data tables for pointers and dynamic memory allocation...).
Another question. I have read somewhere that you should avoid the for-loop things that the GUI provides because they are slow. Didnt make sense until I looked at how it was done in Galaxy. This is an example from one of the triggers in my map.
It uses some IntLoopBegin and other functions like that. So my question is, should I avoid them and instead do something like this (just smashed some code together, havent checked if it works).
Another question. I have read somewhere that you should avoid the for-loop things that the GUI provides because they are slow. Didnt make sense until I looked at how it was done in Galaxy.
For loops were fixed some patches ago. They used to create tons and tons of unnecessary code when nested. Right now, its fine to use them.
Quote:
Ohh, and just so I get my terms correctly, it is function, right?
Yes, in Galaxy they are called functions (afaik). However, everyone will understand you, if you call them methods or whatever.
Ok, good, would be annoying to have to add that myself all the time, lol. Anyway, thanks for the help. Again. Will return if I have more questions :) .
Have started to play a little with galaxy now. After playing around with the editors own thing for writing the scripts I concluded it was way to annoying and buggy to be a preferable choice and decided to use Notepad+ +. Already have it installed on the system anyway (it is just a great tool to have). But now I have another problem... how do I include external script files in the map?
I actually want to pick up galaxy code. I know the syntax of C and I can code in gml, which is very similar to C. But I'm just not sure how to actually get the code into the map to use it. Do you just make a trigger and then use the 'custom code' action? Or you can make a "trigger" entirely with code? Or does the event for the trigger need to be made in the GUI? And is there any documentation for it?
You can create a new custom script object instead of a trigger. This uses an initializer function, which gets started at map init. For creating triggers, adding events etc, use the according galaxy script actions, for example like this:
You can also import .galaxy files holding the code and include them to your script by using the include command and calling the initializer functions somehow.
You could even replace the whole MapScript.galaxy file every time you change something. A function called InitMap() is started automatically at map initialization. Note that the MapScript.galaxy file gets overwritten every time you change triggers in your map.
Hi all.
Have taken a pause from my map for a while, but have decided to work a little more on it now. However, I just noticed how annoying the trigger GUI is. I am used to coding in languages like Java, and I feel like the trigger GUI makes trivial tasks annoying when they should be just that, trivial. However, have already made quite a few triggers for my map and I am not sure how moving from the GUI would affect them. Should I stick with the trigger GUI or move on to galaxy?
Take care, PsycoticBanana.
They don't exclude each other, you can keep your current triggers and just use galaxy for any future development, or replace the Gui triggers one by one.
You can also copy the generated map script of the triggers and use that.
If you don't like Gui and are willing to learn Galaxy, there is no reason to stick with Gui, in my opinion. Its your decision after all.
However, I strongly recommend switching to a decend development environment besides the galaxy editor (for example Notepad + + or Beier's Galaxy + + editor). Stuff like autocompletion makes coding in galaxy so much more convenient.
A good suggestion for working both at the same time is to show raw form of the GUI by pressing Ctrl + D, it will convert all current GUI into their raw function name. Getting used to them will help you code in galaxy faster. galaxy is based on C, which your java knowledge will help in familiarizing.
And adding custom script along with your GUI trigger will work just as fine.
Thanks guys. Want to make sure my understanding so far is correct.
This is what I have understood from what I have read. Galaxy is very much like C but a LOT more limited. For example it doesnt allow you to dynamically allocate memory. There are no pointers and such. You cannot have real dynamic arrays (I can imagine that you can fake them, though). There is no for-loop. You have to declare the variables before they are used (no "int number = 84" I guess?). When arrays are declared you donĀ“t give the size but rather the last index. Galaxy, as a language, is statically and strongly typed. It is also compiled.
Have I understood the language? Or is there something I have missed or missunderstood?
Sounds correct so far.
This should work, initializing a variable is supported, so are constant variables (which need to be initialized anyway)
You just cannot do this in the middle of a function.
There are several language extentions in development, which try to bypass the limits of the Galaxy language by using precompilers. For example Galaxy++ by Beier or Andromeda by Gex. Both of them support many additional features already (pointers, dynamic memory allocation, for loops, use variables before declaration etc etc).
Of course, all those are "pseudo-features", the precompiler translates all this to standard galaxy again (like translates for to while loops, declares variables at the top automatically, uses data tables for pointers and dynamic memory allocation...).
Ok, thanks :).
Another question. I have read somewhere that you should avoid the for-loop things that the GUI provides because they are slow. Didnt make sense until I looked at how it was done in Galaxy. This is an example from one of the triggers in my map.
It uses some IntLoopBegin and other functions like that. So my question is, should I avoid them and instead do something like this (just smashed some code together, havent checked if it works).
This is assuming IntLoopBegin means it will start with 0 and end with 7. Is that assumption correct?
Ohh, and just so I get my terms correctly, it is function, right?
EDIT:
Also, does galaxy support things like increasing variables like this.
And decreasing them like this.
Sorry for bombarding you guys with questions, I just want to understand how Galaxy does things.
For loops were fixed some patches ago. They used to create tons and tons of unnecessary code when nested. Right now, its fine to use them.
Yes, in Galaxy they are called functions (afaik). However, everyone will understand you, if you call them methods or whatever.
No, Galaxy just supports += and -=
Most language extensions do support all of them, though.
Ok, that is great!
Ok, thanks again.
And now on to another question. I noticed the gui added an else part when it was not needed (at last it does not seem to be needed to me).
Is that just something the GUI does or something I should do as well for some reason?
yes
no
Ok, good, would be annoying to have to add that myself all the time, lol. Anyway, thanks for the help. Again. Will return if I have more questions :) .
Have started to play a little with galaxy now. After playing around with the editors own thing for writing the scripts I concluded it was way to annoying and buggy to be a preferable choice and decided to use Notepad+ +. Already have it installed on the system anyway (it is just a great tool to have). But now I have another problem... how do I include external script files in the map?
I actually want to pick up galaxy code. I know the syntax of C and I can code in gml, which is very similar to C. But I'm just not sure how to actually get the code into the map to use it. Do you just make a trigger and then use the 'custom code' action? Or you can make a "trigger" entirely with code? Or does the event for the trigger need to be made in the GUI? And is there any documentation for it?
@PsycoticBanana: Go @zeldarules28: Go
You can create a new custom script object instead of a trigger. This uses an initializer function, which gets started at map init. For creating triggers, adding events etc, use the according galaxy script actions, for example like this:
You can also import .galaxy files holding the code and include them to your script by using the include command and calling the initializer functions somehow.
You could even replace the whole MapScript.galaxy file every time you change something. A function called InitMap() is started automatically at map initialization. Note that the MapScript.galaxy file gets overwritten every time you change triggers in your map.