Results 1 to 6 of 6

Thread: Hunt: loot checker with array of items on Setup.

  1. #1
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5

    Hunt: loot checker with array of items on Setup.

    I need a waypoint action which has the same function as itemcount() but is not exactly the same.

    In my Setup, I will have an array like:

    PHP Code:
    items = {"vampire shield","plate armor","crown legs"
    And in my waypoint action, I will have something like:

    PHP Code:
    if itemcount(items) > 0 then gotolabel("x"end 
    Of course itemcount() doesn't accept arrays, this is just an example.

    Can someone code this to me? Unfortunately I don't know how to check an array of items.
    Last edited by john86; 01-22-2013 at 04:14 PM.

  2. #2
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5
    Quote Originally Posted by BUgWT View Post
    PHP Code:
    itemcount("vampire shield""plate armor""crown legs"
    So itemcount() accepts array? I didn't know that.

    If I wanted to put the items to be checked in my Setup, how would it look like?

    Setup:
    PHP Code:
    items = {"vampire shield","plate armor","crown legs"
    Waypoint action:
    PHP Code:
    if itemcount(items) > 0 then gotolabel("x"end 
    ?

  3. #3
    iBot User walukasz's Avatar
    Join Date
    Feb 2012
    Location
    Poland
    Posts
    312
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    25 Post(s)
    Reputation
    67
    Rep Power
    5
    if it really accepts arrays then:

    if itemcount(unpack(items)) > 0 then gotolabel("x") end

  4. #4
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5
    itemcount() definitely doesn't accept arrays. I tested it.

    I think it's still possible, though, like using an "for each" (sorry I am noob at this...) for each item of the array items.

    PHP Code:
    for each item in array do
    if 
    itemcount(items+) > 0 then
    ...
    end
    end 
    Well, one might have an idea of what I'm trying to say.

    A good soul please help me

  5. #5
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    You want to count all of your items, but different kinds of items?


    PHP Code:
    local total 0

    for 1,#items do
        
    total total+itemcount(items[i])
    end

    if total 0 then
    ..
    end 
    Last edited by pink_panther; 01-23-2013 at 07:50 AM.

  6. #6
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5
    Thanks, it's working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •