Spikey Posted December 10, 2014 Share Posted December 10, 2014 (edited) 1) I apologise for this, as I have seen a topic about it before however can't find it again for the life of me. My question is how to make it so I can delete the .jar files for re-compiling? I have tried stopping the script, refreshing etc. My compiler gives me the error it's unable to remove it, and I have to restart client every time to test scripts. 2) I'm looking into doing a project involving trading, I am trying to figure out how to detect whether the user is getting a trade request, I have been looking through http://osbot.org/api/org/osbot/rs07/api/Trade.html#getRequestListener() for some help but am struggling a bit to find what i'm after. I could see a way in which I could use maybe use getLastRequestingPlayer(), to implement this, but I had seen a similar program build in 1.0, which uses " public void onReceiveTrade(String traded) ", which would be a much neater way of doing things. An example code snippet for recognizing trade request, as well as detecting what item they have put up, would be awesome , thanks! e/ As far as the detecting what they have put in inventory from what I understand from reading api documents, one way would be to use a offer container? From what i'm understanding I need to getTheirOffers(), then return the 1st one. can I put this container into somehing like Item[], then return item[0]? this is just my understanding from reading so far, and more info would be great. Edited December 10, 2014 by Spikey Link to comment Share on other sites More sharing options...
Czar Posted December 10, 2014 Share Posted December 10, 2014 1) Don't generate jar files while testing a script, you should do that in the end, otherwise you must restart etc. What I do, is just make your project folder on Users/OSBot, and change your output folder to OSBot/scripts, so all the .class goes there and you can just save script on your ide, and refresh scripts on OSBot and you don't have to restart client every time you make an update 2) A trade request is a message, so you must add a messagelistener to your script by doing the following; put this in your onStart method: getBot().addMessageListener(this); and then add the overriden method onMessage(Message m) the message will be String msg = m.getMessage(); and to check if its a trade, just do m.getMessageType(), which is an enum and contains RECEIVE_TRADE (in your case) As for the last question I've never handled trading in a script so I'm unable to assist you there, but there's an open source merching bot (which handles trades) in the snippet section iirc. Link to comment Share on other sites More sharing options...