Hello, would like to ask about function settings flags. I have 0 experience in programming and no background in mapping before sc2 so i figured out only one of them : create thread. What other checkboxes should i use and in what cases. Plz help to figure out this :>. Also whould like to ask if this is somehow connected with possibility to make so that only one thread can exist per one unit or 2 threads sharing local variables within one trigger (without global variables and unit custom values)
Create thread allows the trigger that the function is in to continue onto its next actions while still doing everything in the the function itself (so it doesn't have to wait); it is extremely useful and somethings the only solution for things like multi action ai, trigger optimization, etc. While it is possible to have multiple functions use the same local variable passed on throught the parameters or return you will want to look into locks to prevent deadlock errors. There is a post already around that explains in great detail about custom definitions and threading (http://www.sc2mapster.com/forums/resources/tutorials/1828-trigger-multithreading-and-ai/).
At this point i wouldn't worry about a lot of the flags for function. Most flags are to emulate the gui's weirder actions such as pick each integer which can easily be done without a function or its for organization.
The flag you should focus on is the threaded flag. This flag changes the behavior, kinda like a the run trigger action. you can make the trigger wait for the function to finish before continuing or run the function and trigger side by side.
Oh, that's very cool to know about. In maps in the past I would create a seperate trigger with no event, and use the run trigger action. Ussually some variable needed referencing, so had to do global variables.
This gets me wondering, are local variables in custom functions much like the ones in triggers? Where they won't be referenced by things outside the action? Specifically for instance, let's say I had a loop that picked all of player 1 units, marked them red, then killed them 10 seconds later. Could I do something like:
I realize with something like that situation, I could set it up several other ways. I'm simply wondering about how local variables work in custom actions. Basically I'm hoping that the 1st loops picked unit won't have any affect on subsequent loops because of the wait action.
cmon guys i asked not about threads, i'm fine working with them. I just asked about a few checkboxes which appears below when you clicking on the second item after function name, before the return type item. It calls settings or maybe properties in english version of editor, not sure about that. So to be more specific i would like to know what will change if i will check the "Own", "Hide", "Subfunction" or "Operator" flag (again not sure about how it's named in engl version of editor, hopefully it was exact translation) What are the life applications for this properties?
@abvdzh: Go
Okay, here is what I found out about some of them:
Hidden: This just hides the action in the list of actions/functions. You can create function "Test" and set it as hidden, and when you want to use it in a trigger, you won't find it in the action list, even if you search for "Test". You can still access it via custom script though.
Operator and Custom Script: Haven't done much with those myself, but it looks like they are pretty much the same, except Custom script messes up the GUI completely...
Here's an image where the three functions OperatorWait, ScriptWait and UsualWait are used, which I put the exact same custom script into: "Wait(lp_time, c_timeGame);" (they have time as parameter).
The Operator function (as opposed to the UsualWait function which is called inside the trigger and will execute it's script in it's own function call) just pastes its content script into the trigger. This causes a syntax error, because the trigger does not have the parameter "time" (you could bypass this by using preprocessor-code "#PARAM(time)" instead of "lp_time").
The custom script function seems to do exactly the same, with the exception that you have an extra field in the GUI which doesn't seem to do anything...
Subfunctions: Also pastes custom script code directly into the trigger, with the addition that you can define function sets which you can execute. The best example here is probably the "If-then-else" Action. It has the subfunctions "If", "Then", and "Else". How they are used can be seen in the custom script section of the action. In the "ifthenelse" case, it checks the result of the "If" subfunctions and then runs either the "Then" or the "Else" subfunctions.
Restricted: As the tooltip says this probably just marks functions like the "Award Achievement" one, so non-blizzard mapmakers are unable to use them. You probably don't want to flag this one.
But like SoulTaker already said, you probably won't really need any of those except Create Thread. "Native" has to do something with custom libraries I believe, but I have no idea what it does. "Hidden" might be useful for libraries aswell, since you can hide the function to people who use the library.
I found Subfunction stuff to be really useful for in-trigger stuff organization and you can do stuff like giving the function multiple actions as "parameter".
1.Local variables in functions stick with the function and never enter the trigger unless u use a return.
2. local trigger Variables cannot be passed to function, but your function can request variable from triggers that use them.
3. function variables like picked integer and picked players can for some odd reason be passed to functions.
@Talon0815: Go
Native just identifies how it should be treated in gui and how its listed. its organizational and never needed.
At this point i wouldn't worry about a lot of the flags for function. Most flags are to emulate the gui's weirder actions such as pick each integer which can easily be done without a function or its for organization.
The flag you should focus on is the threaded flag. This flag changes the behavior, kinda like a the run trigger action. you can make the trigger wait for the function to finish before continuing or run the function and trigger side by side.
ignore them, they are worthless, the one to be interested in is create thread.
Hello, would like to ask about function settings flags. I have 0 experience in programming and no background in mapping before sc2 so i figured out only one of them : create thread. What other checkboxes should i use and in what cases. Plz help to figure out this :>. Also whould like to ask if this is somehow connected with possibility to make so that only one thread can exist per one unit or 2 threads sharing local variables within one trigger (without global variables and unit custom values)
@abvdzh: Go
Create thread allows the trigger that the function is in to continue onto its next actions while still doing everything in the the function itself (so it doesn't have to wait); it is extremely useful and somethings the only solution for things like multi action ai, trigger optimization, etc. While it is possible to have multiple functions use the same local variable passed on throught the parameters or return you will want to look into locks to prevent deadlock errors. There is a post already around that explains in great detail about custom definitions and threading (http://www.sc2mapster.com/forums/resources/tutorials/1828-trigger-multithreading-and-ai/).
Yeah thanks but i know that. I pointed that create thread is the only setting that i Know. Can you help understand the rest plz?
p.s. Definitely will check the tutorial, seems viable!
At this point i wouldn't worry about a lot of the flags for function. Most flags are to emulate the gui's weirder actions such as pick each integer which can easily be done without a function or its for organization.
The flag you should focus on is the threaded flag. This flag changes the behavior, kinda like a the run trigger action. you can make the trigger wait for the function to finish before continuing or run the function and trigger side by side.
Oh, that's very cool to know about. In maps in the past I would create a seperate trigger with no event, and use the run trigger action. Ussually some variable needed referencing, so had to do global variables.
This gets me wondering, are local variables in custom functions much like the ones in triggers? Where they won't be referenced by things outside the action? Specifically for instance, let's say I had a loop that picked all of player 1 units, marked them red, then killed them 10 seconds later. Could I do something like:
I realize with something like that situation, I could set it up several other ways. I'm simply wondering about how local variables work in custom actions. Basically I'm hoping that the 1st loops picked unit won't have any affect on subsequent loops because of the wait action.
cmon guys i asked not about threads, i'm fine working with them. I just asked about a few checkboxes which appears below when you clicking on the second item after function name, before the return type item. It calls settings or maybe properties in english version of editor, not sure about that. So to be more specific i would like to know what will change if i will check the "Own", "Hide", "Subfunction" or "Operator" flag (again not sure about how it's named in engl version of editor, hopefully it was exact translation) What are the life applications for this properties?
@abvdzh: Go Okay, here is what I found out about some of them:
Here's an image where the three functions OperatorWait, ScriptWait and UsualWait are used, which I put the exact same custom script into: "Wait(lp_time, c_timeGame);" (they have time as parameter).
The Operator function (as opposed to the UsualWait function which is called inside the trigger and will execute it's script in it's own function call) just pastes its content script into the trigger. This causes a syntax error, because the trigger does not have the parameter "time" (you could bypass this by using preprocessor-code "#PARAM(time)" instead of "lp_time"). The custom script function seems to do exactly the same, with the exception that you have an extra field in the GUI which doesn't seem to do anything...
But like SoulTaker already said, you probably won't really need any of those except Create Thread. "Native" has to do something with custom libraries I believe, but I have no idea what it does. "Hidden" might be useful for libraries aswell, since you can hide the function to people who use the library. I found Subfunction stuff to be really useful for in-trigger stuff organization and you can do stuff like giving the function multiple actions as "parameter".
@MaskedImposter: Go
1.Local variables in functions stick with the function and never enter the trigger unless u use a return. 2. local trigger Variables cannot be passed to function, but your function can request variable from triggers that use them. 3. function variables like picked integer and picked players can for some odd reason be passed to functions.
@Talon0815: Go Native just identifies how it should be treated in gui and how its listed. its organizational and never needed.
@abvdzh: Go
ignore them, they are worthless, the one to be interested in is create thread.
Thanks! I just wanted to be sure that i'm doing triggering right and not missing something important and useful.
you probably are. i still find useful stuff i didnt know about all the time.