| 05-13-2008, 02:20 PM | #1 |
I think I can do it in a way that isn't absurdly lame, anyways these are the ideas right now: JASS:function aragat takes unit u, integer v returns boolean call SetUnitUserData(u, GetUnitUserData(GetFilterUnit() ) + v) return false endfunction //... call GroupEnumUnitsInRange(g, x,y, 500.0 , condition_function aragat(GetTriggerUnit(), 5) ) //. into: JASS:function c__ aragat takes nothing returns boolean local unit u= f__arg_unit1 local integer v = f__arg_integer1 call SetUnitUserData(u, GetUnitUserData(GetFilterUnit() ) + v) set f__arg_unit1=u set f__arg_integer1=v return false endfunction function c__GroupEnumUnitsInRange_1 takes group g, real x, real y, real radius, unit u, integer v returns nothing set f__arg_unit1=u set f__arg_integer1=v call GroupEnumUnitsInRange(g,x,y,radius,Condition(function c__aragat) ) endfunction //... call c__GroupEnumUnitsInRange_1(g, x,y, 500.0 , GetTriggerUnit(), 5 ) //. Anyways, the bad news: JASS:local boolexpr b= condition_function aragat(GetTriggerUnit(), 5) //Syntax error: illegal usage of condition_function |
| 05-13-2008, 02:41 PM | #2 |
not bad, in the end not many extra steps, and takes the hassle out of needing to do the variable transfer yourself good going |
| 05-13-2008, 02:57 PM | #3 |
It will use the same global variables all the time, I think a lot of systems use its own variables to do this stuff, I think the next challenge is to reduce the amount of global variables as much as possible. |
| 05-13-2008, 05:51 PM | #4 |
all my long life transferred value through global variables... also i feel happily) to write a pair of instructions of assignment it is completely not difficult, and code from first post obviously is not optimum=/ // define waits when it will added))) |
| 05-13-2008, 06:55 PM | #5 |
nobody will force you to use it. Speed is but a single metric of many to consider, the code I posted is the only one with correctness. |
| 05-13-2008, 07:22 PM | #6 |
Guess it is useful for non-periodic groupenums that find units to affect when a spell is cast. It would allow you to have a library of useful filters. |
| 05-13-2008, 09:58 PM | #7 |
it's called vex have idea for an pizdato useless feature. or short. 100500 wrappers will not make it better. (vJass) ofc you can do what you want but it's a publick thread :P // to hear everytime omg awesome is also boring ^^ |
| 05-14-2008, 01:19 AM | #8 |
who the hell cares if there is an extra wrapper? if it makes my life easier, any the minimal slowdown is never apparent in game, its well worth it |
| 05-14-2008, 01:42 AM | #9 | |
Quote:
Also, the wrapper is most likely to get inlined in case it is not necessary when it turns out I upgrade the inliner. And for crying out loud, this little function call is nothing in comparison to the amount of calls a ForGroup or a GroupEnum do already. And perhaps, the reduction in the globals count cancels the issue already.... This is as most of vJass is general purpose solution, thus half-assed solutions that are not robust enough are not what I want to accomplish with it, that's the reason behind all those wrappers. |
| 05-14-2008, 01:48 AM | #10 |
I like it. It makes scripting easier for me. |
| 05-14-2008, 01:58 AM | #11 |
Anyways, I made the whole post to ask about the syntax I am using, could somebody please give any feedback about it? JASS:call GroupEnumUnitsInRange(g, x,y, 500.0 , condition_function aragat(GetTriggerUnit(), 5) ) //Forgot about the version for ForGroup: call ForGroup(g, function aragat(GetTriggerUnit(), 5) ) should work in ForForce and Item/Destructable enums (Who the hell uses ForForce though?) |
| 05-14-2008, 09:34 AM | #12 | ||
Quote:
1000 useless commands - powerful argument (c) DioD // still it is possible to ask what for to invent a bicycle... imho the suggested method of transfer of argument will not be useful...) Quote:
yes, but made 100500 wrappers too there is no sense... |
| 05-14-2008, 11:19 AM | #13 |
the main problem in this is intializing local vars as for me. yes i know you need to keep value queue... btw you could use a global stack... but it's not much better. well yeah to make it "user friendly" i guess you need to add such feature. but i wouldn't use it :P i dislike code generation without my knowledge. |
| 05-14-2008, 12:13 PM | #14 |
I'm not a great fan of the condition_function syntax, partly due to the length, and partly due to the '_' which looks ugly and requires that I use two keys. I'd prefer call GroupEnumUnitsInRange(g, x,y, 500.0 , condition aragat(GetTriggerUnit(), 5) ), but I can see that might cause confusion... |
| 05-14-2008, 12:16 PM | #15 |
if it were up to me JASS:CF aragat() would be a fine, a little harder to understand, but I think easier to remember and easiest to write or perhaps JASS:CF.aragat()I am not good with syntax things |
