I have recently tried to create a new function within the GUI, so I did just like I would normally do to create a new Trigger, changed the return so that it return an integer, check so that it readed custom script and then added some script that returned an integer.
The problem is, I can seem to find a way to retrieve the returned integer via any action made in my normal triggers. I have created a variable of type integer for exemple, went into the value and searched for my function anywhere and could not find it.
How am I supposed to re-use my functions within my other trigger's action?
I tried both, but my function was still not possible to use anywhere, (well exept the action one could still be used as an action in trigger of course)
If a function or action is written in custom script, GUI scripts will not be able to "see them" because they have no "grammar". One solution is to create a custom script function and then make a simple GUI stub function which just defines "grammar" for the custom script version. Another is to write a GUI function and write the function body in a custom script action. I have attached a simple map with how to do the GUI stub version.
Note* The custom script checkbox seems to be borked at the moment - use a native stub instead (see map).
Oh, I forgot to add that you can also put functions/actions into groups by right clicking on them and using the labels option. This makes them easier to find in when writing code with the GUI.
But now, for some reason, the compiler does not want to take my very basic action when trying to insert the return integer inside a variable of type integer.... It does compile it without adding the action to get the data, but as soon as I try to combine both, it messed up, does anyone has a clue of whats happening? The only error being reported is a syntax error, thanks great compiler! :P
function :
Quote:
int angle = UnitGetFacing(Unit);
return angle;
Action :
Quote:
Variable - Set BallAngle = (GetAngle((Last created unit)))
Compiler : (Error shown on the line with the )
Quote:
lv_ballAngle = int angle = UnitGetFacing(Unit);
return angle;;
It seems like it does not return the integer at the right time or something, there is even two semi-colon which seems pretty bad.
It looks like you are using the custom script checkbox on a function to define your custom script. This is currently (very) broken in the editor. As it is now, when you write a GUI function and click the custom script checkbox it simply inlines anything you write. This is far from a desired behavior. A workaround is to put your functions in their own custom script block then make a native GUI stub for your custom function. This is what I was trying to show above with the dog park map.
Hmmm, Im currently trying to do it your way to see if it could solve the problem but it seem that I can`t pass any paramaters to my function. I used to use the Unit keyword plus a Unit parameter so that I can choose what the unit would be within the Galaxy Trigger system but now it seems I can`t do anything with that solution. Its kinda annoying. Seems like the editor is slowly getting more and more annoying.
I will still search around to see if there is anything that can be done but right now there`s a serious lack of information about the programming language and the available functions. Seems like half of them are working or have to be used in a very specific way.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey everybody,
I have recently tried to create a new function within the GUI, so I did just like I would normally do to create a new Trigger, changed the return so that it return an integer, check so that it readed custom script and then added some script that returned an integer.
The problem is, I can seem to find a way to retrieve the returned integer via any action made in my normal triggers. I have created a variable of type integer for exemple, went into the value and searched for my function anywhere and could not find it.
How am I supposed to re-use my functions within my other trigger's action?
Thanks
You're probably created a new function of type action. To get the retuning value, it must be of type function though.
I tried both, but my function was still not possible to use anywhere, (well exept the action one could still be used as an action in trigger of course)
If a function or action is written in custom script, GUI scripts will not be able to "see them" because they have no "grammar". One solution is to create a custom script function and then make a simple GUI stub function which just defines "grammar" for the custom script version. Another is to write a GUI function and write the function body in a custom script action. I have attached a simple map with how to do the GUI stub version.
Note* The custom script checkbox seems to be borked at the moment - use a native stub instead (see map).
Oh that would make sense, Im going to try that as soon as possible, Thanks! :P
Oh, I forgot to add that you can also put functions/actions into groups by right clicking on them and using the labels option. This makes them easier to find in when writing code with the GUI.
Ok, I got it to work successfully :P
But now, for some reason, the compiler does not want to take my very basic action when trying to insert the return integer inside a variable of type integer.... It does compile it without adding the action to get the data, but as soon as I try to combine both, it messed up, does anyone has a clue of whats happening? The only error being reported is a syntax error, thanks great compiler! :P
function :
Action :
Compiler : (Error shown on the line with the )
It seems like it does not return the integer at the right time or something, there is even two semi-colon which seems pretty bad.
@ShaZe88: Go
It looks like you are using the custom script checkbox on a function to define your custom script. This is currently (very) broken in the editor. As it is now, when you write a GUI function and click the custom script checkbox it simply inlines anything you write. This is far from a desired behavior. A workaround is to put your functions in their own custom script block then make a native GUI stub for your custom function. This is what I was trying to show above with the dog park map.
Hmmm, Im currently trying to do it your way to see if it could solve the problem but it seem that I can`t pass any paramaters to my function. I used to use the Unit keyword plus a Unit parameter so that I can choose what the unit would be within the Galaxy Trigger system but now it seems I can`t do anything with that solution. Its kinda annoying. Seems like the editor is slowly getting more and more annoying.
I will still search around to see if there is anything that can be done but right now there`s a serious lack of information about the programming language and the available functions. Seems like half of them are working or have to be used in a very specific way.