Ardenian
A
Ardenian
Hello, I have some questions regarding Jass and I would be glad to receive an answer.
1. One script can have unlimited functions, no matter whether for any purpose or being events, but considering the order that every function you call has to be above the line where you call it, right ?
1.B Can a function be transferred from one trigger to another ? Example, if I call a function in a GUI trigger although it is somewhere in a Jass script ?
2. That being said, do I have to create an actual trigger like a GUI one with Jass ? Couldn't I simply, for a periodic event, for example, add a function that calls another one for the actions ? Why would I have to create an actual trigger ?
3. What can I add to a function that takes something and returns something ? I saw functions taking and returning nothing having actions, but if a function does take and return something, can I add common lines there, like ' set I = I + I' ? Where would they have to be, before returns or after it ?
4. Is it possible to detect particular lines with Jass ?
Example:
If anywhwere in any trigger this line is used:
Can I somehow, without adding anything to the trigger this line is in, detect it is used/executed and call a function ?
Like making an action an event for a function ?
5. Can I check in a function for unlimited arrays ?
This question is a bit complicated, I will try to explain it as good as I can.
Example:
I cannot remember where I add it
1. One script can have unlimited functions, no matter whether for any purpose or being events, but considering the order that every function you call has to be above the line where you call it, right ?
1.B Can a function be transferred from one trigger to another ? Example, if I call a function in a GUI trigger although it is somewhere in a Jass script ?
2. That being said, do I have to create an actual trigger like a GUI one with Jass ? Couldn't I simply, for a periodic event, for example, add a function that calls another one for the actions ? Why would I have to create an actual trigger ?
3. What can I add to a function that takes something and returns something ? I saw functions taking and returning nothing having actions, but if a function does take and return something, can I add common lines there, like ' set I = I + I' ? Where would they have to be, before returns or after it ?
4. Is it possible to detect particular lines with Jass ?
Example:
If anywhwere in any trigger this line is used:
-
Unit - Add Ability to Unit
Can I somehow, without adding anything to the trigger this line is in, detect it is used/executed and call a function ?
Like making an action an event for a function ?
5. Can I check in a function for unlimited arrays ?
This question is a bit complicated, I will try to explain it as good as I can.
Example:
-
set Integer[1] = 1
-
set Integer[2] = 2
-
set Integer[3] = 3
JASS:
//This function should retrieve all integers out of the Integer[ARRAY] variables, but how can I make sure it stops if an Integer[ARRAY] does not exist anymore ( here null) ? I mean, do I have to limit the function checks ( 5 in this example) and check with a condition if == null ?
-
call CalInteger( 1, 2, 3, 4, 5)
JASS:
function CallInteger( integer I, integer A, integer B) takes nothing returns nothing
set local integer I = udg_Integer[1]
set local integer A = udg_Integer[2]
set local integer B = udg_Integer[3]
endfunction