- Joined
- Dec 14, 2005
- Messages
- 10,532
Well, since GUIers were complaining about not being able to make functions, even with a little Custom Scripts, or anything, (like they can do with locals), I came up with a theory, and gave it a test -- it worked!
When you have a GUI trigger such as
Anyways, I found out that you can effectively cut short the 'Trigger_bleh_Actions' function block and inject your own functions into the 'actions' of GUI, with parameters, returns, and all that, and even put GUI in it!
Basically, you're cutting off the Actions function prematurely, then injecting function declarations, like this. (here's an example of a GUI trigger used solely to hold custom functions)
This compiles a little weirdly, as it still takes default indenting, so that the result (actions only) would look something like
(note - dashes represent spaces... for some reason, the JASS tag was removing the spaces)
So sure, the indenting is a little nasty, but if you don't plan on converting it anyways... I just thought people may find this interesting
When you have a GUI trigger such as
- bleh
- Events
- Something Happens
- Conditions
- Actions
- Do Something
- bleh
- Events
- Something Happens
- Conditions
- Actions
- Custom Script: local real pi = 3.14159
- Do Something
Anyways, I found out that you can effectively cut short the 'Trigger_bleh_Actions' function block and inject your own functions into the 'actions' of GUI, with parameters, returns, and all that, and even put GUI in it!
Basically, you're cutting off the Actions function prematurely, then injecting function declarations, like this. (here's an example of a GUI trigger used solely to hold custom functions)
- bleh
- Events
- Conditions
- Actions
- Custom Script: endfunction
- Custom Script: function ZomgGUIParameterReturnFunction takes unit u, real cheese, real pie returns integer
- Custom Script: return 5
This compiles a little weirdly, as it still takes default indenting, so that the result (actions only) would look something like
JASS:
function Trig_bleh_Actions takes nothing returns nothing
----endfunction
----function ZomgGUIParameterReturnFunction takes unit u, real cheese, real pie returns integer
----return 5
endfunction
(note - dashes represent spaces... for some reason, the JASS tag was removing the spaces)
So sure, the indenting is a little nasty, but if you don't plan on converting it anyways... I just thought people may find this interesting