Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Help with a certain action

  1. #1
    Normal User catok's Avatar
    Join Date
    Jan 2013
    Location
    Sweden
    Posts
    94
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    4

    Help with a certain action

    Here's the concept

    Lua Code:
    local IDs = {1, 2, 3, 4, 5, 6}
    local Item = toptileitem(posx, posy-1, posz)
     
    if Item == IDs then
     --do this action--
    end


    Yes. If you're smart you figured out this is for a dice script.. I'm experimenting.
    What i'm wondering is how do you make it do this:

    Lua Code:
    local IDs = {1, 2, 3, 4, 5, 6} -- Item IDs of all possible Dices
    local Item = toptileitem(posx, posy-1, posz) -- Position of the Dice
     
    if Item == IDs then -- Check if the position of the dice is ANY ID out of the 6 possible IDs it could be (not just one) and THEN
     --do this action--
    end


    It's for anti-trash. Just tell me this one thing and i'll figure out the rest.
    Last edited by catok; 02-15-2014 at 05:16 AM.
    Hard Working Scripter



    My Free Scripts:

    Knight
    EK - Mutated Mountains 50+ (option to hunt any tower)

  2. #2
    iBot User
    Join Date
    Aug 2012
    Posts
    805
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    38 Post(s)
    Reputation
    180
    Rep Power
    7
    Lua Code:
    local IDs = {1, 2, 3, 4, 5, 6} -- Item IDs of all possible Dices
    local Item = toptileitem(posx, posy-1, posz) -- Position of the Dice
     
    if table.find(IDs, Item) then -- Check if the position of the dice is ANY ID out of the 6 possible IDs it could be (not just one) and THEN
     --do this action--
    end


    check this

  3. #3
    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
    Quote Originally Posted by shanp View Post
    Lua Code:
    local IDs = {1, 2, 3, 4, 5, 6} -- Item IDs of all possible Dices
    local Item = toptileitem(posx, posy-1, posz) -- Position of the Dice
     
    if table.find(IDs, Item) then -- Check if the position of the dice is ANY ID out of the 6 possible IDs it could be (not just one) and THEN
     --do this action--
    end


    check this


    I would also use table.find

  4. #4
    Normal User catok's Avatar
    Join Date
    Jan 2013
    Location
    Sweden
    Posts
    94
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    4
    There needs to be re-implemented a Action and Variable list :/
    Hard Working Scripter



    My Free Scripts:

    Knight
    EK - Mutated Mountains 50+ (option to hunt any tower)

  5. #5
    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
    Quote Originally Posted by catok View Post
    There needs to be re-implemented a Action and Variable list :/
    What? Why? You mean the variable/action list should have table.find there? It is standard lua function...
    About your action to untrash you rather should untrash if toptileitem is not one of listed one, it's easier to list dices and depot than all other things ;p

  6. #6
    Normal User catok's Avatar
    Join Date
    Jan 2013
    Location
    Sweden
    Posts
    94
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    4
    Quote Originally Posted by walukasz View Post
    What? Why? You mean the variable/action list should have table.find there? It is standard lua function...
    About your action to untrash you rather should untrash if toptileitem is not one of listed one, it's easier to list dices and depot than all other things ;p
    Well that's what I use, I didn't want to post my action here because then some people might take it.
    It only removes trash from DP if the ID's on my own DP and in the middle are not crystal coin, platinum coin, all forms of dices, counter and locker.


    Edit: It was once here and I don't know why the owner removed it. I personally am not so familiar with .lua and if the list was there I probably wouldn't need to ask as many questions as i'm doing ^.-
    Last edited by catok; 02-15-2014 at 11:41 PM.
    Hard Working Scripter



    My Free Scripts:

    Knight
    EK - Mutated Mountains 50+ (option to hunt any tower)

  7. #7
    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
    Quote Originally Posted by catok View Post
    There needs to be re-implemented a Action and Variable list :/
    Do you mean this? http://www.tibiaibot.com/forum/showt...-Documentation


    Quote Originally Posted by walukasz View Post
    What? Why? You mean the variable/action list should have table.find there? It is standard lua function...
    About your action to untrash you rather should untrash if toptileitem is not one of listed one, it's easier to list dices and depot than all other things ;p
    table.find is NOT a standard lua function, it is included in the standard librabry with ibot.
    Last edited by pink_panther; 02-16-2014 at 11:51 PM.

  8. #8
    zami84's Avatar
    Join Date
    May 2012
    Posts
    316
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    48
    Rep Power
    5
    Hey, in my dicer i use
    something like:

    if topitem(pox,posy-1, posz).count > 3 then
    move(..)
    end

    "3" cuz its count a "table", depot and a dice
    Last edited by zami84; 02-17-2014 at 12:43 AM.

  9. #9
    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
    Quote Originally Posted by zami84 View Post
    Hey, in my dicer i use
    something like:

    if topitem(pox,posy-1, posz).count > 3 then
    move(..)
    end

    "3" cuz its count a "table", depot and a dice
    What....

    .count would return 1 if it was a dice, because a die is not a stackable item, there would never be more than 1 in the stack.

  10. #10
    zami84's Avatar
    Join Date
    May 2012
    Posts
    316
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    48
    Rep Power
    5
    True. My mistake...
    Lua Code:
     
     if (gettile(posx, posy -1, posz).count > 2)  then
            moveitems(...)
            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
  •