Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Hey guys, another question (probably gonna be lots of threads by me in the near future haha .)
Anyways, I was wondering if you can use code to change the name of certain functions. For example, in Anitarf's cinematic system the names of the camera actions are things like:
I assumed that this 'call' action came from the code he had written in the part where you click the name of map in the top left hand corner of the trigger editor. If so, can you change the name of certain functions (or can you at all?) and I guess if someone is also willing to explain, how do you create custom variables for the function to take (as in he makes the action use real time, real x and real y and so on).
Also, another quick question if someone can be bothered answering: what are leaks? I know that some triggers 'leak' such as "Pick every unit in Unit Group and do Action" triggers, but what does that mean they 'leak' and why does this end up slowing down the map? This is more just out of curiosity
Hey guys, another question (probably gonna be lots of threads by me in the near future haha .)
Anyways, I was wondering if you can use code to change the name of certain functions. For example, in Anitarf's cinematic system the names of the camera actions are things like:
I assumed that this 'call' action came from the code he had written in the part where you click the name of map in the top left hand corner of the trigger editor. If so, can you change the name of certain functions (or can you at all?) and I guess if someone is also willing to explain, how do you create custom variables for the function to take (as in he makes the action use real time, real x and real y and so on).
When you define a function, it is basically something you can execute later on and perform the actions within. Sometimes, however, you don't always want the same thing to happen each time. Example:
JASS:
function MyFunction takes nothing returns nothing
call BJDebugMsg("Hello World!")
endfunction
function SomeOtherFunction takes nothing returns nothing
call MyFunction()
endfunction
However, what if you wanted to define what message to display? Then you would do:
JASS:
function MyFunction takes string message returns nothing
call BJDebugMsg(message)
endfunction
function SomeOtherFunction takes nothing returns nothing
call MyFunction()
endfunction
Now, parameters act as variables themselves. When you input a value, it will use that value. So think of it this way:
You are walking down the street with quite a bit of change in your left pocket. Some whip cream in your golden locket. So you walk into a store and go to a Coinstar machine. Now, you put some of your coins in, and it will turn it into a dollar each. But what if you have a larger amount, and want it in 10's or 20's? Well, it would be a different situation. If the Coinstar were theoretically be able to "take" what currency amount you want, and then return it in the right amount, you would be easily up and done. But instead, you have to go and walk to the cashier and exchange the dollars, or just deal with it.
So now, say you input "10$'s" Now it will give you the money in the one you want.
--------
To define a parameter, you add takes type Name, type Name2, type Name3 returns type
So what if you want to take an integer?
JASS:
function MyNewFunctionThatTakesInteger takes integer wheeParameter returns nothing
What if we want it to take a string as well?
JASS:
function Whee takes integer lala, string lulu returns nothing
Also, another quick question if someone can be bothered answering: what are leaks? I know that some triggers 'leak' such as "Pick every unit in Unit Group and do Action" triggers, but what does that mean they 'leak' and why does this end up slowing down the map? This is more just out of curiosity
Leaks are known as memory that you no longer need. So if you create a special effect, and never destroy it, it is a leak. You no longer need it, and it is just sitting there in memory. It occurs mostly when you either lose reference to it when you want to destroy/remove it [as in, you have nothing pointing to it and have no way to access it again to destroy it] and it is when you simply forget to destroy/remove it.
There are many tutorials here for it. =)
It slows down the map depending on how major the leak is. Usually, they will build up and slow your map. One leak isn't going to kill your map, otherwise we wouldn't really be able to have anything permanent. It is only when you get to the hundreds or thousands of leaks where it starts to hinder your map.
Think of it like this:
You have a binder. It has tons of papers. Papers you don't need. When your boss comes, he tells you to get certain contracts out of the binder. What do those papers do? Yes, they slow you down. You flip through them when you don't need to. You could've just thrown them away and had a much lighter binder. Then your boss fires you for wasting his time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.