erkro1 Posted April 24, 2012 Author Share Posted April 24, 2012 EDIT: Well, I actually have 2 other questions, but don't wanna spam by making a topic for each.So here they are:1:FIXED2:I have a Sell all [item name] button to sell all the items which have the same number, so that it sells all the Meat for example.But the problem is that the code isn't working and I don't know how to fix it.Here is the code:```Private Sub mnuSellAll_Click()Dim InvNum, i As LongInvNum = IsInvItem(LastItemX, LastItemY)For i = 1 To MAX_INV If PlayerInv(i).num = InvNum Then SellItem PlayerInv(i).num End IfNextSellItem InvNumEnd Sub``` Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 24, 2012 Share Posted April 24, 2012 This code is run by SendExp to send the EXP from the server to the client. Can you elaborate on the nature of the error? (What did you expect - What happened) Can you post your SendEXP sub (server)?Also, what is this "second player gets 0 EXP fix" (I searched and I was unable to find it). Can you post a link? Link to comment Share on other sites More sharing options...
Justn Posted April 24, 2012 Share Posted April 24, 2012 @Soul:> Also, what is this "second player gets 0 EXP fix" (I searched and I was unable to find it).Maybe the second fix here? http://www.touchofdeathforums.com/smf/index.php/topic,77397.0.html Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 24, 2012 Share Posted April 24, 2012 @Justn:> Maybe the second fix here? http://www.touchofdeathforums.com/smf/index.php/topic,77397.0.htmlThat sounds about right, anyway, this may (or may not) fix it.* * *Use this sub:```Private Sub HandlePlayerExp(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim i As LongDim TNL As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteBytes Data() SetPlayerExp MyIndex, Buffer.ReadLong TNL = Buffer.ReadLong frmMain.lblEXP.Caption = GetPlayerExp(MyIndex) & "/" & TNL ' mp bar frmMain.imgEXPBar.width = ((GetPlayerExp(MyIndex) / EXPBar_Width) / (TNL / EXPBar_Width)) * EXPBar_Width ' Error handler Exit Suberrorhandler: HandleError "HandlePlayerExp", "modHandleData", Err.number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
erkro1 Posted April 25, 2012 Author Share Posted April 25, 2012 Wow, that fixed it, pretty stupid that I didn't tried it, thanks for your help. ;)EDIT: Well, I actually have 2 other questions, but don't wanna spam by making a topic for each.So here they are:1:When I move my mouse on txtMyChat it disappears under it, which is kinda annoying with editing the chat text, any idea where the problem could be?2:I have a Sell all [item name] button to sell all the items which have the same number, so that it sells all the Meat for example.But the problem is that the code isn't working and I don't know how to fix it.Here is the code:```Private Sub mnuSellAll_Click()Dim InvNum, i As LongInvNum = IsInvItem(LastItemX, LastItemY)For i = 1 To MAX_INV If PlayerInv(i).num = InvNum Then SellItem PlayerInv(i).num End IfNextSellItem InvNumEnd Sub``` Link to comment Share on other sites More sharing options...
Justn Posted April 25, 2012 Share Posted April 25, 2012 I also have the mouse problem but on frmmenu txtbox.. only way I could fix it was deleting it and copy and pasting new one from a backup where it was working.. but still don't know what's causing it :/ Link to comment Share on other sites More sharing options...
erkro1 Posted April 25, 2012 Author Share Posted April 25, 2012 @Justn:> I also have the mouse problem but on frmmenu txtbox.. only way I could fix it was deleting it and copy and pasting new one from a backup where it was working.. but still don't know what's causing it :/I've copy/pasted from serveral backups but it doesn't fix it. :sad:Weird thing is that I have another label for Channel selection next to it which works fine.EDIT: Fixed it, it was because the back color was some kind of grey, so thesame as the mosue cursor when you move it on a textbox, back to the SellAll problem. Link to comment Share on other sites More sharing options...
Growlith1223 Posted April 25, 2012 Share Posted April 25, 2012 @Erwin:> I have a Sell all [item name] button to sell all the items which have the same number, so that it sells all the Meat for example.> > But the problem is that the code isn't working and I don't know how to fix it.> Here is the code:> ```> Private Sub mnuSellAll_Click()> Dim InvNum, i As Long> > InvNum = IsInvItem(LastItemX, LastItemY)> > For i = 1 To MAX_INV> If PlayerInv(i).num = InvNum Then> SellItem PlayerInv(i).num> End If> Next> > SellItem InvNum> End Sub> ```hm…This sounds like a great feature...I will look into fixing this :DIs this Client Side? Link to comment Share on other sites More sharing options...
erkro1 Posted April 25, 2012 Author Share Posted April 25, 2012 Yes. Link to comment Share on other sites More sharing options...
Growlith1223 Posted April 25, 2012 Share Posted April 25, 2012 @Erwin:> Yes.ok i will let you know if i get it to work cuz i kinda like this xD Link to comment Share on other sites More sharing options...
Justn Posted April 25, 2012 Share Posted April 25, 2012 Lol thanks erwin I am using the same grey color guess ill change it now Link to comment Share on other sites More sharing options...
Joost Posted April 25, 2012 Share Posted April 25, 2012 In my opinion you're trying to something clientside that should be handled serverside. Below sub is what I would use. Now all you have to do is send a packet when the client clicks on your SellAll thing and then call this sub serverside when receiving the packet. Search both client-side and server-side for "CSellItem" for an example, and set up an CSellAllItems packet yourself. Enjoy.```Sub HandleSellAllItems(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim invSlot As Long Dim itemnum As Long Dim price As Long Dim multiplier As Double Dim amount As Long Dim i As Long Dim y As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() invSlot = Buffer.ReadLong ' if invalid, exit out If invSlot < 1 Or invSlot > MAX_INV Then Exit Sub ' has item? If GetPlayerInvItemNum(Index, invSlot) < 1 Or GetPlayerInvItemNum(Index, invSlot) > MAX_ITEMS Then Exit Sub ' seems to be valid itemnum = GetPlayerInvItemNum(Index, invSlot) ' work out price multiplier = Shop(TempPlayer(Index).InShop).BuyRate / 100 price = Item(itemnum).price * multiplier ' item has cost? If price <= 0 Then PlayerMsg Index, "The shop doesn't want that item.", BrightRed ResetShopAction Index Exit Sub End If 'this is the only changed part, first of all it goes through the entire inventory For i = 0 To MAX_INV If GetPlayerInvItemNum(Index, i) = itemnum Then 'to check if the item number matches the item we want to sell ' take item and give gold TakeInvItem Index, i, GetPlayerInvItemValue(Index, i) 'if the item number = correct, then we take as many as we can (GetPlayerInvItemValue(Index, i) ) GiveInvItem Index, 1, price * GetPlayerInvItemValue(Index, i) 'and we give gold for the items, since we might sell a stack of 20 we multiply the gold by the amount of things sold End If Next i ' send confirmation message & reset their shop action PlayerMsg Index, "Trade successful.", BrightGreen ResetShopAction Index Set Buffer = NothingEnd Sub``` Link to comment Share on other sites More sharing options...
erkro1 Posted April 25, 2012 Author Share Posted April 25, 2012 @Justn:> Lol thanks erwin I am using the same grey color guess ill change it nowYour welcome. :P@Joost:> -snip-Well, I thought a loop with SellItem thing would work as well, although its easier to do it server side like you said, I'll look into that, thanks for the code.Although I'm not gonna make a different packet but just modify the SellItem packet to check if SellAll thing is on.Thanks all, I'll lock this. :cheesy: 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