- Joined
- Dec 12, 2011
- Messages
- 116
Okay, Magtheridon96 told me that all BJ's are bad because they are slow (except one that is something like TriggerRegisterAnyUnitEventBJ). So, I am creating a JASS script (actually, I started it through GUI and converted it to Custom Text). After conversion, I saw some BJ's there.
I made this with the intention to learn only. So, you guys will look to my function and say "wtf this function does nothing but waste memory". Yes, I just want to know how to replace those BJ's.
So, I want you guys to help me to improve this script:
The RectFromCenterSizeBJ comes from the GUI function Region - Convert point with size to region
The EnumItemsInRectBJ comes from the GUI function Item - Pick every Item in Region and do (Actions)
By the way, I am not sure if this part of the forum is the right place to post this.
hamsterpellet
I made this with the intention to learn only. So, you guys will look to my function and say "wtf this function does nothing but waste memory". Yes, I just want to know how to replace those BJ's.
So, I want you guys to help me to improve this script:
JASS:
function insideItemLoop takes nothing returns nothing
set udg_ItemArray[udg_tempInteger] = GetEnumItem()
call SetItemVisible(GetEnumItem(), false)
set udg_tempInteger = udg_tempInteger + 1
endfunction
function myFunc takes real x, real y returns nothing
local rect itemRegion = RectFromCenterSizeBJ(Location(x,y), 100.00, 100.00)
local integer counter = 0
set udg_tempInteger = 0
call EnumItemsInRectBJ( itemRegion, function insideItemLoop )
call RemoveRect( itemRegion )
set itemRegion = null
loop
exitwhen counter > udg_tempInteger
call SetItemVisible(udg_ItemArray[counter], true)
set counter = counter + 1
endloop
endfunction
The RectFromCenterSizeBJ comes from the GUI function Region - Convert point with size to region
The EnumItemsInRectBJ comes from the GUI function Item - Pick every Item in Region and do (Actions)
By the way, I am not sure if this part of the forum is the right place to post this.
hamsterpellet