Thread: [#474] event when item is clicked in inventory?

Results 1 to 9 of 9
  1. #1 [#474] event when item is clicked in inventory? 
    Registered Member
    Join Date
    Mar 2012
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    10
    Basically I just need to check if a specific Item was clicked in the player's inventory, and if so call an event.
    Reply With Quote  
     

  2. #2  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    25
    Posts
    4,561
    Thanks given
    1,158
    Thanks received
    1,173
    Rep Power
    2949
    Please explain?

    If I've understood you correctly just do something like:

    Code:
    if(4151 == itemId) {
      doAction;
    }
    [Only registered and activated users can see links. ]
    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Mar 2012
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    10
    Quote Originally Posted by Infexis View Post
    Please explain?

    If I've understood you correctly just do something like:

    Code:
    if(4151 == itemId) {
      doAction;
    }
    Basically, I've created a class and within that class I've got a method I need to call when this item is clicked (For example some bones).
    Reply With Quote  
     

  4. #4  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    25
    Posts
    4,561
    Thanks given
    1,158
    Thanks received
    1,173
    Rep Power
    2949
    Quote Originally Posted by Avian View Post
    Basically, I've created a class and within that class I've got a method I need to call when this item is clicked (For example some bones).
    Code:
    private void myMethod(int itemId) {
      if(bones == itemId) {
        yourMethod();
      }
    }
    [Only registered and activated users can see links. ]
    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Mar 2012
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    10
    Quote Originally Posted by Infexis View Post
    Code:
    private void myMethod(int itemId) {
      if(bones == itemId) {
        yourMethod();
      }
    }
    That method is called automatically though? I don't need to link it or anything?
    For instance, I just created a class 'Bury.java', throw in the method to bury bones, and it'll call that method?
    Reply With Quote  
     

  6. #6  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    25
    Posts
    4,561
    Thanks given
    1,158
    Thanks received
    1,173
    Rep Power
    2949
    Quote Originally Posted by Avian View Post
    That method is called automatically though? I don't need to link it or anything?
    For instance, I just created a class 'Bury.java', throw in the method to bury bones, and it'll call that method?
    You must as well call the myMethod() where your item actions are being handled. The class is usually named ActionHandler or something.
    [Only registered and activated users can see links. ]
    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Mar 2012
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    10
    Quote Originally Posted by Infexis View Post
    You must as well call the myMethod() where your item actions are being handled. The class is usually named ActionHandler or something.
    Well yeah that's basically my question lol, how do I actually call my method when the item is clicked >.<
    Reply With Quote  
     

  8. #8  
    If you read this you're gay!
    Infexis's Avatar
    Join Date
    Aug 2009
    Age
    25
    Posts
    4,561
    Thanks given
    1,158
    Thanks received
    1,173
    Rep Power
    2949
    Quote Originally Posted by Avian View Post
    Well yeah that's basically my question lol, how do I actually call my method when the item is clicked >.<
    Simply do buryBone(); where the item actions are being handled. Never touched a 474 so I can't really tell you where exactly.
    [Only registered and activated users can see links. ]
    "If you can't explain it simply, you don't understand it well enough." - Albert Einstein
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Mar 2012
    Posts
    24
    Thanks given
    0
    Thanks received
    0
    Rep Power
    10
    Quote Originally Posted by Infexis View Post
    Simply do buryBone(); where the item actions are being handled. Never touched a 474 so I can't really tell you where exactly.
    Yeah that's the thing for me too, I just started on #474, so I don't know my way around. But I think I'm onto it now.
    ItemOptionPacketHandler class
    Code:
    private void handleItemOptionClick1(final Player player, Packet packet)
    Thanks for the help though
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 10
    Last Post: 03-02-2011, 08:06 AM
  2. Item inventory model
    By Cody. in forum Help
    Replies: 0
    Last Post: 12-22-2010, 11:52 PM
  3. [Pi] Item Inventory
    By jakehop22 in forum Help
    Replies: 1
    Last Post: 08-30-2010, 08:52 AM
  4. Replies: 12
    Last Post: 11-14-2009, 04:40 AM
  5. Replies: 2
    Last Post: 11-11-2009, 12:31 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •