| 09-30-2007, 07:26 PM | #1 |
I need to get items class from items type, there does not seem to be a function for that. Any ideas? |
| 09-30-2007, 08:03 PM | #2 |
Create an item with the type, and check the class on that? |
| 09-30-2007, 08:07 PM | #3 |
can't do, it is in a performance bottleneck. Anyways I found something interesting: JASS:function GetInventoryIndexOfItemTypeBJ takes unit whichUnit, integer itemId returns integer local integer index local item indexItem set index = 0 loop set indexItem = UnitItemInSlot(whichUnit, index) if (indexItem != null) and (GetItemTypeId(indexItem) == itemId) then return index + 1 endif set index = index + 1 exitwhen index >= bj_MAX_INVENTORY endloop return 0 endfunction jass does smart conditional statement evaluation, had no idea... |
| 09-30-2007, 08:22 PM | #4 |
What you mean is that if you have an 'and', and the first condition is false, Jass doesn't bother with the second one. Correct? |
| 09-30-2007, 08:29 PM | #5 | |
Quote:
|
| 09-30-2007, 08:29 PM | #6 |
yes. It is nitto, saves some trouble when making nested if statements. EDIT: I still need an answer for the question from the first post, so if anyone finds it let me know. Vex, lool, did you insert your post before mine? I could sware I checked this thread and there was no your post between Here-b-Trollz and me. Anyways I am afraid of your optimizer. Some of my algorithms depend on integer overflows. Basically there are places where (x*256)/256 should NOT be optimized. (Note that standard programming languages don't optimize this kind of statement) Oh and I found a solution for my problem, apparently there exist a function GetLastRemovedItem() - loooooool |
| 09-30-2007, 10:06 PM | #7 |
Also there is a last minipulated item |
