aiko Posted January 5, 2009 Author Share Posted January 5, 2009 I used this script:```Sub TakeItem(index, item, value)If value = "all" ThenSLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, 0)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd SubElseSLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd SubEnd IfSub GiveItem(index, item, value)SLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = 0 ThenCall SetPlayerInvItemNum(index, SLOT, item)Call SetPlayerInvItemValue(index, SLOT, value)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd Sub```And placed it right here:```Sub SetBank(Map, X, Y) Call SetAttribute(Map, X, Y, 23, 0, 0, 0, "", "", "")End Sub' Tests scripts up to the location of Sub TestMain(Index).' Leave this sub at the bottom to test the entire script file.Sub TestMain(Index) Call PlayerMsg(Index, "Scripts are working properly.", BRIGHTGREEN)End SubSub TakeItem(index, item, value)If value = "all" ThenSLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, 0)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd SubElseSLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd SubEnd IfSub GiveItem(index, item, value)SLOT = 1Do While SLOT < 24If GetPlayerInvItemNum(index, SLOT) = 0 ThenCall SetPlayerInvItemNum(index, SLOT, item)Call SetPlayerInvItemValue(index, SLOT, value)Call SendInventoryUpdate(index, SLOT)SLOT = 24End IfSLOT = SLOT+1LoopEnd Sub```And still, takeitem isn't working….I already checked this:```' Tests scripts up to the location of Sub TestMain(Index).' Leave this sub at the bottom to test the entire script file.Sub TestMain(Index) Call PlayerMsg(Index, "Scripts are working properly.", BRIGHTGREEN)End Sub```But they also said: place it a the very bottom, so…Can someone give me:The reason why it isn't working(Even when it's a noob fault)Or give me the right script? Link to comment Share on other sites More sharing options...
Tribal Posted January 5, 2009 Share Posted January 5, 2009 This should go under the forum **Scripting: Questions**. Link to comment Share on other sites More sharing options...
Roujo Posted January 5, 2009 Share Posted January 5, 2009 Hello aiko!I suggest you use [http://www.touchofdeathforums.com/smf/index.php/topic,28174.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,28174.0.html), just don't forget to give him credit.It includes useful commands like GetFreeSlots, GiveItem, GiveCurrency, CanTake and TakeItem. Actually… That's pretty much all of them. In his post he gives out the code itself plus instruction on how to you it and documentation. The easiest way for you to use the code would be to place it at the end of your main.txt. Don't worry about the TestMain, sub placement usually doesn't matter in the main.txt. I keep the TestMain at the bottom, though, just because it says so.Good luck! ^_^ Link to comment Share on other sites More sharing options...
aiko Posted January 5, 2009 Author Share Posted January 5, 2009 Thanks mate!It just was a wrong script!Now I have all of them^^Really ty Link to comment Share on other sites More sharing options...
Zuleloan Posted January 5, 2009 Share Posted January 5, 2009 Test main is to check whether the scripts are working or not Link to comment Share on other sites More sharing options...
Roujo Posted January 6, 2009 Share Posted January 6, 2009 No problem, I'm glad help! ^^ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now