Signup Now
Results 1 to 2 of 2
  1. #1
    Free User
    Join Date
    Feb 2014
    Posts
    5
    Reputation
    10
    Rep Power
    0

    getcontainer function BUG

    Hi, I think I found bug in function "GetContainer", check it out

    Script
    Code:
    init start
    	PlatinumBackpack = "green backpack"
    	local fontsize = 7
    	local fontspacing = fontsize + 6
    	setfontstyle('Tahoma', fontsize, 99, 0xFFFFFF, 1, 0)
    	setmaskcolorxp(0)
    init end
    
    
    InitPosX = $clientwin.left + 5
    InitPosY = $clientwin.top + 0
    addtext("Ibot Function 1: ".. getcontainer_ib(PlatinumBackpack).items[0].count .." coins.", InitPosX + 200, InitPosY + 45)
    addtext("Ibot Function 2: ".. getcontainer_ib(PlatinumBackpack).items[1].count .." coins.", InitPosX + 200, InitPosY + 60)
    addtext("Ibot Function 3: ".. getcontainer_ib(PlatinumBackpack).items[2].count .." coins.", InitPosX + 200, InitPosY + 75)
    addtext("Ibot Function 4: ".. getcontainer_ib(PlatinumBackpack).items[3].count .." coins.", InitPosX + 200, InitPosY + 90)
    
    addtext("Wind Function 1: ".. getcontainer(PlatinumBackpack).item[0].count .." coins.", InitPosX + 200, InitPosY + 105)
    addtext("Wind Function 2: ".. getcontainer(PlatinumBackpack).item[1].count .." coins.", InitPosX + 200, InitPosY + 120)
    Here's a picture of the return of the functions tested one by one!

    img1.jpg

    Now see what I think may be a bug!

    In this code have this error...

    Code:
    addtext("Wind Function 2: ".. getcontainer(PlatinumBackpack).item[1].count .." coins.", InitPosX + 200, InitPosY + 120)
    Code:
    error in HUD script NewHUDScript1:
      ["addtext("Wind Function 2: ".. getcont..."]:NewHUDScript1:22 attempt to index field 'item' with an unknown property
    In this code return nil and stop script ...

    Code:
    addtext("Ibot Function 4: ".. getcontainer_ib(PlatinumBackpack).items[3].count .." coins.", InitPosX + 200, InitPosY + 90)
    Code:
    error in HUD script NewHUDScript1:
      ["addtext("Ibot Function 4: ".. getcont..."]:NewHUDScript1:15 attempt to index a nil value

  2. #2
    Administrator Lucas Terra's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    2,200
    Reputation
    180
    Rep Power
    10
    I will check that.

    But you are doing it wrongly, anyways. You should not use getcontainer_ib. iBot did it all wrong, making their tables 0-indexed, so I had to make this function to make iBot scripts compatible.

    You should only use getcontainer(...), and the tables are 1-indexed (meaning items start at index 1, and ends at cont.itemcount).

    init start
    PlatinumBackpack = "green backpack"
    local fontsize = 7
    local fontspacing = fontsize + 6
    setfontstyle('Tahoma', fontsize, 99, 0xFFFFFF, 1, 0)
    setmaskcolorxp(0)
    init end


    local InitPosX = $clientwin.left + 205
    local InitPosY = $clientwin.top + 0

    local cont = getcontainer(PlatinumBackpack) -- only call getcontainer once, store it at a variable...

    for i = 1, cont.itemcount do
    addtext("Wind Function "..i..": ".. cont.item[i].count .." coins.", InitPosX, InitPosY + (fontspacing-1) * i )
    end

 

 

Posting Permissions

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