HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Item ID test

04-04-2009, 03:08 AM#1
wraithseeker
For example we have this.

Collapse JASS:
private function Init takes nothing returns nothing
call test.create('abcd',3) // rawcode of item and then + 3 agi

How would we go about detecting that item ID without doing
Collapse JASS:
if d.id == abcd then // continued on with the massive items
04-04-2009, 03:25 AM#2
Kwah
Add the ID abcd as a member of an array, then loop through the array checking things?
04-04-2009, 03:26 AM#3
wraithseeker
I added it as a struct member as

integer ItemID.

Why loop through the array? I don't get it.
04-04-2009, 03:31 AM#4
Vexorian
what?

--
please, explain exactly what you want to do.
04-04-2009, 03:35 AM#5
wraithseeker
I am trying to make a item bonus system, I set up the bonuses correctly but I do not know how to detect what ItemID the unit has in the inventory slot. As there is many items, I do not want to go through the usual

if .... then
if then....

To wrap it up, I want to check how do you find the ItemId and add the correct bonuses of the item correctly set up in my init function.
04-04-2009, 03:57 AM#6
Vexorian
1. Are you familiar with loops?

2. In this case, this is the sort of thing gamecache is excellent at, could try Table
04-04-2009, 03:58 AM#7
Kwah
I was going to suggest a struct, but wasn't sure if you knew vJass.

Looping through an array seems pretty self explanatory. You have a loop that performs said action upon array[loopcount].

Just use a struct, with the bonuses as members, no?

EDIT: Double Vex Poast.
04-04-2009, 04:08 AM#8
wraithseeker
Yes, I am familar with loops.

So, I set all the itemtype ids to a integer array and then I loop till I find the itemId I want? Is that how?

Yes I know vJASS.
04-04-2009, 04:13 AM#9
Kwah
First, I hate using languages that have types. It's a huge pain in the arse.

Second, listen to Vex. Table/GC.
04-04-2009, 04:28 AM#10
Vexorian
Quote:
First, I hate using languages that have types. It's a huge pain in the arse.
I can't think of any language that doesn't have types.
04-04-2009, 04:35 AM#11
Kwah
Python.

I don't have to worry 'bout them.

Types might have been the wrong word. I don't speak the lingo.
04-04-2009, 01:17 PM#12
Vexorian
Python definitely has types. Python's lack of explicit declarations makes it quite unusable for large projects, waiting 30 minutes of program execution to find out you didn't type a variable name correctly can really delay your progress.
04-04-2009, 01:47 PM#13
wraithseeker
Could you take a look at my Item Bonus, you guys are going seriously off topic now.