Is there a list of how to write what you want to be done? I am interested in writing my own if I ever have a use to do so... Is it a more responsive method than triggers? Is that why it is used?
Edit: I have tried to create a traceline script to cause colissions with bullets where you look but it never worked :( I dislike very much how there is no auto correct for minor mistakes and typos...
If such a "list" existed, it would contain more words than the current size of the known Universe in cubic micrometers. That's the whole point of programming and scripting; the possibilities are practically infinite. Of course, most of those possibilities are of no interest whatsoever to any of us, but still, even 0.01% of "practical infinity" remains a gargantuan number.
The best place to start for learning galaxy is probably here, and then using the Script View (CTRL-F11 from the Trigger Editor) to look at code generated by triggers.
Galaxy scripting is mostly used either because the mapmaker is simply used to typing code, wants to have more control and flexibility over how the map/script works, wants to do more with less (often, a smart coder can make a small script in five minutes where doing the same thing with triggers would take half an hour), or wants to optimize his code for maximal performance (because you need better control over the code to achieve this than what is offered by triggers), or any combination of the previous points.
Fair warning though: Even galaxy, as simplistic a language as it is, is not for the faint of heart and will take a lot of time and effort to learn if you've never worked with programming or scripting languages before.
A bitwise AND returns an integer and not a boolean value.
You first try "return a & b" which would return an integer and then "return false" which returns boolean. I don't know what your return type is, but since you said the second option works for you it must be boolean. And since the first option returns an integer there is a type conflict.
Galaxy is very type strict, as you know.
but there are some errors with it and I can't fix it because I'm not quite sure what is done wrong. I followed it EXACTLY, I swear EXACTLY, but it didn't work...
but there are some errors with it and I can't fix it because I'm not quite sure what is done wrong. I followed it EXACTLY, I swear EXACTLY, but it didn't work...
Why use traceLines when you can get the .... X,Y,Z cords of the mouse cursor now?
traceline would just tell you if theres something in the way (from my understanding) .... and the XYZ cords.... are of the mouse cursor and take that into account if unit/actor/models have the "3d volumes" turned on (from my understanding)
Is there a list of how to write what you want to be done? I am interested in writing my own if I ever have a use to do so... Is it a more responsive method than triggers? Is that why it is used?
Edit: I have tried to create a traceline script to cause colissions with bullets where you look but it never worked :( I dislike very much how there is no auto correct for minor mistakes and typos...
@Reaper872: Go
If such a "list" existed, it would contain more words than the current size of the known Universe in cubic micrometers. That's the whole point of programming and scripting; the possibilities are practically infinite. Of course, most of those possibilities are of no interest whatsoever to any of us, but still, even 0.01% of "practical infinity" remains a gargantuan number.
The best place to start for learning galaxy is probably here, and then using the Script View (CTRL-F11 from the Trigger Editor) to look at code generated by triggers.
Galaxy scripting is mostly used either because the mapmaker is simply used to typing code, wants to have more control and flexibility over how the map/script works, wants to do more with less (often, a smart coder can make a small script in five minutes where doing the same thing with triggers would take half an hour), or wants to optimize his code for maximal performance (because you need better control over the code to achieve this than what is offered by triggers), or any combination of the previous points.
Fair warning though: Even galaxy, as simplistic a language as it is, is not for the faint of heart and will take a lot of time and effort to learn if you've never worked with programming or scripting languages before.
@DaFranker: Go
Working with Galaxy also exposes a few flaws in the language such as:
will not properly compile, despite being a valid boolean expression.
In fact, you actually need to do:
So you need to be able to detect and work around language bugs like that that you may find.
@MotiveMe: Go
use && pls. bitwise and is not and
You can't bitwise AND booleans in galaxy.
This works.
@s3rius: Go
I think you misunderstood me.
I was indeed intending to do a bitwise AND, and they are in fact both integer variables.
In fact, I could not get something like what s3rius quoted to work.
A bitwise AND returns an integer and not a boolean value.
You first try "return a & b" which would return an integer and then "return false" which returns boolean. I don't know what your return type is, but since you said the second option works for you it must be boolean. And since the first option returns an integer there is a type conflict.
Galaxy is very type strict, as you know.
These two are valid operations. The first one does the same thing as your second option (with the if-then-else).
You sure? I just tried it myself to make sure I'm not mistaken. It does compile for me without problems.
@s3rius: Go
But an integer should be cast to a boolean expression even in Galaxy. Doing for example:
is completely valid because it just checks the value against 0, which is what should be happening here.
There should be no reason anything I can use validly in an if() shouldn't work in a return, right?
In any case, I also had an issue with this code:
"aMask & bMask != 0" would be a valid boolean expression.
U want galaxy automatic cast a integer to a boolean? How typesafe is that XXXX?
Well, I am despratley trying to understand how to do this
http://forums.sc2mapster.com/resources/tutorials/1626-trigger-how-to-target-with-mouselook-tracelines/
but there are some errors with it and I can't fix it because I'm not quite sure what is done wrong. I followed it EXACTLY, I swear EXACTLY, but it didn't work...
Yes, I do. Because it already does in a lot of places.
Also, aMask & bMask != 0 IS a boolean expression.
@MotiveMe: Go
Well I think the SC2 code validator is a bitch.
Return will work if u only return a variable. But u want to return a operation.
Work arround(don't know if it works)
That doesn't work? It should compile well.
It compiles just fine. My guess is, you forgot the brackets.
compiles, while
gives an error. (I did not check, if the results are correct, only, if it compiles)
Why use traceLines when you can get the .... X,Y,Z cords of the mouse cursor now?
traceline would just tell you if theres something in the way (from my understanding) .... and the XYZ cords.... are of the mouse cursor and take that into account if unit/actor/models have the "3d volumes" turned on (from my understanding)
@MotiveMe: Go
Eh Im suprised.... that works in VB6.... i never code like that though
thats basically what your doing in script with a function call huh?